Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 140895 - [jVi] EditorRegistry doesn't contain all JEditorPanes
[jVi] EditorRegistry doesn't contain all JEditorPanes
Status: RESOLVED WORKSFORME
Product: editor
Classification: Unclassified
Component: Settings
6.x
All All
: P3 (vote)
: 6.x
Assigned To: Vitezslav Stejskal
issues@editor
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-07-19 23:01 UTC by err
Modified: 2009-02-19 20:45 UTC (History)
0 users

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 2008-07-19 23:01:40 UTC
This situation occurs after a jVi disable/enable. After an enable, jVi need to find all the JEPs to capture their
DefaultKeyTypedAction. The precise sequence of events for the log is:

- start NB with 3 files opened in editor, I've marked log with "<<<<< kit installed >>>>>" where jVi picks up the four
  install actions. The fourth of these must be some NB internal thing.
- Then immeadiately disable/enable jVi. Do not select the tabs of any of the other two editors.
  Marked with <<<<<DISABLE/ENABLE DONE HERE>>>>>
- After that the log shows only one entry in the EditorRegistry. In the TopComponent registry, three TCs are found that
  hold JEPs.

It looks like JEPs are not added to the editor registry when the kit is installed, but rather after the "tab" is
selected and/or there is some editting done.


===== LOG =====

Module-1033450:  runJViEnable
~~~ KeybindingsInjector: org.netbeans.modules.jvi.Module$KeybindingsInjector@1190cfc
Injector: build jVi map. size 54
Injector: afterLoad: mimePath 'MimePath[]' profile 'NetBeans' defaults 'false' orig map size: 88
INFO [org.netbeans.core.startup.NbEvents]: Turning on modules:
        org.openide.util [7.16.0.1 1 200807101204]
        ...
trackTC: open: null:ProjectTab@12eddc0 'explorer' ec null
trackTC: open: null:ProjectTab@503636 'explorer' ec null
trackTC: open: null:MainTab@4eaf47 'explorer' ec null
trackTC: open: main - Navigator:NavigatorTC@79c0f4 'navigator' ec null
trackTC: open: Output:OutputWindow@1da6c0d 'output' ec null
Injector: afterLoad: mimePath 'MimePath[text/x-java]' profile 'NetBeans' defaults 'false' orig map size: 15

<<<<< kit installed >>>>>
Module-1033450: kit installed: JavaKit
Module-1033450: capture: QuietEditorPane@1bccede action: JavaDefaultKeyTypedAction
Module-1033450: capture caret
trackTC: open: Main.java:JavaEditor@12a4674 'editor' : nPanes = 1
        ep QuietEditorPane@1bccede Main.java:JavaEditor@12a4674
Activation: ViManager.activateAppEditor: P_OPEN QuietEditorPane@1bccede JavaEditor@12a4674 Main.java

<<<<< kit installed >>>>>
Module-1033450: kit installed: JavaKit
Module-1033450: MISSED CAPTURE: QuietEditorPane@1ed8c3 action: EnqueCharAction
Module-1033450: capture caret
trackTC: open: NewClass.java:JavaEditor@149865b 'editor' : nPanes = 1
        ep QuietEditorPane@1ed8c3 NewClass.java:JavaEditor@149865b
Activation: ViManager.activateAppEditor: P_OPEN QuietEditorPane@1ed8c3 JavaEditor@149865b NewClass.java
Injector: afterLoad: mimePath 'MimePath[text/plain]' profile 'NetBeans' defaults 'false' orig map size: 0

<<<<< kit installed >>>>>
Module-1033450: kit installed: PlainKit
Module-1033450: capture: QuietEditorPane@f2eb18 action: ExtDefaultKeyTypedAction
Module-1033450: capture caret
trackTC: open: someFile.txt:CloneableEditor@9df61d 'editor' : nPanes = 1
        ep QuietEditorPane@f2eb18 someFile.txt:CloneableEditor@9df61d
Activation: ViManager.activateAppEditor: P_OPEN QuietEditorPane@f2eb18 CloneableEditor@9df61d someFile.txt
trackTC: open: null:WelcomeComponent@157053a 'editor' ec null
INFO [org.netbeans.modules.editor.EditorModule]: Number of loaded editor kits: 2
Injector: afterLoad: mimePath 'MimePath[text/x-java/text/x-javadoc]' profile 'NetBeans' defaults 'false' orig map size: 0
Injector: afterLoad: mimePath 'MimePath[text/x-java/text/x-java-string]' profile 'NetBeans' defaults 'false' orig map
size: 0
trackTC: activated newTC: Main.java:JavaEditor@12a4674 'editor' : nPanes = 1
        ep QuietEditorPane@1bccede Main.java:JavaEditor@12a4674
Activation: ViManager.activateAppEditor: P_ACTV QuietEditorPane@1bccede JavaEditor@12a4674 Main.java
Activation: getViTextView: create
TV.attach: 29150942
TVCache: attach: 29150942
Activation: ViManager.SWITCHTO: QuietEditorPane@1bccede Main.java
...

