示例#1
0
        /// <summary>Create <see cref="RenameBranchDialog"/>.</summary>
        /// <param name="branch">Branch to rename.</param>
        /// <exception cref="ArgumentNullException"><paramref name="branch"/> == <c>null</c>.</exception>
        public RenameBranchDialog(Branch branch)
        {
            Verify.Argument.IsNotNull(branch, nameof(branch));
            Verify.Argument.IsFalse(branch.IsDeleted, nameof(branch),
                                    Resources.ExcObjectIsDeleted.UseAsFormat("Branch"));

            Branch = branch;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                NewName = new TextBoxInputSource(_txtNewName),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtNewName, ReferenceType.LocalBranch);

            var branchName = branch.Name;

            _txtOldName.Text = branchName;
            _txtNewName.Text = branchName;
            _txtNewName.SelectAll();

            GitterApplication.FontManager.InputFont.Apply(_txtNewName, _txtOldName);

            _controller = new RenameBranchController(branch)
            {
                View = this
            };
        }
示例#2
0
        public InitDialog(IGitRepositoryProvider gitRepositoryProvider)
        {
            Verify.Argument.IsNotNull(gitRepositoryProvider, nameof(gitRepositoryProvider));

            GitRepositoryProvider = gitRepositoryProvider;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                RepositoryPath    = new TextBoxInputSource(_txtPath),
                Bare              = new CheckBoxInputSource(_chkBare),
                UseCustomTemplate = new CheckBoxInputSource(_chkUseTemplate),
                Template          = new TextBoxInputSource(_txtTemplate),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            GitterApplication.FontManager.InputFont.Apply(_txtPath, _txtTemplate);

            _controller = new InitController(gitRepositoryProvider)
            {
                View = this
            };
        }
示例#3
0
        /// <summary>Create <see cref="AddSubmoduleDialog"/>.</summary>
        public AddSubmoduleDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            _repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                Path            = new TextBoxInputSource(_txtPath),
                Url             = new TextBoxInputSource(_txtRepository),
                UseCustomBranch = new CheckBoxInputSource(_chkBranch),
                BranchName      = new TextBoxInputSource(_txtBranch),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            GitterApplication.FontManager.InputFont.Apply(_txtBranch, _txtRepository, _txtPath);

            _controller = new AddSubmoduleController(repository)
            {
                View = this
            };
        }
示例#4
0
        public CheckoutDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            _repository = repository;

            InitializeComponent();

            var inputs = new IUserInputSource[]
            {
                Revision = new TextBoxInputSource(_txtRevision),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            Text = Resources.StrCheckoutRevision;

            _lblRevision.Text = Resources.StrRevision.AddColon();

            _lstReferences.Style = GitterApplication.DefaultStyle;
            _lstReferences.LoadData(_repository, ReferenceType.Reference, GlobalBehavior.GroupReferences, GlobalBehavior.GroupRemoteBranches);
            _lstReferences.Items[0].IsExpanded = true;
            _lstReferences.ItemActivated      += OnReferencesItemActivated;

            GlobalBehavior.SetupAutoCompleteSource(_txtRevision, _repository, ReferenceType.Reference);
            GitterApplication.FontManager.InputFont.Apply(_txtRevision);

            _controller = new CheckoutController(repository)
            {
                View = this
            };
        }
示例#5
0
        public StashToBranchDialog(StashedState stashedState)
        {
            Verify.Argument.IsNotNull(stashedState, nameof(stashedState));
            Verify.Argument.IsFalse(stashedState.IsDeleted, nameof(stashedState),
                                    Resources.ExcObjectIsDeleted.UseAsFormat(stashedState.GetType().Name));

            StashedState = stashedState;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                BranchName = new TextBoxInputSource(_txtBranchName),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtBranchName, ReferenceType.LocalBranch);

            _txtStashName.Text = ((IRevisionPointer)StashedState).Pointer;

            GitterApplication.FontManager.InputFont.Apply(_txtBranchName, _txtStashName);

            _controller = new StashToBranchController(stashedState)
            {
                View = this
            };
        }
