public static int ShowChooseChangelistActions(string prompt, IList <string> files, IList <string> actions, IList <P4.Changelist> items, ref string NewChangeDescription) { if (Preferences.LocalSettings.GetBool("PromptForChanglist", true)) { if (ActiveChangeList > -1) { CurrentChangeListLastUse = DateTime.Now; // NewChangeDescription = CurrentChangeDescription; return(CurrentChangeList); } SelectChangelistDlg2 dlg = new SelectChangelistDlg2(prompt, files, actions, items); dlg.NewChangelistDescription = NewChangeDescription; dlg.OkBtn.Visible = true; dlg.CancelBtn.Visible = true; dlg.saveToChangelistBtn.Visible = false; dlg.submitBtn.Visible = false; dlg.YesBtn1.Visible = false; dlg.NoBtn1.Visible = false; dlg.YesBtn2.Visible = false; dlg.NoBtn2.Visible = false; dlg.BtnBar.Controls.Clear(); dlg.BtnBar.Controls.Add(dlg.BtnSpacer); dlg.BtnBar.Controls.Add(dlg.OkBtn); dlg.BtnBar.Controls.Add(dlg.CancelBtn); dlg.OkBtn.Column = 1; dlg.CancelBtn.Column = 2; dlg.BtnBar.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); } }
public static int ShowChooseChangelistSubmit(string prompt, IList <string> files, IList <P4.Changelist> items, ref string NewChangeDescription, out string action) { action = null; //if ((items == null) || (items.Count <= 0)) //{ // return 0; //} if (Preferences.LocalSettings.GetBool("PromptForChanglist", true)) { SelectChangelistDlg2 dlg = new SelectChangelistDlg2(prompt, files, items); dlg.NewChangelistDescription = NewChangeDescription; dlg.saveToChangelistBtn.Enabled = true; dlg.saveToChangelistBtn.Visible = true; dlg.submitBtn.Enabled = true; dlg.submitBtn.Visible = true; dlg.CancelBtn.Visible = true; dlg.YesBtn1.Visible = false; dlg.NoBtn1.Visible = false; dlg.YesBtn2.Visible = false; dlg.NoBtn2.Visible = false; dlg.OkBtn.Visible = false; dlg.BtnBar.Controls.Clear(); dlg.BtnBar.Controls.Add(dlg.BtnSpacer); dlg.BtnBar.Controls.Add(dlg.saveToChangelistBtn); dlg.BtnBar.Controls.Add(dlg.submitBtn); dlg.BtnBar.Controls.Add(dlg.CancelBtn); dlg.saveToChangelistBtn.Column = 1; dlg.submitBtn.Column = 2; dlg.CancelBtn.Column = 2; dlg.BtnBar.InitializeGrid(true); if (dlg.ShowDialog() == DialogResult.Cancel) { return(-2); } if (dlg.DialogResult == DialogResult.OK) { // Save to Changelist return(dlg.Result); } if (dlg.DialogResult == DialogResult.Yes) { // Submit... action = "submit"; return(dlg.Result); } int changelistId = dlg.Result; if (changelistId == -1) { NewChangeDescription = dlg.DescriptionTB.Text; } return(changelistId); } else { return(P4VsProvider.Instance.ChangeLists.ActiveChangeList); } }
public static int ShowChooseChangelistYesNoCancel(string prompt, IList <string> files, IList <P4.Changelist> items, ref string NewChangeDescription) { //if ((items == null) || (items.Count <= 0)) //{ // return 0; //} if (ActiveChangeList > -1) { CurrentChangeListLastUse = DateTime.Now; // NewChangeDescription = CurrentChangeDescription; return(CurrentChangeList); } SelectChangelistDlg2 dlg = new SelectChangelistDlg2(prompt, files, items); dlg.NewChangelistDescription = NewChangeDescription; dlg.OkBtn.Visible = false; dlg.CancelBtn.Visible = true; dlg.saveToChangelistBtn.Visible = false; dlg.submitBtn.Visible = false; dlg.YesBtn1.Visible = false; dlg.NoBtn1.Visible = false; dlg.YesBtn2.Visible = true; dlg.NoBtn2.Visible = true; dlg.DontShowAgainCB.Visible = false; dlg.BtnBar.Controls.Clear(); dlg.BtnBar.Controls.Add(dlg.BtnSpacer); dlg.BtnBar.Controls.Add(dlg.YesBtn2); dlg.BtnBar.Controls.Add(dlg.NoBtn2); dlg.BtnBar.Controls.Add(dlg.CancelBtn); dlg.YesBtn2.Column = 1; dlg.NoBtn2.Column = 2; dlg.CancelBtn.Column = 3; dlg.BtnBar.InitializeGrid(true); DialogResult res = dlg.ShowDialog(); if (res == DialogResult.Cancel) { CurrentChangeList = -3; return(CurrentChangeList); } if (res == DialogResult.No) { CurrentChangeList = -2; return(CurrentChangeList); } int changelistId = dlg.Result; if (changelistId == -1) { NewChangeDescription = dlg.DescriptionTB.Text; // CurrentChangeDescription = NewChangeDescription; } CurrentChangeListLastUse = DateTime.Now; CurrentChangeList = changelistId; return(changelistId); }
public static int ShowChooseChangelistMove(string prompt, IList <string> files, IList <P4.Changelist> items, ref string NewChangeDescription, P4ScmProvider scm) { if (ActiveChangeList > -1) { CurrentChangeListLastUse = DateTime.Now; // NewChangeDescription = CurrentChangeDescription; return(CurrentChangeList); } SelectChangelistDlg2 dlg = new SelectChangelistDlg2(prompt, files, 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.YesBtn1.Visible = false; dlg.NoBtn1.Visible = false; dlg.YesBtn2.Visible = false; dlg.NoBtn2.Visible = false; dlg.BtnBar.Controls.Clear(); dlg.BtnBar.Controls.Add(dlg.BtnSpacer); dlg.BtnBar.Controls.Add(dlg.OkBtn); dlg.BtnBar.Controls.Add(dlg.CancelBtn); dlg.OkBtn.Column = 1; dlg.CancelBtn.Column = 2; dlg.BtnBar.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); }
public void CheckoutResource(IList <string> sel) { IList <VSITEMSELECTION> nodes = SccService.SelectedNodes; IList <string> lockedFiles = new List <string>(); IList <string> lockUsers = new List <string>(); IList <string> staleFiles = new List <string>(); IList <string> checkoutFiles = new List <string>(); for (int idx = 0; idx < sel.Count; idx++) { string file = sel[idx]; bool isWildcard = file.EndsWith("...") || file.EndsWith("*"); if (isWildcard == false) { P4.FileMetaData fmd = null; if (string.IsNullOrEmpty(file) == false) { fmd = SccService.ScmProvider.Fetch(file); } if (fmd != null && fmd.HeadType.Modifiers.HasFlag(P4.FileTypeModifier.ExclusiveOpen) && fmd.OtherOpen > 0) { // Show the error for exclusive open file and continue // without adding file to list of files to checkout P4ErrorDlg.Show(Resources.P4VsProvider_ExclusiveOpenError, false, false); continue; } if ((fmd == null) || (fmd.HeadAction == P4.FileAction.Delete)) { sel.RemoveAt(idx--); continue; } if (fmd.OtherLock) { lockedFiles.Add(fmd.LocalPath.Path); string otherlocks = string.Empty; foreach (string otherLock in fmd.OtherLockUserClients) { if (string.IsNullOrEmpty(otherlocks) == false) { otherlocks += ","; } otherlocks += otherLock; } lockUsers.Add(otherlocks); } if (fmd.IsStale) { staleFiles.Add(fmd.LocalPath.Path); } } else { IList <P4.FileMetaData> fmdList = SccService.ScmProvider.GetFileMetaData(null, file); foreach (P4.FileMetaData fmd in fmdList) { if (fmd.OtherLock) { lockedFiles.Add(fmd.LocalPath.Path); string otherlocks = string.Empty; foreach (string otherLock in fmd.OtherLockUserClients) { if (string.IsNullOrEmpty(otherlocks) == false) { otherlocks += ","; } otherlocks += otherLock; } lockUsers.Add(otherlocks); } if (fmd.IsStale) { staleFiles.Add(fmd.LocalPath.Path); } } } checkoutFiles.Add(file); } if ((lockedFiles != null) && (lockedFiles.Count > 0)) { string lockWarning = Resources.WarningStyle_Locked_Prompt; if (FileListWarningDlg.Show(lockedFiles, lockUsers, FileListWarningDlg.WarningStyle.Locked) == DialogResult.Cancel) { return; } } if ((staleFiles != null) && (staleFiles.Count > 0)) { DialogResult answer = FileListWarningDlg.Show(staleFiles, null, FileListWarningDlg.WarningStyle.GetLatest); if (answer == DialogResult.Cancel) { return; } if (answer == DialogResult.OK) { if (!SccService.SyncFiles(null, staleFiles)) { return; } } } if (checkoutFiles.Count < 1) { return; } P4.Changelist getDesc = SccService.ScmProvider.GetChangelist(-1); if (getDesc == null) { return; } string newChangeDescription = getDesc.Description; if (newChangeDescription == Resources.DefaultChangeListDescription) { newChangeDescription = Resources.P4VsProvider_CheckoutFilesDefaultChangelistDescription; } IList <P4.Changelist> changes = SccService.ScmProvider.GetAvailibleChangelists(-1); int changeListId = -1; string prompt = Resources.P4VsProvider_CheckoutFilePrompt; if (sel.Count >= 2) { prompt = Resources.P4VsProvider_CheckoutFilesPrompt; } changeListId = SelectChangelistDlg2.ShowChooseChangelistYesNo(prompt, checkoutFiles, changes, ref newChangeDescription); if (changeListId < -1) { // user hit cancel return; } if (string.IsNullOrEmpty(newChangeDescription)) { newChangeDescription = Resources.P4VsProvider_CheckoutFilesDefaultChangelistDescription; } SelectChangelistDlg.CurrentChangeList = SccService.CheckoutFiles(sel, changeListId, newChangeDescription); // now refresh the selected nodes' glyphs Glyphs.RefreshNodesGlyphs(nodes, sel); }