This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 179368

Summary: Clean up o.n.editor.Registry
Product: editor Reporter: Vitezslav Stejskal <vstejskal>
Component: -- Other --Assignee: Vitezslav Stejskal <vstejskal>
Status: RESOLVED FIXED    
Severity: normal Keywords: API
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: TASK Exception Reporter:
Bug Depends on:    
Bug Blocks: 181156    
Attachments: Trunk changes
mian/contrib changes

Description Vitezslav Stejskal 2010-01-11 04:03:03 UTC
Despite the fact that o.n.editor.Registry has been long time deprecated it's still used throughout Netbeans codebase. These usages should be converted to EditorRegistry, the Registry class should be bridged to EditorRegistry and its API cleaned up. The class itself can probably stay where it is to avoid incompatible changes and minimize impact on other modules.
Comment 1 Vitezslav Stejskal 2010-01-11 06:07:28 UTC
Created attachment 93171 [details]
Trunk changes
Comment 2 Vitezslav Stejskal 2010-01-11 06:07:56 UTC
Created attachment 93172 [details]
mian/contrib changes
Comment 3 Vitezslav Stejskal 2010-01-11 06:17:26 UTC
This is just a notification that I'm going to clean up o.n.editor.Registry a little bit. The class has been deprecated for quite some time now, but despite of that it was still used in both the editor infrastructure and other modules. The attached patches contain changes needed to remove all the existing usages in Netbeans codebase (trunk + main/contrib) and to bridge the implementation to the official o.n.api.editor.EditorRegistry. I used @PatchedPublic to hide some of the Registry's API methods while preserving the class' backwards compatibility. Sadly @PatchedPublic doesn't seem to be applicable on a class, so I could not remove the whole o.n.e.Registry.
Comment 4 Vitezslav Stejskal 2010-01-11 06:51:42 UTC
http://hg.netbeans.org/jet-main/rev/7dd78ba4d67d

I'll integrate the patch for main/contrib when 7dd78ba4d67d passes through the builders.
Comment 5 Quality Engineering 2010-01-11 23:31:52 UTC
Integrated into 'main-golden', will be available in build *201001120200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/7dd78ba4d67d
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #179368: cleaning up o.n.editor.Registry and its usages
Comment 6 Vitezslav Stejskal 2010-01-12 00:47:51 UTC
main/contrib patch applied - http://hg.netbeans.org/main/contrib/rev/7b25cbdaa32b
Comment 7 Michel Graciano 2010-02-23 17:39:31 UTC
I think it is not fully compatible. I did some test and face problems with Registry.getMostActiveDocument where it thrown an NPE when I select an action at the menu, as Copy FQN for example, since when I invoke the action it access this method but the editor has no focus anymore, so I used EditorRegistry.lastFocusedComponent() instead EditorRegistry.focusedComponent(). Maybe this is an inconsistency since CopyFQN works very well in 6.8 with any modification? I am not sure if here is the correct place to this comment, maybe should I file an new issue?
Comment 8 Vitezslav Stejskal 2010-02-24 03:10:14 UTC
Well, if there are NPEs or other regressions caused by this change please file a new defect with stackraces or steps reproducing the problem. And I'll have a look.
Comment 9 Vitezslav Stejskal 2010-03-04 03:37:57 UTC
http://hg.netbeans.org/jet-main/rev/439d8ed95829
Comment 10 Vitezslav Stejskal 2010-03-04 03:47:02 UTC
http://hg.netbeans.org/main/contrib/rev/e4264700a316
Comment 11 Quality Engineering 2010-03-04 22:10:21 UTC
Integrated into 'main-golden', will be available in build *201003050200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/439d8ed95829
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #179368: using safer ER.lastFocusedComponent rather than just ER.focusedComponent as suggested by hmichel in #181156