private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = this.treeView1.SelectedNode;
            if (node != null)
            {
                dlgRenameItem dialog = new dlgRenameItem();
                dialog.Text = "Rename Folder";
                dialog.ItemName = node.Text;
                dialog.DetailName = "";
                dialog.ItemNameValidator = delegate(string txt, out string error)
                {
                    error = String.Empty;
                    if (node.Parent.Nodes.ContainsKey(txt) && txt != node.Text)
                    {
                        error = "Node with same name exists";
                    }
                    else if (txt.Contains(SessionIdDelim))
                    {
                        error = "Invalid character ( " + SessionIdDelim + " ) in name";
                    }
                    return string.IsNullOrEmpty(error);
                };
                if (dialog.ShowDialog(this) == DialogResult.OK && node.Text != dialog.ItemName)
                {

                    SuperPuTTY.GetRootFolderData().RenameSessionFolderName((SessionFolderData) node.Tag, dialog.ItemName);
                    CreateTreeview();
                    this.treeView1.SelectedNode = getTreeNode(this.treeView1.Nodes[0], (SessionFolderData)node.Tag);
                }
            }
        }
        private void renameTabToolStripMenuItem_Click(object sender, EventArgs e)
        {
            dlgRenameItem dialog = new dlgRenameItem();
            dialog.ItemName = this.Text;
            dialog.DetailName = this.m_Session.SessionName;

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                this.Text = dialog.ItemName;
                this.TextOverride = dialog.ItemName;
            }
        }
        private void newFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = this.treeView1.SelectedNode;
            if (node != null)
            {
                dlgRenameItem dialog = new dlgRenameItem();
                dialog.Text = "New Folder";
                dialog.ItemName = "New Folder";
                dialog.DetailName = "";
                dialog.ItemNameValidator = delegate(string txt, out string error)
                {
                    error = String.Empty;
                    if (node.Nodes.ContainsKey(txt))
                    {
                        error = "Node with same name exists";
                    }
                    else if (txt.Contains(SessionIdDelim))
                    {
                        error = "Invalid character ( " + SessionIdDelim + " ) in name";
                    }
                    else if (string.IsNullOrEmpty(txt) || txt.Trim() == String.Empty)
                    {
                        error = "Empty folder name";
                    }

                    return string.IsNullOrEmpty(error);
                };
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    SessionFolderData parent = (SessionFolderData)node.Tag;
                    SessionFolderData newData = parent.AddChildFolderData(dialog.ItemName);
                   //SessionFolderData folderData = SuperPuTTY.GetRootFolderData().AddChildFolderData(dialog.ItemName);
                    //this.treeView1.SelectedNode = AddFolderNode(node, folderData);

                    CreateTreeview();
                    this.treeView1.SelectedNode = getTreeNode(nodeRoot, newData);
                }
            }
        }
 private void renameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LayoutData layout = (LayoutData)this.listBoxLayouts.SelectedItem;
     if (layout != null)
     {
         dlgRenameItem renameDialog = new dlgRenameItem();
         renameDialog.DetailName = String.Empty;
         renameDialog.ItemName = layout.Name;
         renameDialog.ItemNameValidator = this.ValidateLayoutName;
         if (DialogResult.OK == renameDialog.ShowDialog(this))
         {
             SuperPuTTY.RenameLayout(layout, renameDialog.ItemName);
         }
     }
 }