Esempio n. 1
0
        public static int ShowQuerySave(string fileName, IList <P4.Changelist> items, out int changelistId, out string NewChangeDescription)
        {
            NewChangeDescription = null;
            changelistId         = P4VsProvider.Instance.ChangeLists.ActiveChangeList;

            //if ((items == null) || (items.Count <= 0))
            //{
            //    return Checkout;
            //}
            if (DateTime.Now - LastQuerySaveTime < TimeSpan.FromSeconds(2))
            {
                changelistId = LastQuerySaveChangelistId;
                if (changelistId == -1)
                {
                    NewChangeDescription = LastQuerySaveChangeDesc;
                }
                LastQuerySaveTime = DateTime.Now;
                return(LastQuerySaveResult);
            }
            if (Preferences.LocalSettings.GetBool("PromptForChanglist", true))
            {
                string prompt = string.Format(
                    Resources.SelectChangelistDlg_QueryEditOrSavePrompt,
                    System.IO.Path.GetFileName(fileName));
                SelectChangelistDlg dlg = new SelectChangelistDlg(prompt, items);

                dlg.saveToChangelistBtn.Visible = false;
                dlg.submitBtn.Visible           = false;

                dlg.OkBtn.Visible     = false;
                dlg.CancelBtn.Visible = false;

                dlg.CheckoutAndSaveBtn.Visible = true;
                dlg.SkipSaveBtn.Visible        = true;
                dlg.SaveAsBtn.Visible          = true;
                dlg.CancelSaveBtn.Visible      = true;

                dlg.CancelButton = dlg.CancelSaveBtn;

                dlg.ShowApplyToAllChk  = true;
                dlg.ApplyToAllChk.Text = Resources.SelectChangelistDlg_ApplyToAllFilesSaveLabel;

                dlg.CancelEditBtn.Visible = false;
                dlg.EditFileBtn.Visible   = false;
                dlg.CheckoutBtn.Visible   = false;

                dlg.BtnPanel.Controls.Clear();
                dlg.BtnPanel.Controls.Add(dlg.BtnPanelBuffer);
                dlg.BtnPanel.Controls.Add(dlg.CheckoutAndSaveBtn);
                dlg.BtnPanel.Controls.Add(dlg.SkipSaveBtn);
                dlg.BtnPanel.Controls.Add(dlg.SaveAsBtn);
                dlg.BtnPanel.Controls.Add(dlg.CancelSaveBtn);

                //dlg.BtnPanel.Controls.Add(dlg.CheckoutBtn);
                //dlg.BtnPanel.Controls.Add(dlg.EditFileBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CancelEditBtn);
                //dlg.BtnPanel.Controls.Add(dlg.saveToChangelistBtn);
                //dlg.BtnPanel.Controls.Add(dlg.submitBtn);
                //dlg.BtnPanel.Controls.Add(dlg.OkBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CancelBtn);

                dlg.CheckoutAndSaveBtn.Column = 1;
                dlg.SkipSaveBtn.Column        = 2;
                dlg.SaveAsBtn.Column          = 3;
                dlg.CancelSaveBtn.Column      = 4;
                dlg.BtnPanel.InitializeGrid(true);

                DialogResult result = dlg.ShowDialog();

                if (dlg.ApplyToAllChk.Checked)
                {
                    LastQuerySaveTime = DateTime.Now;
                }

                if (result == DialogResult.Cancel)
                {
                    LastQuerySaveResult = Cancel;
                    return(Cancel);
                }
                else if (result == DialogResult.Ignore)
                {
                    LastQuerySaveResult = Ignore;
                    return(Ignore);
                }
                else if (result == DialogResult.Retry)
                {
                    LastQuerySaveResult = SaveAs;
                    return(SaveAs);
                }
                changelistId = dlg.Result;
                LastQuerySaveChangelistId = changelistId;
                if (changelistId == -1)
                {
                    NewChangeDescription    = dlg.DescriptionTB.Text;
                    LastQuerySaveChangeDesc = NewChangeDescription;
                }
                LastQuerySaveResult = Checkout;
                return(Checkout);
            }
            else
            {
                return(Checkout);
            }
        }
