Ejemplo n.º 1
0
        public StashedStateMenu(StashedState stashedState)
        {
            Verify.Argument.IsValidGitObject(stashedState, nameof(stashedState));

            StashedState = stashedState;

            Items.AddRange(
                new ToolStripItem[]
            {
                GuiItemFactory.GetViewDiffItem <ToolStripMenuItem>(StashedState.GetDiffSource()),
                GuiItemFactory.GetViewTreeItem <ToolStripMenuItem>(StashedState),
                GuiItemFactory.GetSavePatchItem <ToolStripMenuItem>(StashedState),
                new ToolStripSeparator(),
                GuiItemFactory.GetStashPopItem <ToolStripMenuItem>(StashedState),
                GuiItemFactory.GetStashApplyItem <ToolStripMenuItem>(StashedState),
                GuiItemFactory.GetStashDropItem <ToolStripMenuItem>(StashedState),
                new ToolStripSeparator(),
                GuiItemFactory.GetStashToBranchItem <ToolStripMenuItem>(StashedState),
                new ToolStripSeparator(),
                new ToolStripMenuItem(Resources.StrCopyToClipboard, null,
                                      new ToolStripItem[]
                {
                    GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, ((IRevisionPointer)StashedState).Pointer),
                    GuiItemFactory.GetCopyHashToClipboardItem <ToolStripMenuItem>(Resources.StrHash, StashedState.Revision.Hash.ToString()),
                    GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrSubject, StashedState.Revision.Subject),
                }),
            });
        }
Ejemplo n.º 2
0
        public UnstagedChangesMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            Items.Add(GuiItemFactory.GetStashSaveKeepIndexItem <ToolStripMenuItem>(repository));

            if (repository.Status.UnmergedCount != 0)
            {
                Items.Add(new ToolStripSeparator());

                Items.Add(GuiItemFactory.GetResolveConflictsItem <ToolStripMenuItem>(repository));
            }

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetStageAllItem <ToolStripMenuItem>(repository, Resources.StrStageAll));
            Items.Add(GuiItemFactory.GetUpdateItem <ToolStripMenuItem>(repository, Resources.StrUpdate));
            Items.Add(GuiItemFactory.GetManualStageItem <ToolStripMenuItem>(repository, Resources.StrManualStage.AddEllipsis()));

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetCleanItem <ToolStripMenuItem>(repository));
            Items.Add(GuiItemFactory.GetResetItem <ToolStripMenuItem>(repository, ResetMode.Mixed | ResetMode.Hard));
        }
Ejemplo n.º 3
0
        public RemoteMenu(Remote remote)
        {
            Verify.Argument.IsValidGitObject(remote, "remote");

            _remote = remote;

            Items.Add(GuiItemFactory.GetShowRemoteItem <ToolStripMenuItem>(remote));
            Items.Add(GuiItemFactory.GetEditRemotePropertiesItem <ToolStripMenuItem>(remote));

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetFetchFromItem <ToolStripMenuItem>(remote, "{0}"));
            Items.Add(GuiItemFactory.GetPullFromItem <ToolStripMenuItem>(remote, "{0}"));
            Items.Add(GuiItemFactory.GetPruneRemoteItem <ToolStripMenuItem>(remote, "{0}"));

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetRemoveRemoteItem <ToolStripMenuItem>(remote, "{0}"));
            Items.Add(GuiItemFactory.GetRenameRemoteItem <ToolStripMenuItem>(remote, "{0}"));

            Items.Add(new ToolStripSeparator());

            var item = new ToolStripMenuItem(Resources.StrCopyToClipboard);

            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, remote.Name));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrFetchUrl, remote.FetchUrl));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrPushUrl, remote.PushUrl));

            Items.Add(item);
        }
