Home > Components > DXCore Components – SmartTagProvider

DXCore Components – SmartTagProvider

The SmartTagProvider DXCore component provides a custom smart tag item used in the Visual Studio IDE context menu or in the Refactor! popup menu. Here’s a standard Refactor! popup menu – it may contain the Refactor!, Code! and other smart tag providers:

Refactor!/Code! Popup menu

The Popup menu is configurable on the “Editor | Smart Tags Catalog” options page in the Options Dialog:

DXCore Smart Tags Catalog options page

The SmartTagProvider control doesn’t exist on the Visual Studio toolbox, by default. You have to manually add it by selecting the “Choose Items” in the context menu of the Visual Studio toolbox:

DXCore SmartTagProvider Choose Items

and locating the SmartTagProvider in the list:

DXCore SmartTagProvider Choose Toolbox Items

Here’s the Properties window, containing available properties, their categories and default values:

DXCore SmartTagProvider Properties

and the Events list:

DXCore SmartTagProvider Events

The SmartTagProvider component is located in the “DevExpress.CodeRush. Core” assembly. It is derived from the “SmartTagProviderBase” base type from the same “DevExpress.CodeRush.Core” assembly:

DXCore SmartTagProvider hierarchy

Here’s a list of properties in alphabetical order:

Property name

Description

DescriptionText, describing the purpose or behavior of this plug-in extension. This text may appear inside the User Guide, configuration UI, or the About box.
DisplayNameThe text name that identifies this extension. This text may appear inside the User Guide, configuration UI, or the About box.
ImageSets the bitmap image for this provider. Provider images are optional, but can be useful for menu items inside the IDE.
ImageBackColorSets the image background color for this provider’s image. It is used to determine which color is to be treated as transparent in the bitmap assigned to the Image property.
MenuOrderPosition of the provider in the Popup menu.
ProviderNameThe name of this provider.
RegisterIf true, this extension will be available to the DXCore. Otherwise, it will be hidden.
ShowInContextMenuGets or sets the value indicating if a smart tag provider should be shown in the Visual Studio editor context menu.
ShowInPopupMenuGets or sets the value indicating if a smart tag provider should be shown in the Popup menu.

Events:

Event name

Description

CanShowInContextMenuHandle this event to specify whether this smart tag provider can be added to the VS editor context menu.
CheckSmartTagAvailabilityHandle this event to specify whether this smart tag provider is available.
ContextMenuInvalidateOccurs when the editor context menu is invalidated. This event is raised for each smart tag provider.
ContextMenuShowOccurs when the editor context menu with this smart tag provider is shown.
GetSmartTagItemColorsHandle this event to initialize smart tag provider colors for the Popup menu.
GetSmartTagItemsHandle this event to initialize smart tag provider menu items.
ItemExecuteOccurs when the item execute event is triggered.
LanguageSupportedHandle this optional event if you want to restrict your context to one or more programming languages. If you do not handle this event, theDXCore makes your context available in all programming languages.

And the list of methods for using of this control:

Method Name

Description

ClearMenuItemsClears the cached menu items.
GetItem(String)Returns the menu item by the given name.
GetItemColorsReturns the colors used for this smart tag provider in the Popup menu.
GetItemsGets all menu items for this smart tag provider. Menu items are cached to improve performance, call ClearMenuItems to clear cached values and invalidate the items.
HidePopupMenuHides the popup menu.
HideSmartTagHides the smart tag.
IsAvailableReturns true if the smart tag provider is available for the current context.
ShowPopupMenu(Point)Displays the popup menu inside the code editor at the specified position.
ShowPopupMenu(Point, Boolean)Displays the popup menu inside the code editor at the specified position. The boolean parameter specifies whether to show a notification if no items are available for this smart tag provider.
ShowSmartTagShows the smart tag.

See the “How to use DXCore SmartTagProvider component and create your own Popup menu entry” topic, to learn more on SmartTagProvider usage.

—–
Products: DXCore
Versions: 10.2 and up
VS IDEs: any
Updated: May/24/2011
ID: D085

Similar Posts:

  1. No comments yet. Be the first and leave a comment!
  1. May 24th, 2011 at 04:25 | #1