Analysing sqltexteditor plugin from Java Developer's Guide to Eclipse I cannot understand one thing.
I added project into my workspace and my uncertainty concerns class SQLEditorContributor.
I understand this class add three new buttons to the Edit menu. However I have no idea where are the strings which are used as buttons' texts.
I mean, the class creates following buttons in menu Edit:
Content Assist Ctrl+SPACE
Content Format
Content Tips Ctrl+SHIFT+SPACE
maybe anybody analysed this project before and could explain me how it works.
public class SQLEditorContributor extends TextEditorActionContributor {
protected RetargetTextEditorAction fContentAssistProposal;
protected RetargetTextEditorAction fContentAssistTip;
protected RetargetTextEditorAction fContentFormatProposal;
/**
* Constructor for SQLEditorContributor. Creates a new contributor in the form of
* adding Content Assist, Conent Format and Assist tip menu items
*/
public SQLEditorContributor() {
super();
ResourceBundle bundle =
STEditorPlugin.getDefault().getResourceBundle();
fContentAssistProposal =
new RetargetTextEditorAction(bundle, "ContentAssistProposal.");
fContentFormatProposal =
new RetargetTextEditorAction(bundle, "ContentFormatProposal.");
fContentAssistTip =
new RetargetTextEditorAction(bundle, "ContentAssistTip.");
}
public void contributeToMenu(IMenuManager mm) {
IMenuManager editMenu =
mm.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null) {
editMenu.add(new Separator());
editMenu.add(fContentAssistProposal);
editMenu.add(fContentFormatProposal);
editMenu.add(fContentAssistTip);
}
}
/**
* Sets the active editor to this contributor.
* This updates the actions to reflect the SQL editor.
* @see EditorActionBarContributor#editorChanged
*/
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
ITextEditor editor = null;
if (part instanceof ITextEditor)
editor = (ITextEditor) part;
fContentAssistProposal.setAction(
getAction(editor, "ContentAssistProposal"));
fContentFormatProposal.setAction(
getAction(editor, "ContentFormatProposal"));
fContentAssistTip.setAction(getAction(editor, "ContentAssistTip"));
}
/**
*
* Contributes to the toolbar.
* @see EditorActionBarContributor#contributeToToolBar
*/
public void contributeToToolBar(IToolBarManager tbm) {
tbm.add(new Separator());
}
}