Ejemplo n.º 4
0
        public TagMenu(Tag tag)
        {
            Verify.Argument.IsValidGitObject(tag, "tag");

            _tag = tag;

            Items.Add(GuiItemFactory.GetViewTreeItem <ToolStripMenuItem>(_tag));
            Items.Add(GuiItemFactory.GetArchiveItem <ToolStripMenuItem>(_tag));

            Items.Add(new ToolStripSeparator());             // interactive section

            Items.Add(GuiItemFactory.GetCheckoutRevisionItem <ToolStripMenuItem>(_tag, "{0} '{1}'"));
            Items.Add(GuiItemFactory.GetResetHeadHereItem <ToolStripMenuItem>(_tag));
            Items.Add(GuiItemFactory.GetRemoveTagItem <ToolStripMenuItem>(_tag, Resources.StrDelete));

            Items.Add(new ToolStripSeparator());             // copy to clipboard section

            var item = new ToolStripMenuItem(Resources.StrCopyToClipboard);

            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, tag.Name));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrFullName, tag.FullName));
            item.DropDownItems.Add(GuiItemFactory.GetCopyHashToClipboardItem <ToolStripMenuItem>(Resources.StrPosition, tag.Revision.Hash.ToString()));

            Items.Add(item);

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetCreateBranchItem <ToolStripMenuItem>(_tag));
            Items.Add(GuiItemFactory.GetCreateTagItem <ToolStripMenuItem>(_tag));
        }
Ejemplo n.º 5
0
        public SubmoduleMenu(Submodule submodule)
        {
            Verify.Argument.IsValidGitObject(submodule, nameof(submodule));

            Submodule = submodule;

            Items.Add(GuiItemFactory.GetOpenAppItem <ToolStripMenuItem>(
                          Resources.StrOpenWithGitter, null, Application.ExecutablePath, Submodule.FullPath.SurroundWithDoubleQuotes()));
            Items.Add(GuiItemFactory.GetOpenUrlItem <ToolStripMenuItem>(
                          Resources.StrOpenInWindowsExplorer, null, Submodule.FullPath));
            Items.Add(GuiItemFactory.GetOpenCmdAtItem <ToolStripMenuItem>(
                          Resources.StrOpenCommandLine, null, Submodule.FullPath));

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetUpdateSubmoduleItem <ToolStripMenuItem>(submodule));
            Items.Add(GuiItemFactory.GetSyncSubmoduleItem <ToolStripMenuItem>(submodule));

            Items.Add(new ToolStripSeparator());             // copy to clipboard section

            var item = new ToolStripMenuItem(Resources.StrCopyToClipboard);

            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, Submodule.Name));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrPath, Submodule.Path));
            item.DropDownItems.Add(GuiItemFactory.GetCopyHashToClipboardItem <ToolStripMenuItem>(Resources.StrUrl, Submodule.Url));

            Items.Add(item);
        }
Ejemplo n.º 6
0
        /// <summary>Gets the context menu.</summary>
        /// <param name="requestEventArgs">Request parameters.</param>
        /// <returns>Context menu for specified location.</returns>
        public override ContextMenuStrip GetContextMenu(ItemContextMenuRequestEventArgs requestEventArgs)
        {
            ContextMenuStrip menu = null;

            if (Repository != null)
            {
                menu = new ContextMenuStrip();
                menu.Items.Add(GuiItemFactory.GetRefreshReferencesItem <ToolStripMenuItem>(Repository, DataContext, Resources.StrRefresh));
                switch (DataContext)
                {
                case ReferenceType.LocalBranch:
                    menu.Items.Add(GuiItemFactory.GetCreateBranchItem <ToolStripMenuItem>(Repository));
                    break;

                case ReferenceType.RemoteBranch:
                    menu.Items.Add(GuiItemFactory.GetAddRemoteItem <ToolStripMenuItem>(Repository));
                    break;

                case ReferenceType.Tag:
                    menu.Items.Add(GuiItemFactory.GetCreateTagItem <ToolStripMenuItem>(Repository));
                    break;
                }
            }
            if (menu != null)
            {
                Utility.MarkDropDownForAutoDispose(menu);
            }
            return(menu);
        }
Ejemplo n.º 7
0
            public override ContextMenuStrip CreateContextMenu(Revision revision)
            {
                var menu = new ContextMenuStrip();

                menu.Items.Add(GuiItemFactory.GetCopyHashToClipboardItem <ToolStripMenuItem>(Resources.StrCopyToClipboard, revision.TreeHashString));
                Utility.MarkDropDownForAutoDispose(menu);
                return(menu);
            }
