private void AAOpenMergedMI_Click(object sender, EventArgs e) { if ((sourceFile == null) || (!System.IO.File.Exists(sourceFile))) { sourceFile = new TempFile(_selectedItem.ResolveRecord.FromFileSpec); if (Scm.GetFileVersion(sourceFile, _selectedItem.ResolveRecord.FromFileSpec) == null) { sourceFile.Dispose(); sourceFile = null; return; } } if ((baseFile == null) || (!System.IO.File.Exists(baseFile))) { baseFile = new TempFile(_selectedItem.ResolveRecord.BaseFileSpec); if (Scm.GetFileVersion(baseFile, _selectedItem.ResolveRecord.BaseFileSpec) == null) { baseFile = null; return; } } string targetFile = _selectedItem.ResolveRecord.LocalFilePath.Path; if ((mergedFile == null) || (!System.IO.File.Exists(mergedFile))) { string mergedFileName = string.Format("{0}(merged {1}[{2}]){3}", System.IO.Path.GetFileNameWithoutExtension(_selectedItem.ResolveRecord.LocalFilePath.Path), ((P4.VersionRange)_selectedItem.ResolveRecord.FromFileSpec.Version).Upper, _selectedItem.ResolveRecord.BaseFileSpec.Version, System.IO.Path.GetExtension(_selectedItem.ResolveRecord.LocalFilePath.Path)); mergedFile = new TempFile(mergedFileName); if (Scm.MergeLocalFiles(baseFile, sourceFile, targetFile, mergedFile) == false) { MessageBox.Show(Resources.ResolveFileInteractiveControl_CannotCreateMergedFile, Resources.PerforceSCM, MessageBoxButtons.OK); mergedFile.Dispose(); mergedFile = null; return; } } if (Preferences.LocalSettings.GetBool("OpenShelvedFileInEditor", true)) { EnvDTE.DTE dte = P4VsProvider.GetDTE(); dte.ItemOperations.OpenFile(mergedFile, null); } else { ShowFileContentsDlg dlg = new ShowFileContentsDlg(); dlg.TempFile = mergedFile; dlg.Title = string.Format(Resources.ResolveFileInteractiveControl_MergeOfFiles, _selectedItem.ResolveRecord.FromFileSpec.ToString(), _selectedItem.ResolveRecord.LocalFilePath.Path); // Show modeless dlg.Show(); } }
public static DialogResult Show(P4.P4Exception ex, bool showCancel, bool suppressUI) { P4VsProviderService p4vs = (P4VsProviderService)P4VsProvider.Service(typeof(P4VsProviderService)); if ((suppressUI) && (ex.ErrorLevel < P4.ErrorSeverity.E_FATAL)) { return(DialogResult.OK); } if (p4vs.ScmProvider != null && p4vs.ScmProvider.Connection != null) { if (p4vs.ScmProvider.Connection.isLoggedIn() == false) { MessageBox.Show(Resources.P4ErrorDlg_LoggedOutMsg, Resources.P4VS, MessageBoxButtons.OK, MessageBoxIcon.Error); return(DialogResult.Cancel); } } if (ex is P4.P4CommandCanceledException) { // this command was canceled by the user, so no need to show an error. return(DialogResult.OK); } P4ErrorDlg dlg = new P4ErrorDlg(ex, showCancel); return(dlg.ShowDialog()); }
private void AAOpenSourceMI_Click(object sender, EventArgs e) { if ((sourceFile == null) || (!System.IO.File.Exists(sourceFile))) { sourceFile = new TempFile(_selectedItem.ResolveRecord.FromFileSpec); if (Scm.GetFileVersion(sourceFile, _selectedItem.ResolveRecord.FromFileSpec) == null) { sourceFile.Dispose(); sourceFile = null; return; } } if (Preferences.LocalSettings.GetBool("OpenShelvedFileInEditor", true)) { EnvDTE.DTE dte = P4VsProvider.GetDTE(); dte.ItemOperations.OpenFile(sourceFile, null); } else { ShowFileContentsDlg dlg = new ShowFileContentsDlg(); dlg.TempFile = sourceFile; dlg.Title = _selectedItem.ResolveRecord.FromFileSpec.ToString(); // Show modeless dlg.Show(); } }
private void FileListMnu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Name == "FLM_ViewMI") { foreach (ListViewItem it in ShelvedFilesLV.SelectedItems) { P4.ShelvedFile shelvedFile = it.Tag as P4.ShelvedFile; if (shelvedFile != null) { string file = shelvedFile.Path.ToString(); long maxPreviewSize = 1024 * ((long)Preferences.LocalSettings.GetInt("Size_files", 500)); long shelvedSize = _scm.GetShelvedFileSize(_changelistId, file); if (shelvedSize > maxPreviewSize) { string size = P4ObjectTreeListViewItem.PrettyPrintFileSize(shelvedSize); string msg = string.Format(Resources.FileExceedsMaxPreviewSizeWarning, size); if (DialogResult.No == MessageBox.Show(msg, Resources.P4VS, MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { return; } } P4.FileSpec shelvedSpec = new P4.FileSpec(shelvedFile.Path, new P4.ShelvedInChangelistIdVersion(_changelistId)); using (TempFile sourceFile = new TempFile(shelvedSpec)) { if (_scm.GetFileVersion(sourceFile, shelvedSpec) == null) { MessageBox.Show(Resources.UnshelveFileDialog_CannotGetShelvedFileContentsError, Resources.P4VS, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Preferences.LocalSettings.GetBool("OpenShelvedFileInEditor", true)) { EnvDTE.DTE dte = P4VsProvider.GetDTE(); dte.ItemOperations.OpenFile(sourceFile, null); } else { ShowFileContentsDlg dlg = new ShowFileContentsDlg(); dlg.TempFile = sourceFile; dlg.Title = shelvedSpec.ToString(); // Show modeless dlg.Show(); } } } } } }
private void OpenConnectionBtn_Click(object sender, EventArgs e) { P4ScmProvider newConection = new P4ScmProvider(SccService); if (UseEnvConnect) { newConection.Connection.Connect(true, null); } else { // trigger the connection dialog newConection.Connection.Connect(); } // only replace ScmProvider if a connection has been made // through env vars or connection dlg if (newConection.Connected) { SccService.ScmProvider = newConection; } if (SccService.ScmProvider.Connection.Repository != null && !(string.IsNullOrEmpty(SccService.ScmProvider.Connection.Workspace))) { if (SccService.ScmProvider != null) { SccService.ScmProvider.LoadingSolution = !string.IsNullOrEmpty(SccService.LoadingControlledSolutionLocation); } Init(); P4VsProvider.BroadcastNewConnection(SccService.ScmProvider); ConnectionInfo = new ConnectionData(); ConnectionInfo.ServerPort = SccService.ScmProvider.Connection.Port; ConnectionInfo.UserName = SccService.ScmProvider.Connection.User; ConnectionInfo.Workspace = SccService.ScmProvider.Connection.Workspace; P4VsProvider.Instance.currentConnectionDropDownComboChoice = ConnectionInfo.ToString(); string key = "ActiveChangelist_" + SccService.ScmProvider.Connection.Repository.Connection.Server.Address.Uri.Replace(':', '_') + "_" + SccService.ScmProvider.Connection.User + "_" + SccService.ScmProvider.Connection.Workspace; P4VsProvider.Instance.ChangeLists = new ActiveChangeListCombo(SccService); string newActiveChangeListComboChoice = Preferences.LocalSettings.GetString(key, Resources.Changelist_Default); P4VsProvider.Instance.ChangeLists.SetActiveChangeList(newActiveChangeListComboChoice); } else { P4VsProvider.BroadcastNewConnection(null); } }
private void AAOpenTargetMI_Click(object sender, EventArgs e) { if (Preferences.LocalSettings.GetBool("OpenShelvedFileInEditor", true)) { EnvDTE.DTE dte = P4VsProvider.GetDTE(); dte.ItemOperations.OpenFile(_selectedItem.ResolveRecord.LocalFilePath.Path, null); } else { ShowFileContentsDlg dlg = new ShowFileContentsDlg(); dlg.FilePath = _selectedItem.ResolveRecord.LocalFilePath.Path; dlg.Title = _selectedItem.ResolveRecord.FromFileSpec.ToString(); // Show modeless dlg.Show(); } }
protected override void Initialize() { try { // load the local settings Preferences.Initialize(); Preferences.LocalSettings.Load(null); logger.Trace("Entering Initialize() of: {0}", this.ToString()); base.Initialize(); // Proffer the source control service implemented by the provider // The service provider implemented by the package SccService = new P4VsProviderService(this); ((IServiceContainer)this).AddService(typeof(P4VsProviderService), SccService, true); // Initilise Glyphs IVsHierarchy solHier = (IVsHierarchy)GetService(typeof(SVsSolution)); Glyphs = new NodeGlyphs(SccService, solHier); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (mcs != null) { // View Menu commands #region View Menu commands // Workspaces ToolWindow Command CommandID cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewWorkspaceToolWindow); MenuCommand menuCmd = new MenuCommand(new EventHandler(P4VsViewWorkspaceToolWindow), cmd); mcs.AddCommand(menuCmd); // History ToolWindow cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewHistoryToolWindow); menuCmd = new MenuCommand(new EventHandler(P4VsViewHistoryToolWindow), cmd); mcs.AddCommand(menuCmd); // Jobs ToolWindow cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewJobsToolWindow); menuCmd = new MenuCommand(new EventHandler(P4VsViewJobsToolWindow), cmd); mcs.AddCommand(menuCmd); // P4 ToolWindow //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewP4ToolWindow); //menuCmd = new MenuCommand(new EventHandler(P4VsViewP4ToolWindow), cmd); //mcs.AddCommand(menuCmd); // SubmittedChangelists ToolWindow cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewSubmittedChangelistsToolWindow); menuCmd = new MenuCommand(new EventHandler(P4VsViewSubmittedChangelistsToolWindow), cmd); mcs.AddCommand(menuCmd); // PendingChangelists ToolWindow cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewPendingChangelistsToolWindow); menuCmd = new MenuCommand(new EventHandler(P4VsViewPendingChangelistsToolWindow), cmd); mcs.AddCommand(menuCmd); // Labels ToolWindow cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewLabelsToolWindow); menuCmd = new MenuCommand(new EventHandler(P4VsViewLabelsToolWindow), cmd); mcs.AddCommand(menuCmd); // Swarm ToolWindow //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewSwarmToolWindow); //menuCmd = new MenuCommand(new EventHandler(P4VsViewSwarmToolWindow), cmd); //mcs.AddCommand(menuCmd); // Streams ToolWindow cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewStreamsToolWindow); menuCmd = new MenuCommand(new EventHandler(P4VsViewStreamsToolWindow), cmd); mcs.AddCommand(menuCmd); // Reviews ToolWindow //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewReviewsToolWindow); //menuCmd = new MenuCommand(new EventHandler(P4VsViewReviewsToolWindow), cmd); //mcs.AddCommand(menuCmd); #endregion // Help Menu commands #region Help Menu commands // Help/P4VS Help cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdP4VSHelp); menuCmd = new MenuCommand(new EventHandler(P4VsP4VSHelp), cmd); mcs.AddCommand(menuCmd); // Help/P4VS SystemInfo cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdP4VSSystemInfo); menuCmd = new MenuCommand(new EventHandler(P4VsP4VSSystemInfo), cmd); mcs.AddCommand(menuCmd); #endregion // File Menu commands #region File Menu commands // File/Open Solution in Perforce Depot cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdFileOpenInDepot); menuCmd = new MenuCommand(new EventHandler(P4VsFileOpenInDepot), cmd); mcs.AddCommand(menuCmd); // File/Open Connection to a Perforce Depot cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdOpenConnection); menuCmd = new MenuCommand(new EventHandler(P4VsOpenConnection), cmd); mcs.AddCommand(menuCmd); // File/Close Connection to the Perforce Depot cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCloseConnection); menuCmd = new MenuCommand(new EventHandler(P4VsCloseConnection), cmd); mcs.AddCommand(menuCmd); // Workspaces ToolWindow's ToolBar Command //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdToolWindowToolbarCommand); //menuCmd = new MenuCommand(new EventHandler(P4VsWorkspaceToolWindowToolbarCommand), cmd); //mcs.AddCommand(menuCmd); #endregion // Source control menu commands #region File Menu commands cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdScmRefresh); menuCmd = new MenuCommand(new EventHandler(P4VsScmRefresh), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdAddToSourceControl); menuCmd = new MenuCommand(new EventHandler(P4VsAddToSourceControl), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckin); menuCmd = new MenuCommand(new EventHandler(P4VsCheckin), cmd); mcs.AddCommand(menuCmd); //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckout); //menuCmd = new MenuCommand(new EventHandler(P4VsCheckout), cmd); //mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckout); menuCmd = new OleMenuCommand(new EventHandler(P4VsCheckout), cmd); //queryStatusMenuCommand.BeforeQueryStatus +=new EventHandler(OnBeforeQueryStatus); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckoutProject); menuCmd = new MenuCommand(new EventHandler(P4VsCheckoutEntireProjectOrSolution), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckoutSolution); menuCmd = new MenuCommand(new EventHandler(P4VsCheckoutEntireProjectOrSolution), cmd); mcs.AddCommand(menuCmd); //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdUseSccOffline); //menuCmd = new MenuCommand(new EventHandler(P4VsUseSccOffline), cmd); //mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdReconcile); menuCmd = new MenuCommand(new EventHandler(P4VsReconcileFiles), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdRevert); menuCmd = new MenuCommand(new EventHandler(P4VsRevert), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdRevertUnchanged); menuCmd = new MenuCommand(new EventHandler(P4VsRevertUnchanged), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdLock); menuCmd = new MenuCommand(new EventHandler(P4VsLock), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdUnlock); menuCmd = new MenuCommand(new EventHandler(P4VsUnlock), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdChangeFileType); menuCmd = new MenuCommand(new EventHandler(P4VsChangeFileType), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdMoveToChangelist); menuCmd = new MenuCommand(new EventHandler(P4VsMoveToChangelist), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdAddToIgnoreList); menuCmd = new MenuCommand(new EventHandler(P4VsAddToIgnoreList), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdRemoveFromIgnoreList); menuCmd = new MenuCommand(new EventHandler(P4VsRemoveFromIgnoreList), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdEditIgnoreList); menuCmd = new MenuCommand(new EventHandler(P4VsEditIgnoreList), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdResolve); menuCmd = new MenuCommand(new EventHandler(P4VsResolve), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdSync); menuCmd = new MenuCommand(new EventHandler(P4VsSync), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdSyncHead); menuCmd = new MenuCommand(new EventHandler(P4VsSyncHead), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdDiffVsHave); menuCmd = new MenuCommand(new EventHandler(P4VsDiffVsHave), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdDiffVsAny); menuCmd = new MenuCommand(new EventHandler(P4VsDiffVsAny), cmd); mcs.AddCommand(menuCmd); //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdAddProjectToSCC); //menuCmd = new MenuCommand(new EventHandler(P4VsAddProjectToSCC), cmd); //mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdShowHistory); menuCmd = new MenuCommand(new EventHandler(P4VsShowHistory), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdShelve); menuCmd = new MenuCommand(new EventHandler(P4VsShelve), cmd); mcs.AddCommand(menuCmd); //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdScmAttributes); //menuCmd = new MenuCommand(new EventHandler(P4VsScmAttributes), cmd); //mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdScmMerge); menuCmd = new MenuCommand(new EventHandler(P4VsScmMerge), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdScmCopy); menuCmd = new MenuCommand(new EventHandler(P4VsScmCopy), cmd); mcs.AddCommand(menuCmd); #endregion // P4V commands #region P4V Menu commands cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdP4V); menuCmd = new MenuCommand(new EventHandler(P4VsP4V), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdTimeLapse); menuCmd = new MenuCommand(new EventHandler(P4VsTimeLapse), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdRevGraph); menuCmd = new MenuCommand(new EventHandler(P4VsRevGraph), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdStreamGraph); menuCmd = new MenuCommand(new EventHandler(P4VsStreamGraph), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.cmdidCancelActiveCommand); menuCmd = new MenuCommand(new EventHandler(Exec_CancelActiveCommand), cmd); mcs.AddCommand(menuCmd); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.cmdidCurrentStream); menuCmd = new MenuCommand(new EventHandler(Exec_CurrentStream), cmd); mcs.AddCommand(menuCmd); #endregion // Status Bar commands #region Status Bar commands // Add to Source Control/Publish cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdPublish); menuCmd = new MenuCommand(new EventHandler(P4VsScmPublish), cmd); mcs.AddCommand(menuCmd); #endregion // DropDownCombo // a DROPDOWNCOMBO does not let the user type into the combo box; they can only pick from the list. // The string value of the element selected is returned. // For example, this type of combo could be used for the "Solution Configurations" on the "Standard" toolbar. // // A DropDownCombo box requires two commands: // One command (cmdidMyCombo) is used to ask for the current value of the combo box and to // set the new value when the user makes a choice in the combo box. // // The second command (cmdidMyComboGetList) is used to retrieve this list of choices for the combo box. // // Normally IOleCommandTarget::QueryStatus is used to determine the state of a command, e.g. // enable vs. disable, shown vs. hidden, etc. The QueryStatus method does not have any way to // control the statue of a combo box, e.g. what list of items should be shown and what is the // current value. In order to communicate this information actually IOleCommandTarget::Exec // is used with a non-NULL varOut parameter. You can think of these Exec calls as extended // QueryStatus calls. There are two pieces of information needed for a combo, thus it takes // two commands to retrieve this information. The main command id for the command is used to // retrieve the current value and the second command is used to retrieve the full list of // choices to be displayed as an array of strings. cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, (int)CommandId.cmdidConnectionDropDownCombo); omcConnectionComboSelChanged = new OleMenuCommand(new EventHandler(P4VsConnectionDropDownCombo), cmd); omcConnectionComboSelChanged.ParametersDescription = "$"; // accept any argument string mcs.AddCommand(omcConnectionComboSelChanged); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, (int)CommandId.cmdidConnectionDropDownComboGetList); omcConnectionComboGetList = new OleMenuCommand(new EventHandler(P4VsConnectionDropDownComboGetList), cmd); mcs.AddCommand(omcConnectionComboGetList); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, (int)CommandId.cmdidActiveChangelistDropDownCombo); omcActiveChangelistComboSelChanged = new OleMenuCommand(new EventHandler(P4VsActiveChangelistDropDownCombo), cmd); omcActiveChangelistComboSelChanged.ParametersDescription = "$"; // accept any argument string mcs.AddCommand(omcActiveChangelistComboSelChanged); cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, (int)CommandId.cmdidActiveChangelistDropDownComboGetList); omcActiveChangelistComboGetList = new OleMenuCommand(new EventHandler(P4VsActiveChangelistDropDownComboGetList), cmd); mcs.AddCommand(omcActiveChangelistComboGetList); } // -- Set an eventlistener for shell property changes var shellService = GetService(typeof(SVsShell)) as IVsShell; if (shellService != null) { ErrorHandler.ThrowOnFailure(shellService.AdviseShellPropertyChanges(this, out _EventSinkCookie)); } // Register the provider with the source control manager // If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider)); rscp.RegisterSourceControlProvider(GuidList.guidP4VsProvider); instance = this; } catch (Exception ex) { logger.Error(ex, "Initialize failed"); logger.Error("Error: {0}", ex.Message); logger.Error("Stacktrace: {0}", ex.StackTrace); } }
//[Import] //System.IServiceProvider ServiceManager = null; public IVsWindowFrame FindSolutionExplorerFrame() { IVsUIShell uiShell = (IVsUIShell)P4VsProvider.Service(typeof(SVsUIShell)); return(FindSolutionExplorerFrame(uiShell)); }