In order for the tool to be useful, it must provide actions which the desktop can incorporate into the user-interface. The easiest way to do this is to use action attributes. We’ll add the following attribute to our tool class definition:
[MenuAction("launch", "global-menus/Tools/Text Editor", "Launch")]
The first and second parameters of the MenuAction attribute declare that the tool will provide an action named “launch”, and that this action will show up in the global menus, under the Tools menu, labeled as Text Editor. The third parameter declares that the action will be handled by a method on the tool class named Launch. Therefore, we must add a Launch method to our tool class. This method must have a void return type and take no parameters. We also add Dispose and Workspace_Closed methods, which we'll use later. The tool class definition now looks like this:
[MenuAction("launch", "global-menus/Tools/Text Editor", "Launch")]
[ExtensionOf(typeof (DesktopToolExtensionPoint))]
public class TextEditorLaunchTool : Tool<IDesktopToolContext>
{
private IWorkspace _workspace;
private IApplicationComponent _component;
public TextEditorLaunchTool() : base() {}
public void Launch() {}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
private void Workspace_Closed(object sender, ClosedEventArgs e) {}
}