Replace DataObject with Project.

Gj

On Sat, 28 Nov 2020 at 23:38, Orlyanskiy Vladimir <en...@mail.ru.invalid>
wrote:

> Hello.
>
> I try to create module with new action for existing file type.
>
> I have created action with code that I have put below.
>
> I have problem with loading Project in method actionPerformed. Project is
> null in both cases.
>
> How to load current Project from action ?
>
>
>
>
>
> @ActionID*(*
>
>         category *=* "Build"*,*
>
>         id *=* "org.xxx.netbeans.groovy.SomeAction"
>
> *)*
>
> @ActionRegistration*(*
>
>         displayName *=* "#CTL_SomeAction"
>
> *)*
>
> @ActionReferences*({*
>
>     @ActionReference*(*path *=* "Loaders/text/x-groovy/Actions"*,*
> position *=* 566*),*
>
> *})*
>
> @Messages*(*"CTL_SomeAction=My Action"*)*
>
> public final class SomeAction *implements* ActionListener *{*
>
>
>
>     private final DataObject context*;*
>
>
>
>     public SomeAction*(*DataObject context*)* *{*
>
>         *this**.*context *=* context*;*
>
>     *}*
>
>
>
>     @Override
>
>     public void actionPerformed*(*ActionEvent ev*)* *{*
>
>         Project project *=* Utilities*.*actionsGlobalContext*().*lookup*(*
> Project*.*class*);*
>
>         Project project2 *=* context*.*getLookup*().*lookup*(*Project*.*
> class*);*
>
>     *}*
>
> *}*
>
>
>
>
>

Reply via email to