Fast Eclipse plug-in development experience:
1. Gets the contents of the currently selected text and converts it.
1 defines the action implementation Ieditoractiondelegate interface.
2 Gets the current editor (Geteditor ()).
Platformui.getworkbench (). Getactiveworkbenchwindow (). GetActivePage (). Getactiveeditor ();
3) Get the selected text.
(itextselection) Geteditor (). Geteditorsite (). Getselectionprovider (). GetSelection ();
4) Replace the selected text.
Abstracttexteditor editor = (abstracttexteditor) geteditor ();
Editor.getdocumentprovider (). GetDocument (Editor.geteditorinput ());
Document.replace (offset, length, replacetext);
5 Select the replaced text.
Itextselection tsnew = new TextSelection (document, offset, length);
Geteditor (). Geteditorsite (). Getselectionprovider (). SetSelection (tsnew);
2. Menu grouping, icons, shortcuts, implementation of the sidebar.
1) Menu grouping. If divided into 4 groups, there is a dividing line between the groups.
<menu label="XXXXTools(&T)" id="XXXXToolsMenu">
<separator name="XXXXToolsGroupTxt"></separator>
<separator name="XXXXToolsGroupSql"></separator>
<separator name="XXXXToolsGroupCode"></separator>
<separator name="XXXXToolsGroupRefrence"></separator>
</menu>
2 Assign action to group. Set the icon. and tool bars.
<action label="To Lower Case(&L)"
class="XXXXTools.actions.text.ToLowerCaseAction"
icon="icons/lower.gif"
menubarPath="XXXXToolsMenu/XXXXToolsGroupTxt"
toolbarPath="XXXXToolsGroupTxt"
id="XXXXTools.actions.text.ToLowerCaseAction"
definitionId="XXXXTools.actions.text.ToLowerCaseAction">
<selection class="org.eclipse.jface.text.ITextSelection" />
</action>
3) Set the shortcut key.