You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Peter Nabbefeld <pe...@gmx.de> on 2018/06/24 17:28:52 UTC

Why do I still need to implement "getName()" for an action annotated with "@ActionRegistration"?

Hello,

in my class file, I've got the following lines of code:

@ActionRegistration(displayName = "#CTL_GotoHTMLAction", lazy = false)
public class GotoHTMLAction extends CookieAction {
...
}

Why do I still need to implement the "getName()" method? Short answer, 
of course, it's declared abstract.

But I don't like the duplicate information. Is there any use for this?

I know, the annotation results in a classic entry in the now generated 
layer, but IMHO having two names (which could even be different - which 
one is used where?) isn't good style.

I'd prefer to use the layer's entry as a default value - any chance to 
change the implementation of CookieAction (and/or any related)?

Kind regards
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Why do I still need to implement "getName()" for an action annotated with "@ActionRegistration"?

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
Change it ti ActionListener extension and use the annotations there. Better
still put it in a GitHub repo so me and others can take a look and help.

Gj

On Sun, Jun 24, 2018 at 7:49 PM, Peter Nabbefeld <pe...@gmx.de>
wrote:

> Just because it's already there.  ;-)
>
> I'm just hanging around with some old code ... will have to figure out,
> how to exactly change it.
>
> Peter
>
>
>
> Am 24.06.2018 um 19:47 schrieb Geertjan Wielenga:
>
>> The real question is why you're using CookieAction at all.
>>
>> http://bits.netbeans.org/8.2/javadoc/org-openide-nodes/org/o
>> penide/util/actions/CookieAction.html
>>
>> Gj
>>
>>
>> On Sun, Jun 24, 2018 at 7:28 PM, Peter Nabbefeld <pe...@gmx.de>
>> wrote:
>>
>> Hello,
>>>
>>> in my class file, I've got the following lines of code:
>>>
>>> @ActionRegistration(displayName = "#CTL_GotoHTMLAction", lazy = false)
>>> public class GotoHTMLAction extends CookieAction {
>>> ...
>>> }
>>>
>>> Why do I still need to implement the "getName()" method? Short answer, of
>>> course, it's declared abstract.
>>>
>>> But I don't like the duplicate information. Is there any use for this?
>>>
>>> I know, the annotation results in a classic entry in the now generated
>>> layer, but IMHO having two names (which could even be different - which
>>> one
>>> is used where?) isn't good style.
>>>
>>> I'd prefer to use the layer's entry as a default value - any chance to
>>> change the implementation of CookieAction (and/or any related)?
>>>
>>> Kind regards
>>> Peter
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
>>> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>>>
>>> For further information about the NetBeans mailing lists, visit:
>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>>
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

Re: Why do I still need to implement "getName()" for an action annotated with "@ActionRegistration"?

Posted by Peter Nabbefeld <pe...@gmx.de>.
Just because it's already there.  ;-)

I'm just hanging around with some old code ... will have to figure out, 
how to exactly change it.

Peter


Am 24.06.2018 um 19:47 schrieb Geertjan Wielenga:
> The real question is why you're using CookieAction at all.
>
> http://bits.netbeans.org/8.2/javadoc/org-openide-nodes/org/openide/util/actions/CookieAction.html
>
> Gj
>
>
> On Sun, Jun 24, 2018 at 7:28 PM, Peter Nabbefeld <pe...@gmx.de>
> wrote:
>
>> Hello,
>>
>> in my class file, I've got the following lines of code:
>>
>> @ActionRegistration(displayName = "#CTL_GotoHTMLAction", lazy = false)
>> public class GotoHTMLAction extends CookieAction {
>> ...
>> }
>>
>> Why do I still need to implement the "getName()" method? Short answer, of
>> course, it's declared abstract.
>>
>> But I don't like the duplicate information. Is there any use for this?
>>
>> I know, the annotation results in a classic entry in the now generated
>> layer, but IMHO having two names (which could even be different - which one
>> is used where?) isn't good style.
>>
>> I'd prefer to use the layer's entry as a default value - any chance to
>> change the implementation of CookieAction (and/or any related)?
>>
>> Kind regards
>> Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
>> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Why do I still need to implement "getName()" for an action annotated with "@ActionRegistration"?

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
The real question is why you're using CookieAction at all.

http://bits.netbeans.org/8.2/javadoc/org-openide-nodes/org/openide/util/actions/CookieAction.html

Gj


On Sun, Jun 24, 2018 at 7:28 PM, Peter Nabbefeld <pe...@gmx.de>
wrote:

>
> Hello,
>
> in my class file, I've got the following lines of code:
>
> @ActionRegistration(displayName = "#CTL_GotoHTMLAction", lazy = false)
> public class GotoHTMLAction extends CookieAction {
> ...
> }
>
> Why do I still need to implement the "getName()" method? Short answer, of
> course, it's declared abstract.
>
> But I don't like the duplicate information. Is there any use for this?
>
> I know, the annotation results in a classic entry in the now generated
> layer, but IMHO having two names (which could even be different - which one
> is used where?) isn't good style.
>
> I'd prefer to use the layer's entry as a default value - any chance to
> change the implementation of CookieAction (and/or any related)?
>
> Kind regards
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>