views:

216

answers:

0

I have created a new Perspective with additional views pretty similar to the Eclipse "Debug" Perspective.

I have created some commands and key bindings using the extension points

  • extension point="org.eclipse.ui.handlers"
  • extension point="org.eclipse.ui.commands"
  • extension point="org.eclipse.ui.bindings"

I have to use "F5" to bind the command. And the command is enabled when a specific perspective is activated. I added a new context and enable the context, when my view is opened. Like it is described here Platform_Command_Framework

  • extension point="org.eclipse.ui.contexts"

    IContextService contextService = (IContextService)getSite().getService(IContextService.class); mContextActivation = contextService.activateContext("my.context.id");

When i switch to the perspective, the command is enabled and after pressing "F5", i get a selection window in which i have to select, whether i want to "Refresh" or to use the command i have added.

In this perspective the "Refresh" command shold be disabled like Eclipse do it, when you open the "Debug" Perspective and step thru a debug session using "F5".

Do you have an idear how eclipse manages the enabling/disabling of command during perspective switching?

Edit:

i found a good article about Enablement of IHandlers, but i do not know how to use this information for my problem

Edit 2:

I think the solution could be found in the plugin org.eclipse.debug.ui. You can get the services for Handler, Binding and Command by calling

workbench.getService(IHandlerService.class);
workbench.getService(IBindingService.class);
workbench.getService(ICommandService.class);

but i can not remove the binding so easily. The conflict is coming from the class WorkbenchKeyboard call

Collection match = (InternalPolicy.currentConflicts == null ? null : (Collection) InternalPolicy.currentConflicts.get(sequenceAfterKeyStroke));

The map InternalPolicy.currentConflicts contains 2 entries for the KeySequence "F5"