Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mylyn-dev] command handlers and activeFocusControl

As part of the Textile-J contribution for wikitext support in Mylyn I'm converting some actions to commands, and so far so good.  I've got one command that's going to be activated as follows:


<extension point="org.eclipse.ui.handlers">

<handler commandId="org.eclipse.mylyn.wikitext.ui.editor.showCheatSheetCommand"

class="org.eclipse.mylyn.wikitext.ui.editor.internal.commands.ShowCheatSheetCommand">

<activeWhen>

<with variable="activeFocusControlId">

<equals value="org.eclipse.mylyn.wikitext.ui.editor.sourceViewer">

</equals>

</with>

</activeWhen>

</handler>

</extension>


In my ITaskEditorExtension I can do this:



IFocusService focusService = (IFocusService) PlatformUI.getWorkbench().getService(IFocusService.class);

if (focusService != null) {

focusService.addFocusTracker(viewer.getTextWidget(), "org.eclipse.mylyn.wikitext.ui.editor.sourceViewer");

}

viewer.getTextWidget().setData(MarkupLanguage.class.getName(), markupLanguage);

Providing that the editor sets the right context, everything should just work.  Here's the question:

I'm wondering how I can access the activeFocusControl in the AbstractHandler.  This will give the handler access to the markupLanguage.  Any ideas?


Thanks in advance,


David


Back to the top