private void fileTreeOpenContainingFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var    gitItem  = tvGitTree.SelectedNode?.Tag as GitItem;
            string filePath = gitItem == null ? Module.WorkingDir : FormBrowseUtil.GetFullPathFromGitItem(Module, gitItem);

            FormBrowseUtil.ShowFileOrFolderInFileExplorer(filePath);
        }
Exemple #2
0
        private void FileTreeContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var gitItem     = tvGitTree.SelectedNode?.Tag as GitItem;
            var enableItems = gitItem != null && gitItem.IsBlob;

            if (gitItem != null && gitItem.IsCommit)
            {
                openSubmoduleMenuItem.Visible = true;
                if (!openSubmoduleMenuItem.Font.Bold)
                {
                    openSubmoduleMenuItem.Font = new Font(openSubmoduleMenuItem.Font, FontStyle.Bold);
                }
            }
            else
            {
                openSubmoduleMenuItem.Visible = false;
            }

            saveAsToolStripMenuItem.Visible                  = enableItems;
            openFileToolStripMenuItem.Visible                = enableItems;
            openFileWithToolStripMenuItem.Visible            = enableItems;
            openWithToolStripMenuItem.Visible                = enableItems;
            copyFilenameToClipboardToolStripMenuItem.Visible = gitItem != null && FormBrowseUtil.IsFileOrDirectory(FormBrowseUtil.GetFullPathFromGitItem(Module, gitItem));
            editCheckedOutFileToolStripMenuItem.Visible      = enableItems;
        }
        private void FileTreeContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var gitItem      = tvGitTree.SelectedNode?.Tag as GitItem;
            var itemSelected = gitItem != null;
            var isFile       = itemSelected && gitItem.ObjectType == GitObjectType.Blob;
            var isFolder     = itemSelected && gitItem.ObjectType == GitObjectType.Tree;
            var isExistingFileOrDirectory = itemSelected && FormBrowseUtil.IsFileOrDirectory(FormBrowseUtil.GetFullPathFromGitItem(Module, gitItem));

            if (itemSelected && gitItem.ObjectType == GitObjectType.Commit)
            {
                openSubmoduleMenuItem.Visible = true;
                if (!openSubmoduleMenuItem.Font.Bold)
                {
                    openSubmoduleMenuItem.Font = new Font(openSubmoduleMenuItem.Font, FontStyle.Bold);
                }
            }
            else
            {
                openSubmoduleMenuItem.Visible = false;
            }

            saveAsToolStripMenuItem.Visible = isFile;
            resetToThisRevisionToolStripMenuItem.Visible = isFile && !Module.IsBareRepository();
            toolStripSeparatorFileSystemActions.Visible  = isFile;

            fileHistoryToolStripMenuItem.Enabled                  = itemSelected;
            copyFilenameToClipboardToolStripMenuItem.Visible      = itemSelected;
            fileTreeOpenContainingFolderToolStripMenuItem.Enabled = isExistingFileOrDirectory;
            fileTreeArchiveToolStripMenuItem.Enabled              = itemSelected;
            fileTreeCleanWorkingTreeToolStripMenuItem.Visible     = isFolder;
            fileTreeCleanWorkingTreeToolStripMenuItem.Enabled     = isExistingFileOrDirectory;

            blameToolStripMenuItem1.Visible = isFile;

            editCheckedOutFileToolStripMenuItem.Visible = isFile;
            editCheckedOutFileToolStripMenuItem.Enabled = isExistingFileOrDirectory;
            openWithToolStripMenuItem.Visible           = isFile;
            openWithToolStripMenuItem.Enabled           = isExistingFileOrDirectory;
            openFileToolStripMenuItem.Visible           = isFile;
            openFileWithToolStripMenuItem.Visible       = isFile;

            toolStripSeparatorGitActions.Visible            = isFile;
            stopTrackingThisFileToolStripMenuItem.Visible   = isFile;
            stopTrackingThisFileToolStripMenuItem.Enabled   = isExistingFileOrDirectory;
            assumeUnchangedTheFileToolStripMenuItem.Visible = isFile;
            assumeUnchangedTheFileToolStripMenuItem.Enabled = isExistingFileOrDirectory;
            findToolStripMenuItem.Enabled = tvGitTree.Nodes.Count > 0;

            toolStripSeparatorFileTreeActions.Visible = isFile;
            toolStripSeparatorFileTreeActions.Enabled = isExistingFileOrDirectory;
            expandSubtreeToolStripMenuItem.Visible    = isFolder;
        }
Exemple #4
0
        private void FileTreeContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var gitItem     = tvGitTree.SelectedNode?.Tag as GitItem;
            var enableItems = gitItem != null && gitItem.ObjectType == GitObjectType.Blob;

            if (gitItem != null && gitItem.ObjectType == GitObjectType.Commit)
            {
                openSubmoduleMenuItem.Visible = true;
                if (!openSubmoduleMenuItem.Font.Bold)
                {
                    openSubmoduleMenuItem.Font = new Font(openSubmoduleMenuItem.Font, FontStyle.Bold);
                }
            }
            else
            {
                openSubmoduleMenuItem.Visible = false;
            }
            this.fileHistoryToolStripMenuItem.Enabled = gitItem != null;

            this.resetToThisRevisionToolStripMenuItem.Enabled     =
                this.blameToolStripMenuItem1.Enabled              =
                    this.fileTreeArchiveToolStripMenuItem.Enabled =
                        enableItems;

            saveAsToolStripMenuItem.Visible                  = enableItems;
            openFileToolStripMenuItem.Visible                = enableItems;
            openFileWithToolStripMenuItem.Visible            = enableItems;
            openWithToolStripMenuItem.Visible                = enableItems;
            copyFilenameToClipboardToolStripMenuItem.Visible = gitItem != null && FormBrowseUtil.IsFileOrDirectory(FormBrowseUtil.GetFullPathFromGitItem(Module, gitItem));
            editCheckedOutFileToolStripMenuItem.Visible      = enableItems;
            toolStripSeparator18.Visible = enableItems;
        }