Ejemplo n.º 8
0
        public RepositoryMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            _repository = repository;

            Items.Add(GuiItemFactory.GetCompressRepositoryItem <ToolStripMenuItem>(_repository));
        }
Ejemplo n.º 9
0
        public HeadMenu(Head head)
        {
            Verify.Argument.IsValidGitObject(head, nameof(head));

            Head = head;

            Items.Add(GuiItemFactory.GetViewReflogItem <ToolStripMenuItem>(head));
        }
Ejemplo n.º 10
0
        public StashMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            Items.Add(GuiItemFactory.GetShowStashViewItem <ToolStripMenuItem>());
            Items.Add(GuiItemFactory.GetRefreshStashItem <ToolStripMenuItem>(Repository));
        }
Ejemplo n.º 11
0
            public override ContextMenuStrip CreateContextMenu(Revision revision)
            {
                var menu = new ContextMenuStrip();

                menu.Items.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrCopyToClipboard,
                                                                                         Utility.FormatDate(revision.AuthorDate, DateFormat)));
                Utility.MarkDropDownForAutoDispose(menu);
                return(menu);
            }
Ejemplo n.º 12
0
        public UsersMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            _repository = repository;

            Items.Add(GuiItemFactory.GetShowContributorsViewItem <ToolStripMenuItem>());
            Items.Add(GuiItemFactory.GetRefreshContributorsItem <ToolStripMenuItem>(_repository));
        }
Ejemplo n.º 13
0
        public ConfigurationMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            Items.Add(GuiItemFactory.GetShowConfigurationViewItem <ToolStripMenuItem>());
            Items.Add(GuiItemFactory.GetRefreshConfigurationItem <ToolStripMenuItem>(Repository));
        }
Ejemplo n.º 14
0
        public StagedItemMenu(TreeItem item)
        {
            Verify.Argument.IsValidGitObject(item, "item");
            Verify.Argument.AreEqual(StagedStatus.Staged, item.StagedStatus & StagedStatus.Staged, "item",
                                     "This item is not staged.");

            _item = item;

            Items.Add(GuiItemFactory.GetUnstageItem <ToolStripMenuItem>(_item));
        }
Ejemplo n.º 15
0
            public override ContextMenuStrip CreateContextMenu(Revision revision)
            {
                var menu = new ContextMenuStrip();

                menu.Items.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrCopyToClipboard,
                                                                                         string.Format("{0} <{1}>", revision.Committer.Name, revision.Committer.Email)));
                menu.Items.Add(GuiItemFactory.GetSendEmailItem <ToolStripMenuItem>(revision.Committer.Email));
                Utility.MarkDropDownForAutoDispose(menu);
                return(menu);
            }
Ejemplo n.º 16
0
        public BranchMenu(BranchBase branch)
        {
            Verify.Argument.IsValidGitObject(branch, "branch");

            _branch = branch;

            Items.Add(GuiItemFactory.GetViewReflogItem <ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetViewTreeItem <ToolStripMenuItem>(_branch));

            Items.Add(new ToolStripSeparator());             // interactive section

            Items.Add(GuiItemFactory.GetCheckoutRevisionItem <ToolStripMenuItem>(_branch, "{0} '{1}'"));
            Items.Add(GuiItemFactory.GetResetHeadHereItem <ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetRebaseHeadHereItem <ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetMergeItem <ToolStripMenuItem>(_branch));
            if (!branch.IsRemote)
            {
                Items.Add(GuiItemFactory.GetRenameBranchItem <ToolStripMenuItem>((Branch)_branch, "{0}"));
            }
            Items.Add(GuiItemFactory.GetRemoveBranchItem <ToolStripMenuItem>(_branch));
            if (!branch.IsRemote)
            {
                lock (branch.Repository.Remotes.SyncRoot)
                {
                    if (branch.Repository.Remotes.Count != 0)
                    {
                        Items.Add(new ToolStripSeparator());
                        var pushTo = new ToolStripMenuItem(Resources.StrPushTo, CachedResources.Bitmaps["ImgPush"]);
                        foreach (var remote in branch.Repository.Remotes)
                        {
                            pushTo.DropDownItems.Add(GuiItemFactory.GetPushBranchToRemoteItem <ToolStripMenuItem>((Branch)branch, remote));
                        }
                        Items.Add(pushTo);
                    }
                }
            }
            else
            {
            }
            Items.Add(new ToolStripSeparator());             // copy to clipboard section

            var item = new ToolStripMenuItem(Resources.StrCopyToClipboard);

            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, _branch.Name));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrFullName, _branch.FullName));
            item.DropDownItems.Add(GuiItemFactory.GetCopyHashToClipboardItem <ToolStripMenuItem>(Resources.StrPosition, _branch.Revision.HashString));

            Items.Add(item);

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetCreateBranchItem <ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetCreateTagItem <ToolStripMenuItem>(_branch));
        }
