![]() |
|
![]() |
Order | ![]() |
Download | ![]() |
Documentation | ![]() |
Blog* | ![]() |
Support | ![]() |
![]() |
Feature Overview | ![]() |
User Guide | ![]() |
Style | ![]() |
Tab Grouping | ![]() |
Add-ins | ![]() |
Tabs Studio supports custom add-ins that can extend Tabs Studio functionality and interact with the Visual Studio shell. Add-in dlls are loaded from the Add-in installation folder at startup. The Add-in Manager window can be opened using the Tabs Studio context menu or TabsStudio.Connect.Addins command. It displays all loaded add-ins and allows add-in configuration if add-in supports it:
If an add-in is not loaded successfully in VS 2010 check whether it is blocked as downloaded from the Internet.
namespace TabsStudioExt
{
public interface ITabsStudioAddin
{
void OnConnection(ITabsStudioEngine engine, EnvDTE80.DTE2 dte);
void OnDisconnection();
}
}
Only one add-in per dll is allowed. TabsStudioExt interfaces are declared in the TabsStudioExt.dll that is installed along with the TabsStudio.dll. EnvDTE80.DTE2 parameter in the OnConnection method offers access to the Visual Studio extensibility model.
TabsStudioExt.ITabsStudioEngine interface offers Tabs Studio methods and events that add-in can use for Tabs Studio customization (see Tab Studio controls specification for more details):
namespace TabsStudioExt
{
public interface ITabsStudioEngine
{
event TabExtensionCreatedEventHandler TabExtensionCreated;
event TabExtensionDestroyedEventHandler TabExtensionDestroyed;
event TabExtensionRenamedEventHandler TabExtensionRenamed;
event TabCreatedEventHandler TabCreated;
event TabDestroyedEventHandler TabDestroyed;
event TabRenamedEventHandler TabRenamed;
event TabsCreatedEventHandler TabsCreated;
event TabsDestroyedEventHandler TabsDestroyed;
event OpeningTabContextMenuEventHandler OpeningTabContextMenu;
event OpeningTabExtensionContextMenuEventHandler OpeningTabExtensionContextMenu;
System.Collections.Generic.List<Tabs> GetTabs();
EnvDTE.AddIn GetAddIn();
}
}
Using Visual Studio 2008 and C#, start creating an add-in from the C# class library template project. References to EnvDTE and EnvDTE80 are needed to use the DTE2 parameter in the OnConnection method. PresentationCore, PresentationFramework and WindowsBase are needed to work with WPF controls. TabsStudioExt defines all Tabs Studio extensibility interfaces.
To execute custom Visual Studio commands and set commands availability status your main add-in class must implement the EnvDTE.IDTCommandTarget interface (Exec and QueryStatus methods):
public class Navigator : TabsStudioExt.ITabsStudioAddin, EnvDTE.IDTCommandTargetTo support configurability add-in's main class must implement the TabsStudioExt.IConfigurable interface:
public class Tracer : TabsStudioExt.ITabsStudioAddin, TabsStudioExt.IConfigurableAdd-in information for Add-in Manager is extracted from the version resource in the add-in dll file. Add-in name is extracted from the ProductName key, in C# project it is set using the AssemblyProduct attribute. Description is extracted from the FileDescription key defined by the AssemblyTitle attribute. Version is extracted from the ProductVersion key defined by the AssemblyFileVersion attribute.
To change tab title from an add-in use the TitleManager property in TabsStudioExt.Tab and TabsStudioExt.TabExtension classes. An add-in can modify the regex transforms list and call the ApplyTransforms method.
To define custom properties for styling, an add-in can use WPF Attached Properties and implement the TabsStudioExt.IStyler interface returning a string with required additional namespace definitions:
public string GetNamespacesForResourceDictionary()
{
return "xmlns:TabsStudioDecorator=\"clr-namespace:TabsStudioDecorator;assembly=Decorator\"";
}
An add-in can add, remove and modify menu items in the Tabs Studio context menu handling OpeningTabContextMenu and OpeningTabExtensionContextMenu events. Right click on a tab with a single extension generates the OpeningTabExtensionContextMenu event.
To simplify customization from an add-in, each menu item and separator in the default context menu has distinct Name. For document tab context menu, the names are: Open, OpenSeparator, Save, SaveSeparator, Close, CloseAllButThis, CloseAllDocuments, FileSeparator, CopyFullPath, OpenContainingFolder, VS2010DocumentSeparator, VS2010Floating, VS2010Dockable, TabGroupsSeparator, MoveToNextTabGroup, MoveToPreviousTabGroup, TabsStudioSeparator and TabsStudio. For non-document tab context menu, additional names are: WindowSeparator, Floating, Dockable, TabbedDocument, AutoHide and Hide.
To debug an add-in using Visual Studio:
<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="TabsStudioDecorator:Properties.IsTopProject" Value="True"/>
<Condition Property="IsTabSelected" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#F5F5F5" Offset="0"/>
<GradientStop Color="#B0B0F0" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</MultiTrigger>
</Style.Triggers>
</Style>
Disambiguator v1.0.0 - detects when two or more tabs have the same title and adds Visual Studio folder or project to titles for these tabs. Demonstrates use of TitleManager and TitleTransform.
Localizer v1.0.0 - tab context menu translation for German and Spanish localized Visual Studio editions.
Navigator v1.0.1 - allows to switch tabs using keyboard. It provides two new Visual Studio commands to activate tabs on the left and on the right of the currently selected one. Demonstrates Visual Studio commands creation in Tabs Studio's add-in.
NewGroup v1.0.0 - for VS 2010 adds New horizontal/vertical tab group commands to the Tabs Studio context menu.
Saver v1.0.1 - restores tab positions when opening a solution to the last state. Demonstrates use of the GetTabs method.Sorter v1.0.2 - automatically sorts tabs in alphabetical order.
Sync v1.0.0 - adds new command to the Tabs Studio context menu to locate document in the Solution Explorer window.
Tracer v1.0.1 - traces ITabsStudioEngine events using the System.Diagnostics.Trace.WriteLine method (use DebugView to view trace events).Copyright 2009 - 2010 Sergey Vlasov