Esempio n. 2
0
        public static P4.Changelist ShowChooseChangelistSubmit(string prompt, IList <P4.Changelist> items,
                                                               ref string NewChangeDescription, out string action, bool streams, bool integ, P4ScmProvider scm)
        {
            action = null;
            P4.Changelist changelist = scm.Connection.Repository.NewChangelist();
            // Make sure files is empty. If default has files in it, a new changelist
            // will automatically get those files.
            changelist.Files = new List <P4.FileMetaData>();
            if (Preferences.LocalSettings.GetBool("PromptForChanglist", true) ||
                integ == true)
            {
                SelectChangelistDlg dlg = new SelectChangelistDlg(prompt, items);

                dlg.saveToChangelistBtn.Enabled = true;
                dlg.saveToChangelistBtn.Visible = true;
                dlg.submitBtn.Enabled           = true;
                dlg.submitBtn.Visible           = true;

                if (streams)
                {
                    dlg.CancelBtn.Visible = false;
                    dlg.CancelBtn.Enabled = false;
                    dlg.ControlBox        = false;

                    dlg.BtnPanel.Controls.Clear();
                    dlg.BtnPanel.Controls.Add(dlg.BtnPanelBuffer);
                    dlg.BtnPanel.Controls.Add(dlg.saveToChangelistBtn);
                    dlg.BtnPanel.Controls.Add(dlg.submitBtn);

                    dlg.saveToChangelistBtn.Column = 1;
                    dlg.submitBtn.Column           = 2;
                    dlg.submitBtn.Column           = 3;
                    dlg.BtnPanel.InitializeGrid(true);
                }
                else
                {
                    dlg.CancelBtn.Visible = true;

                    dlg.BtnPanel.Controls.Clear();
                    dlg.BtnPanel.Controls.Add(dlg.BtnPanelBuffer);
                    dlg.BtnPanel.Controls.Add(dlg.saveToChangelistBtn);
                    dlg.BtnPanel.Controls.Add(dlg.submitBtn);
                    dlg.BtnPanel.Controls.Add(dlg.CancelBtn);

                    dlg.saveToChangelistBtn.Column = 1;
                    dlg.submitBtn.Column           = 2;
                    dlg.submitBtn.Column           = 3;
                    dlg.CancelBtn.Column           = 4;
                    dlg.BtnPanel.InitializeGrid(true);
                }
                dlg.NewChangelistDescription = NewChangeDescription;

                dlg.CancelButton = dlg.CancelBtn;

                dlg.OkBtn.Visible = false;

                dlg.CheckoutAndSaveBtn.Visible = false;
                dlg.SkipSaveBtn.Visible        = false;
                dlg.SaveAsBtn.Visible          = false;
                dlg.CancelSaveBtn.Visible      = false;

                dlg.CancelEditBtn.Visible = false;
                dlg.EditFileBtn.Visible   = false;
                dlg.CheckoutBtn.Visible   = false;

                //dlg.BtnPanel.Controls.Add(dlg.CancelEditBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CancelBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CancelSaveBtn);
                //dlg.BtnPanel.Controls.Add(dlg.SkipSaveBtn);
                //dlg.BtnPanel.Controls.Add(dlg.SaveAsBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CheckoutAndSaveBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CheckoutBtn);
                //dlg.BtnPanel.Controls.Add(dlg.EditFileBtn);

                if (dlg.ShowDialog() == DialogResult.Cancel)
                {
                    return(null);
                }

                if (dlg.DialogResult == DialogResult.OK)
                {
                    // Save to Changelist
                    changelist.Description = dlg.DescriptionTB.Text;
                    return(changelist);
                }

                if (dlg.DialogResult == DialogResult.Yes)
                {
                    // Submit...
                    action = "submit";
                    changelist.Description = dlg.DescriptionTB.Text;
                    return(changelist);
                }

                int changelistId = dlg.Result;
                if (changelistId == -1)
                {
                    changelist.Description = dlg.DescriptionTB.Text;
                }
                return(changelist);
            }
            else
            {
                changelist = P4VsProvider.CurrentScm.GetChangelist(P4VsProvider.Instance.ChangeLists.ActiveChangeList, null);
                return(changelist);
            }
        }
