name="refresh" parentId="org.eclipse.ui.contexts.window">
Once correct context is defined, it needs to be activated. For example, in view:
View.createPartControl(Composite parent) {
...
...
IContextService contextService = (IContextService) getSite().getService(IContextService.class);
contextService.activateContext("com.iwaysoftware.explorer.refresh");
}
Then the usual, command is created that is tied to a handler that extends AbstractHandler, command is tied to a binding, and the binding is in turn uses earlier created custom context.
defaultHandler="com.iwaysoftware.explorer.handler.RefreshHandler" id="com.iwaysoftware.explorer.refreshCommand"
name="Refresh">
sequence="F5" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="com.iwaysoftware.explorer.refresh" />
name="refresh" parentId="org.eclipse.ui.contexts.window">
No comments:
Post a Comment