public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { DTE2 dte2 = (DTE2)automationObject; Window win = dte2.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); OutputWindow outputWindow = (OutputWindow)win.Object; outputWindowPane = outputWindow.OutputWindowPanes.Add("Test"); outputWindowPane.OutputString("Start"); CommandBarControl addRef = null; foreach (CommandBar commandBar in (CommandBars)dte2.CommandBars) { outputWindowPane.OutputString("Command Bar = " + commandBar.Name + Environment.NewLine); foreach (CommandBarControl control in commandBar.Controls) { outputWindowPane.OutputString(control.Caption + Environment.NewLine); if (control.Caption.Equals("Add &Reference...")) { addRef = control; CommandBarButton ctl = (CommandBarButton) commandBar.Controls.Add(MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, control.Index, true); ctl.Click += new _CommandBarButtonEvents_ClickEventHandler(cbShowAddArtifactsForm_Click); //new _CommandBarButtonEvents_ClickEventHandler(ShowAddArtifactsForm); //new ClickEventHandler(); ctl.Caption = "Add Maven Artifact..."; ctl.Visible = true; } } } // dte2. += new EventHandler(ClearOutputWindowPane); // Window solutionExplorerWindow // = (Window) dte2.Windows.Item(Constants.vsWindowKindSolutionExplorer); // solutionExplorerWindow // Window w; UIHierarchy u; // UIHierarchyItem i; // dte2.Events. // ; // EnvDTE.s // DirectoryInfo projectDirectoryInfo = new FileInfo(dte2.Solution.Projects.Item(1).FullName).Directory; // dte2.Solution.Projects.Item(1).SaveAs(projectDirectoryInfo.FullName + @"\src\test.csproj"); try { // Display a form to the user. The form collects // input for the custom message. inputForm = new ArchetypeProjectForm(); String projectName = replacementsDictionary["$projectname$"]; inputForm.GroupId = (projectName.Contains(".")) ? projectName.Substring(0, projectName.LastIndexOf(".")) : projectName; inputForm.ArtifactId = projectName; inputForm.Version = "0.0.0.0-SNAPSHOT"; inputForm.ShowDialog(); String projectPath = @"src\main\csharp"; replacementsDictionary.Add("$artifactId$", inputForm.ArtifactId); replacementsDictionary.Add("$groupId$", inputForm.GroupId); replacementsDictionary.Add("$version$", inputForm.Version); replacementsDictionary.Add("$projectPath$", projectPath); replacementsDictionary.Add("$classPath$", projectPath + @"\" + inputForm.ArtifactId.Replace(".", @"\")); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { DTE2 dte2 = (DTE2)automationObject; Window win = dte2.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); OutputWindow outputWindow = (OutputWindow)win.Object; outputWindowPane = outputWindow.OutputWindowPanes.Add("Test"); outputWindowPane.OutputString("Start"); CommandBarControl addRef = null; foreach (CommandBar commandBar in (CommandBars)dte2.CommandBars) { outputWindowPane.OutputString("Command Bar = " + commandBar.Name + Environment.NewLine); foreach(CommandBarControl control in commandBar.Controls) { outputWindowPane.OutputString(control.Caption + Environment.NewLine); if (control.Caption.Equals("Add &Reference...")) { addRef = control; CommandBarButton ctl = (CommandBarButton) commandBar.Controls.Add(MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, control.Index, true); ctl.Click += new _CommandBarButtonEvents_ClickEventHandler(cbShowAddArtifactsForm_Click); //new _CommandBarButtonEvents_ClickEventHandler(ShowAddArtifactsForm); //new ClickEventHandler(); ctl.Caption = "Add Maven Artifact..."; ctl.Visible = true; } } } // dte2. += new EventHandler(ClearOutputWindowPane); // Window solutionExplorerWindow // = (Window) dte2.Windows.Item(Constants.vsWindowKindSolutionExplorer); // solutionExplorerWindow // Window w; UIHierarchy u; // UIHierarchyItem i; // dte2.Events. // ; // EnvDTE.s // DirectoryInfo projectDirectoryInfo = new FileInfo(dte2.Solution.Projects.Item(1).FullName).Directory; // dte2.Solution.Projects.Item(1).SaveAs(projectDirectoryInfo.FullName + @"\src\test.csproj"); try { // Display a form to the user. The form collects // input for the custom message. inputForm = new ArchetypeProjectForm(); String projectName = replacementsDictionary["$projectname$"]; inputForm.GroupId = (projectName.Contains(".")) ? projectName.Substring(0, projectName.LastIndexOf(".")) : projectName; inputForm.ArtifactId = projectName; inputForm.Version = "0.0.0.0-SNAPSHOT"; inputForm.ShowDialog(); String projectPath = @"src\main\csharp"; replacementsDictionary.Add("$artifactId$", inputForm.ArtifactId); replacementsDictionary.Add("$groupId$", inputForm.GroupId); replacementsDictionary.Add("$version$", inputForm.Version); replacementsDictionary.Add("$projectPath$", projectPath); replacementsDictionary.Add("$classPath$", projectPath + @"\" + inputForm.ArtifactId.Replace(".", @"\")); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }