//FIXME: why is this invalid on the parseddocuments loaded when the doc is first loaded? //maybe the item's type's SourceProject is null? public IEnumerable <IAnalysisFixAction> GetFixes(MonoDevelop.Ide.Gui.Document doc, object fix) { var renameFix = (RenameMemberFix)fix; var refactoring = new RenameRefactoring(); var options = new RefactoringOptions(doc) { SelectedItem = renameFix.Item, }; if (renameFix.Item == null) { ResolveResult resolveResult; options.SelectedItem = CurrentRefactoryOperationsHandler.GetItem(options.Document, out resolveResult); } if (!refactoring.IsValid(options)) { yield break; } var prop = new RenameRefactoring.RenameProperties() { NewName = renameFix.NewName, }; if (string.IsNullOrEmpty(renameFix.NewName)) { yield return(new RenameFixAction() { Label = GettextCatalog.GetString("Rename '{0}'...", renameFix.OldName), Refactoring = refactoring, Options = options, Properties = prop, Preview = false, }); yield break; } yield return(new RenameFixAction() { Label = GettextCatalog.GetString("Rename '{0}' to '{1}'", renameFix.OldName, renameFix.NewName), Refactoring = refactoring, Options = options, Properties = prop, Preview = false, }); yield return(new RenameFixAction() { Label = GettextCatalog.GetString("Rename '{0}' to '{1}' with preview", renameFix.OldName, renameFix.NewName), Refactoring = refactoring, Options = options, Properties = prop, Preview = true, }); }
//FIXME: why is this invalid on the parseddocuments loaded when the doc is first loaded? //maybe the item's type's SourceProject is null? public IEnumerable <IAnalysisFixAction> GetFixes(MonoDevelop.Ide.Gui.Document doc, object fix) { var renameFix = (RenameMemberFix)fix; var refactoring = new RenameRefactoring(); var options = new RefactoringOptions() { Document = doc, Dom = doc.Dom, SelectedItem = renameFix.Item, }; if (!refactoring.IsValid(options)) { yield break; } var prop = new RenameRefactoring.RenameProperties() { NewName = renameFix.NewName, }; yield return(new RenameFixAction() { Label = GettextCatalog.GetString("Rename '{0}' to '{1}'", renameFix.Item.Name, renameFix.NewName), Refactoring = refactoring, Options = options, Properties = prop, Preview = false, }); yield return(new RenameFixAction() { Label = GettextCatalog.GetString("Rename '{0}' to '{1}' with preview", renameFix.Item.Name, renameFix.NewName), Refactoring = refactoring, Options = options, Properties = prop, Preview = true, }); }