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.
While implementing bug 189558, we realized the need to allow registration of separators via annotations as well. This is especially important for users of 6.10 FCS, so they don't need to migrate from current layer based registration to new way of registering separators later. One option is to add into @ActionReference boolean separatorAfter() default false; boolean separatorBefore() default false; but the problem is that when generating the layer one does not have overall view of the layer and can hardlly place separators properly (into position in middle of the action and its predecessor/successor). Other option is to try to align with other IDEs and rather than separators specify some kind of @ActionReference: String group() default "none"; If there is a sequence of actions after each other with same group they would have no separator among themselves. But this is slightly tricky, the primary sorting criteria should naturally be the group, the position shall be secondary. This is hard to do compatibly. Last option I can think of is to provide @ActionReference with int[] separators() default {} an array of positions where one wants to place separators. This is easy to implement as it just means to create JSeparator-position.instance file(s) by the processor without knowing the surroundings. The wizard can properly compute these positions (as it knows the whole layer). This options seems powerful enough, compatible, yet slightly hacky.
(In reply to comment #0) > String group() default "none"; > > If there is a sequence of actions after each other with same group they would > have no separator among themselves. But this is slightly tricky, the primary > sorting criteria should naturally be the group, the position shall be > secondary. This is hard to do compatibly. Also hard to make work with Lookup-based menu interpretation such as Actions.forPath; currently the position attributes simply order the lookup result, but a group ID would complicate this system. > Last option I can think of is to provide @ActionReference with > > int[] separators() default {} I would actually suggest int separatorBefore() default Integer.MAX_VALUE; int separatorAfter() default Integer.MAX_VALUE; where the processor verifies that these attrs, if set, are less (resp. greater) than position(), which must in that case also be set. Basically matches what the wizard already generates, and the basename of the separator instance file can be taken from the reference name, e.g. com-mycom-MyAction-separatorBefore.instance
OK, as you wish my lord.
Created attachment 101737 [details] separatorBefore() and separatorAfter()
I'll integrate the change over weekend.
core-main#960db7e78a68
Integrated into 'main-golden', will be available in build *201009050000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/960db7e78a68 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #189848: ActionReference.separatorBefore and After
Integrated into 'main-golden', will be available in build *201009180000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/d8cc05b87cd5 User: Jesse Glick <jglick@netbeans.org> Log: #189848: again, Integer.MAX_VALUE is the customary default value for "no specified position". -1 is a legal position value between -2 and 0.