Esempio n. 3
0
        public static int ShowChooseChangelist(string prompt, IList <P4.Changelist> items, ref string NewChangeDescription)
        {
            //if ((items == null) || (items.Count <= 0))
            //{
            //    return 0;
            //}
            if (Preferences.LocalSettings.GetBool("PromptForChanglist", true) || (P4VsProvider.Instance.ChangeLists.ActiveChangeList == -2))
            {
                if (ActiveChangeList > -1)
                {
                    CurrentChangeListLastUse = DateTime.Now;
//					NewChangeDescription = CurrentChangeDescription;
                    return(CurrentChangeList);
                }
                SelectChangelistDlg dlg = new SelectChangelistDlg(prompt, items);

                dlg.NewChangelistDescription = NewChangeDescription;

                dlg.OkBtn.Visible     = true;
                dlg.CancelBtn.Visible = true;

                dlg.CancelButton = dlg.CancelBtn;

                dlg.saveToChangelistBtn.Visible = false;
                dlg.submitBtn.Visible           = false;

                dlg.CheckoutAndSaveBtn.Visible = false;
                dlg.SkipSaveBtn.Visible        = false;
                dlg.SaveAsBtn.Visible          = false;
                dlg.CancelSaveBtn.Visible      = false;

                dlg.CancelEditBtn.Visible = false;
                dlg.EditFileBtn.Visible   = false;
                dlg.CheckoutBtn.Visible   = false;

                dlg.BtnPanel.Controls.Clear();
                dlg.BtnPanel.Controls.Add(dlg.BtnPanelBuffer);
                //dlg.BtnPanel.Controls.Add(dlg.CancelEditBtn);
                dlg.BtnPanel.Controls.Add(dlg.CancelBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CancelSaveBtn);
                //dlg.BtnPanel.Controls.Add(dlg.SkipSaveBtn);
                //dlg.BtnPanel.Controls.Add(dlg.SaveAsBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CheckoutAndSaveBtn);
                //dlg.BtnPanel.Controls.Add(dlg.CheckoutBtn);
                //dlg.BtnPanel.Controls.Add(dlg.EditFileBtn);
                //dlg.BtnPanel.Controls.Add(dlg.submitBtn);
                dlg.BtnPanel.Controls.Add(dlg.OkBtn);
                //dlg.BtnPanel.Controls.Add(dlg.saveToChangelistBtn);

                dlg.OkBtn.Column     = 1;
                dlg.CancelBtn.Column = 2;
                dlg.BtnPanel.InitializeGrid(true);

                if (dlg.ShowDialog() == DialogResult.Cancel)
                {
                    CurrentChangeList = -2;
                    return(CurrentChangeList);
                }
                int changelistId = dlg.Result;
                if (changelistId == -1)
                {
                    NewChangeDescription = dlg.DescriptionTB.Text;
//					CurrentChangeDescription = NewChangeDescription;
                }
                CurrentChangeListLastUse = DateTime.Now;
                CurrentChangeList        = changelistId;
                return(changelistId);
            }
            else
            {
                return(P4VsProvider.Instance.ChangeLists.ActiveChangeList);
            }
        }
Esempio n. 4
0
        public static int ShowChooseChangelistMoveFilesInChangelist(string prompt, IList <P4.Changelist> items, ref string NewChangeDescription, P4ScmProvider scm)
        {
            if (ActiveChangeList > -1)
            {
                CurrentChangeListLastUse = DateTime.Now;
                //					NewChangeDescription = CurrentChangeDescription;
                return(CurrentChangeList);
            }
            SelectChangelistDlg dlg = new SelectChangelistDlg(prompt, items);

            dlg.DontShowAgainCB.Enabled = false;
            dlg.DontShowAgainCB.Visible = false;

            dlg.saveToChangelistBtn.Visible = false;
            dlg.submitBtn.Visible           = false;

            dlg.NewChangelistDescription = NewChangeDescription;

            dlg.OkBtn.Visible     = true;
            dlg.CancelBtn.Visible = true;

            dlg.CancelButton = dlg.CancelBtn;

            dlg.CheckoutAndSaveBtn.Visible = false;
            dlg.SkipSaveBtn.Visible        = false;
            dlg.SaveAsBtn.Visible          = false;
            dlg.CancelSaveBtn.Visible      = false;

            dlg.CancelEditBtn.Visible = false;
            dlg.EditFileBtn.Visible   = false;
            dlg.CheckoutBtn.Visible   = false;

            dlg.BtnPanel.Controls.Clear();
            dlg.BtnPanel.Controls.Add(dlg.BtnPanelBuffer);
            //dlg.BtnPanel.Controls.Add(dlg.CancelEditBtn);
            dlg.BtnPanel.Controls.Add(dlg.CancelBtn);
            //dlg.BtnPanel.Controls.Add(dlg.CancelSaveBtn);
            //dlg.BtnPanel.Controls.Add(dlg.SkipSaveBtn);
            //dlg.BtnPanel.Controls.Add(dlg.SaveAsBtn);
            //dlg.BtnPanel.Controls.Add(dlg.CheckoutAndSaveBtn);
            //dlg.BtnPanel.Controls.Add(dlg.CheckoutBtn);
            //dlg.BtnPanel.Controls.Add(dlg.EditFileBtn);
            //dlg.BtnPanel.Controls.Add(dlg.submitBtn);
            dlg.BtnPanel.Controls.Add(dlg.OkBtn);
            //dlg.BtnPanel.Controls.Add(dlg.saveToChangelistBtn);

            dlg.OkBtn.Column     = 1;
            dlg.CancelBtn.Column = 2;
            dlg.BtnPanel.InitializeGrid(true);

            if (dlg.ShowDialog() == DialogResult.Cancel)
            {
                CurrentChangeList = -2;
                return(CurrentChangeList);
            }
            int changelistId = dlg.Result;

            if (changelistId == -1)
            {
                P4.Changelist newChange = scm.Connection.Repository.NewChangelist();
                // Make sure files is empty. If default has files in it, a new changelist
                // will automatically get those files.
                newChange.Files = new List <P4.FileMetaData>();

                newChange.Description = dlg.DescriptionTB.Text;
                newChange             = scm.SaveChangelist(newChange, null);
                if (newChange != null)
                {
                    return(newChange.Id);
                }
                else
                {
                    return(changelistId);
                }
            }
            CurrentChangeListLastUse = DateTime.Now;
            CurrentChangeList        = changelistId;
            return(changelistId);
        }