Пример #1
0
 private void ConflictedFiles_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         System.Drawing.Point     pt  = ConflictedFiles.PointToClient(Cursor.Position);
         DataGridView.HitTestInfo hti = ConflictedFiles.HitTest(pt.X, pt.Y);
         int LastRow = hti.RowIndex;
         ConflictedFiles.ClearSelection();
         if (LastRow >= 0 && ConflictedFiles.Rows.Count > LastRow)
         {
             ConflictedFiles.Rows[LastRow].Selected = true;
         }
     }
 }
        private void ConflictedFiles_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (HasMultipleRowsSelected())
                {
                    // do nothing, choices are limited commands already
                    return;
                }

                System.Drawing.Point pt = ConflictedFiles.PointToClient(Cursor.Position);
                DataGridView.HitTestInfo hti = ConflictedFiles.HitTest(pt.X, pt.Y);
                int LastRow = hti.RowIndex;
                ConflictedFiles.ClearSelection();
                if (LastRow >= 0 && ConflictedFiles.Rows.Count > LastRow)
                    ConflictedFiles.Rows[LastRow].Selected = true;
                SetAvailableCommands(true);
            }
        }
Пример #3
0
        private void Initialize()
        {
            Cursor.Current = Cursors.WaitCursor;

            ConflictedFiles.MultiSelect = false;
            int oldSelectedRow = 0;

            if (ConflictedFiles.SelectedRows.Count > 0)
            {
                oldSelectedRow = ConflictedFiles.SelectedRows[0].Index;
            }
            ConflictedFiles.DataSource = Module.GetConflictedFiles();
            if (ConflictedFiles.Rows.Count > oldSelectedRow)
            {
                ConflictedFiles.Rows[oldSelectedRow].Selected = true;

                if (oldSelectedRow < ConflictedFiles.FirstDisplayedScrollingRowIndex ||
                    oldSelectedRow > (ConflictedFiles.FirstDisplayedScrollingRowIndex + ConflictedFiles.DisplayedRowCount(false)))
                {
                    ConflictedFiles.FirstDisplayedScrollingRowIndex = oldSelectedRow;
                }
            }

            InitMergetool();

            ConflictedFilesContextMenu.Text = _conflictedFilesContextMenuText.Text;
            OpenMergetool.Text    = _openMergeToolItemText.Text + " " + mergetool;
            openMergeToolBtn.Text = _button1Text.Text + " " + mergetool;

            if (Module.InTheMiddleOfRebase())
            {
                Reset.Text = _resetItemRebaseText.Text;
                ContextChooseLocal.Text  = _contextChooseLocalRebaseText.Text;
                ContextChooseRemote.Text = _contextChooseRemoteRebaseText.Text;
            }
            else
            {
                Reset.Text = _resetItemMergeText.Text;
                ContextChooseLocal.Text  = _contextChooseLocalMergeText.Text;
                ContextChooseRemote.Text = _contextChooseRemoteMergeText.Text;
            }

            if (!Module.InTheMiddleOfConflictedMerge() && _thereWhereMergeConflicts)
            {
                UICommands.UpdateSubmodules(this);

                if (!Module.InTheMiddleOfPatch() && !Module.InTheMiddleOfRebase() && _offerCommit)
                {
                    if (MessageBox.Show(this, allConflictsResolved.Text, allConflictsResolvedCaption.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        UICommands.StartCommitDialog(this);
                    }
                }

                Close();
            }

            Cursor.Current = Cursors.Default;
        }
Пример #4
0
        private void Initialize()
        {
            Cursor.Current = Cursors.WaitCursor;

            int oldSelectedRow = 0;

            if (ConflictedFiles.SelectedRows.Count > 0)
            {
                oldSelectedRow = ConflictedFiles.SelectedRows[0].Index;
            }

            ConflictedFiles.DataSource = Module.GetConflicts();
            ConflictedFiles.Columns[0].DataPropertyName = "Filename";
            if (ConflictedFiles.Rows.Count > oldSelectedRow)
            {
                ConflictedFiles.Rows[oldSelectedRow].Selected = true;

                if (oldSelectedRow < ConflictedFiles.FirstDisplayedScrollingRowIndex ||
                    oldSelectedRow > (ConflictedFiles.FirstDisplayedScrollingRowIndex + ConflictedFiles.DisplayedRowCount(false)))
                {
                    try
                    {
                        ConflictedFiles.FirstDisplayedScrollingRowIndex = oldSelectedRow;
                    }
                    catch (InvalidOperationException)
                    {
                        // ignore the exception - setting the row index is not so important to crash the app
                        // see the #2975 issues for details
                    }
                }
            }

            if (!InitMergetool())
            {
                Close();
                return;
            }

            ConflictedFilesContextMenu.Text = _conflictedFilesContextMenuText.Text;
            OpenMergetool.Text    = _openMergeToolItemText.Text + " " + _mergetool;
            openMergeToolBtn.Text = _button1Text.Text + " " + _mergetool;

            if (Module.InTheMiddleOfRebase())
            {
                Reset.Text = _resetItemRebaseText.Text;
                ContextChooseLocal.Text  = _contextChooseLocalRebaseText.Text;
                ContextChooseRemote.Text = _contextChooseRemoteRebaseText.Text;
            }
            else
            {
                Reset.Text = _resetItemMergeText.Text;
                ContextChooseLocal.Text  = _contextChooseLocalMergeText.Text;
                ContextChooseRemote.Text = _contextChooseRemoteMergeText.Text;
            }

            if (!Module.InTheMiddleOfConflictedMerge() && _thereWhereMergeConflicts)
            {
                UICommands.UpdateSubmodules(this);

                if (!Module.InTheMiddleOfPatch() && !Module.InTheMiddleOfRebase() && _offerCommit)
                {
                    if (AppSettings.DontConfirmCommitAfterConflictsResolved ||
                        MessageBox.Show(this, _allConflictsResolved.Text, _allConflictsResolvedCaption.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        UICommands.StartCommitDialog(this);
                    }
                }

                Close();
            }

            Cursor.Current = Cursors.Default;
        }
Пример #5
0
        private void Initialize()
        {
            Cursor.Current = Cursors.WaitCursor;

            ConflictedFiles.MultiSelect = false;
            int oldSelectedRow = 0;

            if (ConflictedFiles.SelectedRows.Count > 0)
            {
                oldSelectedRow = ConflictedFiles.SelectedRows[0].Index;
            }
            ConflictedFiles.DataSource = GitCommandHelpers.GetConflictedFiles();
            if (ConflictedFiles.Rows.Count > oldSelectedRow)
            {
                ConflictedFiles.Rows[oldSelectedRow].Selected = true;

                if (oldSelectedRow < ConflictedFiles.FirstDisplayedScrollingRowIndex ||
                    oldSelectedRow > (ConflictedFiles.FirstDisplayedScrollingRowIndex + ConflictedFiles.DisplayedRowCount(false)))
                {
                    ConflictedFiles.FirstDisplayedScrollingRowIndex = oldSelectedRow;
                }
            }

            InitMergetool();

            ConflictedFilesContextMenu.Text = "Solve";
            OpenMergetool.Text = "Open in " + mergetool;
            button1.Text       = "Open in " + mergetool;

            if (GitCommandHelpers.InTheMiddleOfRebase())
            {
                Reset.Text = "Abort rebase";
                ContextChooseLocal.Text  = "Choose local (theirs)";
                ContextChooseRemote.Text = "Choose remote (ours)";
            }
            else
            {
                Reset.Text = "Abort merge";
                ContextChooseLocal.Text  = "Choose local (ours)";
                ContextChooseRemote.Text = "Choose remote (theirs)";
            }

            if (!GitCommandHelpers.InTheMiddleOfPatch() && !GitCommandHelpers.InTheMiddleOfRebase() && !GitCommandHelpers.InTheMiddleOfConflictedMerge() && ThereWhereMergeConflicts)
            {
                if (MessageBox.Show(allConflictsResolved.Text, allConflictsResolvedCaption.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    GitUICommands.Instance.StartCommitDialog();
                }
            }

            if (!GitCommandHelpers.InTheMiddleOfConflictedMerge() && ThereWhereMergeConflicts)
            {
                Close();
            }
            Cursor.Current = Cursors.Default;
        }