Пример #1
0
        public void Rename()
        {
            List <TreeIter> iter;
            List <string>   ids;

            string[] path = GetSelectedTreePath(out iter, out ids);

            if (path.Length != 1)
            {
                return;
            }

            FileType type = FileType.Base;

            if (ids [0] == ID_FILE)
            {
                type = FileType.File;
            }
            else if (ids [0] == ID_FOLDER)
            {
                type = FileType.Folder;
            }

            TextEditorDialog dialog = new TextEditorDialog(window, "Rename", "New Name:", treeview1.Model.GetValue(iter [0], 1).ToString(), true);

            if (dialog.Run() == (int)ResponseType.Ok)
            {
                string newpath = System.IO.Path.GetDirectoryName(path[0]) + System.IO.Path.DirectorySeparatorChar + dialog.text;
                window._controller.Move(new[] { path[0] }, new[] { newpath.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? newpath.Substring(1) : newpath }, new[] { type });
            }
        }
Пример #2
0
        public void OnNewFolderActionActivated(object sender, EventArgs e)
        {
            var ted = new TextEditorDialog("New Folder", "Folder Name:", "", true);

            ted.TransientFor = this;
            if (ted.Run() != (int)ResponseType.Ok)
            {
                return;
            }
            var foldername = ted.text;

            expand = true;
            List <TreeIter> iters;
            List <string>   ids;

            string[] paths = projectview1.GetSelectedTreePath(out iters, out ids);

            if (paths.Length == 1)
            {
                if (ids [0] == projectview1.ID_FOLDER)
                {
                    _controller.NewFolder(foldername, paths [0]);
                }
                else if (ids[0] == projectview1.ID_BASE)
                {
                    _controller.NewFolder(foldername, _controller.GetFullPath(""));
                }
                else
                {
                    _controller.NewFolder(foldername, System.IO.Path.GetDirectoryName(paths [0]));
                }
            }
            else
            {
                _controller.NewFolder(foldername, _controller.GetFullPath(""));
            }

            expand = false;
        }
Пример #3
0
        public void Rename()
        {
            List<TreeIter> iter;
            List<string> ids;
            string[] path = GetSelectedTreePath (out iter, out ids);

            if (path.Length != 1)
                return;

            FileType type = FileType.Base;

            if (ids [0] == ID_FILE) 
                type = FileType.File;
            else if (ids [0] == ID_FOLDER) 
                type = FileType.Folder;

            TextEditorDialog dialog = new TextEditorDialog ("Rename", "New Name:", treeview1.Model.GetValue (iter [0], 1).ToString(), true);
            dialog.TransientFor = window;

            if (dialog.Run() == (int)ResponseType.Ok)
            {
                string newpath = System.IO.Path.GetDirectoryName(path[0]) + System.IO.Path.DirectorySeparatorChar + dialog.text;
                window._controller.Move(path[0], newpath.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? newpath.Substring(1) : newpath, type);
            }
        }
Пример #4
0
        public void OnNewFolderActionActivated(object sender, EventArgs e)
        {
            var ted = new TextEditorDialog(this, "New Folder", "Folder Name:", "", true);
            if (ted.Run() != (int)ResponseType.Ok)
                return;
            var foldername = ted.text;

            expand = true;
            List<TreeIter> iters;
            List<string> ids;
            string[] paths = projectview1.GetSelectedTreePath (out iters, out ids);

            if (paths.Length == 1) {
                if (ids [0] == projectview1.ID_FOLDER)
                    _controller.NewFolder (foldername, paths [0]);
                else if (ids[0] == projectview1.ID_BASE)
                    _controller.NewFolder (foldername, _controller.GetFullPath (""));
                else
                    _controller.NewFolder (foldername, System.IO.Path.GetDirectoryName (paths [0]));
            }
            else
                _controller.NewFolder (foldername, _controller.GetFullPath (""));

            expand = false;
        }