Bug 37612 - [KeyBindings] Accelerators don't work just after the page is changed in the multi-page editor
Summary: [KeyBindings] Accelerators don't work just after the page is changed in the m...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P1 normal with 1 vote (vote)
Target Milestone: 2.1.3   Edit
Assignee: Douglas Pollock CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 27539 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-14 14:03 EDT by Mari Kuroki CLA
Modified: 2004-03-12 09:08 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mari Kuroki CLA 2003-05-14 14:03:25 EDT
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.
Comment 1 Hirotaka Matsumoto CLA 2003-06-09 02:16:50 EDT
Could you provide us the status of this problem ? We would like to
know what is going on about this problem.

.
Comment 2 Hirotaka Matsumoto CLA 2003-06-25 08:59:23 EDT
Could you please update the status on this problem ? Thank you.
Comment 3 Chris McLaren CLA 2003-09-12 14:07:15 EDT
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?
Comment 4 Douglas Pollock CLA 2003-09-22 11:27:29 EDT
See also Bug 27539.
Comment 5 Douglas Pollock CLA 2003-10-08 10:32:34 EDT
*** Bug 27539 has been marked as a duplicate of this bug. ***
Comment 6 Douglas Pollock CLA 2004-02-18 10:14:17 EST
This has been schedule to be looked at for the 2.1.3 maintenance release. 
Comment 7 Douglas Pollock CLA 2004-02-24 16:12:57 EST
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.) 
 
 
Comment 8 Douglas Pollock CLA 2004-02-26 16:55:33 EST
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. 
Comment 9 Douglas Pollock CLA 2004-03-04 10:07:19 EST
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. 
Comment 10 Michael Van Meekeren CLA 2004-03-04 15:03:23 EST
verified on MOTIF for build 2.1.3RC2
Comment 11 Nick Edgar CLA 2004-03-04 23:36:25 EST
verified on Win2000 for build 2.1.3RC2
Comment 12 Chris McLaren CLA 2004-03-05 13:29:48 EST
verified on mac for 2.1.3 RC2
Comment 13 Mari Kuroki CLA 2004-03-12 02:16:32 EST
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.)
Comment 14 Douglas Pollock CLA 2004-03-12 09:08:01 EST
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.