I created my own editor and Extended the TextEditor.
When I open a file with the TextEditor I have the option to switch to Block selection mode. But the functionality is missing when using my own editor. I guess I have to add the command in my plugin.xml somehow.
I am currently searching within the eclipse-code to finde where they add the Menu to the toolbar. But can't find it.
Any suggestions?
2 Answers
This is declared in the org.eclipse.ui.workbench.texteditor plugin.
The command id for the toggle block selection command is org.eclipse.ui.edit.text.toggleBlockSelectionMode
The action is defined using the old style org.eclipse.ui.actionSets extension point:
<action
allowLabelUpdate="true"
definitionId="org.eclipse.ui.edit.text.toggleBlockSelectionMode"
disabledIcon="$nl$/icons/full/dtool16/block_selection_mode.gif"
helpContextId="org.eclipse.ui.block_selection_mode_action_context"
icon="$nl$/icons/full/etool16/block_selection_mode.gif"
id="org.eclipse.ui.edit.text.toggleBlockSelectionMode"
label="%toggleBlockSelectionMode.label"
retarget="true"
style="toggle"
toolbarPath="Normal/Presentation"
tooltip="%toggleBlockSelectionMode.tooltip">
</action>
The action id in the text editor is ITextEditorActionConstants.BLOCK_SELECTION_MODE. The action is created in org.eclipse.ui.texteditor.AbstractTextEditor in the createActions method.
Comments
for how to add the "Block Selection" button into your eclipse toolbar :
goto Window--Customize prespective--- in new came out window, goto table "Command group avaiable" , select " editor presentation " then goto table "Tool Bar visiability", select " editor presentation " click OK button.