Ejemplo n.º 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();
            }
        }
Ejemplo n.º 2
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)
            {
                new RenamingRefactoring().Run(IdeApp.Workbench.ActiveDocument.HasProject ?
                                              IdeApp.Workbench.ActiveDocument.Project as DProject : null, n, args.NewText);

                TreeView.Selection.SelectIter(iter);
                TreeView.GrabFocus();
            }
        }