internal static Window CreateToolWindow(string toolWindowClass, string caption, string guidpos) { Window found = GetWindow(caption); if (found != null) { found.Activate(); LoadDataForAppropriateClass(found); return(found); } string assemblypath = Assembly.GetExecutingAssembly().CodeBase.Remove(0, 8); object ctlobj = null; Windows2 wins2obj = (Windows2)ApplicationObject.Windows; Window window = wins2obj.CreateToolWindow2( FindAddin(ApplicationObject.AddIns), assemblypath, toolWindowClass, caption, guidpos, ref ctlobj); _omnWindows.Add(window); return(window); }
public override void Execute(VsCommandEventArgs e) { if (toolWindow != null) { toolWindow.Visible = true; return; } try { object programmableObject = null; DTE2 application = e.Application; AddIn addInInstance = e.Addin; Windows2 windows2 = (Windows2)application.Windows; Type userCtrlType = typeof(SettingsControl); Assembly userCtrlAssembly = userCtrlType.Assembly; string windowGuid = "{858C3FCD-3333-4540-A592-F31C1520B174}"; toolWindow = windows2.CreateToolWindow2(addInInstance, userCtrlAssembly.Location, userCtrlType.FullName, "CSql Settings", windowGuid, ref programmableObject); Type resourcesType = typeof(Resources); string imageResourceRoot = resourcesType.FullName; string imageResourcePath = imageResourceRoot + ".Images.Commands.Settings.bmp"; var icon = new VsCommandIcon(userCtrlAssembly, imageResourcePath); var iconPicture = icon.IconPicture; toolWindow.SetTabPicture(iconPicture); SettingsControl settingsControl = (SettingsControl)toolWindow.Object; settingsControl.SetApplication(application); toolWindow.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "csql addin error"); } }
private void CreateToolWindow() { object tempControl = null; Windows2 applicationWindow = (Windows2)_applicationObject.Windows; if (_toolWindow == null) { _toolWindow = applicationWindow.CreateToolWindow2(_addInInstance, GetType().Assembly.Location, typeof(MainToolWindow).FullName, WINDOW_TITLE, TOOL_WINDOW_GUID, ref tempControl); if ((_toolWindowControl = tempControl as MainToolWindow) != null) { _toolWindowControl.Application = _applicationObject; _toolWindowControl.Visible = _toolWindow.Visible = true; } else { throw new Exception(TOOL_WINDOW_CREATION_FAILURE); } } else { ShowToolWindow(); } LaunchExternalWPFWindow(); }
/// <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) { DTE2 dte = ServiceCache.ExtensibilityModel.DTE as DTE2; if (commandName == "MyAddin1.Connect.MyAddin1") { Document activeDocument = null; IScriptFactory scriptFactory = ServiceCache.ScriptFactory; if (scriptFactory != null) { scriptFactory.CreateNewBlankScript(ScriptType.Sql); activeDocument = dte.ActiveDocument; } if (activeDocument != null) { TextSelection ts = activeDocument.Selection as TextSelection; ts.Insert("This Query Window was created with our TestAddin.", (int)vsInsertFlags.vsInsertFlagsInsertAtStart); } handled = true; } if (commandName == "MyAddin1.Connect.MyAddin1ToolWindowForm") { Windows2 MyWindow = (Windows2)dte.Windows; Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); object MyControl = null; Window toolWindow = MyWindow.CreateToolWindow2(_addInInstance, asm.Location, "MyAddin1.MyAddinWindow", "MyAddin1.MyAddin1ToolWindowForm", "{5B7F8C1C-65B9-2aca-1Ac3-12AcBbAF21d5}", MyControl); toolWindow.Visible = true; handled = true; /*Assembly a = Assembly.GetExecutingAssembly(); * object controlObject = null; * * Windows2 toolWindows = dte.Windows as Windows2; * Window2 toolWindow; * * * toolWindow = (Window2)toolWindows.CreateToolWindow2(_addInInstance,a.Location, "MyAddin1.MyAddin1ToolWindowForm ", "", Guid.NewGuid().ToString(), ref controlObject); * * toolWindow.WindowState = vsWindowState.vsWindowStateNormal; * toolWindow.IsFloating = false; * toolWindow.Visible = true; * * handled = true;*/ } else { String s = varIn.ToString(); string s2 = varOut.ToString(); } } }
public static void SetVisible(Window win, bool v) { try { if (chDTE.Version == "9.0") { Windows2 windows2 = (Windows2)Common.chDTE.Windows; Window w2 = Common.chDTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput).LinkedWindowFrame; frame = (Window2)windows2.CreateLinkedWindowFrame(win, w2, vsLinkedWindowType.vsLinkedWindowTypeTabbed); Common.chDTE.MainWindow.LinkedWindows.Add(frame); frame.SetKind(EnvDTE.vsWindowType.vsWindowTypeToolWindow); if (frame != null) { frame.Activate(); } } else if (chDTE.Version == "8.0") { //frame = (Window2)w2 ; } } catch (Exception) { } win.Visible = v; Control ctl = win.Object as Control; if (ctl != null) { ctl.Visible = true; } }
public IToolWindowContext CreateToolWindow(string assemblyLocation, string typeName, string Caption, Guid uiTypeGuid) { Windows2 win2 = _applicationObject.Windows as Windows2; if (win2 != null) { object controlObject = null; Window toolWindow = win2.CreateToolWindow2(_addInInstance, assemblyLocation, typeName, Caption, "{" + uiTypeGuid.ToString() + "}", ref controlObject); Window2 toolWindow2 = (Window2)toolWindow; toolWindow.Linkable = false; //toolWindow.IsFloating = true; try { toolWindow.WindowState = vsWindowState.vsWindowStateMaximize; } catch { } toolWindow.Visible = true; return(new ToolWindowContext(toolWindow, toolWindow2, controlObject)); } return(null); }
private void CreateExplorerWindow() { if (_explorerWindow != null) { _explorerWindow.Activate(); } else { Windows2 windows2 = (Windows2)_applicationObject.Windows; Assembly asm = Assembly.GetExecutingAssembly(); object customControl = null; string className = "TracExplorer.Common.TracExplorerControl"; string caption = "Trac Explorer"; string asmLocation = asm.Location; asmLocation = asmLocation.Replace("VSTrac.dll", "Common.dll"); _explorerWindow = windows2.CreateToolWindow2(_addInInstance, asmLocation, className, caption, _explorerWindowGuid, ref customControl); Image customToolWindowTabImage = GetCustomToolWindowTabImage(); _explorerWindow.SetTabPicture(Support.ImageToIPicture(customToolWindowTabImage)); if (customControl != null) { ((TracExplorerControl)customControl).TracConnect = this; } _explorerWindow.Visible = true; } }
public Window2 ShowWindow <T>(AddIn addIn, string title, bool isFloating = true, int width = 450, int height = 450) where T : UserControl { Windows2 toolWindows = _dte.Windows as Windows2; if (toolWindows != null) { var assembly = Assembly.GetExecutingAssembly(); var location = assembly.Location; var type = typeof(T); object controlObject = null; var toolWindow = (Window2)toolWindows.CreateToolWindow2(addIn, location, type.FullName, title, Guid.NewGuid().ToString(), ref controlObject); var dataService = new PresentationDataService(); var presenter = new SqlTodoExplorerPresenter((ISqlTodoExplorerView)controlObject, dataService); presenter.Init(); toolWindow.WindowState = vsWindowState.vsWindowStateNormal; toolWindow.IsFloating = isFloating; toolWindow.Width = width; toolWindow.Height = height; toolWindow.Visible = true; return(toolWindow); } return(null); }
/// <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) { try { handled = false; if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault) { if (commandName == "AnAppADay.JediVSIRC.Addin.Connect.JediVSIRC") { handled = true; if (_toolWindow == null) { string assembly = this.GetType().Assembly.Location; string userControlClass = typeof(JediVSIRCChatControl).FullName; Windows2 appWin = (Windows2)_applicationObject.Windows; string toolWindowGuid = "{a88cec17-a4f5-48a2-ae4f-c6da9dbe6f13}"; object control = null; _toolWindow = appWin.CreateToolWindow2(_addInInstance, assembly, userControlClass, "AnAppADay.com Jedi Visual Studio IRC", toolWindowGuid, ref control); _toolWindow.AutoHides = false; _toolWindowControl = control as JediVSIRCChatControl; } _toolWindow.Visible = true; return; } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error loading addin: " + ex.Message); } }
private void createJiraWindow() { try { const string guid = "{CB0B2DD2-8849-431d-B92D-E86B97115345}"; object obj = null; Windows2 windows2 = (Windows2)applicationObject.Windows; string loc = Assembly.GetExecutingAssembly().Location; jiraWindow = windows2.CreateToolWindow2(addInInstance, loc, "PaZu.PaZuWindow", "Atlassian", guid, ref obj); // todo: this does not work - need to figure out why. Probably need to load bitmap from a satellite DLL // it is all sort of very stupid, no obvious reason for the failure and the exception (ArgumentException) // does not explain anything //Bitmap bmp = Properties.Resources.ide_plugin_161; //jiraWindow.SetTabPicture(bmp.GetHbitmap()); jiraWindow.Visible = true; } catch (Exception e) { MessageBox.Show("Creation of the Atlassian Connector window failed \n\n" + e); } }
/// <summary> /// Creates the allocation window. /// </summary> /// <returns></returns> public AllocationContainer CreateAllocationWindow() { Guid id = new Guid("{65a48117-79b3-4863-b268-eb7eafc21feb}"); Windows2 windows2 = applicationObject.Windows as Windows2; if (windows2 != null) { object controlObject = null; Assembly asm = Assembly.GetExecutingAssembly(); Window toolWindow = windows2.CreateToolWindow2(this.addInInstance, asm.Location, "InternalsViewer.SSMSAddIn.AllocationContainer", "Internals Viewer", "{" + id.ToString() + "}", ref controlObject); // Make the window a tabbed document toolWindow.Linkable = false; toolWindow.IsFloating = false; toolWindow.Visible = true; return(controlObject as AllocationContainer); } else { return(null); } }
/// <summary> /// Loads the tool window for upgraded task window /// </summary> private void AddToolWindow() { // Load tool window region object programmableObject = null; string guidString = "{9FFC9D9B-1F39-4763-A2AF-66AED06C799E}"; Windows2 windows2 = (Windows2)_applicationObject.Windows; Assembly asm = Assembly.GetExecutingAssembly(); toolWindow = windows2.CreateToolWindow2(_addInInstance, asm.Location, "UpgradedTaskList.TaskListControl", "Upgraded Task List", guidString, ref programmableObject); toolWindow.Visible = true; // Instantiate the TaskListControl WPF object toolWindowControl = (TaskListControl)toolWindow.Object; // Load all task items to the task window toolWindowControl.InitializeViewModel(ref _applicationObject); taskUpdateDelayTimer = new System.Timers.Timer(UPDATE_DELAY); taskUpdateDelayTimer.AutoReset = false; taskUpdateDelayTimer.Elapsed += new ElapsedEventHandler(taskUpdateTimer_Elapsed); solutionOpenedDelayTimer = new System.Timers.Timer(SOLUTION_OPENED_DELAY); solutionOpenedDelayTimer.AutoReset = false; solutionOpenedDelayTimer.Elapsed += new ElapsedEventHandler(solutionOpenedTimer_Elapsed); SetTabNameOnWindow(guidString); }
internal window_manager(SSMS ssms) { _ssms = ssms; _working_query_window = new query_window(); _SSMS_window_collection = (Windows2)_ssms.DTE2.Windows; _addin_window_collection = new System.Collections.Generic.List <Window>(); }
void item_Click(object sender, EventArgs e) { if (Connect.CurrentAddin == null) { return; } if (Connect.CurrentApplication == null) { return; } Connect.CurrentTable = this.Parent.Name; Connect.ConnectionString = Helper.FixConnectionString(this.Parent.Connection.ConnectionString, this.Parent.Connection.ConnectionTimeout); try { if (!Connect.EditTracked) { Connect.EditTracked = true; } Windows2 windows2 = Connect.CurrentApplication.Windows as Windows2; if (windows2 != null) { object controlObject = null; System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); string dbName = System.IO.Path.GetFileNameWithoutExtension(this.Parent.Connection.ServerName); EnvDTE.Window toolWindow = windows2.CreateToolWindow2(Connect.CurrentAddin, asm.Location, "SqlCeScripter.ResultsetGrid", string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} - {1}", dbName, this.Parent.Name), "{" + Guid.NewGuid().ToString() + "}", ref controlObject); if (toolWindow != null) { toolWindow.IsFloating = false; toolWindow.Linkable = false; toolWindow.Visible = true; } } } catch (System.Data.SqlServerCe.SqlCeException sqlCe) { Connect.ShowErrors(sqlCe); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void CreateTicketWindow(ServerDetails serverDetails, TicketQueryDefinition ticketDef, string guid) { Windows2 windows2 = (Windows2)_applicationObject.Windows; Assembly asm = Assembly.GetExecutingAssembly(); object customControl = null; string className = "TracExplorer.Common.TicketView"; string caption = ticketDef.Name; if (guid == null) { // Generate new guid guid = Guid.NewGuid().ToString("B"); } string asmLocation = asm.Location; asmLocation = asmLocation.Replace("VSTrac.dll", "Common.dll"); Window toolWindow = windows2.CreateToolWindow2(_addInInstance, asmLocation, className, caption, guid, ref customControl); Image customToolWindowTabImage = GetCustomToolWindowTabImage(); toolWindow.SetTabPicture(Support.ImageToIPicture(customToolWindowTabImage)); if (customControl != null) { ((TicketView)customControl).TicketQueryUpdate += new TicketView.TicketQueryUpdateEvent(Connect_TicketQueryUpdate); ((TicketView)customControl).TracConnect = this; ((TicketView)customControl).ServerDetails = serverDetails; ((TicketView)customControl).TicketDefinition = ticketDef; ((TicketView)customControl).ParentWindow = toolWindow; ((TicketView)customControl).RunQuery(); } toolWindow.Visible = true; // Add TicketWindow informations to reload window after restart if (_ticketWindowList == null) { _ticketWindowList = new List <TicketWindowDefinition>(); } TicketWindowDefinition definition = new TicketWindowDefinition(); definition.Guid = guid; definition.ServerName = serverDetails.Server; definition.TicketQueryName = ticketDef.Name; definition.ToolWindow = toolWindow; _ticketWindowList.Add(definition); }
private IntPtr CreateVSWindowInternal2(string commandName, ref VSWindowHandle handle, DTE2 applicationObject, AddIn addIn) { string hostAssembly = Assembly.GetCallingAssembly().Location; // +Alphonso (8/14/2014) // // Note: // 'DocumentSite' can only be set once so if we utilize the same // guid for each window creation it in essence is referring to // the same object that has already been created and registered // as a COM Instance. // // The myth is that the COM Guid needs to be the same as the assembly // guid but I believe this is a Microsoft bug. For that reason I'm // commenting out this code and replacing it with a new Guid each time which // mimics having a separate assembly where the COM visible Guid's are different. // // Bug Fix: // 1 Assembly + 1 Control = Single COM+ Guid(); // 1 Assembly + N number of Controls = New COM+ Guids(); //const string hostAssemblyComGuid = "{F494D23E-B31E-45AB-BCA4-28865DFC2E60}"; string hostAssemblyComGuid = Guid.NewGuid().ToString(); object m_managedControl = null; IntPtr m_controlHandle = IntPtr.Zero; // Create the window and then store it in our collection. Windows2 hwndWindows = (Windows2)applicationObject.Windows; Window2 hwndWindowControl = (Window2)hwndWindows.CreateToolWindow2( addIn, hostAssembly, handle.ClassName, handle.VSWindowTitle, hostAssemblyComGuid, ref m_managedControl ); hwndWindowControl.Visible = true; hwndWindowControl.Width = m_stack.Pop(); // width hwndWindowControl.Height = m_stack.Pop(); // height // Grab the managed handle of the control so we can register it // to receive our unmanaged window messages whenever events are raised. // Without this we won't be able to capture specific window events :(. m_controlHandle = ((System.Windows.Forms.Control)m_managedControl).Handle; ((IThemeControl)m_managedControl).SetTheme(); handle.ControlHandle = m_controlHandle; handle.Window = hwndWindowControl; handle.Control = m_managedControl as System.Windows.Forms.Control; return(handle.ControlHandle); }
/// <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 = "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, "XnaLevelEditor", "XnaLevelEditor", "Executes the command for XnaLevelEditor", 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) { windows2 = (Windows2)applicationObject.Windows; userControlType = typeof(MainUserControl); asm = Assembly.GetAssembly(userControlType); mainUserControls = new Dictionary <Window, MainUserControl>(); Events2 events = (Events2)applicationObject.Events; windowVisibilityEvents = events.get_WindowVisibilityEvents(); windowVisibilityEvents.WindowShowing += new _dispWindowVisibilityEvents_WindowShowingEventHandler(windowVisibilityEvents_WindowShowing); windowVisibilityEvents.WindowHiding += new _dispWindowVisibilityEvents_WindowHidingEventHandler(windowVisibilityEvents_WindowHiding); } }
private void CreateToolWindow() { object programmableObject = null; string guidString = "{73000449-0035-43ad-985F-A3071ECBC079}"; Windows2 windows2 = (Windows2)_applicationObject.Windows; Assembly asm = Assembly.GetExecutingAssembly(); m_toolWindow = windows2.CreateToolWindow2(_addInInstance, asm.Location, "vsCCM.ccmControl", "Code Complexity", guidString, ref programmableObject); m_toolWindow.Visible = true; ((ccmControl)m_toolWindow.Object).Initialize(this._applicationObject); }
public static void CreateToolWindow(ref Window win, ref Control ctl, string guid, string classname, string caption) { if (win == null || win.Visible == false) { object programmableObject = null; string guidString = guid;//""; Windows2 windows2 = (Windows2)Common.chDTE.Windows; Assembly asm = Assembly.GetExecutingAssembly(); win = windows2.CreateToolWindow2(Common.chAddIN, asm.Location, classname, caption, guidString, ref programmableObject); win.SetTabPicture(GetTabPicture(Properties.Resources.ToolWindowBmp)); win.Visible = true; ctl = (Control)win.Object; } }
/// <summary> /// Initializes the plug in. /// </summary> private void InitializePlugIn() { object programmableObject = null; String guidstr = "{858C3FCD-8B39-4540-A592-F31C1520B174}"; Windows2 windows2 = (EnvDTE80.Windows2)_visualStudioInstance.Windows; Assembly asm = Assembly.GetExecutingAssembly(); Utils.AssemblyTitle = GetAssemblyTitle(asm); Utils.AssemblyPath = GetAssemblyPath(asm); _windowToolWindow = windows2.CreateToolWindow2(_addInInstance, asm.Location, "ReviewPal.UI.ReviewWindow", "Review List", guidstr, ref programmableObject); _windowToolWindow.Visible = true; ReviewWindow rCommentControl = (ReviewWindow)_windowToolWindow.Object; rCommentControl.VisualStudioInstance = _visualStudioInstance; }
public override void OnExecute(VsCommandEventArgs e) { if (this.ProjectViewToolWindow == null) { object temp = null; Windows2 windows = (Windows2)e.DTE.Windows; this.ProjectViewToolWindow = windows.CreateToolWindow2(e.AddIn, System.Reflection.Assembly.GetExecutingAssembly().Location, "JianLi.UI.ProjectView", "项目任务", "{DD52FE78-3F3A-4c9d-8828-E78FC75B944F}", ref temp); ProjectView projectView = (ProjectView)temp; projectView.DTE = e.DTE; projectView.ParentWindow = this.ProjectViewToolWindow; this.ProjectViewToolWindow.Visible = true; } else { this.ProjectViewToolWindow.Activate(); } }
public override void OnExecute(VsCommandEventArgs e) { if (this.SolutionListViewToolWindow == null) { object temp = null; Windows2 windows = (Windows2)e.DTE.Windows; this.SolutionListViewToolWindow = windows.CreateToolWindow2(e.AddIn, System.Reflection.Assembly.GetExecutingAssembly().Location, "JianLi.UI.SolutionListView", "解决方案列表", "{6882BEB2-80BB-45f9-BF6F-60BC8DC77F25}", ref temp); SolutionListView codeOutlineView = (SolutionListView)temp; codeOutlineView.DTE = e.DTE; codeOutlineView.ParentWindow = this.SolutionListViewToolWindow; this.SolutionListViewToolWindow.Visible = true; } else { this.SolutionListViewToolWindow.Activate(); } }
public override void OnExecute(VsCommandEventArgs e) { if (this.solutionTagToolWindow == null) { object temp = null; Windows2 windows = (Windows2)e.DTE.Windows; this.solutionTagToolWindow = windows.CreateToolWindow2(e.AddIn, System.Reflection.Assembly.GetExecutingAssembly().Location, "JianLi.UI.SolutionTagView", "解决方案标签视图", "{786FD1AF-97BA-4f44-B73C-021FA6E174BC}", ref temp); SolutionTagView codeOutlineView = (SolutionTagView)temp; codeOutlineView.DTE = e.DTE; codeOutlineView.ParentWindow = this.solutionTagToolWindow; this.solutionTagToolWindow.Visible = true; } else { this.solutionTagToolWindow.Activate(); } }
private DataPaneControl GetDataPaneControl() { if (null == _dataPaneControl) { object window = null; var asm = typeof(DataGridControl).Assembly; DTE2 dte2 = Locator.Get <DTE2>(); AddIn addIn = Locator.Get <AddIn>(); Windows2 w = (Windows2)dte2.Windows; if (null == _toolWindow) { try { _toolWindow = w.Item(DataPaneControl.Guid); window = _toolWindow.Object; } catch { } if (null == _toolWindow) { _toolWindow = w.CreateToolWindow2( addIn, asm.Location, typeof(DataPaneControl).FullName, "StudioShell Data Panes", DataPaneControl.Guid, ref window); } if (null == _toolWindow || null == window) { Debug.Assert(false, "unable to locate data pane tool window"); } } _dataPaneControl = (DataPaneControl)window; } return(_dataPaneControl); }
/// <summary> /// Show WindowPane for jiraconn /// </summary> public static void ActivateWindowPane(string assemblyLocation, string progId, string title) { if (toolWindow == null) { Windows2 toolWins = (Windows2)applicationObject.Windows; object objTemp = null; // Create a new tool window, embedding the // LineCounterBrowser control inside it... toolWindow = toolWins.CreateToolWindow2( addInInstance, assemblyLocation, progId, title, guidToolWindow, ref objTemp); toolWindow.Visible = true; } }
////////////////////////////////////////////////////////////////////////// /// <summary> /// Create a view of the addin /// The view should be a UserControl which will be created directly /// embedded within the Window representing the AddIn in VisualStudio. /// the Window container of the Addin on screee, /// </summary> /// <param name="addInApplication"></param> /// <param name="addInInstance"></param> /// <param name="addInView"></param> /// <param name="viewGuid"></param> /// <param name="viewCaption"></param> /// <param name="viewClass"></param> /// <param name="viewIcon"></param> /// <returns></returns> ////////////////////////////////////////////////////////////////////////// public static Window CreateAddinView(DTE2 addInApplication, AddIn addInInstance, ref object addInView, string viewGuid, string viewCaption, Type viewClass, Bitmap viewIcon) { Windows2 dteWindows = (Windows2)addInApplication.Windows; Window addInWindow = dteWindows.CreateToolWindow2(addInInstance, viewClass.Assembly.Location, viewClass.FullName, viewCaption, viewGuid, ref addInView); if (addInWindow != null) { // Set the tab icon if (viewIcon != null) { StdPicture tabPicture = AddInUtils.CreatePicture(viewIcon); addInWindow.SetTabPicture(tabPicture); } addInWindow.Linkable = true; addInWindow.IsFloating = false; addInWindow.Activate(); } return(addInWindow); }
private void createIssueDetailsWindow() { try { const string guid = "{0D8A8CD2-1B6F-4efe-AB9B-B295A59CB76F}"; object obj = null; Windows2 windows2 = (Windows2)applicationObject.Windows; string loc = Assembly.GetExecutingAssembly().Location; Window issuesWindow = windows2.CreateToolWindow2( addInInstance, loc, "PaZu.IssueDetailsWindow", "Issues - JIRA", guid, ref obj); IssueDetailsWindow.Instance.WindowInstance = issuesWindow; issuesWindow.Visible = false; } catch (Exception e) { MessageBox.Show("Creation of the issue details window failed \n\n" + e); } }
/// <summary> /// Creates a page viewer window with a given connection string and page address /// </summary> /// <param name="connectionString">The connection string.</param> /// <param name="pageAddress">The page address.</param> /// <returns></returns> public PageViewerContainer CreatePageViewerWindow(string connectionString, RowIdentifier rowIdentifier) { Guid id = Guid.NewGuid(); Windows2 windows2 = applicationObject.Windows as Windows2; if (windows2 != null) { object controlObject = null; Assembly asm = Assembly.GetExecutingAssembly(); Window toolWindow = windows2.CreateToolWindow2(this.addInInstance, asm.Location, "InternalsViewer.SSMSAddIn.PageViewerContainer", "Page Viewer " + rowIdentifier.PageAddress.ToString(), "{" + id.ToString() + "}", ref controlObject); // Make the window a tabbed document toolWindow.Linkable = false; toolWindow.IsFloating = false; PageViewerContainer pageViewerContainer = (controlObject as PageViewerContainer); pageViewerContainer.Window = toolWindow; pageViewerContainer.WindowManager = this; pageViewerContainer.PageViewerWindow.LoadPage(connectionString, rowIdentifier); toolWindow.Visible = true; pageViewerContainer.PageViewerWindow.SetSlot(rowIdentifier.SlotId); return(pageViewerContainer); } else { return(null); } }
/* * CreateToolWindow */ private Window CreateToolWindow(AddIn addIn, Type toolWindowType, string toolWindowCaption) { Debug.Assert(addIn != null, "addIn != null"); Debug.Assert(toolWindowType != null, "toolWindowType != null"); Window toolWindow = null; object controlObject = null; Windows2 toolWindows = (Windows2)_applicationObject.Windows; toolWindow = toolWindows.CreateToolWindow2( addIn, Assembly.GetExecutingAssembly().Location, toolWindowType.FullName, toolWindowCaption, "{7ED46EA6-8E0D-4116-ABFE-0EEED142BF1E}", ref controlObject ); Debug.Assert(toolWindow != null, "toolWindow != null"); Debug.Assert(controlObject is NuGenTaskListUI, "controlObject is NuGenTaskListUI"); _taskListUI = (NuGenTaskListUI)controlObject; _taskListUI.DTE = _applicationObject; _taskListUI.Load += _TaskListUI_Load; toolWindow.SetTabPicture(Resources.ToolWindow_TaskList.GetHbitmap()); /* It is necessary to set the value of the Visible property to true; otherwise, * exceptions are thrown. */ toolWindow.Visible = true; toolWindow.Width = 250; toolWindow.Height = 200; return(toolWindow); }
/// <summary> /// Creates the allocation window. /// </summary> /// <returns></returns> public DecodeContainer CreateDecodeWindow() { Guid id = new Guid("{fd35b1e4-c1ca-4b63-8be5-0b005a6def4d}"); Windows2 windows2 = applicationObject.Windows as Windows2; if (windows2 != null) { object controlObject = null; Assembly asm = Assembly.GetExecutingAssembly(); Window toolWindow = windows2.CreateToolWindow2(this.addInInstance, asm.Location, "InternalsViewer.SSMSAddIn.DecodeContainer", "Internals Viewer", "{" + id.ToString() + "}", ref controlObject); toolWindow.Visible = true; if (toolWindow.IsFloating) { toolWindow.Width = 376; toolWindow.Height = 135; } toolWindow.Caption = "Decode and Find"; this.decodeContainer = controlObject as DecodeContainer; return(this.decodeContainer); } else { return(null); } }
internal window_manager(SSMS ssms) { _ssms = ssms; _working_query_window = new query_window(); _SSMS_window_collection = (Windows2)_ssms.DTE2.Windows; _addin_window_collection = new System.Collections.Generic.List<Window>(); }
public WindowCollectionNodeFactory(Windows2 windows) { _windows = windows; }