org-openide-windows

16:40:47.824 INFO  jd.cli.Main - Decompiling org-openide-windows.jar
package org.netbeans.modules.openide.windows;

import javax.swing.ActionMap;

final class GlobalActionContextImpl$1
  implements Runnable
{
  GlobalActionContextImpl$1(ActionMap paramActionMap) {}
  
  public void run()
  {
    GlobalActionContextImpl.blickActionMapImpl(val$map);
  }
}

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

import java.awt.EventQueue;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.ActionMap;
import org.openide.util.ContextGlobalProvider;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Provider;
import org.openide.util.Utilities;
import org.openide.util.lookup.Lookups;
import org.openide.util.lookup.ProxyLookup;
import org.openide.windows.TopComponent;
import org.openide.windows.TopComponent.Registry;

public final class GlobalActionContextImpl
  implements ContextGlobalProvider, Lookup.Provider, PropertyChangeListener
{
  private TopComponent.Registry registry;
  private static volatile Lookup temporary;
  
  public GlobalActionContextImpl()
  {
    this(TopComponent.getRegistry());
  }
  
  public GlobalActionContextImpl(TopComponent.Registry paramRegistry)
  {
    registry = paramRegistry;
  }
  
  public static void blickActionMap(ActionMap paramActionMap)
  {
    if (EventQueue.isDispatchThread()) {
      blickActionMapImpl(paramActionMap);
    } else {
      EventQueue.invokeLater(new Runnable()
      {
        public void run()
        {
          GlobalActionContextImpl.blickActionMapImpl(val$map);
        }
      });
    }
  }
  
  static void blickActionMapImpl(ActionMap paramActionMap)
  {
    assert (EventQueue.isDispatchThread());
    Object localObject1 = Lookup.getDefault().lookup(ContextGlobalProvider.class);
    if ((localObject1 instanceof GlobalActionContextImpl))
    {
      GlobalActionContextImpl localGlobalActionContextImpl = (GlobalActionContextImpl)localObject1;
      
      Lookup[] arrayOfLookup = { Lookups.singleton(paramActionMap), Lookups.exclude(localGlobalActionContextImpl.getLookup(), new Class[] { ActionMap.class }) };
      
      Lookup localLookup = temporary;
      try
      {
        temporary = new ProxyLookup(arrayOfLookup);
        Object localObject2 = Utilities.actionsGlobalContext().lookup(ActionMap.class);
        if ((!$assertionsDisabled) && (localObject2 != paramActionMap)) {
          throw new AssertionError("We really get map from the lookup. Map: " + paramActionMap + " returned: " + localObject2);
        }
      }
      finally
      {
        temporary = localLookup;
        
        Utilities.actionsGlobalContext().lookup(ActionMap.class);
      }
    }
  }
  
  public Lookup createGlobalContext()
  {
    registry.addPropertyChangeListener(this);
    return Lookups.proxy(this);
  }
  
  public Lookup getLookup()
  {
    Lookup localLookup = temporary;
    if (localLookup != null) {
      return localLookup;
    }
    TopComponent localTopComponent = registry.getActivated();
    return localTopComponent == null ? Lookup.EMPTY : localTopComponent.getLookup();
  }
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    if ("activated".equals(paramPropertyChangeEvent.getPropertyName())) {
      Utilities.actionsGlobalContext().lookup(ActionMap.class);
    }
  }
}

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

class CloneableOpenSupport$1
  implements Runnable
{
  CloneableOpenSupport$1(CloneableOpenSupport paramCloneableOpenSupport) {}
  
  public void run()
  {
    CloneableTopComponent localCloneableTopComponent = this$0.openCloneableTopComponent();
    localCloneableTopComponent.requestActive();
  }
}

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

import java.util.Enumeration;
import org.openide.util.Mutex.Action;

class CloneableOpenSupport$2
  implements Mutex.Action<Boolean>
{
  CloneableOpenSupport$2(CloneableOpenSupport paramCloneableOpenSupport, boolean paramBoolean) {}
  
  public Boolean run()
  {
    synchronized (CloneableOpenSupport.access$000(this$0))
    {
      if ((val$ask) && (!this$0.canClose())) {
        return Boolean.FALSE;
      }
      Enumeration localEnumeration = this$0.allEditors.getComponents();
      while (localEnumeration.hasMoreElements())
      {
        TopComponent localTopComponent = (TopComponent)localEnumeration.nextElement();
        if (!localTopComponent.close()) {
          return Boolean.FALSE;
        }
      }
    }
    return Boolean.TRUE;
  }
}

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

