title: NetBeans Platform: Toolbar and Actions
body: <p>I have been trying to solve this for the past 2 days with no luck. I went through pages upon pages of solutions that all look correct, but either my implementation is wrong or they aren't they right solutions.</p>
  
  <p>I have created a new Toolbar called AddEditDelete. Then I proceeded to add Actions to it:</p>
  
  <p>Here is the AddAction.java</p>
  
  <pre><code>@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 = "D-A")
  })
  @Messages("CTL_AddAction=Add")
  
  public final class AddAction implements ActionListener {
  
      public void actionPerformed(ActionEvent e) {
          //TODO: Code here
      }
  }
  </code></pre>
  
  <p>I also have EditAction.java and DeleteAction.java - they were all created as "Always Enabled".</p>
  
  <p>What I have been trying to do is this: When you click on the Add button on the toolbar, it will execute the code in the AddAction.java AND disable EditAction.java (Gray out the action buttons so they are unclickable).</p>
  
  <p>After 2 days of trying to figure out how to do this, I am completely lost and almost sure its impossible. NetBeans dev forums have been unhelpful so far.</p>
  
  <p><strong>Edit:</strong> My question is quite specific and simple: What would be the correct (even if it is a bad practice) approach to disabling EditAction.java from AddAction.java -So far I have tried using Lookup, CookieSet, Direct calls, Action instantiation, and the only thing I got that was remotely what I wanted is</p>
  
  <pre><code>ToolbarPool.getDefault().findToolbar("AddEditDelete").setEnabled(false);
  </code></pre>
  
  <p>which hides the whole toolbar, but not individual actions(icons) on it.</p>