org-openide-nodes

16:40:39.553 INFO  jd.cli.Main - Decompiling org-openide-nodes.jar
package org.openide.cookies;

import org.netbeans.api.actions.Closable;
import org.openide.nodes.Node.Cookie;

public abstract interface CloseCookie
  extends Closable, Node.Cookie
{}

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

import java.util.EventObject;
import org.openide.nodes.Node;

public class ConnectionCookie$Event
  extends EventObject
{
  static final long serialVersionUID = 7177610435688865839L;
  private ConnectionCookie.Type type;
  
  public ConnectionCookie$Event(Node paramNode, ConnectionCookie.Type paramType)
  {
    super(paramNode);
    type = paramType;
  }
  
  public Node getNode()
  {
    return (Node)getSource();
  }
  
  public ConnectionCookie.Type getType()
  {
    return type;
  }
}

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

import java.util.EventListener;
import org.openide.nodes.Node.Cookie;

public abstract interface ConnectionCookie$Listener
  extends Node.Cookie, EventListener
{
  public abstract void notify(ConnectionCookie.Event paramEvent)
    throws IllegalArgumentException, ClassCastException;
}

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

import java.io.Serializable;

public abstract interface ConnectionCookie$Type
  extends Serializable
{
  public abstract Class<?> getEventClass();
  
  public abstract boolean isPersistent();
  
  public abstract boolean overlaps(Type paramType);
}

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

import java.io.IOException;
import java.io.Serializable;
import java.util.EventListener;
import java.util.EventObject;
import java.util.Set;
import org.openide.nodes.Node;
import org.openide.nodes.Node.Cookie;

@Deprecated
public abstract interface ConnectionCookie
  extends Node.Cookie
{
  public abstract void register(Type paramType, Node paramNode)
    throws IOException;
  
  public abstract void unregister(Type paramType, Node paramNode)
    throws IOException;
  
  public abstract Set<? extends Type> getTypes();
  
  public static class Event
    extends EventObject
  {
    static final long serialVersionUID = 7177610435688865839L;
    private ConnectionCookie.Type type;
    
    public Event(Node paramNode, ConnectionCookie.Type paramType)
    {
      super();
      type = paramType;
    }
    
    public Node getNode()
    {
      return (Node)getSource();
    }
    
    public ConnectionCookie.Type getType()
    {
      return type;
    }
  }
  
  public static abstract interface Type
    extends Serializable
  {
    public abstract Class<?> getEventClass();
    
    public abstract boolean isPersistent();
    
    public abstract boolean overlaps(Type paramType);
  }
  
  public static abstract interface Listener
    extends Node.Cookie, EventListener
  {
    public abstract void notify(ConnectionCookie.Event paramEvent)
      throws IllegalArgumentException, ClassCastException;
  }
}

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

import org.netbeans.api.actions.Editable;
import org.openide.nodes.Node.Cookie;

public abstract interface EditCookie
  extends Editable, Node.Cookie
{}

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

import org.openide.nodes.Node.Cookie;

@Deprecated
public abstract interface FilterCookie
  extends Node.Cookie
{
  public abstract Class getFilterClass();
  
  public abstract Object getFilter();
  
  public abstract void setFilter(Object paramObject);
}

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

public abstract interface InstanceCookie$Of
  extends InstanceCookie
{
  public abstract boolean instanceOf(Class<?> paramClass);
}

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

import java.io.IOException;
import org.openide.nodes.Node.Cookie;

public abstract interface InstanceCookie
  extends Node.Cookie
{
  public abstract String instanceName();
  
  public abstract Class<?> instanceClass()
    throws IOException, ClassNotFoundException;
  
  public abstract Object instanceCreate()
    throws IOException, ClassNotFoundException;
  
  public static abstract interface Of
    extends InstanceCookie
  {
    public abstract boolean instanceOf(Class<?> paramClass);
  }
}

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

import org.netbeans.api.actions.Openable;
import org.openide.nodes.Node.Cookie;

public abstract interface OpenCookie
  extends Openable, Node.Cookie
{}

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

import org.netbeans.api.actions.Printable;
import org.openide.nodes.Node.Cookie;

public abstract interface PrintCookie
  extends Printable, Node.Cookie
{}

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

import java.io.IOException;
import org.openide.nodes.Node.Cookie;

public abstract interface SaveCookie
  extends Node.Cookie
{
  public abstract void save()
    throws IOException;
}

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

import org.netbeans.api.actions.Viewable;
import org.openide.nodes.Node.Cookie;