Ejemplo n.º 17
0
        public ConfigParameterMenu(ConfigParameter parameter)
        {
            Verify.Argument.IsValidGitObject(parameter, "parameter");

            _parameter = parameter;
            Items.Add(GuiItemFactory.GetUnsetParameterItem <ToolStripMenuItem>(parameter));
            Items.Add(new ToolStripSeparator());
            Items.Add(new ToolStripMenuItem(Resources.StrCopyToClipboard, null,
                                            GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, _parameter.Name),
                                            GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrValue, _parameter.Value)));
        }
Ejemplo n.º 18
0
 private void OnRemoteAdded(object sender, RemoteEventArgs e)
 {
     _fetchButton.DropDown.Items.Add(GuiItemFactory.GetFetchFromItem <ToolStripMenuItem>(e.Object, "{1}"));
     _pullButton.DropDown.Items.Add(GuiItemFactory.GetPullFromItem <ToolStripMenuItem>(e.Object, "{1}"));
     if (_repository.Remotes.Count == 1)
     {
         _fetchButton.Enabled = true;
         _pullButton.Enabled  = true;
         _pushButton.Enabled  = true;
     }
 }
Ejemplo n.º 19
0
        public ReferencesMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            Items.Add(GuiItemFactory.GetShowReferencesViewItem <ToolStripMenuItem>());
            Items.Add(GuiItemFactory.GetRefreshAllReferencesListItem <ToolStripMenuItem>(repository));
            Items.Add(new ToolStripSeparator());
            Items.Add(GuiItemFactory.GetCreateBranchItem <ToolStripMenuItem>(repository));
            Items.Add(GuiItemFactory.GetCreateTagItem <ToolStripMenuItem>(repository));
        }
Ejemplo n.º 20
0
        public RemotesMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            Items.Add(GuiItemFactory.GetShowRemotesViewItem <ToolStripMenuItem>());
            Items.Add(GuiItemFactory.GetRefreshRemotesItem <ToolStripMenuItem>(repository));
            Items.Add(new ToolStripSeparator());
            Items.Add(GuiItemFactory.GetFetchItem <ToolStripMenuItem>(repository));
            Items.Add(GuiItemFactory.GetPullItem <ToolStripMenuItem>(repository));
            Items.Add(new ToolStripSeparator());
            Items.Add(GuiItemFactory.GetAddRemoteItem <ToolStripMenuItem>(repository));
        }
