You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nmaven-commits@incubator.apache.org by si...@apache.org on 2007/05/01 20:24:34 UTC
svn commit: r534229 - in
/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin: ./
src/ src/main/ src/main/csharp/ src/main/csharp/NMaven/
src/main/csharp/NMaven/VisualStudio/
src/main/csharp/NMaven/VisualStudio/Addin/ src/main/resources/
Author: sisbell
Date: Tue May 1 13:24:33 2007
New Revision: 534229
URL: http://svn.apache.org/viewvc?view=rev&rev=534229
Log:
Initial import of the Visual Studio Addin.
Added:
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/pom.xml (with props)
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/Connect.cs
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/resources/
incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/resources/IDEAddin.AddIn (with props)
Added: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/pom.xml?view=auto&rev=534229
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/pom.xml (added)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/pom.xml Tue May 1 13:24:33 2007
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <parent>
+ <groupId>NMaven</groupId>
+ <version>0.14</version>
+ <artifactId>NMaven.Assemblies</artifactId>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>NMaven.VisualStudio</groupId>
+ <artifactId>NMaven.VisualStudio.Addin</artifactId>
+ <packaging>library</packaging>
+ <version>0.14</version>
+ <name>NMaven.VisualStudio</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>NMaven.IDE</groupId>
+ <artifactId>NMaven.IDE</artifactId>
+ <version>0.14</version>
+ <type>library</type>
+ </dependency>
+ <dependency>
+ <groupId>NMaven.Plugin</groupId>
+ <artifactId>NMaven.Plugin</artifactId>
+ <version>0.14</version>
+ <type>library</type>
+ </dependency>
+ <dependency>
+ <groupId>NMaven.Logging</groupId>
+ <artifactId>NMaven.Logging</artifactId>
+ <version>0.14</version>
+ <type>library</type>
+ </dependency>
+ <dependency>
+ <groupId>NMaven.VisualStudio</groupId>
+ <artifactId>NMaven.VisualStudio</artifactId>
+ <version>0.14</version>
+ <type>library</type>
+ </dependency>
+ <dependency>
+ <groupId>Microsoft.VisualStudio.CommandBars</groupId>
+ <artifactId>Microsoft.VisualStudio.CommandBars</artifactId>
+ <version>8.0.0.0__b03f5f7f11d50a3a</version>
+ <type>gac</type>
+ </dependency>
+ <dependency>
+ <groupId>EnvDTE</groupId>
+ <artifactId>EnvDTE</artifactId>
+ <type>gac</type>
+ <version>8.0.0.0__b03f5f7f11d50a3a</version>
+ </dependency>
+ <dependency>
+ <groupId>EnvDTE80</groupId>
+ <artifactId>EnvDTE80</artifactId>
+ <type>gac</type>
+ <version>8.0.0.0__b03f5f7f11d50a3a</version>
+ </dependency>
+ <dependency>
+ <groupId>Extensibility</groupId>
+ <artifactId>Extensibility</artifactId>
+ <type>gac</type>
+ <version>7.0.3300.0__b03f5f7f11d50a3a</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Propchange: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/Connect.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/Connect.cs?view=auto&rev=534229
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/Connect.cs (added)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/Connect.cs Tue May 1 13:24:33 2007
@@ -0,0 +1,208 @@
+using Extensibility;
+using EnvDTE;
+using EnvDTE80;
+
+using System;
+using System.Resources;
+using System.Reflection;
+using System.Globalization;
+using System.Drawing;
+
+using Microsoft.VisualStudio.CommandBars;
+
+using NMaven.IDE;
+using NMaven.IDE.Controls;
+using NMaven.IDE.Commands;
+using NMaven.IDE.Impl;
+using NMaven.IDE.View;
+using NMaven.Logging;
+using NMaven.VisualStudio.Logging;
+
+namespace NMaven.VisualStudio.Addin
+{
+ /// <summary>The object for implementing an Add-in.</summary>
+ /// <seealso class='IDTExtensibility2' />
+ public class Connect : IDTExtensibility2, IDTCommandTarget
+ {
+ private Window _windowToolWindow;
+
+ private OutputWindowPane outputWindowPane;
+
+ private Logger logger;
+
+ /// <summary>Implements the constructor for the Add-in object. Place your initialization code within this method.</summary>
+ public Connect()
+ {
+ }
+
+ /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
+ /// <param term='application'>Root object of the host application.</param>
+ /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
+ /// <param term='addInInst'>Object representing this Add-in.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
+ {
+ _applicationObject = (DTE2)application;
+ _addInInstance = (AddIn)addInInst;
+ if (connectMode == ext_ConnectMode.ext_cm_UISetup)
+ {
+ object[] contextGUIDS = new object[] { };
+ Commands2 commands = (Commands2)_applicationObject.Commands;
+ string toolsMenuName;
+
+ try
+ {
+ //If you would like to move the command to a different menu, change the word "Tools" to the
+ // English version of the menu. This code will take the culture, append on the name of the menu
+ // then add the command to that menu. You can find a list of all the top-level menus in the file
+ // CommandBar.resx.
+ ResourceManager resourceManager = new ResourceManager("IDEAddin.CommandBar", Assembly.GetExecutingAssembly());
+ CultureInfo cultureInfo = new System.Globalization.CultureInfo(_applicationObject.LocaleID);
+ string resourceName = String.Concat(cultureInfo.TwoLetterISOLanguageName, "Tools");
+ toolsMenuName = resourceManager.GetString(resourceName);
+ }
+ catch
+ {
+ //We tried to find a localized version of the word Tools, but one was not found.
+ // Default to the en-US word, which may work for the current culture.
+ toolsMenuName = "Tools";
+ }
+
+ //Place the command on the tools menu.
+ //Find the MenuBar command bar, which is the top-level command bar holding all the main menu items:
+ Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars)["MenuBar"];
+
+ //Find the Tools command bar on the MenuBar command bar:
+ CommandBarControl toolsControl = menuBarCommandBar.Controls[toolsMenuName];
+ CommandBarPopup toolsPopup = (CommandBarPopup)toolsControl;
+
+ //This try/catch block can be duplicated if you wish to add multiple commands to be handled by your Add-in,
+ // just make sure you also update the QueryStatus/Exec method to include the new command names.
+ try
+ {
+ //Add a command to the Commands collection:
+ Command command = commands.AddNamedCommand2(_addInInstance, "IDEAddin", "IDEAddin", "Executes the command for IDEAddin", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
+
+ //Add a control for the command to the tools menu:
+ if ((command != null) && (toolsPopup != null))
+ {
+ command.AddControl(toolsPopup.CommandBar, 1);
+ }
+ }
+ catch (System.ArgumentException)
+ {
+ //If we are here, then the exception is probably because a command with that name
+ // already exists. If so there is no need to recreate the command and we can
+ // safely ignore the exception.
+ }
+
+ }
+ else if (connectMode == ext_ConnectMode.ext_cm_AfterStartup)
+ {
+ Window win = _applicationObject.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
+ OutputWindow outputWindow = (OutputWindow)win.Object;
+ outputWindowPane = outputWindow.OutputWindowPanes.Add("NMaven Addin");
+
+ OutputWindowPaneHandler handler = new OutputWindowPaneHandler();
+ handler.SetOutputWindowPaneHandler(outputWindowPane);
+
+ logger = Logger.GetLogger("UC");
+ logger.AddHandler(handler);
+ logger.Log(Level.INFO, "NMaven Addin");
+ MavenBuildControl mavenBuildControl = new MavenBuildControl();
+ object programmableObject = null;
+
+ String guidstr = "{858C3FCD-8B39-4540-A592-F31C1520B174}";
+ EnvDTE80.Windows2 windows2 = (EnvDTE80.Windows2)_applicationObject.Windows;
+ System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(mavenBuildControl.GetType());
+ _windowToolWindow = windows2.CreateToolWindow2(_addInInstance, asm.Location, "NMaven.IDE.Controls.MavenBuildControl", "Maven Build Tool", guidstr, ref programmableObject);
+
+ _windowToolWindow.Visible = true;
+
+ mavenBuildControl = (MavenBuildControl)_windowToolWindow.Object;
+ mavenBuildControl.Init(logger, 9099, new Size(400, 400));
+ mavenBuildControl.ClearOutputWindow += new EventHandler(ClearOutputWindowPane);
+ mavenBuildControl.FocusOutputWindow += new EventHandler(ActivateOutputWindowPane);
+ }
+ }
+
+ private void ClearOutputWindowPane(object sender, EventArgs args)
+ {
+ outputWindowPane.Clear();
+ }
+
+ private void ActivateOutputWindowPane(object sender, EventArgs args)
+ {
+ outputWindowPane.Activate();
+ }
+
+ /// <summary>Implements the OnDisconnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being unloaded.</summary>
+ /// <param term='disconnectMode'>Describes how the Add-in is being unloaded.</param>
+ /// <param term='custom'>Array of parameters that are host application specific.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
+ {
+ }
+
+ /// <summary>Implements the OnAddInsUpdate method of the IDTExtensibility2 interface. Receives notification when the collection of Add-ins has changed.</summary>
+ /// <param term='custom'>Array of parameters that are host application specific.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnAddInsUpdate(ref Array custom)
+ {
+ }
+
+ /// <summary>Implements the OnStartupComplete method of the IDTExtensibility2 interface. Receives notification that the host application has completed loading.</summary>
+ /// <param term='custom'>Array of parameters that are host application specific.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnStartupComplete(ref Array custom)
+ {
+ }
+
+ /// <summary>Implements the OnBeginShutdown method of the IDTExtensibility2 interface. Receives notification that the host application is being unloaded.</summary>
+ /// <param term='custom'>Array of parameters that are host application specific.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnBeginShutdown(ref Array custom)
+ {
+ }
+
+ /// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary>
+ /// <param term='commandName'>The name of the command to determine state for.</param>
+ /// <param term='neededText'>Text that is needed for the command.</param>
+ /// <param term='status'>The state of the command in the user interface.</param>
+ /// <param term='commandText'>Text requested by the neededText parameter.</param>
+ /// <seealso class='Exec' />
+ public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText)
+ {
+ if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
+ {
+ if (commandName == "IDEAddin.Connect.IDEAddin")
+ {
+ status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
+ return;
+ }
+ }
+ }
+
+ /// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary>
+ /// <param term='commandName'>The name of the command to execute.</param>
+ /// <param term='executeOption'>Describes how the command should be run.</param>
+ /// <param term='varIn'>Parameters passed from the caller to the command handler.</param>
+ /// <param term='varOut'>Parameters passed from the command handler to the caller.</param>
+ /// <param term='handled'>Informs the caller if the command was handled or not.</param>
+ /// <seealso class='Exec' />
+ public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
+ {
+ handled = false;
+ if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
+ {
+ //// if(commandName == "IDEAddin.Connect.IDEAddin")
+ //{
+ handled = true;
+
+ }
+ _windowToolWindow.Visible = true;
+ }
+ private DTE2 _applicationObject;
+ private AddIn _addInInstance;
+ }
+}
\ No newline at end of file
Added: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/resources/IDEAddin.AddIn
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/resources/IDEAddin.AddIn?view=auto&rev=534229
==============================================================================
Binary file - no diff available.
Propchange: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.VisualStudio.Addin/src/main/resources/IDEAddin.AddIn
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream