Quantcast

NetBeans Platform 7.0 Actions and Annotations - Popup Actions

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

NetBeans Platform 7.0 Actions and Annotations - Popup Actions

David Beer-3
Hi All

I am just starting a new project using the NetNeans Platform and am liking the new annotations for the actions. However I have a small issue. Pre annotations methods and i used to use the Presenter.Popup to display the icon for the action on my popup menu's. How can I achieve the same thing with the annotations way and still have the action registered on the toolbar and in the menu? So affectively I am creating action either 'Always Enabled' or 'Context Aware' and what they action to appear in the menu, tool bar and the popup on my node.

Thanks

David

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NetBeans Platform 7.0 Actions and Annotations - Popup Actions

David Beer-3
Hi All

My Action is defined as follows:

@ActionID(category = "Users",
id = "com.copperarrow.mense.users.ui.actions.DeleteUserAction")
@ActionRegistration(iconBase = "com/copperarrow/mense/users/ui/resources/user-delete.png",
displayName = "#CTL_DeleteUserAction")
@ActionReferences({
    @ActionReference(path = "Menu/Users", position = 3333),
    @ActionReference(path = "Toolbars/Users", position = 3333)
})

This creates my action and lists it under the Menu and on the toolbar. I have converted my action so that it is only enabled if the Item is in the Lookup etc. If I use Presenter.Toolbar to create the toolbar button the Large Icon that I have specified is used all the time, so if the user selects 'Small toolbar icons' from the toolbar itself the icon remains as the large icon. How can I get the small icon to be used when specified by the main toolbar.

Any advice is greatly appreciated.

Thanks

David

On 15 July 2011 17:31, David Beer <[hidden email]> wrote:
Hi All

I am just starting a new project using the NetNeans Platform and am liking the new annotations for the actions. However I have a small issue. Pre annotations methods and i used to use the Presenter.Popup to display the icon for the action on my popup menu's. How can I achieve the same thing with the annotations way and still have the action registered on the toolbar and in the menu? So affectively I am creating action either 'Always Enabled' or 'Context Aware' and what they action to appear in the menu, tool bar and the popup on my node.

Thanks

David


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NetBeans Platform 7.0 Actions and Annotations - Popup Actions

Geertjan Wielenga-3
On 07/19/2011 05:30 PM, David Beer wrote:
Hi All

My Action is defined as follows:

@ActionID(category = "Users",
id = "com.copperarrow.mense.users.ui.actions.DeleteUserAction")
@ActionRegistration(iconBase = "com/copperarrow/mense/users/ui/resources/user-delete.png",
displayName = "#CTL_DeleteUserAction")
@ActionReferences({
    @ActionReference(path = "Menu/Users", position = 3333),
    @ActionReference(path = "Toolbars/Users", position = 3333)
})

This creates my action and lists it under the Menu and on the toolbar. I have converted my action so that it is only enabled if the Item is in the Lookup etc. If I use Presenter.Toolbar to create the toolbar button the Large Icon that I have specified is used all the time, so if the user selects 'Small toolbar icons' from the toolbar itself the icon remains as the large icon. How can I get the small icon to be used when specified by the main toolbar.

Any advice is greatly appreciated.


http://blogs.oracle.com/geertjan/entry/presenter_toolbar_meets_action_annotations

Gj

Thanks

David

On 15 July 2011 17:31, David Beer <[hidden email]> wrote:
Hi All

I am just starting a new project using the NetNeans Platform and am liking the new annotations for the actions. However I have a small issue. Pre annotations methods and i used to use the Presenter.Popup to display the icon for the action on my popup menu's. How can I achieve the same thing with the annotations way and still have the action registered on the toolbar and in the menu? So affectively I am creating action either 'Always Enabled' or 'Context Aware' and what they action to appear in the menu, tool bar and the popup on my node.

Thanks

David



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NetBeans Platform 7.0 Actions and Annotations - Popup Actions

David Beer-2
On 19 July 2011 16:33, Geertjan Wielenga <[hidden email]> wrote:
On 07/19/2011 05:30 PM, David Beer wrote:
Hi All

My Action is defined as follows:

@ActionID(category = "Users",
id = "com.copperarrow.mense.users.ui.actions.DeleteUserAction")
@ActionRegistration(iconBase = "com/copperarrow/mense/users/ui/resources/user-delete.png",
displayName = "#CTL_DeleteUserAction")
@ActionReferences({
    @ActionReference(path = "Menu/Users", position = 3333),
    @ActionReference(path = "Toolbars/Users", position = 3333)
})

This creates my action and lists it under the Menu and on the toolbar. I have converted my action so that it is only enabled if the Item is in the Lookup etc. If I use Presenter.Toolbar to create the toolbar button the Large Icon that I have specified is used all the time, so if the user selects 'Small toolbar icons' from the toolbar itself the icon remains as the large icon. How can I get the small icon to be used when specified by the main toolbar.

Any advice is greatly appreciated.


http://blogs.oracle.com/geertjan/entry/presenter_toolbar_meets_action_annotations

Gj


Hi Gj

Thanks for the link. The icon works as long as my action does not implement ContextAwareAction. I am trying to get my action similar to how I had them in pre NB 7. As in my action was context aware and the checking was also done via Lookup for the Node association. So my action class would be a lot like the 'Roll your Own' from the Dev FAQ http://wiki.netbeans.org/DevFaqActionContextSensitive.

Is there away of getting the base icon to work with a ContextAwareAction using the annotations?

David
Loading...