Originally posted by: febro.gmx.net
Hi,
I have some problems with retarget actions... they always remain grey and stay inactive...
ApplicationActionBarAdvisor.java:
this.deleteAction = new RetargetAction(ITextEditorActionDefinitionIds.DELETE,"Delete");
this.deleteAction.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE);
register(this.deleteAction);
this.formatProposalAction = new RetargetAction(IXMLActions.XML_FORMAT, "Format");
his.formatProposalAction.setActionDefinitionId(IXMLActions.XML_FORMAT);
this.formatProposalAction.setAccelerator(SWT.CTRL | SWT.SHIFT | 'F');
register(this.formatProposalAction);
this.contentAssistProposalAction = new RetargetAction(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, "ContentAssist");
this.contentAssistProposalAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
register(this.contentAssistProposalAction);
they are added to the menubar, of course...
Editor.createActions():
IAction a = new TextOperationAction(resourceBundle, "ContentFormatProposal.", this, ISourceViewer.FORMAT);
a.setActionDefinitionId(IXMLActions.XML_FORMAT);
a.setAccelerator(SWT.CTRL | SWT.SHIFT | 'F');
setAction(IXMLActions.XML_FORMAT, a);
getEditorSite().getActionBars().setGlobalActionHandler(IXMLActions.XML_FORMAT, a);
a = new TextOperationAction(resourceBundle, "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS);
a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
setAction(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, a);
getEditorSite().getActionBars().setGlobalActionHandler(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, a);
a = new TextOperationAction(resourceBundle,"Delete." ,this, ITextOperationTarget.DELETE);
a.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE);
setAction(ITextEditorActionDefinitionIds.DELETE, a);
getEditorSite().getActionBars().setGlobalActionHandler(ITextEditorActionDefinitionIds.DELETE, a);
but nothing happens... the entries in the menubar remain grey, the key-shortcuts are disabled, too.
Just the right-click-contextmenu works... here the actions are added and functional!
Editor.editorContextMenuAboutToShow(IMenuManager menu):
super.editorContextMenuAboutToShow(menu);
addAction(menu, IXMLActions.XML_FORMAT);
addAction(menu, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
addAction(menu, ITextEditorActionDefinitionIds.DELETE);
please help! i have no idea whats wrong... maybe it is connected wih my other problem ("EditorContributor: only Constructor is called", http://eclipsezone.com/eclipse/forums/t90294.html)...
any ideas???
Felix