コード例 #1
0
        void nameCell_Edited(object o, EditedArgs args)
        {
            TreeIter iter;

            TreeStore.GetIter(out iter, new Gtk.TreePath(args.Path));

            var n = TreeStore.GetValue(iter, 0) as INode;

            if (n != null && args.NewText != n.Name &&
                DRenameRefactoring.CanRenameNode(n) &&
                DRenameRefactoring.IsValidIdentifier(args.NewText))
            {
                RefactoringService.AcceptChanges(
                    IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor("Rename item", null),
                    new DRenameRefactoring().PerformChanges(
                        new RefactoringOptions(IdeApp.Workbench.ActiveDocument)
                {
                    SelectedItem = n
                },
                        new MonoDevelop.Refactoring.Rename.RenameRefactoring.RenameProperties {
                    NewName = args.NewText
                }));

                TreeView.Selection.SelectIter(iter);
                TreeView.GrabFocus();
            }
        }
コード例 #2
0
ファイル: DRenameNameDialog.cs プロジェクト: lenoil98/Mono-D
        public DRenameNameDialog(RefactoringOptions options, DRenameRefactoring rename)
        {
            this.rename  = rename;
            this.options = options;

            this.Build();
            var ds = (INode)options.SelectedItem;

            #region Adjust dialog title
            var app = "Renaming ";

            if (ds is DClassLike)
            {
                var dc = (DClassLike)ds;
                app += dc.ClassType.ToString();
            }
            else if (ds is DMethod)
            {
                app += "method";
            }
            else if (ds is DVariable)
            {
                app += ((DVariable)ds).IsAlias ? "alias" : "variable";
            }
            else
            {
                app += "item";
            }

            Title = app;
            #endregion

            text_NewId.Text = originalName = ds.Name;

            buttonPreview.Sensitive = buttonOk.Sensitive = false;

            buttonOk.Clicked      += OnOKClicked;
            buttonPreview.Clicked += OnPreviewClicked;
            text_NewId.Changed    += delegate { setNotifyIcon(buttonPreview.Sensitive = buttonOk.Sensitive = ValidateName()); };
            ValidateName();

            buttonOk.GrabDefault();
            buttonOk.ReceivesDefault = true;
            text_NewId.GrabFocus();
        }
コード例 #3
0
ファイル: DRenameNameDialog.cs プロジェクト: lenoil98/Mono-D
 bool ValidateName()
 {
     return(originalName != text_NewId.Text &&
            DRenameRefactoring.IsValidIdentifier(text_NewId.Text));
 }
コード例 #4
0
 bool ValidateName()
 {
     return(DRenameRefactoring.IsValidIdentifier(text_NewId.Text));
 }