Community
Participate
Working Groups
Accelerators don't work just after the page is changed in the editor which has multi-page. The following is a example. The editor is a subclass of MultiPageEditorPart. Each of the pages has different scopes for key bindings. And IKeyBindingService#setScopes and registerAction are called when the page is activated. However, the accelerators don't work, because the accelerators are updated in WWinKeyBindingService#updateAccelerators and this is called only when the part (editor or view) is activated. And this problem also happens, if the editor has two panes and more and each of the panes has different scopes for key bindings.
Could you provide us the status of this problem ? We would like to know what is going on about this problem. .
Could you please update the status on this problem ? Thank you.
the command handler service (used to be part of the key binding service in 2.1) is provided to the granularity of a page. multi-editor parts need to provide further granularity down to their individual pages and manage the page switching. doug can you look at this?
See also Bug 27539.
*** Bug 27539 has been marked as a duplicate of this bug. ***
This has been schedule to be looked at for the 2.1.3 maintenance release.
I've made it so that KeyBindingService, implements INestableKeyBindingService (a sub-interface of IKeyBindingService). This interface adds methods to register and switch between active key binding services. It has been committed to the 2.1.3 stream. I will now port it to the 3.0 stream, and include the test case. (I'm only including the test case in 3.0, as we have not versioned our test suites for the maintenance stream, and it is more effort than its worth for one test.)
Should be fixed in both 2.1.3 and 3.0. Not yet verified in 2.1.3. Changes only apply to MultiPageEditorPart and MultiPageEditorSite.
To verify this fix, load the multi-page editor example v20030315. Modify the "createPage0()" method to include this: editor.getSite().getKeyBindingService().setScopes(new String[] { "Moo" }); Modify the "pageChange(int)" method to append: String[] scopes = getSite().getKeyBindingService().getScopes(); System.out.print("Scopes = "); for (int i = 0; i < scopes.length; ) { System.out.print(scopes[i]); if (++i < scopes.length) { System.out.print(","); } } System.out.println(); Open a multi-page editor example, you should see "Moo" printed when the first tab is activated. For the other tabs, you shouldn't.
verified on MOTIF for build 2.1.3RC2
verified on Win2000 for build 2.1.3RC2
verified on mac for 2.1.3 RC2
I tried to verify this fix using the multipage editor example with 2.1.3RC2 build. However, It seems that this fix has an effect if the page is added to MultiPageEditorPart as IEditorPart. When the page is added to MultiPageEditorPart as Control, I think the accelerators have not worked yet. For example, if we want to have different scopes for each page, how should we modify the multipage editor example? (We are adding all pages to MultiPageEditorPart as Control in our program.)
For controls, I would recommend creating your own nested key binding services. Similar to what is done in MultiPageEditorSite.getKeyBindingService(). You will need to control activation of these nested services (see: setFocus(int)). If you would like this functionality added in 3.0, please open a new bug and provide a suggested design.