public abstract interface ViewCookie
  extends Viewable, Node.Cookie
{}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

final class AbstractNode$SheetAndCookieListener
  implements PropertyChangeListener, ChangeListener
{
  AbstractNode$SheetAndCookieListener(AbstractNode paramAbstractNode) {}
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    this$0.firePropertySetsChange(null, null);
  }
  
  public void stateChanged(ChangeEvent paramChangeEvent)
  {
    this$0.fireCookieChange();
  }
}

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

import java.awt.Component;
import java.awt.Image;
import java.awt.datatransfer.Transferable;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.MissingResourceException;
import java.util.WeakHashMap;
import javax.swing.Action;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.util.Exceptions;
import org.openide.util.HelpCtx;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.actions.SystemAction;
import org.openide.util.datatransfer.NewType;
import org.openide.util.datatransfer.PasteType;

public class AbstractNode
  extends Node
{
  private static final String[] icons = { "", "32", "", "32", "Open", "Open32", "Open", "Open32" };
  private static final int ICON_BASE = -1;
  private static final int OPENED_ICON_BASE = 3;
  private static final PasteType[] NO_PASTE_TYPES = new PasteType[0];
  private static final NewType[] NO_NEW_TYPES = new NewType[0];
  private static final String DEFAULT_ICON_BASE = "org/openide/nodes/defaultNode";
  private static final String DEFAULT_ICON_EXTENSION = ".gif";
  private static final String DEFAULT_ICON = "org/openide/nodes/defaultNode.png";
  private static final WeakHashMap<Class, Object> overridesGetDefaultAction = new WeakHashMap(32);
  protected MessageFormat displayFormat;
  private Action preferredAction;
  private String iconBase = "org/openide/nodes/defaultNode";
  private String iconExtension = ".png";
  private Object lookup;
  private Sheet sheet;
  @Deprecated
  protected SystemAction[] systemActions;
  private SheetAndCookieListener sheetCookieL = null;
  
  public AbstractNode(Children paramChildren)
  {
    this(paramChildren, null);
  }
  
  public AbstractNode(Children paramChildren, Lookup paramLookup)
  {
    super(paramChildren, paramLookup);
    
    super.setName("");
  }
  
  AbstractNode(CookieSet paramCookieSet)
  {
    super(Children.LEAF);
    lookup = paramCookieSet;
  }
  
  public Node cloneNode()
  {
    try
    {
      if ((this instanceof Cloneable)) {
        return (Node)clone();
      }
    }
    catch (CloneNotSupportedException localCloneNotSupportedException) {}
    return new FilterNode(this);
  }
  
  public void setName(String paramString)
  {
    super.setName(paramString);
    
    MessageFormat localMessageFormat = displayFormat;
    if (localMessageFormat != null) {
      setDisplayName(localMessageFormat.format(new Object[] { paramString }));
    } else {
      fireDisplayNameChange(null, null);
    }
  }
  
  @Deprecated
  public void setIconBase(String paramString)
  {
    setIconBaseWithExtension(paramString, ".gif");
  }
  
  public final void setIconBaseWithExtension(String paramString)
  {
    int i = paramString.lastIndexOf('.');
    int j = paramString.lastIndexOf('/');
    if ((j > i) || (i == -1))
    {
      setIconBaseWithExtension(paramString, "");
    }
    else
    {
      String str1 = paramString.substring(0, i);
      String str2 = paramString.substring(i);
      setIconBaseWithExtension(str1, str2);
    }
  }
  
  private final void setIconBaseWithExtension(String paramString1, String paramString2)
  {
    if ((paramString1.equals(iconBase)) && (paramString2.equals(iconExtension))) {
      return;
    }
    iconBase = paramString1;
    iconExtension = paramString2;
    fireIconChange();
    fireOpenedIconChange();
  }
  
  public Image getIcon(int paramInt)
  {
    return findIcon(paramInt, -1);
  }
  
  public Image getOpenedIcon(int paramInt)
  {
    return findIcon(paramInt, 3);
  }
  
  public HelpCtx getHelpCtx()
  {
    return HelpCtx.DEFAULT_HELP;
  }
  
  private Image findIcon(int paramInt1, int paramInt2)
  {
    String str = iconBase + icons[(paramInt1 + paramInt2)] + iconExtension;
    Image localImage = ImageUtilities.loadImage(str, true);
    if (localImage != null) {
      return localImage;
    }
    str = iconBase + icons[(1 + paramInt2)] + iconExtension;
    
    localImage = ImageUtilities.loadImage(str, true);
    if (localImage != null) {
      return localImage;
    }
    if (paramInt2 == 3) {
      return findIcon(paramInt1, -1);
    }
    return getDefaultIcon();
  }
  
  Image getDefaultIcon()
  {
    Image localImage = ImageUtilities.loadImage("org/openide/nodes/defaultNode.png", true);
    if (localImage == null) {
      throw new MissingResourceException("No default icon", "", "org/openide/nodes/defaultNode.png");
    }
    return localImage;
  }
  
  public boolean canRename()
  {
    return false;
  }
  
  public boolean canDestroy()
  {
    return false;
  }
  
  protected final synchronized void setSheet(Sheet paramSheet)
  {
    setSheetImpl(paramSheet);
    firePropertySetsChange(null, null);
  }
  
  private synchronized void setSheetImpl(Sheet paramSheet)
  {
    if (sheetCookieL == null) {
      sheetCookieL = new SheetAndCookieListener();
    }
    if (sheet != null) {
      sheet.removePropertyChangeListener(sheetCookieL);
    }
    paramSheet.addPropertyChangeListener(sheetCookieL);
    sheet = paramSheet;
  }
  
  protected Sheet createSheet()
  {
    return new Sheet();
  }
  
  protected final synchronized Sheet getSheet()
  {
    if (sheet != null) {
      return sheet;
    }
    Sheet localSheet = createSheet();
    if (localSheet == null) {
      throw new IllegalStateException("createSheet returns null in " + getClass().getName());
    }
    setSheetImpl(localSheet);
    
    return localSheet;
  }
  
  public Node.PropertySet[] getPropertySets()
  {
    Sheet localSheet = getSheet();
    
    return localSheet.toArray();
  }
  
  boolean propertySetsAreKnown()
  {
    return sheet != null;
  }
  
  public Transferable clipboardCopy()
    throws IOException
  {
    return NodeTransfer.transferable(this, 1);
  }
  
  public Transferable clipboardCut()
    throws IOException
  {
    return NodeTransfer.transferable(this, 4);
  }
  
  public Transferable drag()
    throws IOException
  {
    return clipboardCopy();
  }
  
  public boolean canCopy()
  {
    return true;
  }
  
  public boolean canCut()
  {
    return false;
  }
  
  protected void createPasteTypes(Transferable paramTransferable, List<PasteType> paramList)
  {
    NodeTransfer.Paste localPaste = NodeTransfer.findPaste(paramTransferable);
    if (localPaste != null) {
      paramList.addAll(Arrays.asList(localPaste.types(this)));
    }
  }
  
  public final PasteType[] getPasteTypes(Transferable paramTransferable)
  {
    LinkedList localLinkedList = new LinkedList();
    createPasteTypes(paramTransferable, localLinkedList);
    
    return (PasteType[])localLinkedList.toArray(NO_PASTE_TYPES);
  }
  
  public PasteType getDropType(Transferable paramTransferable, int paramInt1, int paramInt2)
  {
    LinkedList localLinkedList = new LinkedList();
    createPasteTypes(paramTransferable, localLinkedList);
    
    return localLinkedList.isEmpty() ? null : (PasteType)localLinkedList.get(0);
  }
  
  public NewType[] getNewTypes()
  {
    return NO_NEW_TYPES;
  }
  
  private boolean overridesAMethod(String paramString, Class[] paramArrayOfClass)
  {
    try
    {
      Method localMethod = getClass().getMethod(paramString, paramArrayOfClass);
      if (localMethod.getDeclaringClass() != AbstractNode.class) {
        return true;
      }
    }
    catch (NoSuchMethodException localNoSuchMethodException)
    {
      Exceptions.printStackTrace(localNoSuchMethodException);
    }
    return false;
  }
  
  public Action getPreferredAction()
  {
    boolean bool = false;
    
    Class localClass = getClass();
    if (localClass != AbstractNode.class) {
      synchronized (overridesGetDefaultAction)
      {
        Object localObject1 = overridesGetDefaultAction.get(localClass);
        if (localObject1 == this)
        {
          overridesGetDefaultAction.put(localClass, Boolean.FALSE);
          
          return preferredAction;
        }
        Boolean localBoolean;
        if (localObject1 == null)
        {
          localBoolean = overridesAMethod("getDefaultAction", new Class[0]) ? Boolean.TRUE : Boolean.FALSE;
          if (localBoolean.booleanValue())
          {
            overridesGetDefaultAction.put(localClass, this);
            getDefaultAction();
            if (overridesGetDefaultAction.get(localClass) == this) {
              overridesGetDefaultAction.put(localClass, localBoolean);
            }
          }
          else
          {
            overridesGetDefaultAction.put(localClass, localBoolean);
          }
        }
        else
        {
          localBoolean = (Boolean)localObject1;
        }
        bool = localBoolean.booleanValue();
      }
    }
    return bool ? getDefaultAction() : preferredAction;
  }
  
  @Deprecated
  public SystemAction getDefaultAction()
  {
    Action localAction = getPreferredAction();
    if ((localAction instanceof SystemAction)) {
      return (SystemAction)localAction;
    }
    return null;
  }
  
  @Deprecated
  public void setDefaultAction(SystemAction paramSystemAction)
  {
    preferredAction = paramSystemAction;
  }
  
  @Deprecated
  public SystemAction[] getActions()
  {
    if (systemActions == null)
    {
      systemActions = createActions();
      if (systemActions == null) {
        systemActions = super.getActions();
      }
    }
    return systemActions;
  }
  
  @Deprecated
  protected SystemAction[] createActions()
  {
    return null;
  }
  
  public boolean hasCustomizer()
  {
    return false;
  }
  
  public Component getCustomizer()
  {
    return null;
  }
  
  @Deprecated
  protected final synchronized void setCookieSet(CookieSet paramCookieSet)
  {
    if (internalLookup(false) != null) {
      throw new IllegalStateException("CookieSet cannot be used when lookup is associated with the node");
    }
    if (sheetCookieL == null) {
      sheetCookieL = new SheetAndCookieListener();
    }
    CookieSet localCookieSet = (CookieSet)lookup;
    if (localCookieSet != null) {
      localCookieSet.removeChangeListener(sheetCookieL);
    }
    paramCookieSet.addChangeListener(sheetCookieL);
    lookup = paramCookieSet;
    
    fireCookieChange();
  }
  
  protected final CookieSet getCookieSet()
  {
    if (internalLookup(false) != null) {
      throw new IllegalStateException("CookieSet cannot be used when lookup is associated with the node");
    }
    CookieSet localCookieSet = (CookieSet)lookup;
    if (localCookieSet != null) {
      return localCookieSet;
    }
    synchronized (this)
    {
      if (lookup != null) {
        return (CookieSet)lookup;
      }
      setCookieSet(new CookieSet());
      
      return (CookieSet)lookup;
    }
  }
  
  public <T extends Node.Cookie> T getCookie(Class<T> paramClass)
  {
    if ((lookup instanceof CookieSet))
    {
      CookieSet localCookieSet = (CookieSet)lookup;
      
      return localCookieSet.getCookie(paramClass);
    }
    return super.getCookie(paramClass);
  }
  
  public Node.Handle getHandle()
  {
    return DefaultHandle.createHandle(this);
  }
  
  private final class SheetAndCookieListener
    implements PropertyChangeListener, ChangeListener
  {
    SheetAndCookieListener() {}
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      firePropertySetsChange(null, null);
    }
    
    public void stateChanged(ChangeEvent paramChangeEvent)
    {
      fireCookieChange();
    }
  }
}

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

import java.awt.EventQueue;
import java.util.Collections;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.util.RequestProcessor;
import org.openide.util.RequestProcessor.Task;

final class AsynchChildren<T>
  extends Children.Keys<Object>
  implements ChildFactory.Observer, Runnable
{
  private final ChildFactory<T> factory;
  private final RequestProcessor.Task task;
  private static final RequestProcessor PROC = new RequestProcessor("Asynch children creator ", 4, true);
  private static final Logger logger = Logger.getLogger(AsynchChildren.class.getName());
  
  AsynchChildren(ChildFactory<T> paramChildFactory)
  {
    paramChildFactory.setObserver(this);
    factory = paramChildFactory;
    task = PROC.create(this, true);
  }
  
  volatile boolean initialized = false;
  
  protected void addNotify()
  {
    logger.log(Level.FINER, "addNotify on {0}", new Object[] { this });
    if (((!initialized) && (task.isFinished())) || (cancelled))
    {
      cancelled = false;
      Node localNode = factory.getWaitNode();
      if (localNode != null) {
        setKeys(new Object[] { localNode });
      }
      task.schedule(0);
    }
  }
  
  protected void removeNotify()
  {
    logger.log(Level.FINER, "removeNotify on {0}", new Object[] { this });
    try
    {
      cancelled = true;
      task.cancel();
      initialized = false;
      setKeys(Collections.emptyList());
    }
    finally
    {
      synchronized (notifyLock)
      {
        if (notified) {
          factory.removeNotify();
        }
      }
    }
  }
  
  public void refresh(boolean paramBoolean)
  {
    paramBoolean &= !EventQueue.isDispatchThread();
    logger.log(Level.FINE, "Refresh on {0} immediate {1}", new Object[] { this, Boolean.valueOf(paramBoolean) });
    if (logger.isLoggable(Level.FINEST)) {
      logger.log(Level.FINEST, "Refresh: ", new Exception());
    }
    if (paramBoolean)
    {
      LinkedList localLinkedList = new LinkedList();
      boolean bool;
      do
      {
        bool = factory.createKeys(localLinkedList);
      } while (!bool);
      setKeys(localLinkedList);
    }
    else
    {
      task.schedule(0);
    }
  }
  
  public Node[] getNodes(boolean paramBoolean)
  {
    Node[] arrayOfNode = super.getNodes();
    if (paramBoolean)
    {
      task.waitFinished();
      arrayOfNode = super.getNodes();
    }
    return arrayOfNode;
  }
  
  public Node findChild(String paramString)
  {
    Node[] arrayOfNode = getNodes(true);
    return super.findChild(paramString);
  }
  
  protected Node[] createNodes(Object paramObject)
  {
    if (ChildFactory.isWaitNode(paramObject)) {
      return new Node[] { (Node)paramObject };
    }
    return factory.createNodesForKey(paramObject);
  }
  
  volatile boolean cancelled = false;
  volatile boolean notified;
  private final Object notifyLock = new Object();
  
  public void run()
  {
    boolean bool1 = (cancelled) || (Thread.interrupted());
    logger.log(Level.FINE, "Running background children creation on {0} fail = {1}", new Object[] { this, Boolean.valueOf(bool1) });
    if (bool1)
    {
      setKeys(Collections.emptyList());
      return;
    }
    LinkedList localLinkedList = new LinkedList();
    boolean bool2;
    do
    {
      synchronized (notifyLock)
      {
        if (!notified)
        {
          notified = true;
          factory.addNotify();
        }
      }
      if ((cancelled) || (Thread.interrupted()))
      {
        setKeys(Collections.emptyList());
        return;
      }
      bool2 = factory.createKeys(localLinkedList);
      if ((cancelled) || (Thread.interrupted()))
      {
        setKeys(Collections.emptyList());
        return;
      }
      setKeys(new LinkedList(localLinkedList));
    } while ((!bool2) && (!Thread.interrupted()) && (!cancelled));
    initialized = bool2;
  }
  
  public String toString()
  {
    return super.toString() + "[" + factory + "]";
  }
}

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

import java.beans.IntrospectionException;

class BeanChildren$BeanFactory
  implements BeanChildren.Factory
{
  public Node createNode(Object paramObject)
    throws IntrospectionException
  {
    return new BeanNode(paramObject);
  }
}

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

import java.beans.beancontext.BeanContext;
import java.beans.beancontext.BeanContextMembershipEvent;
import java.beans.beancontext.BeanContextMembershipListener;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

final class BeanChildren$ContextL
  extends NodeAdapter
  implements BeanContextMembershipListener
{
  private WeakReference<BeanChildren> ref;
  
  BeanChildren$ContextL() {}
  
  BeanChildren$ContextL(BeanChildren paramBeanChildren)
  {
    ref = new WeakReference(paramBeanChildren);
  }
  
  public void childrenAdded(BeanContextMembershipEvent paramBeanContextMembershipEvent)
  {
    BeanChildren localBeanChildren = (BeanChildren)ref.get();
    if (localBeanChildren != null) {
      localBeanChildren.updateKeys();
    }
  }
  
  public void childrenRemoved(BeanContextMembershipEvent paramBeanContextMembershipEvent)
  {
    BeanChildren localBeanChildren = (BeanChildren)ref.get();
    if (localBeanChildren != null) {
      localBeanChildren.updateKeys();
    }
  }
  
  public void nodeDestroyed(NodeEvent paramNodeEvent)
  {
    Node localNode = paramNodeEvent.getNode();
    Reference[] arrayOfReference;
    synchronized (BeanChildren.access$000())
    {
      arrayOfReference = (Reference[])BeanChildren.access$000().get(localNode);
    }
    if (arrayOfReference != null)
    {
      ??? = (BeanContext)arrayOfReference[0].get();
      if (??? != null)
      {
        Object localObject2 = arrayOfReference[1].get();
        if (localObject2 != null) {
          try
          {
            ((BeanContext)???).remove(localObject2);
          }
          catch (RuntimeException localRuntimeException)
          {
            Logger.getLogger(BeanChildren.class.getName()).log(Level.WARNING, null, localRuntimeException);
          }
        }
      }
    }
  }
}

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

import java.beans.IntrospectionException;

public abstract interface BeanChildren$Factory
{
  public abstract Node createNode(Object paramObject)
    throws IntrospectionException;
}

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

import java.beans.IntrospectionException;
import java.beans.beancontext.BeanContext;
import java.beans.beancontext.BeanContextMembershipEvent;
import java.beans.beancontext.BeanContextMembershipListener;
import java.beans.beancontext.BeanContextSupport;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

public class BeanChildren
  extends Children.Keys
{
  private static final Factory DEFAULT_FACTORY = new BeanFactory();
  private static final Map<Node, Reference[]> nodes2Beans = new WeakHashMap();
  private BeanContext bean;
  private Factory factory;
  private ContextL contextL;
  
  public BeanChildren(BeanContext paramBeanContext)
  {
    this(paramBeanContext, DEFAULT_FACTORY);
  }
  
  public BeanChildren(BeanContext paramBeanContext, Factory paramFactory)
  {
    bean = paramBeanContext;
    factory = paramFactory;
  }
  
  final void updateKeys()
  {
    setKeys(bean.toArray());
  }
  
  protected Node[] createNodes(Object paramObject)
  {
    try
    {
      if ((paramObject instanceof BeanContextSupport))
      {
        localObject1 = (BeanContextSupport)paramObject;
        if ((bean.contains(((BeanContextSupport)localObject1).getBeanContextPeer())) && (localObject1 != ((BeanContextSupport)localObject1).getBeanContextPeer())) {
          return new Node[0];
        }
      }
      Object localObject1 = factory.createNode(paramObject);
      synchronized (nodes2Beans)
      {
        nodes2Beans.put(localObject1, new Reference[] { new WeakReference(bean), new WeakReference(paramObject) });
      }
      ((Node)localObject1).addNodeListener(contextL);
      
      return new Node[] { localObject1 };
    }
    catch (IntrospectionException localIntrospectionException)
    {
      Logger.getLogger(BeanChildren.class.getName()).log(Level.WARNING, null, localIntrospectionException);
    }
    return new Node[0];
  }
  
  protected void addNotify()
  {
    contextL = new ContextL(this);
    bean.addBeanContextMembershipListener(contextL);
    
    updateKeys();
  }
  
  protected void removeNotify()
  {
    if (contextL != null) {
      bean.removeBeanContextMembershipListener(contextL);
    }
    contextL = null;
    
    setKeys(Collections.emptySet());
  }
  
  public static abstract interface Factory
  {
    public abstract Node createNode(Object paramObject)
      throws IntrospectionException;
  }
  
  private static class BeanFactory
    implements BeanChildren.Factory
  {
    public Node createNode(Object paramObject)
      throws IntrospectionException
    {
      return new BeanNode(paramObject);
    }
  }
  
  private static final class ContextL
    extends NodeAdapter
    implements BeanContextMembershipListener
  {
    private WeakReference<BeanChildren> ref;
    
    ContextL() {}
    
    ContextL(BeanChildren paramBeanChildren)
    {
      ref = new WeakReference(paramBeanChildren);
    }
    
    public void childrenAdded(BeanContextMembershipEvent paramBeanContextMembershipEvent)
    {
      BeanChildren localBeanChildren = (BeanChildren)ref.get();
      if (localBeanChildren != null) {
        localBeanChildren.updateKeys();
      }
    }
    
    public void childrenRemoved(BeanContextMembershipEvent paramBeanContextMembershipEvent)
    {
      BeanChildren localBeanChildren = (BeanChildren)ref.get();
      if (localBeanChildren != null) {
        localBeanChildren.updateKeys();
      }
    }
    
    public void nodeDestroyed(NodeEvent paramNodeEvent)
    {
      Node localNode = paramNodeEvent.getNode();
      Reference[] arrayOfReference;
      synchronized (BeanChildren.nodes2Beans)
      {
        arrayOfReference = (Reference[])BeanChildren.nodes2Beans.get(localNode);
      }
      if (arrayOfReference != null)
      {
        ??? = (BeanContext)arrayOfReference[0].get();
        if (??? != null)
        {
          Object localObject2 = arrayOfReference[1].get();
          if (localObject2 != null) {
            try
            {
              ((BeanContext)???).remove(localObject2);
            }
            catch (RuntimeException localRuntimeException)
            {
              Logger.getLogger(BeanChildren.class.getName()).log(Level.WARNING, null, localRuntimeException);
            }
          }
        }
      }
    }
  }
}

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

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

