I tried to solve this in the last two days with no luck. I looked at the pages on the solution pages that look right, but either my implementation is wrong or they are not the right solutions.
I created a new toolbar called AddEditDelete. Then I started adding Actions to it:
Here is AddAction.java
@ActionID(category = "Edit", id = "com.waudware.toolbar.AddAction") @ActionRegistration(iconBase = "com/demo/toolbar/icons/add.png", displayName = "#CTL_AddAction") @ActionReferences({ @ActionReference(path = "Toolbars/AddEditDelete", position = 1), @ActionReference(path = "Shortcuts", name = "DA") }) @Messages("CTL_AddAction=Add") public final class AddAction implements ActionListener { public void actionPerformed(ActionEvent e) {
I also have EditAction.java and DeleteAction.java - they were all created as "Always Enabled".
What I'm trying to do is this: when you click the "Add" button on the toolbar, it will execute the code in AddAction.java and disable EditAction.java ("Gray of the action buttons so that they are invisible").
After 2 days, trying to figure out how to do this, I completely lost and am almost sure that this is impossible. Until now, NetBeans dev forums have been useless.
Edit: My question is quite specific and simple: what would be the correct (even if it is bad practice) approach to disconnecting EditAction.java from AddAction.java. So far I have tried using Lookup, CookieSet, Direct calls, Action instantication, and the only thing I got was remotely what I wanted -
ToolbarPool.getDefault().findToolbar("AddEditDelete").setEnabled(false);
which hides the entire toolbar, but not the individual actions (icons) on it.