Question

I have an Eclipse RCP application which uses some bindings from org.eclipse.ui.defaultAcceleratorConfiguration in addition to its own keybindigs, which are defined through the extension org.eclipse.ui.binding. I defined my own binding scheme and set the defaultAcceleratorConfiguration as parentId, then activated that scheme from plugin_customization.ini so that I can override some binding

Currently, nearly all of my commands are in the org.eclipse.ui.contexts.window context. However, I would like some binding to only take effect when a certain perspective is selected.

How could I change the current context so that when a perspective is selected or loaded (upon application launch, for example) a certain context is activated, then revert to the window context when it is deselected? I am looking for a solution that interferes other perspectives minimally, that is, it should be able to be used by several perspectives in the workbech.

I did some IPerspectiveListener3 trickery that indeed works. I activate the context when my perspective is activated, and deactivate it upon perspective deactivation. However, I wonder whether a less hackish solution exists.

Was it helpful?

Solution

I went with the IPerspectiveListener3 approach, and didn't run into any regressions. Yet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top