public Driver(DTE dte, SolutionOptions options, BackgroundBuild2 backgroundBuild, DriverUI ui) { _dte = dte; _solution = _dte.Solution; _options = options; _backgroundBuild = backgroundBuild; _ui = ui; _context = SynchronizationContext.Current; }
public BuildOnSave(Package package) { IServiceProvider serviceProvider = package; _dte = serviceProvider.GetService(typeof(DTE)) as DTE; _events = _dte.Events; _documentEvents = _events.DocumentEvents; _buildEvents = _events.BuildEvents; var guid = typeof(VSConstants.VSStd97CmdID).GUID.ToString("B"); _buildSolutionEvent = _dte.Events.CommandEvents[guid, (int)VSConstants.VSStd97CmdID.BuildSln]; var commandService = serviceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; _topMenu = new MenuCommand(delegate { }, new CommandID(CommandSet, TopMenuCommandId)); _menuItem = new MenuCommand(enableDisableBuildOnSave, new CommandID(CommandSet, CommandId)); _disableWhenDebugging = new MenuCommand(enableDisableWhenDebugging, new CommandID(CommandSet, DisableWhenDebuggingCommandId)); _relaunchNewBuildWhenSaved = new MenuCommand(enableRelaunchNewBuildWhenSaved, new CommandID(CommandSet, RelaunchNewBuildWhenSavedCommandId)); _buildTypeSolution = new MenuCommand(setBuildTypeToSolution, new CommandID(CommandSet, BuildTypeSolutionCommandId)); _buildTypeStartupProject = new MenuCommand(setBuildTypeToStartupProject, new CommandID(CommandSet, BuildTypeStartupProjectCommandId)); commandService.AddCommand(_topMenu); commandService.AddCommand(_menuItem); commandService.AddCommand(_disableWhenDebugging); commandService.AddCommand(_relaunchNewBuildWhenSaved); commandService.AddCommand(_buildTypeSolution); commandService.AddCommand(_buildTypeStartupProject); // create the output pane. _outputWindow = _dte.Windows.Item(Constants.vsWindowKindOutput); _outputPane = ((OutputWindow)_outputWindow.Object).OutputWindowPanes.Add("BuildOnSave"); _topMenu.Visible = true; _solutionOptions = DefaultOptions; Log.I("BuildOnSave initialized"); syncOptions(); }
public BuildOnSave(DTE dte, OleMenuCommandService commandService) { _dte = dte; _events = _dte.Events; _documentEvents = _events.DocumentEvents; _buildEvents = _events.BuildEvents; var guid = typeof(VSConstants.VSStd97CmdID).GUID.ToString("B"); _buildSolutionEvent = _dte.Events.CommandEvents[guid, (int)VSConstants.VSStd97CmdID.BuildSln]; _topMenu = new MenuCommand(delegate { }, new CommandID(CommandSet, TopMenuCommandId)); _menuItem = new MenuCommand(enableDisableBuildOnSave, new CommandID(CommandSet, CommandId)); _buildTypeSolution = new MenuCommand(setBuildTypeToSolution, new CommandID(CommandSet, BuildTypeSolutionCommandId)); _buildTypeStartupProject = new MenuCommand(setBuildTypeToStartupProject, new CommandID(CommandSet, BuildTypeStartupProjectCommandId)); commandService.AddCommand(_topMenu); commandService.AddCommand(_menuItem); commandService.AddCommand(_buildTypeSolution); commandService.AddCommand(_buildTypeStartupProject); // create the output pane. _outputWindow = _dte.Windows.Item(Constants.vsWindowKindOutput); _outputPane = ((OutputWindow)_outputWindow.Object).OutputWindowPanes.Add("BuildOnSave"); _topMenu.Visible = true; _solutionOptions = DefaultOptions; Log.I("BuildOnSave initialized"); syncOptions(); }
void connectDriver(SolutionOptions options) { if (_driver_ != null) { return; } var backgroundBuild = new BackgroundBuild2(_dte, _outputPane); var ui = new DriverUI(_dte, _outputWindow, _outputPane); var driver = new Driver(_dte, options, backgroundBuild, ui); _documentEvents.DocumentSaved += driver.onDocumentSaved; _buildEvents.OnBuildBegin += driver.onBuildBegin; _buildEvents.OnBuildDone += driver.onBuildDone; _buildSolutionEvent.BeforeExecute += driver.onBeforeBuildSolutionCommand; _buildSolutionEvent.AfterExecute += driver.onAfterBuildSolutionCommand; _driver_ = driver; Log.D("driver connected"); }
public BuildOnSave(Package package) { IServiceProvider serviceProvider = package; _dte = serviceProvider.GetService(typeof(DTE)) as DTE; _events = _dte.Events; _documentEvents = _events.DocumentEvents; _buildEvents = _events.BuildEvents; var guid = typeof(VSConstants.VSStd97CmdID).GUID.ToString("B"); _buildSolutionEvent = _dte.Events.CommandEvents[guid, (int)VSConstants.VSStd97CmdID.BuildSln]; var commandService = serviceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; _topMenu = new MenuCommand(delegate { }, new CommandID(CommandSet, TopMenuCommandId)); _menuItem = new MenuCommand(enableDisableBuildOnSave, new CommandID(CommandSet, CommandId)); _buildTypeSolution = new MenuCommand(setBuildTypeToSolution, new CommandID(CommandSet, BuildTypeSolutionCommandId)); _buildTypeStartupProject = new MenuCommand(setBuildTypeToStartupProject, new CommandID(CommandSet, BuildTypeStartupProjectCommandId)); _buildTypeProjectsOfSavedFiles = new MenuCommand(setBuildTypeToProjectsOfSavedFiles, new CommandID(CommandSet, BuildTypeProjectsOfSavedFilesCommandId)); _buildTypeAffectedProjectsOfSavedFiles = new MenuCommand(setBuildTypeToAffectedProjectsOfSavedFiels, new CommandID(CommandSet, BuildTypeAffectedProjectsOfSavedFilesCommandId)); commandService.AddCommand(_topMenu); commandService.AddCommand(_menuItem); commandService.AddCommand(_buildTypeSolution); commandService.AddCommand(_buildTypeStartupProject); commandService.AddCommand(_buildTypeProjectsOfSavedFiles); commandService.AddCommand(_buildTypeAffectedProjectsOfSavedFiles); // create the output pane. _outputWindow = _dte.Windows.Item(Constants.vsWindowKindOutput); _outputPane = ((OutputWindow)_outputWindow.Object).OutputWindowPanes.Add("BuildOnSave"); _topMenu.Visible = true; _solutionOptions = DefaultOptions; Log.I("BuildOnSave initialized"); syncOptions(); }
public void solutionClosed() { SolutionOptions = DefaultOptions; _topMenu.Visible = false; }