import java.beans.PropertyChangeListener;
import java.beans.VetoableChangeListener;
import java.io.IOException;
import java.io.Serializable;

public abstract interface CloneableOpenSupport$Env
  extends Serializable
{
  public static final String PROP_VALID = "valid";
  public static final String PROP_MODIFIED = "modified";
  
  public abstract void addPropertyChangeListener(PropertyChangeListener paramPropertyChangeListener);
  
  public abstract void removePropertyChangeListener(PropertyChangeListener paramPropertyChangeListener);
  
  public abstract void addVetoableChangeListener(VetoableChangeListener paramVetoableChangeListener);
  
  public abstract void removeVetoableChangeListener(VetoableChangeListener paramVetoableChangeListener);
  
  public abstract boolean isValid();
  
  public abstract boolean isModified();
  
  public abstract void markModified()
    throws IOException;
  
  public abstract void unmarkModified();
  
  public abstract CloneableOpenSupport findCloneableOpenSupport();
}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import org.openide.util.Mutex;

final class CloneableOpenSupport$Listener
  extends CloneableTopComponent.Ref
  implements PropertyChangeListener, VetoableChangeListener, Runnable
{
  static final long serialVersionUID = -1934890789745432531L;
  private CloneableOpenSupport.Env env;
  
  public CloneableOpenSupport$Listener(CloneableOpenSupport.Env paramEnv)
  {
    env = paramEnv;
  }
  
  private CloneableOpenSupport support()
  {
    return env.findCloneableOpenSupport();
  }
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    if ("valid".equals(paramPropertyChangeEvent.getPropertyName()))
    {
      if (Boolean.FALSE.equals(paramPropertyChangeEvent.getOldValue())) {
        return;
      }
      Mutex.EVENT.readAccess(this);
    }
  }
  
  public void run()
  {
    CloneableOpenSupport localCloneableOpenSupport = support();
    if (localCloneableOpenSupport != null)
    {
      env.unmarkModified();
      
      localCloneableOpenSupport.close(false);
    }
  }
  
  public void vetoableChange(PropertyChangeEvent paramPropertyChangeEvent)
    throws PropertyVetoException
  {
    if ("valid".equals(paramPropertyChangeEvent.getPropertyName()))
    {
      if (Boolean.FALSE.equals(paramPropertyChangeEvent.getOldValue())) {
        return;
      }
      if (env.isModified())
      {
        CloneableOpenSupport localCloneableOpenSupport = support();
        if ((localCloneableOpenSupport != null) && (!localCloneableOpenSupport.canClose())) {
          throw new PropertyVetoException("", paramPropertyChangeEvent);
        }
      }
    }
  }
  
  public Object readResolve()
  {
    CloneableOpenSupport localCloneableOpenSupport = support();
    if (localCloneableOpenSupport == null) {
      return this;
    }
    return allEditors;
  }
}

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

import java.awt.Container;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.io.IOException;
import java.io.Serializable;
import java.util.Enumeration;
import org.openide.awt.StatusDisplayer;
import org.openide.util.Mutex;
import org.openide.util.Mutex.Action;
import org.openide.util.WeakListeners;

public abstract class CloneableOpenSupport
{
  private static Container container;
  protected Env env;
  protected CloneableTopComponent.Ref allEditors;
  
  public CloneableOpenSupport(Env paramEnv)
  {
    env = paramEnv;
    
    Listener localListener = new Listener(paramEnv);
    allEditors = localListener;
    
    paramEnv.addPropertyChangeListener(WeakListeners.propertyChange(localListener, paramEnv));
    
    paramEnv.addVetoableChangeListener(WeakListeners.vetoableChange(localListener, paramEnv));
  }
  
  public void open()
  {
    Mutex.EVENT.writeAccess(new Runnable()
    {
      public void run()
      {
        CloneableTopComponent localCloneableTopComponent = openCloneableTopComponent();
        localCloneableTopComponent.requestActive();
      }
    });
  }
  
  public void view()
  {
    open();
  }
  
  public void edit()
  {
    open();
  }
  
  public boolean close()
  {
    return close(true);
  }
  
  protected boolean close(final boolean paramBoolean)
  {
    if (allEditors.isEmpty()) {
      return true;
    }
    Boolean localBoolean = (Boolean)Mutex.EVENT.writeAccess(new Mutex.Action()
    {
      public Boolean run()
      {
        synchronized (CloneableOpenSupport.this.getLock())
        {
          if ((paramBoolean) && (!canClose())) {
            return Boolean.FALSE;
          }
          Enumeration localEnumeration = allEditors.getComponents();
          while (localEnumeration.hasMoreElements())
          {
            TopComponent localTopComponent = (TopComponent)localEnumeration.nextElement();
            if (!localTopComponent.close()) {
              return Boolean.FALSE;
            }
          }
        }
        return Boolean.TRUE;
      }
    });
    return localBoolean.booleanValue();
  }
  