class BeanNode$1
  implements PropertyChangeListener
{
  BeanNode$1(BeanNode paramBeanNode) {}
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    this$0.firePropertyChange(paramPropertyChangeEvent.getPropertyName(), paramPropertyChangeEvent.getOldValue(), paramPropertyChangeEvent.getNewValue());
  }
}

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

import java.util.ArrayList;

public final class BeanNode$Descriptor
{
  public final Node.Property[] property;
  public final Node.Property[] expert;
  public final Node.Property[] hidden;
  
  BeanNode$Descriptor(ArrayList<Node.Property> paramArrayList1, ArrayList<Node.Property> paramArrayList2, ArrayList<Node.Property> paramArrayList3)
  {
    property = new Node.Property[paramArrayList1.size()];
    paramArrayList1.toArray(property);
    
    expert = new Node.Property[paramArrayList2.size()];
    paramArrayList2.toArray(expert);
    
    hidden = new Node.Property[paramArrayList3.size()];
    paramArrayList3.toArray(hidden);
  }
}

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

import java.beans.BeanInfo;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyDescriptor;

final class BeanNode$PropL
  implements PropertyChangeListener
{
  BeanNode$PropL(BeanNode paramBeanNode) {}
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    String str = paramPropertyChangeEvent.getPropertyName();
    Object localObject;
    if (str == null)
    {
      this$0.firePropertyChange(null, paramPropertyChangeEvent.getOldValue(), paramPropertyChangeEvent.getNewValue());
    }
    else
    {
      localObject = BeanNode.access$000(this$0).getPropertyDescriptors();
      for (int i = 0; i < localObject.length; i++) {
        if (!localObject[i].isHidden()) {
          if (str.equals(localObject[i].getName()))
          {
            this$0.firePropertyChange(paramPropertyChangeEvent.getPropertyName(), paramPropertyChangeEvent.getOldValue(), paramPropertyChangeEvent.getNewValue());
            
            break;
          }
        }
      }
    }
    if ((BeanNode.access$100(this$0)) && (
      (str == null) || (str.equals("name")) || (str.equals("displayName"))))
    {
      localObject = BeanNode.access$200(this$0);
      if (!((String)localObject).equals(this$0.getName())) {
        this$0.setNameSilently((String)localObject);
      }
    }
  }
}

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

