Bug 199823 - @EditorActionRegistration in editor module overrides registrations from editor.lib w/o weight attr
@EditorActionRegistration in editor module overrides registrations from edito...
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar
7.0
All All
: P3 (vote)
: 7.1
Assigned To: Miloslav Metelka
issues@editor
: API, API_REVIEW_FAST
Depends on: 141925
Blocks: 150875 204686
  Show dependency treegraph
 
Reported: 2011-07-01 14:12 UTC by Jesse Glick
Modified: 2011-11-17 07:29 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
Proposed diff (6.26 KB, patch)
2011-11-13 23:16 UTC, Miloslav Metelka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-07-01 14:12:31 UTC
After 0081ad9a40cf, ValidateLayerConsistencyTest.testLayerOverrides began failing due to Editors/Actions/build-*.instance which are provided by both editor and editor.lib. Is this really intentional?

If not, remove the two @EditorActionRegistration's from editor.lib.

If it is intentional (e.g. so that the actions will be defined in an app including editor.lib but not editor), please consider adding an 'int weight() default 0' to EditorActionRegistration producing a 'weight' file attribute (see bug #141925) when defined, so that the editor version can clearly override the editor.lib version without considering layer load order.

Or the annotation processor could hardcode the weight attribute in this case; or even figure out that the registration in editor was an override based on the fact that NbBuildPopupMenuAction extends BuildPopupMenuAction and the superclass is also annotated with the same key.
Comment 1 Jesse Glick 2011-07-01 14:12:54 UTC
174a04b221c1 is the current workaround in the test, by the way.
Comment 2 Miloslav Metelka 2011-10-18 13:46:51 UTC
I'll add the weight attribute into the @EditorActionRegistration. Thanks.
Comment 3 Jesse Glick 2011-11-01 21:33:41 UTC
Do not forget to revert 174a04b221c1 when fixing.
Comment 4 Miloslav Metelka 2011-11-13 23:16:32 UTC
Created attachment 113170 [details]
Proposed diff
Comment 5 Miloslav Metelka 2011-11-13 23:34:43 UTC
Diff adds the weight attribute to @EditorActionRegistration. I have reverted 174a04b221c1 and uncommented NbBuildPopupAction in NbEditorKit and the test failed. After adding weight attribute the test passed.
Jesse, are there any guidelines for the weight attribute values? I have used weight = 100 in NbEditorKit.
Since EditorActionRegistration is API I request a fasttrack review. Thanks.
Comment 6 Jesse Glick 2011-11-14 14:55:54 UTC
[JG01] Typo "ommited"


[JG02] Do not link to "http://bits.netbeans.org/6.9/javadoc/". Use "@TOP@/" instead. But anyway there is no need to link to apichanges because the mechanism is covered in Javadoc proper; use {@link org.openide.filesystems.MultiFileSystem}.


[JG03] Check build-popup-menu.instance which suffered from the same problem, at least when I worked around it in ValidateLayerConsistencyTest.


(In reply to comment #5)
> are there any guidelines for the weight attribute values?

Nothing in particular, this patch looks OK to me.
Comment 7 Miloslav Metelka 2011-11-15 22:55:50 UTC
Thanks, Jesse.
http://hg.netbeans.org/jet-main/rev/4dbcb49c751c
Comment 8 Jesse Glick 2011-11-16 13:57:52 UTC
One minor thing I forgot to mention before:


[JG04] The natural default value for weight is 0, not MIN_VALUE: you can make files "recessive" by giving them negative weights just as they can be "dominant" with positive weights, and <attr name="weight" intvalue="0"/> is a no-op. Thus I would recommend

int weight() default 0;

and having the processor check

if (weight != 0) ...
Comment 9 Miloslav Metelka 2011-11-16 18:31:51 UTC
default weight is now 0. Thanks.

http://hg.netbeans.org/jet-main/rev/942e801cbb4f
Comment 10 Quality Engineering 2011-11-17 07:29:17 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/4dbcb49c751c
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #199823 - @EditorActionRegistration in editor module overrides registrations from editor.lib w/o weight attr.


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