private void BackgroundThreadInitialization() { Dte = (DTE)GetService(typeof(DTE)); _projectItemsEvents = (Dte.Events as Events2).ProjectItemsEvents; _projectItemsEvents.ItemAdded += ProjectItemsEvents_ItemAdded; _projectItemsEvents.ItemRenamed += ProjectItemsEvents_ItemRenamed; _projectItemsEvents.ItemRemoved += ProjectItemsEvents_ItemRemoved; FileHelper.Dte = (DTE2)GetService(typeof(SDTE)); CommandHelper.Dte = Dte; OptionsHelper.Dte = Dte; _tortoiseProc = FileHelper.GetTortoiseSvnProc(); // Add our command handlers for menu (commands must exist in the .vsct file) _mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; TSVNToolWindowCommand.Initialize(this); }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(Package package) { Instance = new TSVNToolWindowCommand(package); }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(Package package) { Instance = new TSVNToolWindowCommand(package); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); Dte = (DTE)GetService(typeof(DTE)); FileHelper.Dte = Dte; CommandHelper.Dte = Dte; _tortoiseProc = FileHelper.GetTortoiseSvnProc(); LogHelper.Initialize(this, "TSVN"); // Add our command handlers for menu (commands must exist in the .vsct file) var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null == mcs) { return; } mcs.AddCommand(CreateCommand(ShowChangesCommand, PkgCmdIdList.ShowChangesCommand)); mcs.AddCommand(CreateCommand(UpdateCommand, PkgCmdIdList.UpdateCommand)); mcs.AddCommand(CreateCommand(UpdateToRevisionCommand, PkgCmdIdList.UpdateToRevisionCommand)); mcs.AddCommand(CreateCommand(CommitCommand, PkgCmdIdList.CommitCommand)); mcs.AddCommand(CreateCommand(ShowLogCommand, PkgCmdIdList.ShowLogCommand)); mcs.AddCommand(CreateCommand(CreatePatchCommand, PkgCmdIdList.CreatePatchCommand)); mcs.AddCommand(CreateCommand(ApplyPatchCommand, PkgCmdIdList.ApplyPatchCommand)); mcs.AddCommand(CreateCommand(RevertCommand, PkgCmdIdList.RevertCommand)); mcs.AddCommand(CreateCommand(DiskBrowserCommand, PkgCmdIdList.DiskBrowser)); mcs.AddCommand(CreateCommand(RepoBrowserCommand, PkgCmdIdList.RepoBrowser)); mcs.AddCommand(CreateCommand(BranchCommand, PkgCmdIdList.BranchCommand)); mcs.AddCommand(CreateCommand(SwitchCommand, PkgCmdIdList.SwitchCommand)); mcs.AddCommand(CreateCommand(MergeCommand, PkgCmdIdList.MergeCommand)); mcs.AddCommand(CreateCommand(DifferencesCommand, PkgCmdIdList.DifferencesCommand)); mcs.AddCommand(CreateCommand(BlameCommand, PkgCmdIdList.BlameCommand)); mcs.AddCommand(CreateCommand(ShowLogFileCommand, PkgCmdIdList.ShowLogFileCommand)); mcs.AddCommand(CreateCommand(CleanupCommand, PkgCmdIdList.CleanupCommand)); mcs.AddCommand(CreateCommand(DiskBrowserFileCommand, PkgCmdIdList.DiskBrowserFileCommand)); mcs.AddCommand(CreateCommand(RepoBrowserFileCommand, PkgCmdIdList.RepoBrowserFileCommand)); mcs.AddCommand(CreateCommand(MergeFileCommand, PkgCmdIdList.MergeFileCommand)); mcs.AddCommand(CreateCommand(UpdateToRevisionFileCommand, PkgCmdIdList.UpdateToRevisionFileCommand)); mcs.AddCommand(CreateCommand(PropertiesCommand, PkgCmdIdList.PropertiesCommand)); mcs.AddCommand(CreateCommand(UpdateFileCommand, PkgCmdIdList.UpdateFileCommand)); mcs.AddCommand(CreateCommand(CommitFileCommand, PkgCmdIdList.CommitFileCommand)); mcs.AddCommand(CreateCommand(DiffPreviousCommand, PkgCmdIdList.DiffPreviousCommand)); mcs.AddCommand(CreateCommand(RevertFileCommand, PkgCmdIdList.RevertFileCommand)); mcs.AddCommand(CreateCommand(AddFileCommand, PkgCmdIdList.AddFileCommand)); var tsvnMenu = CreateCommand(null, PkgCmdIdList.TSvnMenu); var tsvnContextMenu = CreateCommand(null, PkgCmdIdList.TSvnContextMenu); switch (Dte.Version) { case "11.0": case "12.0": tsvnMenu.Text = "TSVN"; tsvnContextMenu.Text = "TSVN"; break; default: tsvnMenu.Text = "Tsvn"; tsvnContextMenu.Text = "Tsvn"; break; } mcs.AddCommand(tsvnMenu); mcs.AddCommand(tsvnContextMenu); TSVNToolWindowCommand.Initialize(this); }