import java.awt.Component;
import java.awt.Image;
import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.Beans;
import java.beans.Customizer;
import java.beans.EventSetDescriptor;
import java.beans.IndexedPropertyDescriptor;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyDescriptor;
import java.beans.beancontext.BeanContext;
import java.beans.beancontext.BeanContextChild;
import java.beans.beancontext.BeanContextProxy;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import org.openide.util.Exceptions;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.Utilities;
import org.openide.util.WeakListeners;
import org.openide.util.actions.SystemAction;

public class BeanNode<T>
  extends AbstractNode
{
  private static final String ICON_BASE = "org/openide/nodes/beans.gif";
  private final T bean;
  private BeanInfo beanInfo;
  private Method nameGetter = null;
  private Method nameSetter = null;
  private Method removePCLMethod = null;
  private BeanNode<T>.PropL propertyChangeListener = null;
  private boolean synchronizeName;
  
  public BeanNode(T paramT)
    throws IntrospectionException
  {
    this(paramT, null, null);
  }
  
  protected BeanNode(T paramT, Children paramChildren)
    throws IntrospectionException
  {
    this(paramT, paramChildren, null);
  }
  
  protected BeanNode(T paramT, Children paramChildren, Lookup paramLookup)
    throws IntrospectionException
  {
    super(paramChildren == null ? getChildren(paramT) : paramChildren, paramLookup);
    if (paramT == null) {
      throw new NullPointerException("cannot make a node for a null bean");
    }
    bean = paramT;
    try
    {
      initialization(paramLookup != null);
    }
    catch (IntrospectionException localIntrospectionException)
    {
      throw localIntrospectionException;
    }
    catch (RuntimeException localRuntimeException)
    {
      throw mkie(localRuntimeException);
    }
    catch (LinkageError localLinkageError)
    {
      throw mkie(localLinkageError);
    }
  }
  
  private static Children getChildren(Object paramObject)
  {
    if ((paramObject instanceof BeanContext)) {
      return new BeanChildren((BeanContext)paramObject);
    }
    if ((paramObject instanceof BeanContextProxy))
    {
      BeanContextChild localBeanContextChild = ((BeanContextProxy)paramObject).getBeanContextProxy();
      if ((localBeanContextChild instanceof BeanContext)) {
        return new BeanChildren((BeanContext)localBeanContextChild);
      }
    }
    return Children.LEAF;
  }
  
  private static IntrospectionException mkie(Throwable paramThrowable)
  {
    return (IntrospectionException)new IntrospectionException(paramThrowable.toString()).initCause(paramThrowable);
  }
  
  protected void setSynchronizeName(boolean paramBoolean)
  {
    synchronizeName = paramBoolean;
  }
  
  protected T getBean()
  {
    return (T)bean;
  }
  
  public void destroy()
    throws IOException
  {
    if (removePCLMethod != null) {
      try
      {
        Object localObject = Beans.getInstanceOf(bean, removePCLMethod.getDeclaringClass());
        removePCLMethod.invoke(localObject, new Object[] { propertyChangeListener });
      }
      catch (Exception localException)
      {
        NodeOp.exception(localException);
      }
    }
    super.destroy();
  }
  
  public boolean canDestroy()
  {
    return true;
  }
  
  public void setName(String paramString)
  {
    if (synchronizeName)
    {
      Method localMethod = nameSetter;
      if (localMethod != null) {
        try
        {
          localMethod.invoke(bean, new Object[] { paramString });
        }
        catch (Exception localException)
        {
          NodeOp.exception(localException);
        }
      }
    }
    super.setName(paramString);
  }
  
  public boolean canRename()
  {
    return (!synchronizeName) || (nameSetter != null);
  }
  
  public Image getIcon(int paramInt)
  {
    Image localImage = beanInfo.getIcon(paramInt);
    if (localImage != null) {
      return localImage;
    }
    return super.getIcon(paramInt);
  }
  
  public Image getOpenedIcon(int paramInt)
  {
    return getIcon(paramInt);
  }
  
  public HelpCtx getHelpCtx()
  {
    HelpCtx localHelpCtx = HelpCtx.findHelp(bean);
    if (localHelpCtx != HelpCtx.DEFAULT_HELP) {
      return localHelpCtx;
    }
    return new HelpCtx(BeanNode.class);
  }
  
  protected void createProperties(T paramT, BeanInfo paramBeanInfo)
  {
    Descriptor localDescriptor = computeProperties(paramT, paramBeanInfo);
    
    Sheet localSheet = getSheet();
    Sheet.Set localSet1 = Sheet.createPropertiesSet();
    localSet1.put(property);
    
    BeanDescriptor localBeanDescriptor = paramBeanInfo.getBeanDescriptor();
    if ((localBeanDescriptor != null) && (localBeanDescriptor.getValue("propertiesHelpID") != null)) {
      localSet1.setValue("helpID", localBeanDescriptor.getValue("propertiesHelpID"));
    }
    localSheet.put(localSet1);
    if (expert.length != 0)
    {
      Sheet.Set localSet2 = Sheet.createExpertSet();
      localSet2.put(expert);
      if ((localBeanDescriptor != null) && (localBeanDescriptor.getValue("expertHelpID") != null)) {
        localSet2.setValue("helpID", localBeanDescriptor.getValue("expertHelpID"));
      }
      localSheet.put(localSet2);
    }
  }
  
  public boolean canCopy()
  {
    return true;
  }
  
  public boolean canCut()
  {
    return false;
  }
  
  public Action[] getActions(boolean paramBoolean)
  {
    return NodeOp.createFromNames(new String[] { "Copy", null, "Tools", "Properties" });
  }
  
  public boolean hasCustomizer()
  {
    return beanInfo.getBeanDescriptor().getCustomizerClass() != null;
  }
  
  public Component getCustomizer()
  {
    Class localClass = beanInfo.getBeanDescriptor().getCustomizerClass();
    if (localClass == null) {
      return null;
    }
    Object localObject1;
    try
    {
      localObject1 = localClass.newInstance();
    }
    catch (InstantiationException localInstantiationException)
    {
      NodeOp.exception(localInstantiationException);
      
      return null;
    }
    catch (Illeg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

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