示例#6
0
        public RenameRemoteDialog(Remote remote)
        {
            Verify.Argument.IsNotNull(remote, nameof(remote));
            Verify.Argument.IsFalse(remote.IsDeleted, nameof(remote),
                                    Resources.ExcObjectIsDeleted.UseAsFormat("Remote"));

            Remote = remote;

            InitializeComponent();
            Localize();

            SetupReferenceNameInputBox(_txtNewName, ReferenceType.Remote);

            _txtOldName.Text = remote.Name;
            _txtNewName.Text = remote.Name;
            _txtNewName.SelectAll();

            var inputs = new IUserInputSource[]
            {
                NewName = new TextBoxInputSource(_txtNewName),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            GitterApplication.FontManager.InputFont.Apply(_txtNewName, _txtOldName);

            _controller = new RenameRemoteController(remote);
        }
示例#7
0
        /// <summary>Create <see cref="CreateBranchDialog"/>.</summary>
        /// <param name="repository"><see cref="Repository"/> to create <see cref="Branch"/> in.</param>
        /// <exception cref="ArgumentNullException"><paramref name="repository"/> == <c>null</c>.</exception>
        public CreateBranchDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            _repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                BranchName       = new TextBoxInputSource(_txtName),
                StartingRevision = new ControlInputSource(_txtRevision),
                Checkout         = new CheckBoxInputSource(_chkCheckoutAfterCreation),
                Orphan           = new CheckBoxInputSource(_chkOrphan),
                CreateReflog     = new CheckBoxInputSource(_chkCreateReflog),
                TrackingMode     = new RadioButtonGroupInputSource <BranchTrackingMode>(
                    new[]
                {
                    Tuple.Create(_trackingDefault, BranchTrackingMode.Default),
                    Tuple.Create(_trackingTrack, BranchTrackingMode.Tracking),
                    Tuple.Create(_trackingDoNotTrack, BranchTrackingMode.NotTracking),
                }),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtName, ReferenceType.LocalBranch);

            var logallrefupdates = _repository.Configuration.TryGetParameterValue(GitConstants.CoreLogAllRefUpdatesParameter);

            if (logallrefupdates != null && logallrefupdates == "true")
            {
                _chkCreateReflog.Checked = true;
                _chkCreateReflog.Enabled = false;
            }

            ToolTipService.Register(_chkCheckoutAfterCreation, Resources.TipCheckoutAfterCreation);
            ToolTipService.Register(_chkOrphan, Resources.TipOrphan);
            ToolTipService.Register(_chkCreateReflog, Resources.TipReflog);
            ToolTipService.Register(_trackingTrack, Resources.TipTrack);

            _txtRevision.References.LoadData(
                _repository,
                ReferenceType.Reference,
                GlobalBehavior.GroupReferences,
                GlobalBehavior.GroupRemoteBranches);
            _txtRevision.References.Items[0].IsExpanded = true;

            GitterApplication.FontManager.InputFont.Apply(_txtName, _txtRevision);
            GlobalBehavior.SetupAutoCompleteSource(_txtRevision, _repository, ReferenceType.Branch);

            _controller = new CreateBranchController(repository)
            {
                View = this
            };
        }
示例#8
0
        public CommitDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                Message     = new TextBoxInputSource(_txtMessage),
                Amend       = new CheckBoxInputSource(_chkAmend),
                StagedItems = new ControlInputSource(_lstStaged),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            for (int i = 0; i < _lstStaged.Columns.Count; ++i)
            {
                var col = _lstStaged.Columns[i];
                col.IsVisible = col.Id == (int)ColumnId.Name;
            }

            _lstStaged.Columns[0].SizeMode = ColumnSizeMode.Auto;
            _lstStaged.Style = GitterApplication.DefaultStyle;
            _lstStaged.SetTree(repository.Status.StagedRoot, TreeListBoxMode.ShowFullTree);
            _lstStaged.ExpandAll();

            _chkAmend.Enabled = !repository.Head.IsEmpty;

            GitterApplication.FontManager.InputFont.Apply(_txtMessage);
            if (SpellingService.Enabled)
            {
                _speller = new TextBoxSpellChecker(_txtMessage, true);
            }

            _txtMessage.Text   = repository.Status.LoadCommitMessage();
            _txtMessage.Height = _chkAmend.Top - _txtMessage.Top - 2;

            _controller = new CommitController(repository)
            {
                View = this
            };
        }
示例#9
0
        /// <summary>Create <see cref="CreateTagDialog"/>.</summary>
        /// <param name="repository"><see cref="Repository"/> to create <see cref="Tag"/> in.</param>
        /// <exception cref="ArgumentNullException"><paramref name="repository"/> == <c>null</c>.</exception>
        public CreateTagDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            _repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                TagName   = new TextBoxInputSource(_txtName),
                Revision  = new ControlInputSource(_txtRevision),
                Message   = new TextBoxInputSource(_txtMessage),
                Annotated = new RadioButtonInputSource(_radAnnotated),
                Signed    = new RadioButtonInputSource(_radSigned),
                UseKeyId  = new RadioButtonInputSource(_radUseKeyId),
                KeyId     = new TextBoxInputSource(_txtKeyId),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtName, ReferenceType.Tag);

            _txtRevision.References.LoadData(
                _repository,
                ReferenceType.Reference,
                GlobalBehavior.GroupReferences,
                GlobalBehavior.GroupRemoteBranches);
            _txtRevision.References.Items[0].IsExpanded = true;

            GitterApplication.FontManager.InputFont.Apply(_txtKeyId, _txtMessage, _txtName, _txtRevision);
            GlobalBehavior.SetupAutoCompleteSource(_txtRevision, _repository, ReferenceType.Branch);
            if (SpellingService.Enabled)
            {
                _speller = new TextBoxSpellChecker(_txtMessage, true);
            }

            _controller = new CreateTagController(repository)
            {
                View = this
            };
        }