  protected boolean canClose()
  {
    return true;
  }
  
  protected final CloneableTopComponent openCloneableTopComponent()
  {
    synchronized (getLock())
    {
      CloneableTopComponent localCloneableTopComponent1 = allEditors.getArbitraryComponent();
      if (localCloneableTopComponent1 != null)
      {
        localCloneableTopComponent1.open();
        
        return localCloneableTopComponent1;
      }
      String str = messageOpening();
      if (str != null) {
        StatusDisplayer.getDefault().setStatusText(str);
      }
      CloneableTopComponent localCloneableTopComponent2 = createCloneableTopComponent();
      localCloneableTopComponent2.setReference(allEditors);
      localCloneableTopComponent2.open();
      
      str = messageOpened();
      if (str == null) {
        str = "";
      }
      StatusDisplayer.getDefault().setStatusText(str);
      
      return localCloneableTopComponent2;
    }
  }
  
  private Object getLock()
  {
    if (container == null) {
      container = new Container();
    }
    return container.getTreeLock();
  }
  
  protected abstract CloneableTopComponent createCloneableTopComponent();
  
  protected abstract String messageOpening();
  
  protected abstract String messageOpened();
  
  private static final class Listener
    extends CloneableTopComponent.Ref
    implements PropertyChangeListener, VetoableChangeListener, Runnable
  {
    static final long serialVersionUID = -1934890789745432531L;
    private CloneableOpenSupport.Env env;
    
    public Listener(CloneableOpenSupport.Env paramEnv)
    {
      env = paramEnv;
    }
    
    private CloneableOpenSupport support()
    {
      return env.findCloneableOpenSupport();
    }
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      if ("valid".equals(paramPropertyChangeEvent.getPropertyName()))
      {
        if (Boolean.FALSE.equals(paramPropertyChangeEvent.getOldValue())) {
          return;
        }
        Mutex.EVENT.readAccess(this);
      }
    }
    
    public void run()
    {
      CloneableOpenSupport localCloneableOpenSupport = support();
      if (localCloneableOpenSupport != null)
      {
        env.unmarkModified();
        
        localCloneableOpenSupport.close(false);
      }
    }
    
    public void vetoableChange(PropertyChangeEvent paramPropertyChangeEvent)
      throws PropertyVetoException
    {
      if ("valid".equals(paramPropertyChangeEvent.getPropertyName()))
      {
        if (Boolean.FALSE.equals(paramPropertyChangeEvent.getOldValue())) {
          return;
        }
        if (env.isModified())
        {
          CloneableOpenSupport localCloneableOpenSupport = support();
          if ((localCloneableOpenSupport != null) && (!localCloneableOpenSupport.canClose())) {
            throw new PropertyVetoException("", paramPropertyChangeEvent);
          }
        }
      }
    }
    
    public Object readResolve()
    {
      CloneableOpenSupport localCloneableOpenSupport = support();
      if (localCloneableOpenSupport == null) {
        return this;
      }
      return allEditors;
    }
  }
  
  public static abstract interface Env
    extends Serializable
  {
    public static final String PROP_VALID = "valid";
    public static final String PROP_MODIFIED = "modified";
    
    public abstract void addPropertyChangeListener(PropertyChangeListener paramPropertyChangeListener);
    
    public abstract void removePropertyChangeListener(PropertyChangeListener paramPropertyChangeListener);
    
    public abstract void addVetoableChangeListener(VetoableChangeListener paramVetoableChangeListener);
    
    public abstract void removeVetoableChangeListener(VetoableChangeListener paramVetoableChangeListener);
    
    public abstract boolean isValid();
    
    public abstract boolean isModified();
    
    public abstract void markModified()
      throws IOException;
    
    public abstract void unmarkModified();
    
    public abstract CloneableOpenSupport findCloneableOpenSupport();
  }
}

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

class CloneableTopComponent$1 {}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Set;