Ejemplo n.º 21
0
        public ConflictedFileMenu(TreeFile file)
        {
            Verify.Argument.IsValidGitObject(file, "file");
            Verify.Argument.AreEqual(StagedStatus.Unstaged, file.StagedStatus & StagedStatus.Unstaged, "file",
                                     "This file is not unstaged.");
            Verify.Argument.AreNotEqual(ConflictType.None, file.ConflictType, "file",
                                        "This file is not in conflicted state.");

            _file = file;

            Items.Add(GuiItemFactory.GetMergeToolItem <ToolStripMenuItem>(_file));
            if (_file.ConflictType != ConflictType.DeletedByUs &&
                _file.ConflictType != ConflictType.DeletedByThem &&
                _file.ConflictType != ConflictType.AddedByThem &&
                _file.ConflictType != ConflictType.AddedByUs)
            {
                var mergeTools = new ToolStripMenuItem("Select Merge Tool");
                foreach (var tool in MergeTool.KnownTools)
                {
                    if (tool.SupportsWin)
                    {
                        mergeTools.DropDownItems.Add(GuiItemFactory.GetMergeToolItem <ToolStripMenuItem>(_file, tool));
                    }
                }
                Items.Add(mergeTools);
            }

            Items.Add(new ToolStripSeparator());

            switch (_file.ConflictType)
            {
            case ConflictType.DeletedByThem:
            case ConflictType.DeletedByUs:
                Items.Add(GuiItemFactory.GetResolveConflictItem <ToolStripMenuItem>(_file, ConflictResolution.KeepModifiedFile));
                Items.Add(GuiItemFactory.GetResolveConflictItem <ToolStripMenuItem>(_file, ConflictResolution.DeleteFile));
                break;

            case ConflictType.AddedByThem:
            case ConflictType.AddedByUs:
                Items.Add(GuiItemFactory.GetResolveConflictItem <ToolStripMenuItem>(_file, ConflictResolution.KeepModifiedFile));
                Items.Add(GuiItemFactory.GetResolveConflictItem <ToolStripMenuItem>(_file, ConflictResolution.DeleteFile));
                break;

            default:
                Items.Add(GuiItemFactory.GetMarkAsResolvedItem <ToolStripMenuItem>(_file));
                Items.Add(GuiItemFactory.GetResolveConflictItem <ToolStripMenuItem>(_file, ConflictResolution.UseOurs));
                Items.Add(GuiItemFactory.GetResolveConflictItem <ToolStripMenuItem>(_file, ConflictResolution.UseTheirs));
                break;
            }
        }
Ejemplo n.º 22
0
        /// <summary>Create <see cref="RevisionsMenu"/>.</summary>
        /// <param name="revisions">List of related revisions.</param>
        public RevisionsMenu(IList <Revision> revisions)
        {
            Verify.Argument.IsNotNull(revisions, "revisions");

            _revisions = revisions;

            //Items.Add(GuiItemFactory.GetCherryPickItem<ToolStripMenuItem>(revisions));
            //Items.Add(GuiItemFactory.GetRevertItem<ToolStripMenuItem>(revisions));

            if (revisions.Count == 2)
            {
                Items.Add(GuiItemFactory.GetCompareWithItem <ToolStripMenuItem>(revisions[0], revisions[1]));
            }
        }
Ejemplo n.º 23
0
        public StagedChangesMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            _repository = repository;

            Items.Add(GuiItemFactory.GetCommitItem <ToolStripMenuItem>(repository));
            Items.Add(GuiItemFactory.GetStashSaveItem <ToolStripMenuItem>(repository));

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetUnstageAllItem <ToolStripMenuItem>(repository));
            Items.Add(GuiItemFactory.GetResetItem <ToolStripMenuItem>(repository, ResetMode.Mixed | ResetMode.Hard));
        }
Ejemplo n.º 24
0
        public UserMenu(User user)
        {
            Verify.Argument.IsValidGitObject(user, nameof(user));

            User = user;

            Items.Add(GuiItemFactory.GetSendEmailItem <ToolStripMenuItem>(user.Email));

            var item = new ToolStripMenuItem(Resources.StrCopyToClipboard);

            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, user.Name));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrEmail, user.Email));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrCommits, user.Commits.ToString()));
            Items.Add(item);
        }
Ejemplo n.º 25
0
            public override ContextMenuStrip CreateContextMenu(Revision revision)
            {
                var menu = new ContextMenuStrip();
                var sb   = new StringBuilder(41 * revision.Parents.Count);

                foreach (var p in revision.Parents)
                {
                    sb.Append(p.Hash);
                    sb.Append('\n');
                }
                sb.Remove(sb.Length - 1, 1);
                menu.Items.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrCopyToClipboard, sb.ToString()));
                Utility.MarkDropDownForAutoDispose(menu);
                return(menu);
            }