<<<<< kit installed >>>>>
Module-1033450: kit installed: JavaKit
Module-1033450: MISSED CAPTURE: JEditorPane@8a43ba action: EnqueCharAction
Module-1033450: capture caret
Module-1033450: runJViDisable
Module-1033450: restore caret: Main.java
Activation: ViManager.closeAppEditor: Main.java
Activation: shutdown TV
TV.shutdown: LAST CLOSE
Activation: ViManager.detached QuietEditorPane@1bccede
Module-1033450: restore caret: NewClass.java
Activation: ViManager.closeAppEditor: NewClass.java
Module-1033450: restore caret: someFile.txt
Activation: ViManager.closeAppEditor: someFile.txt
Module-1033450: shutdown nomad restore caret
Activation: ViManager.closeAppEditor: (null)
-----------------------------------
currentEditorPane = UNKNOWN
factory = org.netbeans.modules.jvi.NbFactory@16c3d1f
textBuffers: 0
textMRU: 0
currentlyActive: none
ignoreActivation: none
TextViewSet: 0
BufferSet: 0

<<<<<DISABLE/ENABLE DONE HERE>>>>>

Injector: updateKeymap: 
Injector: forceKeymapRefresh: 
Module-1033450:  runJViEnable
Injector: updateKeymap: 
Injector: forceKeymapRefresh: 
UP-BINDING: mapJvi: KEY-MATCH: key: pressed UP action: ViUpKey
UP-BINDING: mapJvi: KEY-MATCH: key: pressed KP_UP action: ViUpKey
Injector: build jVi map. size 54
UP-BINDING: mapOrig: ACTION-MATCH: KEY-MATCH: key: pressed UP action: caret-up
UP-BINDING: mapOrig: ACTION-MATCH: KEY-MATCH: key: pressed KP_UP action: caret-up
Injector: afterLoad: mimePath 'MimePath[]' profile 'NetBeans' defaults 'false' orig map size: 88
Injector: afterLoad: mimePath 'MimePath[text/x-java]' profile 'NetBeans' defaults 'false' orig map size: 15
Injector: afterLoad: mimePath 'MimePath[text/plain]' profile 'NetBeans' defaults 'false' orig map size: 0
Injector: afterLoad: mimePath 'MimePath[text/x-java/text/x-java-string]' profile 'NetBeans' defaults 'false' orig map
size: 0
Injector: afterLoad: mimePath 'MimePath[text/x-java/text/x-javadoc]' profile 'NetBeans' defaults 'false' orig map size: 0

<<<<< ONLY ONE ELEMENT IN EDITOR REGISTRY >>>>>
Module-1033450: init EditorRegistry QuietEditorPane@1bccede
Module-1033450: capture: QuietEditorPane@1bccede action: JavaDefaultKeyTypedAction
Module-1033450: capture caret
Activation: ViManager.activateAppEditor: JVI-ENABLE QuietEditorPane@1bccede JavaEditor@12a4674 Main.java

<<<<< THREE TCs FOUND THAT HOLD EDITORS >>>>>
Module-1033450: init TCRegistry editor QuietEditorPane@f2eb18
Module-1033450: init TCRegistry editor QuietEditorPane@1ed8c3
Module-1033450: init TCRegistry editor QuietEditorPane@1bccede
Comment 1 Vitezslav Stejskal 2008-07-23 09:38:47 UTC
I think this is actually not a problem. Or is it? The tabs are not fully initialized until you click on them. The TC
registry will obviously list them all, but they are dormant until you touch them somehow. And when you do they should
get initialized and hook itself in the EditorRegistry. This is done from BaseKit install, which also installs the keymap.

In other words, any JEP that you get from EditorRegistry has already had its keymap installed and the
DefaultKeyTypedAction set. All others have not.

I think you could test it by listing JEPs from EditorRegistry [1], then JEPs from TopComponent registry [2] and then
again JEPs from EditorRegistry [3]. The number of JEPs that you get in each step should look like [1] < [2] == [3].
Comment 2 err 2008-07-23 17:32:12 UTC
This situation arises around the use of the jVi disable/enable checkbox. When jVi goes from disabled to enabled it needs
to save the old DefaultKeyTypedAction and install its own. It needs to find all the JEPs that won't get kit install
actions.

There was a recommendation to use EditorRegistry to find the editors, rather than TopComponent Registry. It looks like
the semantics of ER are not quite right to entirely replace the old TCR based algorithm. jVi can use a hybrid
approach; the TCR will provide any missing TC JEPs and the ER provides any nomadic editors, such as evaluate expression.

There's some confusion because the KitInstall actions have fired, but in fact the kit has not been installed and the JEP
does not appear in the ER. There will be a problem if the nomadic editors are dormant, i.e. they are not in ER but their
kit-install actions have already fired.

If the nomadic editors can be found, then there is no issue. I was just confused and this can be closed.

Actually, I guess I'm still a little confused
> initialized and hook itself in the EditorRegistry. This is done from BaseKit install, which also installs the keymap.
Ahhh, is only the DKTA installed in the JEP when the kit-install action is invoked? And none of the other stuff?
Comment 3 Miloslav Metelka 2008-11-21 19:52:52 UTC
> Ahhh, is only the DKTA installed in the JEP when the kit-install action is invoked? And none of the other stuff?
The DKTA is created as part of the BaseKit.createActions() which is called lazily from EditorKit.getActions().
kit-install actions are called during EditorKit.install() which happens once the UI gets installed into an editor pane.

The ER should include all the panes using our kits (ER.register() is called in BaseTextUI.installUI()).

Closing as worksforme. Please reopen if necessary.


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