示例#10
0
        public MergeDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            _repository = repository;

            InitializeComponent();
            Localize();
            SetupTooltips();

            var inputs = new IUserInputSource[]
            {
                _revisionsInput = new RevisionsInput(_references),
                Message         = new TextBoxInputSource(_txtMessage),
                NoFastForward   = new CheckBoxInputSource(_chkNoFF),
                NoCommit        = new CheckBoxInputSource(_chkNoCommit),
                Squash          = new CheckBoxInputSource(_chkSquash),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            if (SpellingService.Enabled)
            {
                _speller = new TextBoxSpellChecker(_txtMessage, true);
            }

            GitterApplication.FontManager.InputFont.Apply(_txtMessage);

            _unmergedBranches = _repository.Refs.GetUnmergedBranches();
            _references.DisableContextMenus = true;
            _references.Style = GitterApplication.DefaultStyle;
            _references.LoadData(_repository, ReferenceType.Branch, false, GlobalBehavior.GroupRemoteBranches,
                                 reference => _unmergedBranches.Contains(reference as BranchBase));

            _txtMessage.Height = _pnlOptions.Top - _txtMessage.Top - 6;

            _controller = new MergeController(repository)
            {
                View = this
            };
        }
示例#11
0
        public AddRemoteDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                RemoteName   = new TextBoxInputSource(_txtName),
                Url          = new TextBoxInputSource(_txtUrl),
                Fetch        = new CheckBoxInputSource(_chkFetch),
                Mirror       = new CheckBoxInputSource(_chkMirror),
                TagFetchMode = new RadioButtonGroupInputSource <TagFetchMode>(
                    new[]
                {
                    Tuple.Create(_tagFetchDefault, gitter.Git.TagFetchMode.Default),
                    Tuple.Create(_tagFetchNone, gitter.Git.TagFetchMode.NoTags),
                    Tuple.Create(_tagFetchAll, gitter.Git.TagFetchMode.AllTags),
                }),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtName, ReferenceType.Remote);

            if (Repository.Remotes.Count == 0)
            {
                _txtName.Text = GitConstants.DefaultRemoteName;
            }

            GitterApplication.FontManager.InputFont.Apply(_txtName, _txtUrl);

            _controller = new AddRemoteController(repository)
            {
                View = this
            };
        }
示例#12
0
        /// <summary>Create <see cref="AddNoteDialog"/>.</summary>
        /// <param name="repository">Repository to create note in.</param>
        public AddNoteDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            InitializeComponent();

            var inputs = new IUserInputSource[]
            {
                Revision = new ControlInputSource(_txtRevision),
                Message  = new TextBoxInputSource(_txtMessage),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            Text = Resources.StrAddNote;

            _txtRevision.References.LoadData(
                Repository,
                ReferenceType.Reference,
                GlobalBehavior.GroupReferences,
                GlobalBehavior.GroupRemoteBranches);
            _txtRevision.References.Items[0].IsExpanded = true;

            _txtRevision.Text = GitConstants.HEAD;

            _lblRevision.Text = Resources.StrRevision.AddColon();
            _lblMessage.Text  = Resources.StrMessage.AddColon();

            GitterApplication.FontManager.InputFont.Apply(_txtRevision, _txtMessage);
            if (SpellingService.Enabled)
            {
                _speller = new TextBoxSpellChecker(_txtMessage, true);
            }
            _controller = new AddNoteController(repository)
            {
                View = this
            };
        }
示例#13
0
        public PushDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, nameof(repository));

            Repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                PushTo = new RadioButtonGroupInputSource <PushTo>(
                    new[]
                {
                    Tuple.Create(_radRemote, gitter.Git.Gui.Interfaces.PushTo.Remote),
                    Tuple.Create(_radUrl, gitter.Git.Gui.Interfaces.PushTo.Url),
                }),
                Remote         = PickerInputSource.Create(_remotePicker),
                Url            = new TextBoxInputSource(_txtUrl),
                References     = new BranchesInputSource(_lstReferences),
                ForceOverwrite = new CheckBoxInputSource(_chkForceOverwriteBranches),
                ThinPack       = new CheckBoxInputSource(_chkUseThinPack),
                SendTags       = new CheckBoxInputSource(_chkSendTags),
            };

            ErrorNotifier = new UserInputErrorNotifier(NotificationService, inputs);


            _picWarning.Image = CachedResources.Bitmaps["ImgWarning"];

            _lstReferences.LoadData(Repository, ReferenceType.LocalBranch, false, false, null);
            _lstReferences.EnableCheckboxes();

            if (!Repository.Head.IsDetached)
            {
                foreach (BranchListItem item in _lstReferences.Items)
                {
                    if (item.DataContext == Repository.Head.Pointer)
                    {
                        item.CheckedState = CheckedState.Checked;
                        break;
                    }
                }
            }

            _remotePicker.LoadData(repository);
            Remote remote = null;

            lock (repository.Remotes.SyncRoot)
            {
                foreach (var r in repository.Remotes)
                {
                    remote = r;
                    break;
                }
            }
            _remotePicker.SelectedValue = remote;

            _controller = new PushController(repository)
            {
                View = this
            };
        }