Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » RetargetTextEditorAction uncertainty
RetargetTextEditorAction uncertainty [message #668785] Sat, 07 May 2011 12:50
bonzo269 is currently offline bonzo269Friend
Messages: 4
Registered: April 2011
Junior Member
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());
	}

}
Previous Topic:Contextual Menu in eclipse
Next Topic:Headless build problem in
Goto Forum:
  


Current Time: Sun Aug 09 05:51:14 GMT 2020

Powered by FUDForum. Page generated in 0.03361 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top