protected override void Run(object dataItem) { if (dataItem is Action) { (dataItem as Action)(); } var t = dataItem as object[]; if (t != null) { if (t.Length == 2) { if (RefactoryCommands.ImportSymbol.Equals(t[0])) { ImportStmtCreation.GenerateImportStatementForNode(t[1] as INode, caps.ed, new TextDocumentAdapter(IdeApp.Workbench.ActiveDocument.Editor)); } if (RefactoryCommands.QuickFix.Equals(t [0])) { var n = t [1] as DNode; var textToGenerate = DNode.GetNodePath(n, false) + "."; caps.lastDoc.Editor.Insert(caps.lastDoc.Editor.LocationToOffset(caps.lastSyntaxObject.Location.Line, caps.lastSyntaxObject.Location.Column), textToGenerate); } } } }
public void TryImportMissingSymbol() { DModule n; var nodesToChooseFrom = GetImportableModulesForLastResults(); var count = nodesToChooseFrom.Count(); if (count == 0) { return; } if (count == 1) { n = nodesToChooseFrom.First(); } else { n = ImportSymbolSelectionDlg.Show(nodesToChooseFrom, GettextCatalog.GetString("Select symbol")); } if (n != null) { ImportStmtCreation.GenerateImportStatementForNode(n, ed, new TextDocumentAdapter(IdeApp.Workbench.ActiveDocument.Editor)); } }
public void TryImportMissingSymbol() { var t = GetResult(); if (t is DSymbol) { ImportStmtCreation.GenerateImportStatementForNode((t as DSymbol).Definition, ed, (loc, s) => { var doc = IdeApp.Workbench.ActiveDocument.Editor; doc.Insert(doc.LocationToOffset(loc.Line, loc.Column), s); }); } }
protected override void Run(object dataItem) { if (dataItem is Action) { (dataItem as Action)(); } var t = dataItem as object[]; if (t != null) { if (t.Length == 2) { if (t[0].Equals("a")) { ImportStmtCreation.GenerateImportStatementForNode(t[1] as INode, caps.ed, (loc, s) => { var doc = IdeApp.Workbench.ActiveDocument.Editor; doc.Insert(doc.LocationToOffset(loc.Line, loc.Column), s); }); } } } }
public override void Run(IRefactoringContext _c, object _s) { var editor = refCtxt.Doc.Editor; ImportStmtCreation.GenerateImportStatementForNode(dn, refCtxt.ed, (loc, s) => editor.Insert(editor.LocationToOffset(loc.Line, loc.Column), s)); }