protected override void Run(object data) { Document doc = IdeApp.Workbench.ActiveDocument; if (doc == null || doc.FileName == FilePath.Null || IdeApp.ProjectOperations.CurrentSelectedSolution == null) { return; } ITextBuffer editor = doc.GetContent <ITextBuffer> (); if (editor == null) { return; } int line, column; editor.GetLineColumnFromPosition(editor.CursorPosition, out line, out column); ProjectDom ctx = doc.Dom; ResolveResult resolveResult; INode item; CurrentRefactoryOperationsHandler.GetItem(ctx, doc, editor, out resolveResult, out item); IMember eitem = resolveResult != null ? (resolveResult.CallingMember ?? resolveResult.CallingType) : null; string itemName = null; if (item is IMember) { itemName = ((IMember)item).Name; } if (item != null && eitem != null && (eitem.Equals(item) || (eitem.Name == itemName && !(eitem is IProperty) && !(eitem is IMethod)))) { item = eitem; eitem = null; } IType eclass = null; if (item is IType) { if (((IType)item).ClassType == ClassType.Interface) { eclass = CurrentRefactoryOperationsHandler.FindEnclosingClass(ctx, editor.Name, line, column); } else { eclass = (IType)item; } if (eitem is IMethod && ((IMethod)eitem).IsConstructor && eitem.DeclaringType.Equals(item)) { item = eitem; eitem = null; } } Refactorer refactorer = new Refactorer(ctx, doc.CompilationUnit, eclass, item, null); refactorer.FindDerivedClasses(); }
public void FindDerivedClasses() { IMember member = widget.ActiveMember; if (member == null) { return; } ProjectDom dom = ProjectDomService.GetProjectDom(IdeApp.ProjectOperations.CurrentSelectedProject); if (dom == null) { return; } Refactorer refactorer = new Refactorer(dom, null, null, member, null); refactorer.FindDerivedClasses(); }