org-openide-util-lookup

16:40:44.631 INFO  jd.cli.Main - Decompiling org-openide-util-lookup.jar
package org.netbeans.modules.openide.util;

import javax.annotation.processing.Completion;

final class ServiceProviderProcessor$TypeCompletion
  implements Completion
{
  private final String type;
  
  public ServiceProviderProcessor$TypeCompletion(String paramString)
  {
    type = paramString;
  }
  
  public String getValue()
  {
    return type;
  }
  
  public String getMessage()
  {
    return null;
  }
}

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

import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import javax.annotation.processing.Completion;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.MirroredTypeException;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import org.openide.util.lookup.ServiceProvider;
import org.openide.util.lookup.ServiceProviders;
import org.openide.util.lookup.implspi.AbstractServiceProviderProcessor;

@SupportedSourceVersion(SourceVersion.RELEASE_6)
public class ServiceProviderProcessor
  extends AbstractServiceProviderProcessor
{
  public Set<String> getSupportedAnnotationTypes()
  {
    return new HashSet(Arrays.asList(new String[] { ServiceProvider.class.getCanonicalName(), ServiceProviders.class.getCanonicalName() }));
  }
  
  protected boolean handleProcess(Set<? extends TypeElement> paramSet, RoundEnvironment paramRoundEnvironment)
  {
    for (Iterator localIterator = paramRoundEnvironment.getElementsAnnotatedWith(ServiceProvider.class).iterator(); localIterator.hasNext();)
    {
      localElement = (Element)localIterator.next();
      localTypeElement = (TypeElement)localElement;
      localObject = (ServiceProvider)localTypeElement.getAnnotation(ServiceProvider.class);
      register(localTypeElement, ServiceProvider.class, (ServiceProvider)localObject);
    }
    Element localElement;
    TypeElement localTypeElement;
    Object localObject;
    for (localIterator = paramRoundEnvironment.getElementsAnnotatedWith(ServiceProviders.class).iterator(); localIterator.hasNext();)
    {
      localElement = (Element)localIterator.next();
      localTypeElement = (TypeElement)localElement;
      localObject = (ServiceProviders)localTypeElement.getAnnotation(ServiceProviders.class);
      for (ServiceProvider localServiceProvider : ((ServiceProviders)localObject).value()) {
        register(localTypeElement, ServiceProviders.class, localServiceProvider);
      }
    }
    return true;
  }
  
  private void register(TypeElement paramTypeElement, Class<? extends Annotation> paramClass, ServiceProvider paramServiceProvider)
  {
    try
    {
      paramServiceProvider.service();
      if (!$assertionsDisabled) {
        throw new AssertionError();
      }
      return;
    }
    catch (MirroredTypeException localMirroredTypeException)
    {
      register(paramTypeElement, paramClass, localMirroredTypeException.getTypeMirror(), paramServiceProvider.path(), paramServiceProvider.position(), paramServiceProvider.supersedes());
    }
  }
  
  public Iterable<? extends Completion> getCompletions(Element paramElement, AnnotationMirror paramAnnotationMirror, ExecutableElement paramExecutableElement, String paramString)
  {
    if ((processingEnv == null) || (paramElement == null) || (!paramElement.getKind().isClass())) {
      return Collections.emptyList();
    }
    if ((paramAnnotationMirror == null) || (!"org.openide.util.lookup.ServiceProvider".contentEquals(((TypeElement)paramAnnotationMirror.getAnnotationType().asElement()).getQualifiedName()))) {
      return Collections.emptyList();
    }
    if (!"service".contentEquals(paramExecutableElement.getSimpleName())) {
      return Collections.emptyList();
    }
    TypeElement localTypeElement1 = processingEnv.getElementUtils().getTypeElement("java.lang.Object");
    if (localTypeElement1 == null) {
      return Collections.emptyList();
    }
    LinkedList localLinkedList1 = new LinkedList();
    LinkedList localLinkedList2 = new LinkedList();
    
    localLinkedList2.add((TypeElement)paramElement);
    while (!localLinkedList2.isEmpty())
    {
      TypeElement localTypeElement2 = (TypeElement)localLinkedList2.remove(0);
      
      localLinkedList1.add(new TypeCompletion(localTypeElement2.getQualifiedName().toString() + ".class"));
      
      LinkedList localLinkedList3 = new LinkedList();
      
      localLinkedList3.add(localTypeElement2.getSuperclass());
      localLinkedList3.addAll(localTypeElement2.getInterfaces());
      for (TypeMirror localTypeMirror : localLinkedList3) {
        if ((localTypeMirror != null) && (localTypeMirror.getKind() == TypeKind.DECLARED))
        {
          TypeElement localTypeElement3 = (TypeElement)processingEnv.getTypeUtils().asElement(localTypeMirror);
          if (!localTypeElement1.equals(localTypeElement3)) {
            localLinkedList2.add(localTypeElement3);
          }
        }
      }
    }
    return localLinkedList1;
  }
  
  private static final class TypeCompletion
    implements Completion
  {
    private final String type;
    
    public TypeCompletion(String paramString)
    {
      type = paramString;
    }
    
    public String getValue()
    {
      return type;
    }
    
    public String getMessage()
    {
      return null;
    }
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.openide.util.lookup.Lookups;
import org.openide.util.lookup.ProxyLookup;

final class Lookup$DefLookup
  extends ProxyLookup
{
  public Lookup$DefLookup()
  {
    super(new Lookup[0]);
  }
  
  public void init(ClassLoader paramClassLoader, Lookup paramLookup, boolean paramBoolean)
  {
    Lookup localLookup = Lookups.singleton(paramClassLoader);
    ArrayList localArrayList = new ArrayList();
    localArrayList.add(paramLookup);
    localArrayList.add(localLookup);
    String str1 = System.getProperty("org.openide.util.Lookup.paths");
    if ((paramBoolean) && (str1 != null)) {
      for (String str2 : str1.split(":")) {
        localArrayList.add(Lookups.forPath(str2));
      }
    }
    setLookups((Lookup[])localArrayList.toArray(new Lookup[0]));
  }
}

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

import java.util.Collection;
import java.util.Collections;

final class Lookup$Empty$1
  extends Lookup.Result
{
  public void addLookupListener(LookupListener paramLookupListener) {}
  
  public void removeLookupListener(LookupListener paramLookupListener) {}
  
  public Collection allInstances()
  {
    return Collections.EMPTY_SET;
  }
}

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

import java.util.Collection;
import java.util.Collections;

final class Lookup$Empty
  extends Lookup
{
  private static final Lookup.Result NO_RESULT = new Lookup.Result()
  {
    public void addLookupListener(LookupListener paramAnonymousLookupListener) {}
    
    public void removeLookupListener(LookupListener paramAnonymousLookupListener) {}
    
    public Collection allInstances()
    {
      return Collections.EMPTY_SET;
    }
  };
  
  public <T> T lookup(Class<T> paramClass)
  {
    return null;
  }
  
  public <T> Lookup.Result<T> lookup(Lookup.Template<T> paramTemplate)
  {
    return NO_RESULT;
  }
}

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

public abstract class Lookup$Item<T>
{
  public abstract T getInstance();
  
  public abstract Class<? extends T> getType();
  
  public abstract String getId();
  
  public abstract String getDisplayName();
  
  public String toString()
  {
    return getId();
  }
}

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

public abstract interface Lookup$Provider
{
  public abstract Lookup getLookup();
}

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

import java.util.Collection;
import java.util.Collections;
import java.util.Set;

public abstract class Lookup$Result<T>
{
  public abstract void addLookupListener(LookupListener paramLookupListener);
  
  public abstract void removeLookupListener(LookupListener paramLookupListener);
  
  public abstract Collection<? extends T> allInstances();
  
  public Set<Class<? extends T>> allClasses()
  {
    return Collections.emptySet();
  }
  
  public Collection<? extends Lookup.Item<T>> allItems()
  {
    return Collections.emptyList();
  }
}

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

public final class Lookup$Template<T>
{
  private int hashCode;
  private Class<T> type;
  private String id;
  private T instance;
  
  @Deprecated
  public Lookup$Template()
  {
    this(null);
  }
  
  public Lookup$Template(Class<T> paramClass)
  {
    this(paramClass, null, null);
  }
  
  public Lookup$Template(Class<T> paramClass, String paramString, T paramT)
  {
    type = extractType(paramClass);
    id = paramString;
    instance = paramT;
  }
  
  private Class<T> extractType(Class<T> paramClass)
  {
    return paramClass == null ? Object.class : paramClass;
  }
  
  public Class<T> getType()
  {
    return type;
  }
  
  public String getId()
  {
    return id;
  }
  
  public T getInstance()
  {
    return (T)instance;
  }
  
  public int hashCode()
  {
    if (hashCode != 0) {
      return hashCode;
    }
    hashCode = ((type == null ? 1 : type.hashCode()) + (id == null ? 2 : id.hashCode()) + (instance == null ? 3 : 0));
    
    return hashCode;
  }
  
  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof Template)) {
      return false;
    }
    Template localTemplate = (Template)paramObject;
    if (hashCode() != localTemplate.hashCode()) {
      return false;
    }
    if (type != type) {
      return false;
    }
    if (id == null)
    {
      if (id != null) {
        return false;
      }
    }
    else if (!id.equals(id)) {
      return false;
    }
    if (instance == null) {
      return instance == null;
    }
    return instance.equals(instance);
  }
  
  public String toString()
  {
    return "Lookup.Template[type=" + type + ",id=" + id + ",instance=" + instance + "]";
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.openide.util.lookup.Lookups;
import org.openide.util.lookup.ProxyLookup;

public abstract class Lookup
{
  public static final Lookup EMPTY = new Empty();
  private static Lookup defaultLookup;
  
  public static synchronized Lookup getDefault()
  {
    if (defaultLookup != null) {
      return defaultLookup;
    }
    String str = System.getProperty("org.openide.util.Lookup");
    if ("-".equals(str)) {
      return EMPTY;
    }
    ClassLoader localClassLoader = Thread.currentThread().getContextClassLoader();
    try
    {
      if (str != null)
      {
        defaultLookup = (Lookup)Class.forName(str, true, localClassLoader).newInstance();
        
        return defaultLookup;
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    Lookup localLookup = Lookups.metaInfServices(localClassLoader);
    defaultLookup = (Lookup)localLookup.lookup(Lookup.class);
    if (defaultLookup != null) {
      return defaultLookup;
    }
    Provider localProvider = (Provider)localLookup.lookup(Provider.class);
    if (localProvider != null)
    {
      defaultLookup = Lookups.proxy(localProvider);
      
      return defaultLookup;
    }
    DefLookup localDefLookup = new DefLookup();
    localDefLookup.init(localClassLoader, localLookup, false);
    defaultLookup = localDefLookup;
    localDefLookup.init(localClassLoader, localLookup, true);
    return defaultLookup;
  }
  
  private static final class DefLookup
    extends ProxyLookup
  {
    public DefLookup()
    {
      super();
    }
    
    public void init(ClassLoader paramClassLoader, Lookup paramLookup, boolean paramBoolean)
    {
      Lookup localLookup = Lookups.singleton(paramClassLoader);
      ArrayList localArrayList = new ArrayList();
      localArrayList.add(paramLookup);
      localArrayList.add(localLookup);
      String str1 = System.getProperty("org.openide.util.Lookup.paths");
      if ((paramBoolean) && (str1 != null)) {
        for (String str2 : str1.split(":")) {
          localArrayList.add(Lookups.forPath(str2));
        }
      }
      setLookups((Lookup[])localArrayList.toArray(new Lookup[0]));
    }
  }
  
  private static void resetDefaultLookup()
  {
    if ((defaultLookup instanceof DefLookup))
    {
      DefLookup localDefLookup = (DefLookup)defaultLookup;
      ClassLoader localClassLoader = Thread.currentThread().getContextClassLoader();
      localDefLookup.init(localClassLoader, Lookups.metaInfServices(localClassLoader), true);
    }
  }
  
  public abstract <T> T lookup(Class<T> paramClass);
  
  public abstract <T> Result<T> lookup(Template<T> paramTemplate);
  
  public <T> Item<T> lookupItem(Template<T> paramTemplate)
  {
    Result localResult = lookup(paramTemplate);
    Iterator localIterator = localResult.allItems().iterator();
    return localIterator.hasNext() ? (Item)localIterator.next() : null;
  }
  
  public <T> Result<T> lookupResult(Class<T> paramClass)
  {
    return lookup(new Template(paramClass));
  }
  
  public <T> Collection<? extends T> lookupAll(Class<T> paramClass)
  {
    return lookupResult(paramClass).allInstances();
  }
  
  public static abstract interface Provider
  {
    public abstract Lookup getLookup();
  }
  
  public static final class Template<T>
  {
    private int hashCode;
    private Class<T> type;
    private String id;
    private T instance;
    
    @Deprecated
    public Template()
    {
      this(null);
    }
    
    public Template(Class<T> paramClass)
    {
      this(paramClass, null, null);
    }
    
    public Template(Class<T> paramClass, String paramString, T paramT)
    {
      type = extractType(paramClass);
      id = paramString;
      instance = paramT;
    }
    
    private Class<T> extractType(Class<T> paramClass)
    {
      return paramClass == null ? Object.class : paramClass;
    }
    
    public Class<T> getType()
    {
      return type;
    }
    
    public String getId()
    {
      return id;
    }
    
    public T getInstance()
    {
      return (T)instance;
    }
    
    public int hashCode()
    {
      if (hashCode != 0) {
        return hashCode;
      }
      hashCode = ((type == null ? 1 : type.hashCode()) + (id == null ? 2 : id.hashCode()) + (instance == null ? 3 : 0));
      
      return hashCode;
    }
    
    public boolean equals(Object paramObject)
    {
      if (!(paramObject instanceof Template)) {
        return false;
      }
      Template localTemplate = (Template)paramObject;
      if (hashCode() != localTemplate.hashCode()) {
        return false;
      }
      if (type != type) {
        return false;
      }
      if (id == null)
      {
        if (id != null) {
          return false;
        }
      }
      else if (!id.equals(id)) {
        return false;
      }
      if (instance == null) {
        return instance == null;
      }
      return instance.equals(instance);
    }
    
    public String toString()
    {
      return "Lookup.Template[type=" + type + ",id=" + id + ",instance=" + instance + "]";
    }
  }
  
  public static abstract class Result<T>
  {
    public abstract void addLookupListener(LookupListener paramLookupListener);
    
    public abstract void removeLookupListener(LookupListener paramLookupListener);
    
    public abstract Collection<? extends T> allInstances();
    
    public Set<Class<? extends T>> allClasses()
    {
      return Collections.emptySet();
    }
    
    public Collection<? extends Lookup.Item<T>> allItems()
    {
      return Collections.emptyList();
    }
  }
  
  public static abstract class Item<T>
  {
    public abstract T getInstance();
    
    public abstract Class<? extends T> getType();
    
    public abstract String getId();
    
    public abstract String getDisplayName();
    
    public String toString()
    {
      return getId();
    }
  }
  
  private static final class Empty
    extends Lookup
  {
    private static final Lookup.Result NO_RESULT = new Lookup.Result()
    {
      public void addLookupListener(LookupListener paramAnonymousLookupListener) {}
      
      public void removeLookupListener(LookupListener paramAnonymousLookupListener) {}
      
      public Collection allInstances()
      {
        return Collections.EMPTY_SET;
      }
    };
    
    public <T> T lookup(Class<T> paramClass)
    {
      return null;
    }
    
    public <T> Lookup.Result<T> lookup(Lookup.Template<T> paramTemplate)
    {
      return NO_RESULT;
    }
  }
}

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

import java.util.EventObject;

public final class LookupEvent
  extends EventObject
{
  public LookupEvent(Lookup.Result paramResult)
  {
    super(paramResult);
  }
}

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

import java.util.EventListener;

public abstract interface LookupListener
  extends EventListener
{
  public abstract void resultChanged(LookupEvent paramLookupEvent);
}

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

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.Comparator;

final class ALPairComparator
  implements Comparator<AbstractLookup.Pair<?>>
{
  public static final Comparator<AbstractLookup.Pair<?>> DEFAULT = new ALPairComparator();
  
  public int compare(AbstractLookup.Pair<?> paramPair1, AbstractLookup.Pair<?> paramPair2)
  {
    int i = paramPair1.getIndex() - paramPair2.getIndex();
    if (i == 0)
    {
      if (paramPair1 != paramPair2)
      {
        ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
        PrintStream localPrintStream = new PrintStream(localByteArrayOutputStream);
        
        localPrintStream.println("Duplicate pair in treePair1: " + paramPair1 + " pair2: " + paramPair2 + " index1: " + paramPair1.getIndex() + " index2: " + paramPair2.getIndex() + " item1: " + paramPair1.getInstance() + " item2: " + paramPair2.getInstance() + " id1: " + Integer.toHexString(System.identityHashCode(paramPair1)) + " id2: " + Integer.toHexString(System.identityHashCode(paramPair2)));
        
        localPrintStream.close();
        
        throw new IllegalStateException(localByteArrayOutputStream.toString());
      }
      return 0;
    }
    return i;
  }
}

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

class AbstractLookup$1 {}

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

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.Executor;

public class AbstractLookup$Content
  implements Serializable
{
  private static final long serialVersionUID = 1L;
  private AbstractLookup al;
  private transient Object notifyIn;
  
  public AbstractLookup$Content()
  {
    this(null);
  }
  
  public AbstractLookup$Content(Executor paramExecutor)
  {
    notifyIn = paramExecutor;
  }
  
  final void attachExecutor(Executor paramExecutor)
  {
    notifyIn = paramExecutor;
  }
  
  final synchronized void attach(AbstractLookup paramAbstractLookup)
  {
    if (al == null)
    {
      al = paramAbstractLookup;
      
      ArrayList localArrayList = getEarlyPairs();
      if (localArrayList != null)
      {
        notifyIn = null;
        setPairs(localArrayList);
      }
    }
    else
    {
      throw new IllegalStateException("Trying to use content for " + paramAbstractLookup + " but it is already used for " + al);
    }
  }
  
  public final void addPair(AbstractLookup.Pair<?> paramPair)
  {
    AbstractLookup localAbstractLookup = al;
    Executor localExecutor = getExecutor();
    if ((localAbstractLookup != null) || (localExecutor != null))
    {
      if (localAbstractLookup == null) {
        throw new NullPointerException("Adding a pair to Content not connected to Lookup is not supported!");
      }
      localAbstractLookup.addPair(paramPair, localExecutor);
    }
    else
    {
      if (notifyIn == null) {
        notifyIn = new ArrayList(3);
      }
      getEarlyPairs().add(paramPair);
    }
  }
  
  public final void removePair(AbstractLookup.Pair<?> paramPair)
  {
    AbstractLookup localAbstractLookup = al;
    Executor localExecutor = getExecutor();
    if ((localAbstractLookup != null) || (localExecutor != null))
    {
      localAbstractLookup.removePair(paramPair, localExecutor);
    }
    else
    {
      if (notifyIn == null) {
        notifyIn = new ArrayList(3);
      }
      getEarlyPairs().remove(paramPair);
    }
  }
  
  public final void setPairs(Collection<? extends AbstractLookup.Pair> paramCollection)
  {
    AbstractLookup localAbstractLookup = al;
    Executor localExecutor = getExecutor();
    if ((localAbstractLookup != null) || (localExecutor != null)) {
      localAbstractLookup.setPairs(paramCollection, localExecutor);
    } else {
      notifyIn = new ArrayList(paramCollection);
    }
  }
  
  private ArrayList<AbstractLookup.Pair> getEarlyPairs()
  {
    Object localObject = notifyIn;
    return (localObject instanceof ArrayList) ? (ArrayList)localObject : null;
  }
  
  private Executor getExecutor()
  {
    Object localObject = notifyIn;
    return (localObject instanceof Executor) ? (Executor)localObject : null;
  }
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.Content
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

import java.util.Collection;

class AbstractLookup$CycleError
  extends StackOverflowError
{
  private final Collection<Object> print;
  
  public AbstractLookup$CycleError(Collection<Object> paramCollection)
  {
    print = paramCollection;
  }
  
  public String getMessage()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("StackOverflowError, here are the listeners:\n");
    if (print != null) {
      for (Object localObject : print)
      {
        localStringBuilder.append('\n').append(localObject);
        if (localStringBuilder.length() > 10000) {
          break;
        }
      }
    } else {
      localStringBuilder.append("listeners are null");
    }
    return localStringBuilder.toString();
  }
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.CycleError
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

abstract interface AbstractLookup$ISE$Job
{
  public abstract void before();
  
  public abstract void inside();
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.ISE.Job
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

final class AbstractLookup$ISE
  extends IllegalStateException
{
  static final long serialVersionUID = 100L;
  private List<Job> jobs;
  
  public AbstractLookup$ISE(String paramString)
  {
    super(paramString);
  }
  
  public void registerJob(Job paramJob)
  {
    if (jobs == null) {
      jobs = new ArrayList();
    }
    jobs.add(paramJob);
  }
  
  public void recover(AbstractLookup paramAbstractLookup)
  {
    if (jobs == null) {
      throw this;
    }
    for (Object localObject1 = jobs.iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (Job)((Iterator)localObject1).next();
      ((Job)localObject2).before();
    }
    Object localObject2;
    localObject1 = AbstractLookup.access$400(paramAbstractLookup);
    try
    {
      for (localObject2 = jobs.iterator(); ((Iterator)localObject2).hasNext();)
      {
        Job localJob = (Job)((Iterator)localObject2).next();
        localJob.inside();
      }
    }
    finally
    {
      AbstractLookup.access$500(paramAbstractLookup);
    }
  }
  
  static abstract interface Job
  {
    public abstract void before();
    
    public abstract void inside();
  }
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.ISE
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

final class AbstractLookup$Info
{
  public int index;
  public Object transaction;
  
  public AbstractLookup$Info(int paramInt, Object paramObject)
  {
    index = paramInt;
    transaction = paramObject;
  }
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.Info
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

final class AbstractLookup$NotifyListeners
  implements Runnable
{
  private final ArrayList<Object> evAndListeners;
  
  public AbstractLookup$NotifyListeners(Set<AbstractLookup.R> paramSet)
  {
    if (paramSet.isEmpty())
    {
      evAndListeners = null;
      return;
    }
    evAndListeners = new ArrayList();
    for (AbstractLookup.R localR : paramSet) {
      localR.collectFires(evAndListeners);
    }
  }
  
  public boolean shallRun()
  {
    return (evAndListeners != null) && (!evAndListeners.isEmpty());
  }
  
  public void run()
  {
    Iterator localIterator = evAndListeners.iterator();
    while (localIterator.hasNext())
    {
      LookupEvent localLookupEvent = (LookupEvent)localIterator.next();
      LookupListener localLookupListener = (LookupListener)localIterator.next();
      localLookupListener.resultChanged(localLookupEvent);
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.NotifyListeners
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

import java.io.Serializable;
import org.openide.util.Lookup.Item;

public abstract class AbstractLookup$Pair<T>
  extends Lookup.Item<T>
  implements Serializable
{
  private static final long serialVersionUID = 1L;
  private int index = -1;
  
  final int getIndex()
  {
    return index;
  }
  
  final void setIndex(AbstractLookup.Storage<?> paramStorage, int paramInt)
  {
    if (paramStorage == null)
    {
      index = paramInt;
      
      return;
    }
    if (index == -1) {
      index = paramInt;
    } else {
      throw new IllegalStateException("You cannot use " + this + " in more than one AbstractLookup. Prev: " + index + " new: " + paramInt);
    }
  }
  
  protected abstract boolean instanceOf(Class<?> paramClass);
  
  protected abstract boolean creatorOf(Object paramObject);
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.Pair
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import org.openide.util.Lookup.Item;
import org.openide.util.Lookup.Template;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

final class AbstractLookup$R<T>
  extends WaitableResult<T>
{
  public AbstractLookup.ReferenceToResult<T> reference;
  private Object listeners;
  
  private boolean isSimple()
  {
    AbstractLookup.Storage localStorage = (AbstractLookup.Storage)AbstractLookup.access$200(reference.lookup);
    
    return DelegatingStorage.isSimple(localStorage);
  }
  
  private Object getFromCache(int paramInt)
  {
    if (isSimple()) {
      return null;
    }
    Object localObject = reference.caches;
    if ((localObject instanceof Object[])) {
      return ((Object[])(Object[])localObject)[paramInt];
    }
    return null;
  }
  
  private Set<Class<? extends T>> getClassesCache()
  {
    return (Set)getFromCache(0);
  }
  
  private void setClassesCache(Set paramSet)
  {
    if (isSimple())
    {
      reference.caches = reference;
      
      return;
    }
    if (!(reference.caches instanceof Object[])) {
      reference.caches = new Object[3];
    }
    ((Object[])reference.caches)[0] = paramSet;
  }
  
  private Collection<T> getInstancesCache()
  {
    return (Collection)getFromCache(1);
  }
  
  private void setInstancesCache(Collection paramCollection)
  {
    if (isSimple())
    {
      reference.caches = reference;
      
      return;
    }
    if (!(reference.caches instanceof Object[])) {
      reference.caches = new Object[3];
    }
    ((Object[])reference.caches)[1] = paramCollection;
  }
  
  private AbstractLookup.Pair<T>[] getItemsCache()
  {
    return (AbstractLookup.Pair[])getFromCache(2);
  }
  
  private void setItemsCache(Collection<?> paramCollection)
  {
    if (isSimple())
    {
      reference.caches = reference;
      
      return;
    }
    if (!(reference.caches instanceof Object[])) {
      reference.caches = new Object[3];
    }
    ((Object[])reference.caches)[2] = paramCollection.toArray(new AbstractLookup.Pair[0]);
  }
  
  private void clearCaches()
  {
    if ((reference.caches instanceof Object[])) {
      reference.caches = new Object[3];
    }
  }
  
  public synchronized void addLookupListener(LookupListener paramLookupListener)
  {
    listeners = AbstractLookup.modifyListenerList(true, paramLookupListener, listeners);
  }
  
  public synchronized void removeLookupListener(LookupListener paramLookupListener)
  {
    listeners = AbstractLookup.modifyListenerList(false, paramLookupListener, listeners);
  }
  
  protected void collectFires(Collection<Object> paramCollection)
  {
    AbstractLookup.Pair[] arrayOfPair = getItemsCache();
    clearCaches();
    Object localObject1;
    if (arrayOfPair != null)
    {
      localObject1 = allItemsWithoutBeforeLookup().toArray();
      if (AbstractLookup.access$300(arrayOfPair, (Object[])localObject1)) {
        return;
      }
    }
    synchronized (this)
    {
      if (listeners == null) {
        return;
      }
      if ((listeners instanceof LookupListener))
      {
        localObject1 = new LookupListener[] { (LookupListener)listeners };
      }
      else
      {
        localObject2 = (ArrayList)listeners;
        localObject1 = (LookupListener[])((ArrayList)localObject2).toArray(new LookupListener[((ArrayList)localObject2).size()]);
      }
    }
    ??? = localObject1;
    Object localObject2 = new LookupEvent(this);
    AbstractLookup.notifyListeners((Object[])???, (LookupEvent)localObject2, paramCollection);
  }
  
  public Collection<T> allInstances()
  {
    reference.lookup.beforeLookup(reference.template);
    
    Object localObject1 = getInstancesCache();
    if (localObject1 != null) {
      return (Collection<T>)localObject1;
    }
    Collection localCollection = allItemsWithoutBeforeLookup();
    ArrayList localArrayList = new ArrayList(localCollection.size());
    
    Iterator localIterator = localCollection.iterator();
    while (localIterator.hasNext())
    {
      AbstractLookup.Pair localPair = (AbstractLookup.Pair)localIterator.next();
      Object localObject2 = localPair.getInstance();
      if (reference.template.getType().isInstance(localObject2)) {
        localArrayList.add(localObject2);
      }
    }
    localObject1 = Collections.unmodifiableList(localArrayList);
    setInstancesCache((Collection)localObject1);
    
    return (Collection<T>)localObject1;
  }
  
  public Set<Class<? extends T>> allClasses()
  {
    reference.lookup.beforeLookup(reference.template);
    
    Object localObject = getClassesCache();
    if (localObject != null) {
      return (Set<Class<? extends T>>)localObject;
    }
    localObject = new HashSet();
    for (AbstractLookup.Pair localPair : allItemsWithoutBeforeLookup())
    {
      Class localClass = localPair.getType();
      if (localClass != null) {
        ((Set)localObject).add(localClass);
      }
    }
    localObject = Collections.unmodifiableSet((Set)localObject);
    setClassesCache((Set)localObject);
    
    return (Set<Class<? extends T>>)localObject;
  }
  
  public Collection<? extends Lookup.Item<T>> allItems()
  {
    reference.lookup.beforeLookup(reference.template);
    
    return allItemsWithoutBeforeLookup();
  }
  
  private Collection<AbstractLookup.Pair<T>> allItemsWithoutBeforeLookup()
  {
    AbstractLookup.Pair[] arrayOfPair = getItemsCache();
    if (arrayOfPair != null) {
      return Collections.unmodifiableList(Arrays.asList(arrayOfPair));
    }
    ArrayList localArrayList = null;
    AbstractLookup.Storage localStorage = AbstractLookup.access$400(reference.lookup);
    try
    {
      return Collections.unmodifiableCollection(initItems(localStorage));
    }
    catch (AbstractLookup.ISE localISE)
    {
      localArrayList = new ArrayList();
      
      Enumeration localEnumeration = localStorage.lookup(null);
      while (localEnumeration.hasMoreElements())
      {
        AbstractLookup.Pair localPair = (AbstractLookup.Pair)localEnumeration.nextElement();
        localArrayList.add(localPair);
      }
    }
    finally
    {
      AbstractLookup.access$500(reference.lookup);
    }
    return extractPairs(localArrayList);
  }
  
  private Collection<AbstractLookup.Pair<T>> extractPairs(ArrayList<AbstractLookup.Pair<Object>> paramArrayList)
  {
    TreeSet localTreeSet = new TreeSet(ALPairComparator.DEFAULT);
    for (AbstractLookup.Pair localPair : paramArrayList) {
      if (AbstractLookup.matches(reference.template, localPair, false)) {
        localTreeSet.add(localPair);
      }
    }
    return Collections.unmodifiableCollection(localTreeSet);
  }
  
  private Collection<AbstractLookup.Pair<T>> initItems(AbstractLookup.Storage<?> paramStorage)
  {
    Enumeration localEnumeration = paramStorage.lookup(reference.template.getType());
    
    TreeSet localTreeSet = new TreeSet(ALPairComparator.DEFAULT);
    while (localEnumeration.hasMoreElements())
    {
      AbstractLookup.Pair localPair = (AbstractLookup.Pair)localEnumeration.nextElement();
      if (AbstractLookup.matches(reference.template, localPair, false)) {
        localTreeSet.add(localPair);
      }
    }
    setItemsCache(localTreeSet);
    
    return localTreeSet;
  }
  
  protected void beforeLookup(Lookup.Template paramTemplate)
  {
    if (paramTemplate.getType() == reference.template.getType()) {
      reference.lookup.beforeLookup(paramTemplate);
    }
  }
  
  public String toString()
  {
    return super.toString() + " for " + reference.template;
  }
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.R
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

final class AbstractLookup$ReferenceIterator
{
  private AbstractLookup.ReferenceToResult<?> first;
  private AbstractLookup.ReferenceToResult<?> current;
  private AbstractLookup.R<?> currentResult;
  
  public AbstractLookup$ReferenceIterator(AbstractLookup.ReferenceToResult<?> paramReferenceToResult)
  {
    first = paramReferenceToResult;
  }
  
  public boolean next()
  {
    AbstractLookup.ReferenceToResult localReferenceToResult2;
    AbstractLookup.ReferenceToResult localReferenceToResult1;
    if (current == null)
    {
      localReferenceToResult2 = first;
      localReferenceToResult1 = null;
    }
    else
    {
      localReferenceToResult1 = current;
      localReferenceToResult2 = AbstractLookup.ReferenceToResult.access$100(current);
    }
    while (localReferenceToResult2 != null)
    {
      AbstractLookup.R localR = (AbstractLookup.R)localReferenceToResult2.get();
      if (localR == null)
      {
        if (localReferenceToResult1 == null) {
          first = AbstractLookup.ReferenceToResult.access$100(localReferenceToResult2);
        } else {
          AbstractLookup.ReferenceToResult.access$102(localReferenceToResult1, AbstractLookup.ReferenceToResult.access$100(localReferenceToResult2));
        }
        localReferenceToResult1 = localReferenceToResult2;
        localReferenceToResult2 = AbstractLookup.ReferenceToResult.access$100(localReferenceToResult2);
      }
      else
      {
        currentResult = localR;
        current = localReferenceToResult2;
        
        return true;
      }
    }
    currentResult = null;
    current = null;
    
    return false;
  }
  
  public AbstractLookup.ReferenceToResult<?> current()
  {
    return current;
  }
  
  public AbstractLookup.ReferenceToResult<?> first()
  {
    return first;
  }
}

/* Location:
 * Qualified Name:     org.openide.util.lookup.AbstractLookup.ReferenceIterator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.util.lookup;

import java.lang.ref.WeakReference;
import org.openide.util.Lookup.Template;

final class AbstractLookup$ReferenceToResult<T>
  extends WeakReference<AbstractLookup.R<T>>
  implements Runnable
{
  private ReferenceToResult<?> next;
  public final Lookup.Template<T> template;
  public final AbstractLookup lookup;
  public Object caches;
  
  private AbstractLookup$ReferenceToResult(AbstractLookup.R<T> paramR, AbstractLookup paramAbstractLookup, Lookup.Template<T> paramTemplate)
  {
    super(paramR, AbstractLookup.access$600());
    template = paramTemplate;
    lookup = paramAbstractLookup;
    getResultreference = this;
  }
  
  AbstractLookup.R<T> getResult()
  {
    return (AbstractLookup.R)get();
  }
  
  public void run()
  {
    lookup.cleanUpResult(template);
  }
  
  public void cloneList(AbstractLookup.Storage<?> paramStorage)
  {
    AbstractLooku
1 2 3 4 5 6 7

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