org-openide-awt

16:40:25.843 INFO  jd.cli.Main - Decompiling org-openide-awt.jar
package org.netbeans.api.actions;

public abstract interface Closable
{
  public abstract boolean close();
}

/* Location:
 * Qualified Name:     org.netbeans.api.actions.Closable
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.api.actions;

public abstract interface Editable
{
  public abstract void edit();
}

/* Location:
 * Qualified Name:     org.netbeans.api.actions.Editable
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.api.actions;

public abstract interface Openable
{
  public abstract void open();
}

/* Location:
 * Qualified Name:     org.netbeans.api.actions.Openable
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.api.actions;

public abstract interface Printable
{
  public abstract void print();
}

/* Location:
 * Qualified Name:     org.netbeans.api.actions.Printable
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.api.actions;

public abstract interface Viewable
{
  public abstract void view();
}

/* Location:
 * Qualified Name:     org.netbeans.api.actions.Viewable
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.awt;

import java.awt.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import javax.swing.JToggleButton;
import org.openide.awt.Actions;
import org.openide.awt.Actions.CheckboxMenuItem;
import org.openide.awt.Actions.MenuItem;
import org.openide.awt.DynamicMenuContent;
import org.openide.util.actions.ActionPresenterProvider;
import org.openide.util.actions.BooleanStateAction;
import org.openide.util.actions.SystemAction;

public final class DefaultAWTBridge
  extends ActionPresenterProvider
{
  public JMenuItem createMenuPresenter(Action paramAction)
  {
    Object localObject;
    if ((paramAction instanceof BooleanStateAction))
    {
      localObject = (BooleanStateAction)paramAction;
      return new Actions.CheckboxMenuItem((BooleanStateAction)localObject, true);
    }
    if ((paramAction instanceof SystemAction))
    {
      localObject = (SystemAction)paramAction;
      return new Actions.MenuItem((SystemAction)localObject, true);
    }
    return new Actions.MenuItem(paramAction, true);
  }
  
  public JMenuItem createPopupPresenter(Action paramAction)
  {
    Object localObject2;
    Object localObject1;
    if ((paramAction instanceof BooleanStateAction))
    {
      localObject2 = (BooleanStateAction)paramAction;
      localObject1 = new Actions.CheckboxMenuItem((BooleanStateAction)localObject2, false);
    }
    else if ((paramAction instanceof SystemAction))
    {
      localObject2 = (SystemAction)paramAction;
      localObject1 = new Actions.MenuItem((SystemAction)localObject2, false);
    }
    else
    {
      localObject1 = new Actions.MenuItem(paramAction, false);
    }
    return (JMenuItem)localObject1;
  }
  
  public Component createToolbarPresenter(Action paramAction)
  {
    Object localObject;
    if ((paramAction instanceof BooleanStateAction))
    {
      localObject = new JToggleButton();
      Actions.connect((AbstractButton)localObject, (BooleanStateAction)paramAction);
    }
    else
    {
      localObject = new JButton();
      Actions.connect((AbstractButton)localObject, paramAction);
    }
    return (Component)localObject;
  }
  
  public JPopupMenu createEmptyPopup()
  {
    return new JPopupMenu();
  }
  
  public Component[] convertComponents(Component paramComponent)
  {
    Object localObject;
    if ((paramComponent instanceof JMenuItem))
    {
      localObject = (JMenuItem)paramComponent;
      if ((Boolean.TRUE.equals(((JMenuItem)localObject).getClientProperty("hideWhenDisabled"))) && (!((JMenuItem)localObject).isEnabled())) {
        return new Component[0];
      }
    }
    if ((paramComponent instanceof DynamicMenuContent))
    {
      localObject = ((DynamicMenuContent)paramComponent).getMenuPresenters();
      int i = 0;
      ArrayList localArrayList = new ArrayList();
      for (int j = 0; j < localObject.length; j++) {
        if (((localObject[j] instanceof DynamicMenuContent)) && (localObject[j] != paramComponent))
        {
          localArrayList.addAll(Arrays.asList(convertComponents(localObject[j])));
          i = 1;
        }
        else
        {
          if (localObject[j] == null) {
            localObject[j] = new JSeparator();
          }
          localArrayList.add(localObject[j]);
        }
      }
      if (i != 0) {
        return (Component[])localArrayList.toArray(new Component[localArrayList.size()]);
      }
      return (Component[])localObject;
    }
    return new Component[] { paramComponent };
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.awt.DefaultAWTBridge
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.awt.event.ActionEvent;
import java.util.Collections;
import java.util.List;
import org.netbeans.api.actions.Closable;
import org.netbeans.api.actions.Editable;
import org.netbeans.api.actions.Openable;
import org.netbeans.api.actions.Printable;
import org.netbeans.api.actions.Viewable;
import org.openide.util.Lookup.Provider;

final class ActionDefaultPerfomer
  extends ContextAction.Performer<Object>
{
  final int type;
  
  public ActionDefaultPerfomer(int paramInt)
  {
    super(Collections.emptyMap());
    type = paramInt;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent, List<? extends Object> paramList, Lookup.Provider paramProvider)
  {
    for (Object localObject : paramList) {
      switch (type)
      {
      case 0: 
        ((Openable)localObject).open();
        break;
      case 1: 
        ((Viewable)localObject).view();
        break;
      case 2: 
        ((Editable)localObject).edit();
        break;
      case 3: 
        ((Closable)localObject).close();
        break;
      case 4: 
        ((Printable)localObject).print();
        break;
      default: 
        if (!$assertionsDisabled) {
          throw new AssertionError("Wrong type: " + type);
        }
        break;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.ActionDefaultPerfomer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import javax.swing.AbstractButton;
import org.openide.util.actions.BooleanStateAction;

class Actions$BooleanButtonBridge
  extends Actions.ButtonBridge
{
  public Actions$BooleanButtonBridge(AbstractButton paramAbstractButton, BooleanStateAction paramBooleanStateAction)
  {
    super(paramAbstractButton, paramBooleanStateAction);
  }
  
  public void updateState(String paramString)
  {
    super.updateState(paramString);
    if ((paramString == null) || (paramString.equals("booleanState"))) {
      button.setSelected(((BooleanStateAction)action).getBooleanState());
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.BooleanButtonBridge
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

class Actions$Bridge$VisL
  implements PropertyChangeListener
{
  Actions$Bridge$VisL(Actions.Bridge paramBridge) {}
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    if ("ancestor".equals(paramPropertyChangeEvent.getPropertyName())) {
      if (paramPropertyChangeEvent.getNewValue() != null) {
        this$0.addNotify();
      } else {
        this$0.removeNotify();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.Bridge.VisL
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.awt.EventQueue;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.Action;
import javax.swing.JComponent;
import org.openide.util.HelpCtx;

abstract class Actions$Bridge
  implements PropertyChangeListener
{
  protected JComponent comp;
  protected Action action;
  protected PropertyChangeListener listener;
  
  public Actions$Bridge(JComponent paramJComponent, Action paramAction)
  {
    if ((paramJComponent == null) || (paramAction == null)) {
      throw new IllegalArgumentException("None of the arguments can be null: comp=" + paramJComponent + ", action=" + paramAction);
    }
    comp = paramJComponent;
    action = paramAction;
    
    listener = new VisL();
    comp.addPropertyChangeListener(listener);
    if (comp.isShowing()) {
      addNotify();
    }
    HelpCtx localHelpCtx = Actions.access$000(paramAction);
    if ((localHelpCtx != null) && (!localHelpCtx.equals(HelpCtx.DEFAULT_HELP)) && (localHelpCtx.getHelpID() != null)) {
      HelpCtx.setHelpIDString(paramJComponent, localHelpCtx.getHelpID());
    }
  }
  
  public void addNotify()
  {
    action.addPropertyChangeListener(this);
    updateState(null);
  }
  
  public void removeNotify()
  {
    action.removePropertyChangeListener(this);
  }
  
  public abstract void updateState(String paramString);
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    if (!EventQueue.isDispatchThread()) {
      new IllegalStateException("This must happen in the event thread!").printStackTrace();
    }
    updateState(paramPropertyChangeEvent.getPropertyName());
  }
  
  private class VisL
    implements PropertyChangeListener
  {
    VisL() {}
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      if ("ancestor".equals(paramPropertyChangeEvent.getPropertyName())) {
        if (paramPropertyChangeEvent.getNewValue() != null) {
          addNotify();
        } else {
          removeNotify();
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.Bridge
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.JMenuItem;

public abstract interface Actions$ButtonActionConnector
{
  public abstract boolean connect(AbstractButton paramAbstractButton, Action paramAction);
  
  public abstract boolean connect(JMenuItem paramJMenuItem, Action paramAction, boolean paramBoolean);
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.ButtonActionConnector
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.util.Collection;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

final class Actions$ButtonActionConnectorGetter
  implements LookupListener
{
  private final Lookup.Result<Actions.ButtonActionConnector> result;
  private Collection<? extends Actions.ButtonActionConnector> all;
  
  Actions$ButtonActionConnectorGetter()
  {
    result = Lookup.getDefault().lookupResult(Actions.ButtonActionConnector.class);
    result.addLookupListener(this);
    resultChanged(null);
  }
  
  final Collection<? extends Actions.ButtonActionConnector> all()
  {
    return all;
  }
  
  public void resultChanged(LookupEvent paramLookupEvent)
  {
    all = result.allInstances();
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.ButtonActionConnectorGetter
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;
import org.openide.util.actions.SystemAction;

class Actions$ButtonBridge
  extends Actions.Bridge
  implements ActionListener
{
  private static Logger UILOG = Logger.getLogger("org.netbeans.ui.actions");
  protected AbstractButton button;
  
  public Actions$ButtonBridge(AbstractButton paramAbstractButton, Action paramAction)
  {
    super(paramAbstractButton, paramAction);
    paramAbstractButton.addActionListener(paramAction);
    button = paramAbstractButton;
    paramAbstractButton.addActionListener(this);
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    LogRecord localLogRecord = new LogRecord(Level.FINER, "UI_ACTION_BUTTON_PRESS");
    localLogRecord.setParameters(new Object[] { button, button.getClass().getName(), action, action.getClass().getName(), action.getValue("Name") });
    localLogRecord.setResourceBundle(NbBundle.getBundle(Actions.class));
    localLogRecord.setResourceBundleName(Actions.class.getPackage().getName() + ".Bundle");
    localLogRecord.setLoggerName(UILOG.getName());
    UILOG.log(localLogRecord);
  }
  
  protected void updateButtonIcon()
  {
    Object localObject1 = null;
    Object localObject2 = action.getValue("iconBase");
    int i = 1;
    Object localObject3 = button.getClientProperty("PreferredIconSize");
    if (((localObject3 instanceof Integer)) && 
      (((Integer)localObject3).intValue() == 24)) {
      i = 0;
    }
    Object localObject4;
    ImageIcon localImageIcon1;
    Object localObject5;
    if ((action instanceof SystemAction))
    {
      if ((localObject2 instanceof String))
      {
        localObject4 = (String)localObject2;
        localImageIcon1 = null;
        if (i == 0)
        {
          localImageIcon1 = ImageUtilities.loadImageIcon(insertBeforeSuffix((String)localObject4, "24"), true);
          if (localImageIcon1 == null) {
            localImageIcon1 = ImageUtilities.loadImageIcon((String)localObject4, true);
          }
        }
        else
        {
          localImageIcon1 = ImageUtilities.loadImageIcon((String)localObject4, true);
        }
        if (localImageIcon1 != null)
        {
          localObject1 = localImageIcon1;
          button.setIcon(localImageIcon1);
          button.setDisabledIcon(ImageUtilities.createDisabledIcon(localImageIcon1));
        }
        else
        {
          localObject5 = (SystemAction)action;
          localObject1 = ((SystemAction)localObject5).getIcon(useTextIcons());
          button.setIcon((Icon)localObject1);
          button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon)localObject1));
        }
      }
      else
      {
        localObject4 = (SystemAction)action;
        localObject1 = ((SystemAction)localObject4).getIcon(useTextIcons());
        button.setIcon((Icon)localObject1);
        button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon)localObject1));
      }
    }
    else if ((localObject2 instanceof String))
    {
      localObject4 = (String)localObject2;
      localImageIcon1 = null;
      if (i == 0)
      {
        localImageIcon1 = ImageUtilities.loadImageIcon(insertBeforeSuffix((String)localObject4, "24"), true);
        if (localImageIcon1 == null) {
          localImageIcon1 = ImageUtilities.loadImageIcon((String)localObject4, true);
        }
      }
      else
      {
        localImageIcon1 = ImageUtilities.loadImageIcon((String)localObject4, true);
      }
      if (localImageIcon1 != null)
      {
        localObject1 = localImageIcon1;
        button.setIcon((Icon)localObject1);
        button.setDisabledIcon(ImageUtilities.createDisabledIcon(localImageIcon1));
      }
      else
      {
        localObject1 = action.getValue("SmallIcon");
        if ((localObject1 instanceof Icon))
        {
          button.setIcon((Icon)localObject1);
          button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon)localObject1));
        }
        else
        {
          button.setIcon(Actions.access$100(null));
        }
      }
    }
    else
    {
      localObject1 = action.getValue("SmallIcon");
      if ((localObject1 instanceof Icon))
      {
        button.setIcon((Icon)localObject1);
        button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon)localObject1));
      }
      else
      {
        button.setIcon(Actions.access$100(null));
      }
    }
    if ((localObject2 instanceof String))
    {
      localObject4 = (String)localObject2;
      if (i == 0) {
        localObject4 = insertBeforeSuffix((String)localObject4, "24");
      }
      localImageIcon1 = null;
      if (localObject1 == null)
      {
        localImageIcon1 = ImageUtilities.loadImageIcon((String)localObject4, true);
        if (localImageIcon1 != null) {
          button.setIcon(localImageIcon1);
        }
        localObject1 = localImageIcon1;
      }
      localObject5 = ImageUtilities.loadImageIcon(insertBeforeSuffix((String)localObject4, "_pressed"), true);
      if (localObject5 != null) {
        button.setPressedIcon((Icon)localObject5);
      }
      ImageIcon localImageIcon2 = ImageUtilities.loadImageIcon(insertBeforeSuffix((String)localObject4, "_rollover"), true);
      if (localImageIcon2 != null) {
        button.setRolloverIcon(localImageIcon2);
      }
      ImageIcon localImageIcon3 = ImageUtilities.loadImageIcon(insertBeforeSuffix((String)localObject4, "_disabled"), true);
      if (localImageIcon3 != null) {
        button.setDisabledIcon(localImageIcon3);
      } else if (localImageIcon1 != null) {
        button.setDisabledIcon(ImageUtilities.createDisabledIcon(localImageIcon1));
      }
    }
  }
  
  static String insertBeforeSuffix(String paramString1, String paramString2)
  {
    String str1 = paramString1;
    String str2 = "";
    if (paramString1.lastIndexOf('.') >= 0)
    {
      str1 = paramString1.substring(0, paramString1.lastIndexOf('.'));
      str2 = paramString1.substring(paramString1.lastIndexOf('.'), paramString1.length());
    }
    return str1 + paramString2 + str2;
  }
  
  public void updateState(String paramString)
  {
    if ((paramString == null) || (paramString.equals("enabled"))) {
      button.setEnabled(action.isEnabled());
    }
    if ((paramString == null) || (paramString.equals("icon")) || (paramString.equals("SmallIcon")) || (paramString.equals("iconBase"))) {
      updateButtonIcon();
    }
    if ((paramString == null) || (paramString.equals("AcceleratorKey")) || ((paramString.equals("Name")) && (action.getValue("ShortDescription") == null)) || (paramString.equals("ShortDescription")))
    {
      String str1 = Actions.access$200(action);
      String str2 = (String)action.getValue("ShortDescription");
      if (str2 == null)
      {
        str2 = (String)action.getValue("Name");
        str2 = str2 == null ? "" : Actions.cutAmpersand(str2);
      }
      if ((str1 == null) || (str1.equals(""))) {
        button.setToolTipText(str2);
      } else {
        button.setToolTipText(NbBundle.getMessage(Actions.class, "FMT_ButtonHint", str2, str1));
      }
    }
    if (((button instanceof Accessible)) && ((paramString == null) || (paramString.equals("Name")))) {
      button.getAccessibleContext().setAccessibleName((String)action.getValue("Name"));
    }
  }
  
  protected boolean useTextIcons()
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.ButtonBridge
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
import org.openide.util.ImageUtilities;
import org.openide.util.actions.BooleanStateAction;
import org.openide.util.actions.SystemAction;

final class Actions$CheckMenuBridge
  extends Actions.BooleanButtonBridge
{
  private boolean popup;
  private boolean hasOwnIcon = false;
  
  public Actions$CheckMenuBridge(JCheckBoxMenuItem paramJCheckBoxMenuItem, BooleanStateAction paramBooleanStateAction, boolean paramBoolean)
  {
    super(paramJCheckBoxMenuItem, paramBooleanStateAction);
    popup = paramBoolean;
    if (paramBoolean) {
      Actions.prepareMargins(paramJCheckBoxMenuItem, paramBooleanStateAction);
    }
    Object localObject1 = paramBooleanStateAction.getValue("iconBase");
    Object localObject2 = null;
    if ((paramBooleanStateAction instanceof SystemAction)) {
      localObject2 = paramBooleanStateAction.getValue("icon");
    } else {
      localObject2 = paramBooleanStateAction.getValue("SmallIcon");
    }
    hasOwnIcon = ((localObject1 != null) || (localObject2 != null));
  }
  
  public void updateState(String paramString)
  {
    super.updateState(paramString);
    if ((paramString == null) || (!paramString.equals("AcceleratorKey"))) {
      Actions.updateKey((JMenuItem)comp, action);
    }
    if ((paramString == null) || (paramString.equals("Name")))
    {
      Object localObject = action.getValue("Name");
      if ((localObject instanceof String)) {
        Actions.setMenuText((JMenuItem)comp, (String)localObject, true);
      }
    }
  }
  
  protected void updateButtonIcon()
  {
    if (hasOwnIcon)
    {
      super.updateButtonIcon();
      
      return;
    }
    if (!popup) {
      button.setIcon(ImageUtilities.loadImageIcon("org/openide/resources/actions/empty.gif", true));
    }
  }
  
  protected boolean useTextIcons()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.CheckMenuBridge
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import javax.swing.JCheckBoxMenuItem;
import org.openide.util.actions.BooleanStateAction;

public class Actions$CheckboxMenuItem
  extends JCheckBoxMenuItem
{
  private static final long serialVersionUID = 6190621106981774043L;
  
  public Actions$CheckboxMenuItem(BooleanStateAction paramBooleanStateAction, boolean paramBoolean)
  {
    Actions.connect(this, paramBooleanStateAction, !paramBoolean);
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.CheckboxMenuItem
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class Actions$ISubActionListener
  implements ActionListener
{
  int index;
  Actions.SubMenuModel support;
  
  public Actions$ISubActionListener(int paramInt, Actions.SubMenuModel paramSubMenuModel)
  {
    index = paramInt;
    support = paramSubMenuModel;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    support.performActionAt(index);
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.ISubActionListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JMenuItem;
import org.openide.util.ImageUtilities;
import org.openide.util.actions.SystemAction;

class Actions$MenuBridge
  extends Actions.ButtonBridge
{
  private boolean popup;
  
  public Actions$MenuBridge(JMenuItem paramJMenuItem, Action paramAction, boolean paramBoolean)
  {
    super(paramJMenuItem, paramAction);
    popup = paramBoolean;
    if ((paramJMenuItem instanceof Actions.MenuItem)) {
      comp.removePropertyChangeListener(listener);
    }
    if (paramBoolean) {
      Actions.prepareMargins(paramJMenuItem, paramAction);
    } else {
      paramJMenuItem.putClientProperty("menubridgeresizehack", this);
    }
  }
  
  public void updateState(String paramString)
  {
    if (button == null) {
      button = ((AbstractButton)comp);
    }
    if ((paramString == null) || (paramString.equals("enabled"))) {
      button.setEnabled(action.isEnabled());
    }
    if ((paramString == null) || (!paramString.equals("AcceleratorKey"))) {
      Actions.updateKey((JMenuItem)comp, action);
    }
    if ((!popup) && (
      (paramString == null) || (paramString.equals("icon")) || (paramString.equals("SmallIcon")) || (paramString.equals("iconBase")))) {
      updateButtonIcon();
    }
    if ((paramString == null) || (paramString.equals("Name")))
    {
      Object localObject = null;
      if (popup) {
        localObject = action.getValue("popupText");
      }
      if (localObject == null) {
        localObject = action.getValue("menuText");
      }
      if (localObject == null) {
        localObject = action.getValue("Name");
      }
      if ((localObject instanceof String)) {
        Actions.setMenuText((JMenuItem)comp, (String)localObject, true);
      }
    }
  }
  
  protected void updateButtonIcon()
  {
    Object localObject1 = null;
    Object localObject2 = action.getValue("noIconInMenu");
    if (Boolean.TRUE.equals(localObject2)) {
      return;
    }
    if ((action instanceof SystemAction))
    {
      localObject3 = (SystemAction)action;
      localObject1 = ((SystemAction)localObject3).getIcon(useTextIcons());
      button.setIcon((Icon)localObject1);
      button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon)localObject1));
    }
    else
    {
      localObject1 = action.getValue("SmallIcon");
      if ((localObject1 instanceof Icon))
      {
        button.setIcon((Icon)localObject1);
        button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon)localObject1));
      }
    }
    Object localObject3 = action.getValue("iconBase");
    if ((localObject3 instanceof String))
    {
      String str = (String)localObject3;
      ImageIcon localImageIcon1 = null;
      if (localObject1 == null)
      {
        localImageIcon1 = ImageUtilities.loadImageIcon(str, true);
        if (localImageIcon1 != null)
        {
          button.setIcon(localImageIcon1);
          button.setDisabledIcon(ImageUtilities.createDisabledIcon(localImageIcon1));
        }
      }
      ImageIcon localImageIcon2 = ImageUtilities.loadImageIcon(insertBeforeSuffix(str, "_pressed"), true);
      if (localImageIcon2 != null) {
        button.setPressedIcon(localImageIcon2);
      }
      ImageIcon localImageIcon3 = ImageUtilities.loadImageIcon(insertBeforeSuffix(str, "_rollover"), true);
      if (localImageIcon3 != null) {
        button.setRolloverIcon(localImageIcon3);
      }
      ImageIcon localImageIcon4 = ImageUtilities.loadImageIcon(insertBeforeSuffix(str, "_disabled"), true);
      if (localImageIcon4 != null) {
        button.setDisabledIcon(localImageIcon4);
      } else if (localImageIcon1 != null) {
        button.setDisabledIcon(ImageUtilities.createDisabledIcon(localImageIcon1));
      }
    }
  }
  
  protected boolean useTextIcons()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.MenuBridge
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JMenuItem;
import org.openide.util.actions.SystemAction;

public class Actions$MenuItem
  extends JMenuItem
  implements DynamicMenuContent
{
  static final long serialVersionUID = -21757335363267194L;
  private Actions.Bridge bridge;
  
  public Actions$MenuItem(SystemAction paramSystemAction, boolean paramBoolean)
  {
    Actions.connect(this, paramSystemAction, !paramBoolean);
  }
  
  public Actions$MenuItem(Action paramAction, boolean paramBoolean)
  {
    Actions.connect(this, paramAction, !paramBoolean);
  }
  
  void setBridge(Actions.Bridge paramBridge)
  {
    bridge = paramBridge;
  }
  
  public JComponent[] synchMenuPresenters(JComponent[] paramArrayOfJComponent)
  {
    if (bridge != null) {
      bridge.updateState(null);
    }
    return getMenuPresenters();
  }
  
  public JComponent[] getMenuPresenters()
  {
    return new JComponent[] { this };
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.MenuItem
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JMenuItem;
import org.openide.util.actions.SystemAction;

@Deprecated
public class Actions$SubMenu
  extends JMenuPlus
  implements DynamicMenuContent
{
  private static final long serialVersionUID = -4446966671302959091L;
  private Actions.SubMenuBridge bridge;
  
  public Actions$SubMenu(SystemAction paramSystemAction, Actions.SubMenuModel paramSubMenuModel)
  {
    this(paramSystemAction, paramSubMenuModel, true);
  }
  
  public Actions$SubMenu(SystemAction paramSystemAction, Actions.SubMenuModel paramSubMenuModel, boolean paramBoolean)
  {
    this(paramSystemAction, paramSubMenuModel, paramBoolean);
  }
  
  public Actions$SubMenu(Action paramAction, Actions.SubMenuModel paramSubMenuModel, boolean paramBoolean)
  {
    bridge = new Actions.SubMenuBridge(new JMenuItem(), this, paramAction, paramSubMenuModel, paramBoolean);
    
    bridge.updateState("Name");
  }
  
  public JComponent[] getMenuPresenters()
  {
    return bridge.getMenuPresenters();
  }
  
  public JComponent[] synchMenuPresenters(JComponent[] paramArrayOfJComponent)
  {
    return bridge.synchMenuPresenters(paramArrayOfJComponent);
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.SubMenu
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.awt.EventQueue;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.util.HelpCtx;

final class Actions$SubMenuBridge
  extends Actions.MenuBridge
  implements ChangeListener, DynamicMenuContent
{
  private Actions.SubMenuModel model;
  private List<JMenuItem> currentOnes;
  private JMenuItem single;
  private JMenu multi;
  
  public Actions$SubMenuBridge(JMenuItem paramJMenuItem, JMenu paramJMenu, Action paramAction, Actions.SubMenuModel paramSubMenuModel, boolean paramBoolean)
  {
    super(paramJMenuItem, paramAction, paramBoolean);
    single = paramJMenuItem;
    multi = paramJMenu;
    Actions.setMenuText(multi, (String)paramAction.getValue("Name"), paramBoolean);
    Actions.prepareMargins(paramJMenuItem, paramAction);
    Actions.prepareMargins(paramJMenu, paramAction);
    currentOnes = new ArrayList();
    model = paramSubMenuModel;
  }
  
  public void stateChanged(ChangeEvent paramChangeEvent)
  {
    if (!EventQueue.isDispatchThread()) {
      new IllegalStateException("This must happen in the event thread!").printStackTrace();
    }
  }
  
  public void updateState(String paramString)
  {
    super.updateState(paramString);
  }
  
  public JComponent[] getMenuPresenters()
  {
    return synchMenuPresenters(null);
  }
  
  public JComponent[] synchMenuPresenters(JComponent[] paramArrayOfJComponent)
  {
    currentOnes.clear();
    int i = model.getCount();
    if (i == 0)
    {
      updateState(null);
      currentOnes.add(single);
      
      single.setEnabled(false);
    }
    else if (i == 1)
    {
      updateState(null);
      currentOnes.add(single);
      single.setEnabled(action.isEnabled());
      
      HelpCtx localHelpCtx1 = model.getHelpCtx(0);
      associateHelp(single, localHelpCtx1 == null ? Actions.access$000(action) : localHelpCtx1);
    }
    else
    {
      currentOnes.add(multi);
      multi.removeAll();
      
      Mnemonics.setLocalizedText(multi, (String)action.getValue("Name"));
      
      int j = 0;
      int k = model.getCount();
      for (int m = 0; m < k; m++)
      {
        String str = model.getLabel(m);
        if (str == null)
        {
          j = multi.getItemCount() > 0 ? 1 : 0;
        }
        else
        {
          if (j != 0)
          {
            multi.addSeparator();
            j = 0;
          }
          JMenuItem localJMenuItem = new JMenuItem();
          Mnemonics.setLocalizedText(localJMenuItem, str);
          if (m == 0) {
            Actions.updateKey(localJMenuItem, action);
          }
          localJMenuItem.addActionListener(new Actions.ISubActionListener(m, model));
          
          HelpCtx localHelpCtx2 = model.getHelpCtx(m);
          associateHelp(localJMenuItem, localHelpCtx2 == null ? Actions.access$000(action) : localHelpCtx2);
          multi.add(localJMenuItem);
        }
        associateHelp(multi, Actions.access$000(action));
      }
      multi.setEnabled(true);
    }
    return (JComponent[])currentOnes.toArray(new JMenuItem[currentOnes.size()]);
  }
  
  private void associateHelp(JComponent paramJComponent, HelpCtx paramHelpCtx)
  {
    if ((paramHelpCtx != null) && (!paramHelpCtx.equals(HelpCtx.DEFAULT_HELP)) && (paramHelpCtx.getHelpID() != null)) {
      HelpCtx.setHelpIDString(paramJComponent, paramHelpCtx.getHelpID());
    } else {
      HelpCtx.setHelpIDString(paramJComponent, null);
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.SubMenuBridge
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import javax.swing.event.ChangeListener;
import org.openide.util.HelpCtx;

@Deprecated
public abstract interface Actions$SubMenuModel
{
  public abstract int getCount();
  
  public abstract String getLabel(int paramInt);
  
  public abstract HelpCtx getHelpCtx(int paramInt);
  
  public abstract void performActionAt(int paramInt);
  
  public abstract void addChangeListener(ChangeListener paramChangeListener);
  
  public abstract void removeChangeListener(ChangeListener paramChangeListener);
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.SubMenuModel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.awt.Dimension;
import javax.swing.Action;
import org.openide.util.actions.SystemAction;

@Deprecated
public class Actions$ToolbarButton
  extends ToolbarButton
{
  private static final long serialVersionUID = 6564434578524381134L;
  
  public Actions$ToolbarButton(SystemAction paramSystemAction)
  {
    super(null);
    Actions.connect(this, paramSystemAction);
  }
  
  public Actions$ToolbarButton(Action paramAction)
  {
    super(null);
    Actions.connect(this, paramAction);
  }
  
  public Dimension getMaximumSize()
  {
    return getPreferredSize();
  }
  
  public Dimension getMinimumSize()
  {
    return getPreferredSize();
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.ToolbarButton
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.awt.Dimension;
import org.openide.util.actions.BooleanStateAction;

@Deprecated
public class Actions$ToolbarToggleButton
  extends ToolbarToggleButton
{
  private static final long serialVersionUID = -4783163952526348942L;
  
  public Actions$ToolbarToggleButton(BooleanStateAction paramBooleanStateAction)
  {
    super(null, false);
    Actions.connect(this, paramBooleanStateAction);
  }
  
  public Dimension getMaximumSize()
  {
    return getPreferredSize();
  }
  
  public Dimension getMinimumSize()
  {
    return getPreferredSize();
  }
}

/* Location:
 * Qualified Name:     org.openide.awt.Actions.ToolbarToggleButton
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.awt;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.netbeans.api.actions.Closable;
import org.netbeans.api.actions.Editable;
import org.netbeans.api.actions.Openable;
import org.netbeans.api.actions.Printable;
import org.netbeans.api.actions.Viewable;
import org.openide.util.ContextAwareAction;
import org.openide.util.HelpCtx;
import org.openide.util.HelpCtx.Provider;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.NbBundle;
import org.openide.util.actions.BooleanStateAction;
import org.openide.util.actions.SystemAction;

public class Actions
{
  private static Icon nonNullIcon(Icon paramIcon)
  {
    return null;
  }
  
  public static String findKey(SystemAction paramSystemAction)
  {
    return findKey(paramSystemAction);
  }
  
  private static String findKey(Action paramAction)
  {
    if (paramAction == null) {
      return null;
    }
    KeyStroke localKeyStroke = (KeyStroke)paramAction.getValue("AcceleratorKey");
    if (localKeyStroke == null) {
      return null;
    }
    int i = localKeyStroke.getModifiers();
    String str = "";
    if (i > 0)
    {
      str = KeyEvent.getKeyModifiersText(i);
      str = str + "+";
    }
    else if (localKeyStroke.getKeyCode() == 0)
    {
      return "";
    }
    str = str + KeyEvent.getKeyText(localKeyStroke.getKeyCode());
    
    return str;
  }
  
  @Deprecated
  public static void connect(JMenuItem paramJMenuItem, SystemAction paramSystemAction, boolean paramBoolean)
  {
    connect(paramJMenuItem, paramSystemAction, paramBoolean);
  }
  
  public static void connect(JMenuItem paramJMenuItem, Action paramAction, boolean paramBoolean)
  {
    for (Object localObject = buttonActionConnectors().iterator(); ((Iterator)localObject).hasNext();)
    {
      ButtonActionConnector localButtonActionConnector = (ButtonActionConnector)((Iterator)localObject).next();
      if (localButtonActionConnector.connect(paramJMenuItem, paramAction, paramBoolean)) {
        return;
      }
    }
    localObject = new MenuBridge(paramJMenuItem, paramAction, paramBoolean);
    if ((paramJMenuItem instanceof MenuItem)) {
      ((MenuItem)paramJMenuItem).setBridge((Bridge)localObject);
    }
    ((Bridge)localObject).updateState(null);
    paramJMenuItem.putClientProperty("hideWhenDisabled", paramAction.getValue("hideWhenDisabled"));
  }
  
  public static void connect(JCheckBoxMenuItem paramJCheckBoxMenuItem, BooleanStateAction paramBooleanStateAction, boolean paramBoolean)
  {
    CheckMenuBridge localCheckMenuBridge = new CheckMenuBridge(paramJCheckBoxMenuItem, paramBooleanStateAction, paramBoolean);
    localCheckMenuBridge.updateState(null);
  }
  
  @Deprecated
  public static void connect(AbstractButton paramAbstractButton, SystemAction paramSystemAction)
  {
    connect(paramAbstractButton, paramSystemAction);
  }
  
  public static void connect(AbstractButton paramAbstractButton, Action paramAction)
  {
    for (Object localObject = buttonActionConnectors().iterator(); ((Iterator)localObject).hasNext();)
    {
      ButtonActionConnector localButtonActionConnector = (ButtonActionConnector)((Iterator)localObject).next();
      if (localButtonActionConnector.connect(paramAbstractButton, paramAction)) {
        return;
      }
    }
    localObject = new ButtonBridge(paramAbstractButton, paramAction);
    ((Bridge)localObject).updateState(null);
  }
  
  public static void connect(AbstractButton paramAbstr
1 2 3 4 5 6 7 8 9 10 11 12

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd