protected override void Run(object data) { var doc = IdeApp.Workbench.ActiveDocument; if (doc == null || doc.FileName == FilePath.Null) { return; } ResolveResult resolveResult; var item = CurrentRefactoryOperationsHandler.GetItem(doc, out resolveResult); var typeDef = item as ITypeDefinition; if (typeDef != null && ((typeDef.Kind == TypeKind.Class && !typeDef.IsSealed) || typeDef.Kind == TypeKind.Interface)) { FindDerivedClasses(typeDef); return; } var member = item as IMember; var handler = new FindDerivedSymbolsHandler(member); if (handler.IsValid) { handler.Run(); return; } }
protected override void Run(object data) { var doc = IdeApp.Workbench.ActiveDocument; if (doc == null || doc.FileName == FilePath.Null) { return; } ResolveResult resolveResoult; object item = CurrentRefactoryOperationsHandler.GetItem(doc, out resolveResoult); var entity = item as INamedElement; if (entity != null) { IdeApp.ProjectOperations.JumpToDeclaration(entity); } else { var v = item as IVariable; if (v != null) { IdeApp.ProjectOperations.JumpToDeclaration(v); } } }
protected override void Run(object data) { Document doc = IdeApp.Workbench.ActiveDocument; if (doc == null) { return; } ITextBuffer editor = doc.GetContent <ITextBuffer> (); if (editor == null) { return; } ProjectDom dom = doc.Dom; ResolveResult result; INode item; CurrentRefactoryOperationsHandler.GetItem(dom, doc, editor, out result, out item); RefactoringOptions options = new RefactoringOptions() { Document = doc, Dom = dom, ResolveResult = result, SelectedItem = item is InstantiatedType ? ((InstantiatedType)item).UninstantiatedType : item }; Run(options); }
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 IField) && !(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.GoToDeclaration(); }
protected override void Run(object data) { var doc = IdeApp.Workbench.ActiveDocument; if (doc == null || doc.FileName == FilePath.Null) { return; } ResolveResult resolveResoult; object item = CurrentRefactoryOperationsHandler.GetItem(doc, out resolveResoult); if (item != null) { FindRefs(item); } }
RefactoringOptions CreateOptions() { Document doc = IdeApp.Workbench.ActiveDocument; if (doc == null) { return(null); } ResolveResult result; var item = CurrentRefactoryOperationsHandler.GetItem(doc, out result); return(new RefactoringOptions(doc) { ResolveResult = result, SelectedItem = item }); }