[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: How do I activate the Quick Fix command in a context menu?

Pepe Ciardelli wrote:
Daniel Megert wrote:

There's no pre-installed handler or action for the source viewer. The editor framework does this for you if your source viewer configuration provides a quick assist assistant (see:
org.eclipse.jface.text.source.SourceViewerConfiguration.getQuickAssistAssistant(ISourceViewer)).


Dani

Thanks very much, first of all.
I have added content assistants to my SourceViewerConfiguration as follows:


private IContentAssistant contentAssistant = new ContentAssistant();
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
return contentAssistant;
}
private IQuickAssistAssistant quickAssistAssistant = new QuickAssistAssistant();
public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
return quickAssistAssistant;
}


However, "Quick Fix Ctrl+1" in the SourceViewer context menu is still disabled. Where exactly does the editor framework check for the content assistant?
If you use/subclass one of the editors you get it for free, otherwise you have to create and connect an action that then invokes the corresponding operation on the source viewer.

And out of curiosity, where is the key binding to Ctrl-1 set?
In plugin.xml where the command is defined.

Dani
Cheers,
Pepe