예제 #1
0
		//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,
			};
		}
예제 #2
0
        protected override void Run(RefactoringOptions options)
        {
            RenameRefactoring renameRefactoring = new RenameRefactoring();

            if (renameRefactoring.IsValid(options))
            {
                renameRefactoring.Run(options);
            }
        }
예제 #3
0
        protected override void Update(RefactoringOptions options, CommandInfo info)
        {
            var renameRefactoring = new RenameRefactoring();

            if (!renameRefactoring.IsValid(options))
            {
                info.Bypass = true;
            }
        }
예제 #4
0
		//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 (renameFix.Item == null) {
				INode item;
				ResolveResult resolveResult;
				var editor = options.Document.GetContent<MonoDevelop.Ide.Gui.Content.ITextBuffer> ();
				CurrentRefactoryOperationsHandler.GetItem (options.Dom, options.Document, editor, out resolveResult, out item);
				options.SelectedItem = item;
			}
			
			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,
			};
		}
		protected override void Run (RefactoringOptions options)
		{
			RenameRefactoring renameRefactoring = new RenameRefactoring ();
			if (renameRefactoring.IsValid (options))
				renameRefactoring.Run (options);
		}
예제 #6
0
		protected override void Update (RefactoringOptions options, CommandInfo info)
		{
			var renameRefactoring = new RenameRefactoring ();
			if (!renameRefactoring.IsValid (options))
				info.Bypass = true;
		}