Ejemplo n.º 26
0
        public ConfigParameterMenu(ConfigParameterListItem listItem)
        {
            Verify.Argument.IsNotNull(listItem, "listItem");
            Verify.Argument.IsValidGitObject(listItem.DataContext, "parameter");

            _listItem  = listItem;
            _parameter = listItem.DataContext;

            Items.Add(new ToolStripMenuItem(Resources.StrEditValue, CachedResources.Bitmaps["ImgConfigEdit"], (s, e) => listItem.StartValueEditor()));
            Items.Add(GuiItemFactory.GetUnsetParameterItem <ToolStripMenuItem>(_parameter));
            Items.Add(new ToolStripSeparator());
            Items.Add(new ToolStripMenuItem(Resources.StrCopyToClipboard, null,
                                            GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, _parameter.Name),
                                            GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrValue, _parameter.Value)));
        }
Ejemplo n.º 27
0
            public TreeMenu(ITreeSource treeSource, TreeDirectoryListItem item)
            {
                Verify.Argument.IsNotNull(item, "item");

                Items.Add(GuiItemFactory.GetExpandAllItem <ToolStripMenuItem>(item));
                Items.Add(GuiItemFactory.GetCollapseAllItem <ToolStripMenuItem>(item));

                if (treeSource != null)
                {
                    Items.Add(new ToolStripSeparator());
                    Items.Add(GuiItemFactory.GetPathHistoryItem <ToolStripMenuItem>(treeSource.Revision, item.DataContext));
                    Items.Add(new ToolStripSeparator());
                    Items.Add(GuiItemFactory.GetCheckoutPathItem <ToolStripMenuItem>(treeSource.Revision, item.DataContext));
                }
            }
Ejemplo n.º 28
0
        public SubmodulesMenu(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            Items.Add(GuiItemFactory.GetShowSubmodulesViewItem <ToolStripMenuItem>());
            Items.Add(GuiItemFactory.GetRefreshSubmodulesItem <ToolStripMenuItem>(Repository));

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetUpdateSubmodulesItem <ToolStripMenuItem>(Repository.Submodules));

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetAddSubmoduleItem <ToolStripMenuItem>(Repository));
        }
Ejemplo n.º 29
0
 private void OnHeadLabelMouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         var item = (ToolStripItem)sender;
         var menu = new ContextMenuStrip();
         menu.Items.Add(new ToolStripMenuItem(
                            Resources.StrSwitchBranch.AddEllipsis(), CachedResources.Bitmaps["ImgCheckout"],
                            (s, eargs) => _guiProvider.StartCheckoutDialog()));
         menu.Items.Add(GuiItemFactory.GetViewReflogItem <ToolStripMenuItem>(Repository.Head));
         Utility.MarkDropDownForAutoDispose(menu);
         var parent = Utility.GetParentControl(item);
         var x      = item.Bounds.X + e.X;
         var y      = item.Bounds.Y + e.Y;
         menu.Show(parent, x, y);
     }
 }
Ejemplo n.º 30
0
        private void AttachToRepository(Repository repository)
        {
            _repository          = repository;
            _mergeButton.Enabled = !repository.Head.IsDetached;
            if (repository.Remotes.Count != 0)
            {
                foreach (var remote in repository.Remotes)
                {
                    _fetchButton.DropDown.Items.Add(GuiItemFactory.GetFetchFromItem <ToolStripMenuItem>(remote, "{1}"));
                    _pullButton.DropDown.Items.Add(GuiItemFactory.GetPullFromItem <ToolStripMenuItem>(remote, "{1}"));
                }
                _fetchButton.Enabled = true;
                _pullButton.Enabled  = true;
                _pushButton.Enabled  = true;
            }
            else
            {
                _fetchButton.Enabled = false;
                _pullButton.Enabled  = false;
                _pushButton.Enabled  = false;
            }

            if (repository.Stash.Count != 0)
            {
                _stashPopItem.Enabled   = true;
                _stashApplyItem.Enabled = true;
            }
            else
            {
                _stashPopItem.Enabled   = false;
                _stashApplyItem.Enabled = false;
            }

            _stashButton.Enabled = !repository.IsEmpty;

            repository.Head.PointerChanged   += OnHeadChanged;
            repository.Remotes.ObjectAdded   += OnRemoteAdded;
            repository.Remotes.ObjectRemoved += OnRemoteRemoved;
            repository.Remotes.Renamed       += OnRemoteRenamed;

            repository.Stash.StashedStateCreated += OnStashCreated;
            repository.Stash.StashedStateDeleted += OnStashDeleted;

            Enabled = true;
        }