class CloneableTopComponent$Ref$1
  implements PropertyChangeListener
{
  CloneableTopComponent$Ref$1(CloneableTopComponent.Ref paramRef) {}
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    Object localObject1 = paramPropertyChangeEvent.getNewValue();
    Object localObject2 = paramPropertyChangeEvent.getOldValue();
    int i = 0;
    synchronized (CloneableTopComponent.Ref.access$400())
    {
      i = (CloneableTopComponent.Ref.access$500(this$0).contains(localObject1)) && (CloneableTopComponent.Ref.access$500(this$0).contains(localObject2)) ? 1 : 0;
    }
    if (i != 0)
    {
      CloneableTopComponent.access$600((CloneableTopComponent)localObject1);
      CloneableTopComponent.access$700((CloneableTopComponent)localObject2);
    }
  }
}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;
import org.openide.util.WeakListeners;

public class CloneableTopComponent$Ref
  implements Serializable
{
  static final long serialVersionUID = 5543148876020730556L;
  private static final Object LOCK = new Object();
  private transient Set<CloneableTopComponent> componentSet = new HashSet(7);
  private transient PropertyChangeListener myComponentSetListener;
  
  protected CloneableTopComponent$Ref()
  {
    myComponentSetListener = new PropertyChangeListener()
    {
      public void propertyChange(PropertyChangeEvent paramAnonymousPropertyChangeEvent)
      {
        Object localObject1 = paramAnonymousPropertyChangeEvent.getNewValue();
        Object localObject2 = paramAnonymousPropertyChangeEvent.getOldValue();
        int i = 0;
        synchronized (CloneableTopComponent.Ref.LOCK)
        {
          i = (componentSet.contains(localObject1)) && (componentSet.contains(localObject2)) ? 1 : 0;
        }
        if (i != 0)
        {
          CloneableTopComponent.access$600((CloneableTopComponent)localObject1);
          CloneableTopComponent.access$700((CloneableTopComponent)localObject2);
        }
      }
    };
    PropertyChangeListener localPropertyChangeListener = WeakListeners.propertyChange(myComponentSetListener, WindowManager.getDefault().getRegistry());
    
    WindowManager.getDefault().getRegistry().addPropertyChangeListener(localPropertyChangeListener);
  }
  
  private CloneableTopComponent$Ref(CloneableTopComponent paramCloneableTopComponent)
  {
    synchronized (LOCK)
    {
      componentSet.add(paramCloneableTopComponent);
    }
  }
  
  public Enumeration<CloneableTopComponent> getComponents()
  {
    HashSet localHashSet;
    synchronized (LOCK)
    {
      localHashSet = new HashSet(componentSet);
    }
    return Collections.enumeration(localHashSet);
  }
  
  /* Error */
  public boolean isEmpty()
  {
    // Byte code:
    //   0: getstatic 2	org/openide/windows/CloneableTopComponent$Ref:LOCK	Ljava/lang/Object;
    //   3: dup
    //   4: astore_1
    //   5: monitorenter
    //   6: aload_0
    //   7: getfield 1	org/openide/windows/CloneableTopComponent$Ref:componentSet	Ljava/util/Set;
    //   10: invokeinterface 20 1 0
    //   15: aload_1
    //   16: monitorexit
    //   17: ireturn
    //   18: astore_2
    //   19: aload_1
    //   20: monitorexit
    //   21: aload_2
    //   22: athrow
    // Line number table:
    //   Java source line #337	-> byte code offset #0
    //   Java source line #338	-> byte code offset #6
    //   Java source line #339	-> byte code offset #18
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	23	0	this	Ref
    //   4	16	1	Ljava/lang/Object;	Object
    //   18	4	2	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   6	17	18	finally
    //   18	21	18	finally
  }
  
  /* Error */
  /**
   * @deprecated
   */
  public CloneableTopComponent getAnyComponent()
  {
    // Byte code:
    //   0: getstatic 2	org/openide/windows/CloneableTopComponent$Ref:LOCK	Ljava/lang/Object;
    //   3: dup
    //   4: astore_1
    //   5: monitorenter
    //   6: aload_0
    //   7: getfield 1	org/openide/windows/CloneableTopComponent$Ref:componentSet	Ljava/util/Set;
    //   10: invokeinterface 21 1 0
    //   15: invokeinterface 22 1 0
    //   20: checkcast 23	org/openide/windows/CloneableTopComponent
    //   23: aload_1
    //   24: monitorexit
    //   25: areturn
    //   26: astore_2
    //   27: aload_1
    //   28: monitorexit
    //   29: aload_2
    //   30: athrow
    // Line number table:
    //   Java source line #349	-> byte code offset #0
    //   Java source line #350	-> byte code offset #6
    //   Java source line #351	-> byte code offset #26
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	31	0	this	Ref
    //   4	24	1	Ljava/lang/Object;	Object
    //   26	4	2	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   6	25	26	finally
    //   26	29	26	finally
  }
  
  public CloneableTopComponent getArbitraryComponent()
  {
    TopComponent localTopComponent = WindowManager.getDefault().getRegistry().getActivated();
    synchronized (LOCK)
    {
      if (componentSet.contains(localTopComponent)) {
        return (CloneableTopComponent)localTopComponent;
      }
      Object localObject1 = null;
      for (CloneableTopComponent localCloneableTopComponent : componentSet)
      {
        localObject1 = localCloneableTopComponent;
        if (CloneableTopComponent.access$800(localCloneableTopComponent)) {
          break;
        }
      }
      return (CloneableTopComponent)localObject1;
    }
  }
  
  private final void register(CloneableTopComponent paramCloneableTopComponent)
  {
    synchronized (LOCK)
    {
      componentSet.add(paramCloneableTopComponent);
    }
  }
  
  private final boolean unregister(CloneableTopComponent paramCloneableTopComponent)
  {
    int i;
    synchronized (LOCK)
    {
      if (!componentSet.contains(paramCloneableTopComponent)) {
        return true;
      }
      i = componentSet.size();
    }
    if ((i > 1) || (paramCloneableTopComponent.closeLast()))
    {
      removeComponent(paramCloneableTopComponent);
      
      return true;
    }
    return false;
  }
  
  private void removeComponent(CloneableTopComponent paramCloneableTopComponent)
  {
    synchronized (LOCK)
    {
      componentSet.remove(paramCloneableTopComponent);
    }
  }
  
  private void readObject(ObjectInputStream paramObjectInputStream)
    throws IOException, ClassNotFoundException
  {
    paramObjectInputStream.defaultReadObject();
    synchronized (LOCK)
    {
      componentSet = new HashSet(7);
    }
  }
}

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

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.ResourceBundle;
import java.util.Set;
import org.openide.util.NbBundle;
import org.openide.util.WeakListeners;
import org.openide.util.io.NbMarshalledObject;

