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

Hi all,

I am attempting to add quick fix to a SourceViewer per the instructions in http://wiki.eclipse.org/FAQ_How_do_I_implement_Quick_Fixes_for_my_own_language%3F, i.e.:

   <extension
        point="org.eclipse.ui.ide.markerResolution">
       <markerResolutionGenerator
           class="eu.etaxonomy.taxeditor.tests.QuickFixer"
           markerType="org.eclipse.core.resources.problemmarker">
       </markerResolutionGenerator>
   </extension>	



I have added a menu to my StyledText widget with this plugin.xml code:

<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:eu.etaxonomy.taxeditor.tests.view">
<command commandId="org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals" />
</menuContribution>
</extension>


and this:

MenuManager menuMgr = new MenuManager();
menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
getSite().registerContextMenu(menuMgr, sourceViewer);


       Control control = sourceViewer.getTextWidget();
       Menu menu = menuMgr.createContextMenu(control);
       control.setMenu(menu);	

My StyledText widget contains an annotation that extends MarkerAnnotation and shows its IMarker.MESSAGE attribute when hovering over the SourceViewer's ruler.

So far so good.

But when I right-click inside the StyledText widget to look at the menu, "Quick Fix Ctrl+1" is grayed-out / deactivated. Similarly, Ctrl+1 does nothing.

It seems as if the SourceViewer is failing some kind of context test for activation. I've poked around in the plugin.xml's of the required plugins, and I can't find the appropriate handler for the assist command, nor can I find where the marker resolution generator is called.

Any ideas?

Many thanks in advance!