Use the TextEditorAddArgs class to add a menu item to the text editor context menu. The screen shot below shows a context menu item named Hello Plugin added to the context menu for the text editor.
The code below is shows an example of adding the context menu item plugin shown above.
public class PluginManager : IPlugin
{
private AitApplicationProxy proxy; //Create a class-scoped field for the proxy
public PluginManager(AitApplicationProxy applicationProxy)
{
TextEditorAddArgs helloEditorContextItem = new TextEditorAddArgs(); //Initialize a new instance of the TextEditorAddArgs class
helloEditorContextItem.IconImage = Properties.Resources.debug_add_16; //Set the image to a resource in the assembly
helloEditorContextItem.OnClick = helloContextItem_OnClick; //Set the OnClick event handler
helloEditorContextItem.PluginName = "Hello Plugin"; //Set the unique name (and display name) for the context item
proxy.AddPluginToTextEditorMenu(helloEditorContextItem); //Use the proxy to add the context menu item
}
private void helloContextItem_OnClick(Object sender, AuthoritEventArgs e)
{
//Plugin code goes here
}
}