public abstract class CloneableTopComponent
  extends TopComponent
  implements Externalizable, TopComponent.Cloneable
{
  static final long serialVersionUID = 4893753008783256289L;
  public static final Ref EMPTY = new Ref();
  private Ref ref;
  private boolean isLastActivated;
  
  public final Object clone()
  {
    return cloneComponent();
  }
  
  public final CloneableTopComponent cloneTopComponent()
  {
    CloneableTopComponent localCloneableTopComponent = createClonedObject();
    
    localCloneableTopComponent.setReference(getReference());
    
    return localCloneableTopComponent;
  }
  
  public final TopComponent cloneComponent()
  {
    return cloneTopComponent();
  }
  
  protected CloneableTopComponent createClonedObject()
  {
    try
    {
      NbMarshalledObject localNbMarshalledObject = new NbMarshalledObject(this);
      return (CloneableTopComponent)localNbMarshalledObject.get();
    }
    catch (IOException localIOException)
    {
      throw new AssertionError(localIOException);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new AssertionError(localClassNotFoundException);
    }
  }
  
  public final synchronized Ref getReference()
  {
    if (ref == null) {
      ref = new Ref(this, null);
    }
    return ref;
  }
  
  public final synchronized void setReference(Ref paramRef)
  {
    if (paramRef == EMPTY) {
      throw new IllegalArgumentException(NbBundle.getBundle(CloneableTopComponent.class).getString("EXC_CannotAssign"));
    }
    if (ref != null) {
      ref.removeComponent(this);
    }
    paramRef.register(this);
    
    ref = paramRef;
  }
  
  protected void componentClosed()
  {
    super.componentClosed();
    if (!isOpened()) {
      getReference().unregister(this);
    }
  }
  
  public boolean canClose()
  {
    if (!isOpened()) {
      return false;
    }
    return getReference().unregister(this);
  }
  
  public boolean canClose(Workspace paramWorkspace, boolean paramBoolean)
  {
    if (paramBoolean) {
      return getReference().unregister(this);
    }
    return true;
  }
  
  protected boolean closeLast()
  {
    return true;
  }
  
  public void readExternal(ObjectInput paramObjectInput)
    throws IOException, ClassNotFoundException
  {
    super.readExternal(paramObjectInput);
    if (serialVersion != 0)
    {
      Ref localRef = (Ref)paramObjectInput.readObject();
      if (localRef != null) {
        setReference(localRef);
      }
    }
  }
  
  public void writeExternal(ObjectOutput paramObjectOutput)
    throws IOException
  {
    super.writeExternal(paramObjectOutput);
    
    paramObjectOutput.writeObject(ref);
  }
  
  private boolean isLastActive()
  {
    return isLastActivated;
  }
  
  private void setLastActivated()
  {
    isLastActivated = true;
  }
  
  private void unsetLastActivated()
  {
    isLastActivated = false;
  }
  
  public static class Ref
    implements Serializable
  {
    static final long serialVersionUID = 5543148876020730556L;
    private static final Object LOCK = new Object();
    private transient Set<CloneableTopComponent> componentSet = new HashSet(7);
    private transient PropertyChangeListener myComponentSetListener;
    
    protected Ref()
    {
      myComponentSetListener = new PropertyChangeListener()
      {
        public void propertyChange(PropertyChangeEvent paramAnonymousPropertyChangeEvent)
        {
          Object localObject1 = paramAnonymousPropertyChangeEvent.getNewValue();
          Object localObject2 = paramAnonymousPropertyChangeEvent.getOldValue();
          int i = 0;
          synchronized (CloneableTopComponent.Ref.LOCK)
          {
            i = (componentSet.contains(localObject1)) && (componentSet.contains(localObject2)) ? 1 : 0;
          }
          if (i != 0)
          {
            ((CloneableTopComponent)localObject1).setLastActivated();
            ((CloneableTopComponent)localObject2).unsetLastActivated();
          }
        }
      };
      PropertyChangeListener localPropertyChangeListener = WeakListeners.propertyChange(myComponentSetListener, WindowManager.getDefault().getRegistry());
      
      WindowManager.getDefault().getRegistry().addPropertyChangeListener(localPropertyChangeListener);
    }
    
    private Ref(CloneableTopComponent paramCloneableTopComponent)
    {
      synchronized (LOCK)
      {
        componentSet.add(paramCloneableTopComponent);
      }
    }
    
    public Enumeration<CloneableTopComponent> getComponents()
    {
      HashSet localHashSet;
      synchronized (LOCK)
      {
        localHashSet = new HashSet(componentSet);
      }
      return Collections.enumeration(localHashSet);
    }
    
    /* Error */
    public boolean isEmpty()
    {
      // Byte code:
      //   0: getstatic 2	org/openide/windows/CloneableTopComponent$Ref:LOCK	Ljava/lang/Object;
      //   3: dup
      //   4: astore_1
      //   5: monitorenter
      //   6: aload_0
      //   7: getfield 1	org/openide/windows/CloneableTopComponent$Ref:componentSet	Ljava/util/Set;
      //   10: invokeinterface 20 1 0
      //   15: aload_1
      //   16: monitorexit
      //   17: ireturn
      //   18: astore_2
      //   19: aload_1
      //   20: monitorexit
      //   21: aload_2
      //   22: athrow
      // Line number table:
      //   Java source line #337	-> byte code offset #0
      //   Java source line #338	-> byte code offset #6
      //   Java source line #339	-> byte code offset #18
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	23	0	this	Ref
      //   4	16	1	Ljava/lang/Object;	Object
      //   18	4	2	localObject1	Object
      // Exception table:
      //   from	to	target	type
      //   6	17	18	finally
      //   18	21	18	finally
    }
    
    /* Error */
    /**
     * @deprecated
     */
    public CloneableTopComponent getAnyComponent()
    {
      // Byte code:
      //   0: getstatic 2	org/openide/windows/CloneableTopComponent$Ref:LOCK	Ljava/lang/Object;
      //   3: dup
      //   4: astore_1
      //   5: monitorenter
      //   6: aload_0
      //   7: getfield 1	org/openide/windows/CloneableTopComponent$Ref:componentSet	Ljava/util/Set;
      //   10: invokeinterface 21 1 0
      //   15: invokeinterface 22 1 0
      //   20: checkcast 23	org/openide/windows/CloneableTopComponent
      //   23: aload_1
      //   24: monitorexit
      //   25: areturn
      //   26: astore_2
      //   27: aload_1
      //   28: monitorexit
      //   29: aload_2
      //   30: athrow
      // Line number table:
      //   Java source line #349	-> byte code offset #0
      //   Java source line #350	-> byte code offset #6
      //   Java source line #351	-> byte code offset #26
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	31	0	this	Ref
      //   4	24	1	Ljava/lang/Object;	Object
      //   26	4	2	localObject1	Object
      // Exception table:
      //   from	to	target	type
      //   6	25	26	finally
      //   26	29	26	finally
    }
    
    public CloneableTopComponent getArbitraryComponent()
    {
      TopComponent localTopComponent = WindowManager.getDefault().getRegistry().getActivated();
      synchronized (LOCK)
      {
        if (componentSet.contains(localTopComponent)) {
          return (CloneableTopComponent)localTopComponent;
        }
        Object localObject1 = null;
        for (CloneableTopComponent localCloneableTopComponent : componentSet)
        {
          localObject1 = localCloneableTopComponent;
          if (localCloneableTopComponent.isLastActive()) {
            break;
          }
        }
        return (CloneableTopComponent)localObject1;
      }
    }
    
    private final void register(CloneableTopComponent paramCloneableTopComponent)
    {
      synchronized (LOCK)
      {
        componentSet.add(paramCloneableTopComponent);
      }
    }
    
    private final boolean unregister(CloneableTopComponent paramCloneableTopComponent)
    {
      int i;
      synchronized (LOCK)
      {
        if (!componentSet.contains(paramCloneableTopComponent)) {
          return true;
        }
        i = componentSet.size();
      }
      if ((i > 1) || (paramCloneableTopComponent.closeLast()))
      {
        removeComponent(paramCloneableTopComponent);
        
        return true;
      }
      return false;
    }
    
    private void removeComponent(CloneableTopComponent paramCloneableTopComponent)
    {
      synchronized (LOCK)
      {
        componentSet.remove(paramCloneableTopComponent);
      }
    }
    
    private void readObject(ObjectInputStream paramObjectInputStream)
      throws IOException, ClassNotFoundException
    {
      paramObjectInputStream.defaultReadObject();
      synchronized (LOCK)
      {
        componentSet = new HashSet(7);
      }
    }
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.openide.util.Lookup.Item;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

final class DefaultTopComponentLookup$NoNodeLookup$ExclusionResult<T>
  extends Lookup.Result<T>
  implements LookupListener
{
  private final Lookup.Result<T> delegate;
  private final Map<Object, Object> verboten;
  private final List<LookupListener> listeners = new ArrayList();
  
  public DefaultTopComponentLookup$NoNodeLookup$ExclusionResult(Lookup.Result<T> paramResult, Map<Object, Object> paramMap)
  {
    delegate = paramResult;
    verboten = paramMap;
  }
  
  public Collection<? extends T> allInstances()
  {
    Collection localCollection = delegate.allInstances();
    ArrayList localArrayList = new ArrayList(localCollection.size());
    for (Iterator localIterator = localCollection.iterator(); localIterator.hasNext();)
    {
      Object localObject = localIterator.next();
      if (!verboten.containsKey(localObject)) {
        localArrayList.add(localObject);
      }
    }
    return localArrayList;
  }
  
  public Set<Class<? extends T>> allClasses()
  {
    return delegate.allClasses();
  }
  
  public Collection<? extends Lookup.Item<T>> allItems()
  {
    Collection localCollection = delegate.allItems();
    ArrayList localArrayList = new ArrayList(localCollection.size());
    for (Iterator localIterator = localCollection.iterator(); localIterator.hasNext();)
    {
      Lookup.Item localItem = (Lookup.Item)localIterator.next();
      if (!verboten.containsKey(localItem.getInstance())) {
        localArrayList.add(localItem);
      }
    }
    return localArrayList;
  }
  
  public void addLookupListener(LookupListener paramLookupListener)
  {
    synchronized (listeners)
    {
      if (listeners.isEmpty()) {
        delegate.addLookupListener(this);
      }
      listeners.add(paramLookupListener);
    }
  }
  
  public void removeLookupListener(LookupListener paramLookupListener)
  {
    synchronized (listeners)
    {
      listeners.remove(paramLookupListener);
      if (listeners.isEmpty()) {
        delegate.removeLookupListener(this);
      }
    }
  }
  
  public void resultChanged(LookupEvent paramLookupEvent)
  {
    LookupEvent localLookupEvent = new LookupEvent(this);
    LookupListener[] arrayOfLookupListener;
    synchronized (listeners)
    {
      arrayOfLookupListener = (LookupListener[])listeners.toArray(new LookupListener[listeners.size()]);
    }
    for (int i = 0; i < arrayOfLookupListener.length; i++) {
      arrayOfLookupListener[i].resultChanged(localLookupEvent);
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.windows.DefaultTopComponentLookup.NoNodeLookup.ExclusionResult
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.windows;

import java.util.ArrayList;
import java.util.Collection;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.openide.nodes.Node;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Item;
import org.openide.util.Lookup.Result;
import org.openide.util.Lookup.Template;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

final class DefaultTopComponentLookup$NoNodeLookup
  extends Lookup
{
  private final Lookup delegate;
  private final Map<Object, Object> verboten;
  
  public DefaultTopComponentLookup$NoNodeLookup(Lookup paramLookup, Object[] paramArrayOfObject)
  {
    delegate = paramLookup;
    verboten = new IdentityHashMap();
    for (int i = 0; i < paramArrayOfObject.length; verboten.put(paramArrayOfObject[(i++)], DefaultTopComponentLookup.access$000())) {}
  }
  
  public <T> T lookup(Class<T> paramClass)
  {
    if (paramClass == Node.class) {
      return null;
    }
    Object localObject1 = delegate.lookup(paramClass);
    if (verboten.containsKey(localObject1))
    {
      for (Object localObject2 : lookupAll(paramClass)) {
        if (!verboten.containsKey(localObject2)) {
          return (T)localObject2;
        }
      }
      return null;
    }
    return (T)localObject1;
  }
  
  public <T> Lookup.Result<T> lookup(Lookup.Template<T> paramTemplate)
  {
    if (paramTemplate.getType() == Node.class) {
      return Lookup.EMPTY.lookup(new Lookup.Template(Node.class));
    }
    return new ExclusionResult(delegate.lookup(paramTemplate), verboten);
  }
  
  private static final class ExclusionResult<T>
    extends Lookup.Result<T>
    implements LookupListener
  {
    private final Lookup.Result<T> delegate;
    private final Map<Object, Object> verboten;
    private final List<LookupListener> listeners = new ArrayList();
    
    public ExclusionResult(Lookup.Result<T> paramResult, Map<Object, Object> paramMap)
    {
      delegate = paramResult;
      verboten = paramMap;
    }
    
    public Collection<? extends T> allInstances()
    {
      Collection localCollection = delegate.allInstances();
      ArrayList localArrayList = new ArrayList(localCollection.size());
      for (Iterator localIterator = localCollection.iterator(); localIterator.hasNext();)
      {
        Object localObject = localIterator.next();
        if (!verboten.containsKey(localObject)) {
          localArrayList.add(localObject);
        }
      }
      return localArrayList;
    }
    
    public Set<Class<? extends T>> allClasses()
    {
      return delegate.allClasses();
    }
    
    public Collection<? extends Lookup.Item<T>> allItems()
    {
      Collection localCollection = delegate.allItems();
      ArrayList localArrayList = new ArrayList(localCollection.size());
      for (Iterator localIterator = localCollection.iterator(); localIterator.hasNext();)
      {
        Lookup.Item localItem = (Lookup.Item)localIterator.next();
        if (!verboten.containsKey(localItem.getInstance())) {
          localArrayList.add(localItem);
        }
      }
      return localArrayList;
    }
    
    public void addLookupListener(LookupListener paramLookupListener)
    {
      synchronized (listeners)
      {
        if (listeners.isEmpty()) {
          delegate.addLookupListener(this);
        }
        listeners.add(paramLookupListener);
      }
    }
    
    public void removeLookupListener(LookupListener paramLookupListener)
    {
      synchronized (listeners)
      {
        listeners.remove(paramLookupListener);
        if (listeners.isEmpty()) {
          delegate.removeLookupListener(this);
        }
      }
    }
    
    public void resultChanged(LookupEvent paramLookupEvent)
    {
      LookupEvent localLookupEvent = new LookupEvent(this);
      LookupListener[] arrayOfLookupListener;
      synchronized (listeners)
      {
        arrayOfLookupListener = (LookupListener[])listeners.toArray(new LookupListener[listeners.size()]);
      }
      for (int i = 0; i < arrayOfLookupListener.length; i++) {
        arrayOfLookupListener[i].resultChanged(localLookupEvent);
      }
    }
  }
}

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

import org.openide.nodes.Node;
import org.openide.util.lookup.AbstractLookup.Pair;

final class DefaultTopComponentLookup$NoNodesPair
  extends AbstractLookup.Pair
{
  protected boolean creatorOf(Object paramObject)
  {
    return false;
  }
  
  public String getDisplayName()
  {
    return getId();
  }
  
  public String getId()
  {
    return "none";
  }
  
  public Object getInstance()
  {
    return null;
  }
  
  public Class getType()
  {
    return Node.class;
  }
  
  protected boolean instanceOf(Class paramClass)
  {
    return Node.class.isAssignableFrom(paramClass);
  }
}

/* Location:
 * Qualified Name:     org.openide.windows.DefaultTopComponentLookup.NoNodesPair
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package o
1 2 3

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