Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 183675 - hint completion makes assumptions about associated editor pane bindings
hint completion makes assumptions about associated editor pane bindings
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Hints
6.x
PC Windows XP
: P3 (vote)
: 6.x
Assigned To: Jan Lahoda
issues@java
:
Depends on:
Blocks: 179047
  Show dependency treegraph
 
Reported: 2010-04-07 20:21 UTC by err
Modified: 2010-04-29 11:10 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description err 2010-04-07 20:21:15 UTC
The summary says it all.
Comment 1 Jan Lahoda 2010-04-08 10:07:10 UTC
Should Work - press right arrow when the "Configure" semi-fix is shown in the pop-up.
Comment 2 err 2010-04-08 19:08:31 UTC
The problem turns out to be an interaction between the jVi keybindings and ScrollCompletionPane.installKeyBindings/ScrollCompletionPane.findEditorKeys. For now I've got a workaround.

This in not the first time there has been binding struggles. jVi also has a workaround for some stuff in CompletionImpl.

Rewording the title and cc'ing Mila, Tim and editor since the various source code credits them. Possibly this bug should go to editor?

I'm wondering if there is a way this type of thing can be restructured to avoid this issue in the future, or at least have a well defined way to deal with it when it shows up. Assuming a relatively simple design, I could probably do the work.

The goal seems to be to find the KeyStrokes associated with a particular action, for example caret-forward, and then use those keystrokes for actions in some other component. If the map of behavior,action could be discovered in the filesystem then jVi could switch in its actions while it is active.
Comment 3 err 2010-04-08 20:25:01 UTC
> map of behavior,action ...

Hmm, I guess that is the action map. I guess I should be able to simple add something like:
    "caret-forward" --> jViAction
directly into action map 

Then, even though there is no keystroke that maps to caret-forward, ScrollCompletionPane.findEditorKeys should still do the right thing. I'll play with this and hopefully just close this bug.
Comment 4 err 2010-04-08 22:22:42 UTC
I tried adding entries like
    "caret-forward" --> jViAction
into the editor component's ActionMap. But this didn't work. The code in ScrollCompletionPane.findEditorKeys essentially does

            component.getUI().getEditorKit(component)
                .getActionByName(editorActionName);

which operates on BasKit's internal stuff, not necessarily the map defined in the component.

There is no way, AFAICT, to get these entries into the Kit's map.
StorageFilter<Collection<KeyStroke>, MultiKeyBinding> simply doesn't support it.

If findEditorKeys did the following instead

            component.getActionMap().get(editorActionName)

then it would work.

I guess the first question is whether findEditorKeys can safely be modified to use the component's ActionMap rather than the one from BaseKit? The question applies to both ScrollCompletionPane and CompletionImpl
Comment 5 Jan Lahoda 2010-04-09 14:39:19 UTC
Thanks for the investigations. I tried to use component.getActionMap().get(editorActionName)
instead of kit.getActionByName and both the hint popup and code completion seem to work OK. So unless someone anticipates some problems, I am going to commit the change.
Comment 6 Vitezslav Stejskal 2010-04-10 04:14:28 UTC
IMO, using the component's map should be ok.
Comment 7 Jan Lahoda 2010-04-12 12:42:48 UTC
Integrated:
http://hg.netbeans.org/jet-main/rev/306f4e049229

Ernie, is there something more that needs to be done in NetBeans? Thanks.
Comment 8 err 2010-04-12 13:27:03 UTC
> more that needs to be done in NetBeans?

Not that I'm aware of... I've added the changes to jVi.
Comment 9 Quality Engineering 2010-04-13 17:31:22 UTC
Integrated into 'main-golden', will be available in build *201004131450* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/306f4e049229
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #183675: getting shortcuts for actions using "component.getActionMap().get(editorActionName)".
Comment 10 Jan Lahoda 2010-04-29 11:10:04 UTC
So, this can be marked as fixed, right? Thanks.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo