org-netbeans-modules-editor-mimelookup-impl

16:39:54.270 INFO  jd.cli.Main - Decompiling org-netbeans-modules-editor-mimelookup-impl.jar
package org.netbeans.modules.editor.mimelookup.impl;

class ClassInfoStorage$1 {}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.ClassInfoStorage.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import org.netbeans.spi.editor.mimelookup.Class2LayerFolder;
import org.netbeans.spi.editor.mimelookup.InstanceProvider;
import org.openide.util.Lookup.Result;
import org.openide.util.Utilities;

public final class ClassInfoStorage$Info
{
  private ClassInfoStorage storage;
  private String className;
  private String extraPath;
  private String instanceProviderClass;
  private Reference<InstanceProvider<?>> ref;
  
  private ClassInfoStorage$Info(ClassInfoStorage paramClassInfoStorage, String paramString1, String paramString2, InstanceProvider<?> paramInstanceProvider)
  {
    storage = paramClassInfoStorage;
    className = paramString1;
    extraPath = (paramString2 == null ? "" : paramString2);
    if (paramInstanceProvider != null)
    {
      instanceProviderClass = paramInstanceProvider.getClass().getName();
      ref = new WeakReference(paramInstanceProvider);
    }
  }
  
  public String getClassName()
  {
    return className;
  }
  
  public String getExtraPath()
  {
    return extraPath;
  }
  
  public String getInstanceProviderClass()
  {
    return instanceProviderClass;
  }
  
  public InstanceProvider<?> getInstanceProvider()
  {
    synchronized (ClassInfoStorage.access$400(storage))
    {
      if (ref == null) {
        return null;
      }
      InstanceProvider localInstanceProvider = (InstanceProvider)ref.get();
      if (localInstanceProvider == null)
      {
        for (Class2LayerFolder localClass2LayerFolder : ClassInfoStorage.access$500(storage).allInstances())
        {
          String str = localClass2LayerFolder.getClazz().getName();
          if (className.equals(str))
          {
            localInstanceProvider = localClass2LayerFolder.getInstanceProvider();
            break;
          }
        }
        if (localInstanceProvider != null) {
          ref = new WeakReference(localInstanceProvider);
        }
      }
      return localInstanceProvider;
    }
  }
  
  public boolean equals(Object paramObject)
  {
    if ((paramObject instanceof Info))
    {
      Info localInfo = (Info)paramObject;
      return (className.equals(className)) && (Utilities.compareObjects(extraPath, extraPath)) && (Utilities.compareObjects(instanceProviderClass, instanceProviderClass));
    }
    return false;
  }
  
  public int hashCode()
  {
    int i = className.hashCode();
    if (extraPath != null) {
      i += 7 * extraPath.hashCode();
    }
    if (instanceProviderClass != null) {
      i += 13 * instanceProviderClass.hashCode();
    }
    return i;
  }
  
  public String toString()
  {
    return "ClassInfoStorage.Info[className=" + className + ",extraPath=" + extraPath + ",instanceProviderClass=" + instanceProviderClass + "]";
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.ClassInfoStorage.Info
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeSupport;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

class ClassInfoStorage$L
  implements LookupListener
{
  private ClassInfoStorage$L(ClassInfoStorage paramClassInfoStorage) {}
  
  public void resultChanged(LookupEvent paramLookupEvent)
  {
    for (PropertyChangeEvent localPropertyChangeEvent : ClassInfoStorage.access$200(this$0)) {
      ClassInfoStorage.access$300(this$0).firePropertyChange(localPropertyChangeEvent);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.ClassInfoStorage.L
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import org.netbeans.spi.editor.mimelookup.Class2LayerFolder;
import org.netbeans.spi.editor.mimelookup.InstanceProvider;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.Utilities;
import org.openide.util.WeakListeners;

public final class ClassInfoStorage
{
  public static final String PROP_CLASS_INFO_CHANGED = "Class2Paths.PROP_CLASS_MAPPING_CHANGED";
  public static final String PROP_CLASS_INFO_ADDED = "Class2Paths.PROP_CLASS_MAPPING_ADDED";
  public static final String PROP_CLASS_INFO_REMOVED = "Class2Paths.PROP_CLASS_MAPPING_REMOVED";
  private static Logger LOG = Logger.getLogger(ClassInfoStorage.class.getName());
  private static ClassInfoStorage instance = null;
  
  public static synchronized ClassInfoStorage getInstance()
  {
    if (instance == null) {
      instance = new ClassInfoStorage();
    }
    return instance;
  }
  
  private Lookup.Result<Class2LayerFolder> mappers = null;
  private L mappersListener = null;
  private final String LOCK = new String("Class2Paths.LOCK");
  private Map<String, Info> mapping = new HashMap();
  private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
  
  private ClassInfoStorage()
  {
    mappers = Lookup.getDefault().lookupResult(Class2LayerFolder.class);
    
    mappersListener = new L(null);
    mappers.addLookupListener((LookupListener)WeakListeners.create(LookupListener.class, mappersListener, mappers));
    
    rebuild();
  }
  
  public Info getInfo(String paramString)
  {
    synchronized (LOCK)
    {
      if (mapping.containsKey(paramString)) {
        return (Info)mapping.get(paramString);
      }
      return new Info(this, paramString, null, null, null);
    }
  }
  
  public void addPropertyChangeListener(PropertyChangeListener paramPropertyChangeListener)
  {
    pcs.addPropertyChangeListener(paramPropertyChangeListener);
  }
  
  public void removePropertyChangeListener(PropertyChangeListener paramPropertyChangeListener)
  {
    pcs.removePropertyChangeListener(paramPropertyChangeListener);
  }
  
  private List<PropertyChangeEvent> rebuild()
  {
    synchronized (LOCK)
    {
      HashMap localHashMap = new HashMap();
      for (Object localObject1 = mappers.allInstances().iterator(); ((Iterator)localObject1).hasNext();)
      {
        localObject2 = (Class2LayerFolder)((Iterator)localObject1).next();
        localObject3 = ((Class2LayerFolder)localObject2).getClazz().getName();
        localObject4 = ((Class2LayerFolder)localObject2).getLayerFolderName();
        localObject5 = ((Class2LayerFolder)localObject2).getInstanceProvider();
        if (localObject4 != null) {
          localObject4 = ((String)localObject4).trim();
        }
        if (((localObject4 != null) && (((String)localObject4).length() != 0)) || (localObject5 != null)) {
          if (!localHashMap.containsKey(localObject3)) {
            localHashMap.put(localObject3, new Info(this, (String)localObject3, (String)localObject4, (InstanceProvider)localObject5, null));
          } else {
            LOG.warning("The mapping for class '" + (String)localObject3 + "' to folder '" + (String)localObject4 + "' and InstanceProvider '" + localObject5 + "' has already been " + "defined by another mapper. Ignoring mapper " + localObject2);
          }
        }
      }
      Object localObject5;
      localObject1 = new HashSet(mapping.keySet());
      ((Set)localObject1).removeAll(localHashMap.keySet());
      
      Object localObject2 = new HashSet(localHashMap.keySet());
      ((Set)localObject2).removeAll(mapping.keySet());
      
      Object localObject3 = new HashSet();
      for (Object localObject4 = localHashMap.keySet().iterator(); ((Iterator)localObject4).hasNext();)
      {
        localObject5 = (String)((Iterator)localObject4).next();
        if ((mapping.containsKey(localObject5)) && (!Utilities.compareObjects(localHashMap.get(localObject5), mapping.get(localObject5)))) {
          ((Set)localObject3).add(localObject5);
        }
      }
      mapping.clear();
      mapping.putAll(localHashMap);
      
      localObject4 = new ArrayList(3);
      if (!((Set)localObject1).isEmpty()) {
        ((List)localObject4).add(new PropertyChangeEvent(this, "Class2Paths.PROP_CLASS_MAPPING_REMOVED", null, localObject1));
      }
      if (!((Set)localObject2).isEmpty()) {
        ((List)localObject4).add(new PropertyChangeEvent(this, "Class2Paths.PROP_CLASS_MAPPING_ADDED", null, localObject2));
      }
      if (!((Set)localObject3).isEmpty()) {
        ((List)localObject4).add(new PropertyChangeEvent(this, "Class2Paths.PROP_CLASS_MAPPING_CHANGED", null, localObject3));
      }
      return (List<PropertyChangeEvent>)localObject4;
    }
  }
  
  private class L
    implements LookupListener
  {
    private L() {}
    
    public void resultChanged(LookupEvent paramLookupEvent)
    {
      for (PropertyChangeEvent localPropertyChangeEvent : ClassInfoStorage.this.rebuild()) {
        pcs.firePropertyChange(localPropertyChangeEvent);
      }
    }
  }
  
  public static final class Info
  {
    private ClassInfoStorage storage;
    private String className;
    private String extraPath;
    private String instanceProviderClass;
    private Reference<InstanceProvider<?>> ref;
    
    private Info(ClassInfoStorage paramClassInfoStorage, String paramString1, String paramString2, InstanceProvider<?> paramInstanceProvider)
    {
      storage = paramClassInfoStorage;
      className = paramString1;
      extraPath = (paramString2 == null ? "" : paramString2);
      if (paramInstanceProvider != null)
      {
        instanceProviderClass = paramInstanceProvider.getClass().getName();
        ref = new WeakReference(paramInstanceProvider);
      }
    }
    
    public String getClassName()
    {
      return className;
    }
    
    public String getExtraPath()
    {
      return extraPath;
    }
    
    public String getInstanceProviderClass()
    {
      return instanceProviderClass;
    }
    
    public InstanceProvider<?> getInstanceProvider()
    {
      synchronized (storage.LOCK)
      {
        if (ref == null) {
          return null;
        }
        InstanceProvider localInstanceProvider = (InstanceProvider)ref.get();
        if (localInstanceProvider == null)
        {
          for (Class2LayerFolder localClass2LayerFolder : storage.mappers.allInstances())
          {
            String str = localClass2LayerFolder.getClazz().getName();
            if (className.equals(str))
            {
              localInstanceProvider = localClass2LayerFolder.getInstanceProvider();
              break;
            }
          }
          if (localInstanceProvider != null) {
            ref = new WeakReference(localInstanceProvider);
          }
        }
        return localInstanceProvider;
      }
    }
    
    public boolean equals(Object paramObject)
    {
      if ((paramObject instanceof Info))
      {
        Info localInfo = (Info)paramObject;
        return (className.equals(className)) && (Utilities.compareObjects(extraPath, extraPath)) && (Utilities.compareObjects(instanceProviderClass, instanceProviderClass));
      }
      return false;
    }
    
    public int hashCode()
    {
      int i = className.hashCode();
      if (extraPath != null) {
        i += 7 * extraPath.hashCode();
      }
      if (instanceProviderClass != null) {
        i += 13 * instanceProviderClass.hashCode();
      }
      return i;
    }
    
    public String toString()
    {
      return "ClassInfoStorage.Info[className=" + className + ",extraPath=" + extraPath + ",instanceProviderClass=" + instanceProviderClass + "]";
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.ClassInfoStorage
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.MultiFileSystem;

class CompoundFolderChildren$1
  extends MultiFileSystem
{
  CompoundFolderChildren$1(CompoundFolderChildren paramCompoundFolderChildren, FileSystem[] paramArrayOfFileSystem, String paramString)
  {
    super(paramArrayOfFileSystem);
  }
  
  protected FileObject findResourceOn(FileSystem paramFileSystem, String paramString)
  {
    return paramFileSystem.findResource(val$prefix + paramString);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.CompoundFolderChildren.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

class CompoundFolderChildren$2
  implements Runnable
{
  CompoundFolderChildren$2(CompoundFolderChildren paramCompoundFolderChildren) {}
  
  public void run()
  {
    CompoundFolderChildren.access$000(this$0);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.CompoundFolderChildren.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import java.beans.PropertyChangeSupport;

class CompoundFolderChildren$3
  implements Runnable
{
  CompoundFolderChildren$3(CompoundFolderChildren paramCompoundFolderChildren) {}
  
  public void run()
  {
    CompoundFolderChildren.access$100(this$0).firePropertyChange("FolderChildren.PROP_CHILDREN", null, null);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.CompoundFolderChildren.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.filesystems.FileAttributeEvent;
import org.openide.filesystems.FileChangeListener;
import org.openide.filesystems.FileEvent;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileRenameEvent;
import org.openide.filesystems.FileStateInvalidException;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
import org.openide.filesystems.MultiFileSystem;
import org.openide.util.Exceptions;

public final class CompoundFolderChildren
  implements FileChangeListener
{
  public static final String PROP_CHILDREN = "FolderChildren.PROP_CHILDREN";
  private static final String HIDDEN_ATTR_NAME = "hidden";
  private static final Logger LOG = Logger.getLogger(CompoundFolderChildren.class.getName());
  private final String LOCK = new String("CompoundFolderChildren.LOCK");
  private final List<String> prefixes;
  private final boolean includeSubfolders;
  private List<FileObject> children;
  private FileObject mergedLayers;
  private final FileChangeListener weakFCL = FileUtil.weakFileChangeListener(this, null);
  private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
  
  public CompoundFolderChildren(String[] paramArrayOfString)
  {
    this(paramArrayOfString, true);
  }
  
  public CompoundFolderChildren(String[] paramArrayOfString, boolean paramBoolean)
  {
    prefixes = new ArrayList();
    for (String str : paramArrayOfString) {
      prefixes.add(str + "/");
    }
    includeSubfolders = paramBoolean;
    rebuild();
  }
  
  /* Error */
  public List<FileObject> getChildren()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 8	org/netbeans/modules/editor/mimelookup/impl/CompoundFolderChildren:LOCK	Ljava/lang/String;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 31	org/netbeans/modules/editor/mimelookup/impl/CompoundFolderChildren:children	Ljava/util/List;
    //   11: aload_1
    //   12: monitorexit
    //   13: areturn
    //   14: astore_2
    //   15: aload_1
    //   16: monitorexit
    //   17: aload_2
    //   18: athrow
    // Line number table:
    //   Java source line #100	-> byte code offset #0
    //   Java source line #101	-> byte code offset #7
    //   Java source line #102	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	19	0	this	CompoundFolderChildren
    //   5	11	1	Ljava/lang/Object;	Object
    //   14	4	2	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	17	14	finally
  }
  
  public void addPropertyChangeListener(PropertyChangeListener paramPropertyChangeListener)
  {
    pcs.addPropertyChangeListener(paramPropertyChangeListener);
  }
  
  public void removePropertyChangeListener(PropertyChangeListener paramPropertyChangeListener)
  {
    pcs.removePropertyChangeListener(paramPropertyChangeListener);
  }
  
  private void rebuild()
  {
    PropertyChangeEvent localPropertyChangeEvent = null;
    synchronized (LOCK)
    {
      ArrayList localArrayList1 = new ArrayList(prefixes.size());
      ArrayList localArrayList2 = new ArrayList(prefixes.size());
      for (Object localObject1 = prefixes.iterator(); ((Iterator)localObject1).hasNext();)
      {
        localObject2 = (String)((Iterator)localObject1).next();
        FileObject localFileObject1 = FileUtil.getConfigFile((String)localObject2);
        if ((localFileObject1 != null) && (localFileObject1.isFolder()))
        {
          localArrayList1.add(localFileObject1);
          try
          {
            localArrayList2.add(new MultiFileSystem(new FileSystem[] { localFileObject1.getFileSystem() })
            {
              protected FileObject findResourceOn(FileSystem paramAnonymousFileSystem, String paramAnonymousString)
              {
                return paramAnonymousFileSystem.findResource(localObject2 + paramAnonymousString);
              }
            });
          }
          catch (FileStateInvalidException localFileStateInvalidException)
          {
            Exceptions.printStackTrace(localFileStateInvalidException);
          }
        }
        else
        {
          Object localObject3 = localObject2;
          for (;;)
          {
            assert (((String)localObject3).length() > 0);
            localObject3 = ((String)localObject3).substring(0, Math.max(0, ((String)localObject3).lastIndexOf('/')));
            localObject4 = FileUtil.getConfigFile((String)localObject3);
            if (localObject4 != null)
            {
              ((FileObject)localObject4).removeFileChangeListener(weakFCL);
              ((FileObject)localObject4).addFileChangeListener(weakFCL);
              break;
            }
          }
        }
      }
      Object localObject4;
      mergedLayers = new MultiFileSystem((FileSystem[])localArrayList2.toArray(new FileSystem[localArrayList2.size()])).getRoot();
      mergedLayers.addFileChangeListener(this);
      localObject1 = new ArrayList();
      for (localObject4 : mergedLayers.getChildren()) {
        if (((includeSubfolders) || (((FileObject)localObject4).isData())) && (!Boolean.TRUE.equals(((FileObject)localObject4).getAttribute("hidden"))))
        {
          ((FileObject)localObject4).addFileChangeListener(this);
          ((List)localObject1).add(localObject4);
        }
      }
      final Object localObject2 = new ArrayList(((List)localObject1).size());
      for (FileObject localFileObject2 : FileUtil.getOrder((Collection)localObject1, true))
      {
        localObject4 = localFileObject2.getNameExt();
        FileObject localFileObject3 = null;
        for (FileObject localFileObject4 : localArrayList1)
        {
          localFileObject3 = localFileObject4.getFileObject((String)localObject4);
          if (localFileObject3 != null) {
            break;
          }
        }
        assert (localFileObject3 != null) : ("Should have equivalent to " + (String)localObject4 + " among " + localArrayList1);
        ((List)localObject2).add(localFileObject3);
      }
      if ((children != null) && (!localObject2.equals(children))) {
        localPropertyChangeEvent = new PropertyChangeEvent(this, "FolderChildren.PROP_CHILDREN", children, localObject2);
      }
      children = ((List)localObject2);
      if (LOG.isLoggable(Level.FINE))
      {
        rebuildCnt += 1L;
        LOG.log(Level.FINE, "{0} rebuilt {1} times", new Object[] { this, Long.valueOf(rebuildCnt) });
      }
    }
    if (localPropertyChangeEvent != null) {
      pcs.firePropertyChange(localPropertyChangeEvent);
    }
  }
  
  public void fileFolderCreated(FileEvent paramFileEvent)
  {
    paramFileEvent.runWhenDeliveryOver(rebuildRunnable);
  }
  
  public void fileDataCreated(FileEvent paramFileEvent)
  {
    paramFileEvent.runWhenDeliveryOver(rebuildRunnable);
  }
  
  public void fileChanged(FileEvent paramFileEvent)
  {
    paramFileEvent.runWhenDeliveryOver(propChangeRunnable);
  }
  
  public void fileDeleted(FileEvent paramFileEvent)
  {
    paramFileEvent.runWhenDeliveryOver(rebuildRunnable);
  }
  
  public void fileRenamed(FileRenameEvent paramFileRenameEvent)
  {
    paramFileRenameEvent.runWhenDeliveryOver(rebuildRunnable);
  }
  
  public void fileAttributeChanged(FileAttributeEvent paramFileAttributeEvent)
  {
    paramFileAttributeEvent.runWhenDeliveryOver(rebuildRunnable);
  }
  
  private final Runnable rebuildRunnable = new Runnable()
  {
    public void run()
    {
      CompoundFolderChildren.this.rebuild();
    }
  };
  private final Runnable propChangeRunnable = new Runnable()
  {
    public void run()
    {
      pcs.firePropertyChange("FolderChildren.PROP_CHILDREN", null, null);
    }
  };
  private long rebuildCnt = 0L;
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.CompoundFolderChildren
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import org.netbeans.api.editor.mimelookup.MimePath;
import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
import org.openide.util.Lookup;

public class DefaultMimeDataProvider
  implements MimeDataProvider
{
  public Lookup getLookup(MimePath paramMimePath)
  {
    return new SwitchLookup(paramMimePath);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.DefaultMimeDataProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

class FolderPathLookup$1 {}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.FolderPathLookup.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import java.io.IOException;
import org.openide.cookies.InstanceCookie.Of;

final class FolderPathLookup$ICItem$BrokenInstance
  implements InstanceCookie.Of
{
  private final String message;
  private final Exception ex;
  
  public FolderPathLookup$ICItem$BrokenInstance(String paramString, Exception paramException)
  {
    message = paramString;
    ex = paramException;
  }
  
  public String instanceName()
  {
    return "java.lang.Object";
  }
  
  private ClassNotFoundException die()
  {
    if (ex != null) {
      return new ClassNotFoundException(message, ex);
    }
    return new ClassNotFoundException(message);
  }
  
  public Class instanceClass()
    throws IOException, ClassNotFoundException
  {
    throw die();
  }
  
  public Object instanceCreate()
    throws IOException, ClassNotFoundException
  {
    throw die();
  }
  
  public boolean instanceOf(Class paramClass)
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.FolderPathLookup.ICItem.BrokenInstance
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.cookies.InstanceCookie;
import org.openide.cookies.InstanceCookie.Of;
import org.openide.filesystems.FileObject;
import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectNotFoundException;
import org.openide.loaders.InstanceDataObject;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.openide.util.lookup.AbstractLookup.Pair;

final class FolderPathLookup$ICItem
  extends AbstractLookup.Pair
{
  static final long serialVersionUID = 10L;
  static final ThreadLocal<ICItem> DANGEROUS = new ThreadLocal();
  private static final Logger ERR = Logger.getLogger(ICItem.class.getName());
  private FileObject fo;
  private transient InstanceCookie ic;
  private transient DataObject dataObject;
  private transient Reference<Object> ref;
  
  public FolderPathLookup$ICItem(DataObject paramDataObject, InstanceCookie paramInstanceCookie)
  {
    ic = paramInstanceCookie;
    dataObject = paramDataObject;
    fo = paramDataObject.getPrimaryFile();
    if (ERR.isLoggable(Level.FINE)) {
      ERR.fine("New ICItem: " + paramDataObject);
    }
  }
  
  public void init()
  {
    if (ic != null) {
      return;
    }
    ICItem localICItem = (ICItem)DANGEROUS.get();
    try
    {
      DANGEROUS.set(this);
      if (dataObject == null) {
        try
        {
          dataObject = DataObject.find(fo);
        }
        catch (DataObjectNotFoundException localDataObjectNotFoundException)
        {
          ic = new BrokenInstance("No DataObject for " + fo.getPath(), localDataObjectNotFoundException); return;
        }
      }
      ic = ((InstanceCookie)dataObject.getCookie(InstanceCookie.class));
      if (ic == null) {
        ic = new BrokenInstance("No cookie for " + fo.getPath(), null);
      }
    }
    finally
    {
      DANGEROUS.set(localICItem);
    }
  }
  
  private static final class BrokenInstance
    implements InstanceCookie.Of
  {
    private final String message;
    private final Exception ex;
    
    public BrokenInstance(String paramString, Exception paramException)
    {
      message = paramString;
      ex = paramException;
    }
    
    public String instanceName()
    {
      return "java.lang.Object";
    }
    
    private ClassNotFoundException die()
    {
      if (ex != null) {
        return new ClassNotFoundException(message, ex);
      }
      return new ClassNotFoundException(message);
    }
    
    public Class instanceClass()
      throws IOException, ClassNotFoundException
    {
      throw die();
    }
    
    public Object instanceCreate()
      throws IOException, ClassNotFoundException
    {
      throw die();
    }
    
    public boolean instanceOf(Class paramClass)
    {
      return false;
    }
  }
  
  protected boolean instanceOf(Class paramClass)
  {
    init();
    if (ERR.isLoggable(Level.FINE)) {
      ERR.fine("instanceOf: " + paramClass.getName() + " obj: " + dataObject);
    }
    if ((ic instanceof InstanceCookie.Of))
    {
      InstanceCookie.Of localOf = (InstanceCookie.Of)ic;
      boolean bool2 = localOf.instanceOf(paramClass);
      if (ERR.isLoggable(Level.FINE)) {
        ERR.fine("  of: " + bool2);
      }
      return bool2;
    }
    try
    {
      boolean bool1 = paramClass.isAssignableFrom(ic.instanceClass());
      if (ERR.isLoggable(Level.FINE)) {
        ERR.fine("  plain: " + bool1);
      }
      return bool1;
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      exception(localClassNotFoundException, fo);
    }
    catch (IOException localIOException)
    {
      exception(localIOException, fo);
    }
    return false;
  }
  
  public Object getInstance()
  {
    init();
    try
    {
      Object localObject = ic.instanceCreate();
      if (ERR.isLoggable(Level.FINE)) {
        ERR.fine("  getInstance: " + localObject + " for " + dataObject);
      }
      ref = new WeakReference(localObject);
      return localObject;
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      exception(localClassNotFoundException, fo);
    }
    catch (IOException localIOException)
    {
      exception(localIOException, fo);
    }
    return null;
  }
  
  public int hashCode()
  {
    init();
    
    return System.identityHashCode(ic);
  }
  
  public boolean equals(Object paramObject)
  {
    if ((paramObject instanceof ICItem))
    {
      ICItem localICItem = (ICItem)paramObject;
      localICItem.init();
      init();
      return ic == ic;
    }
    return false;
  }
  
  public String getId()
  {
    init();
    if (dataObject == null) {
      return "<broken: " + fo.getPath() + ">";
    }
    return dataObject.getName();
  }
  
  public String getDisplayName()
  {
    init();
    if (dataObject == null) {
      return "<broken: " + fo.getPath() + ">";
    }
    return dataObject.getNodeDelegate().getDisplayName();
  }
  
  protected boolean creatorOf(Object paramObject)
  {
    Reference localReference = ref;
    if ((localReference != null) && (localReference.get() == paramObject)) {
      return true;
    }
    if ((dataObject instanceof InstanceDataObject)) {
      try
      {
        Method localMethod = InstanceDataObject.class.getDeclaredMethod("creatorOf", new Class[] { Object.class });
        return ((Boolean)localMethod.invoke(dataObject, new Object[] { paramObject })).booleanValue();
      }
      catch (Exception localException) {}
    }
    return false;
  }
  
  public Class getType()
  {
    init();
    try
    {
      return ic.instanceClass();
    }
    catch (IOException localIOException) {}catch (ClassNotFoundException localClassNotFoundException) {}
    return Object.class;
  }
  
  private static void exception(Exception paramException, FileObject paramFileObject)
  {
    Exceptions.attachMessage(paramException, "Bad file: " + paramFileObject);
    FolderPathLookup.access$200().log(Level.WARNING, null, paramException);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.FolderPathLookup.ICItem
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

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

class FolderPathLookup$PCL
  implements PropertyChangeListener
{
  private FolderPathLookup$PCL(FolderPathLookup paramFolderPathLookup) {}
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    FolderPathLookup.access$100(this$0);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.FolderPathLookup.PCL
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.editor.mimelookup.impl;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.cookies.InstanceCookie;
import org.openide.cookies.InstanceCookie.Of;
import org.openide.filesystems.FileObject;
import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectNotFoundException;
import org.openide.loaders.InstanceDataObject;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.openide.util.lookup.AbstractLookup;
import org.openide.util.lookup.AbstractLookup.Pair;
import org.openide.util.lookup.InstanceContent;

public final class FolderPathLookup
  extends AbstractLookup
{
  private static final Logger LOG = Logger.getLogger(FolderPathLookup.class.getName());
  private InstanceContent content;
  private CompoundFolderChildren children;
  private PCL listener = new PCL(null);
  
  public FolderPathLookup(String[] paramArrayOfString)
  {
    this(paramArrayOfString, new InstanceContent());
  }
  
  private FolderPathLookup(String[] paramArrayOfString, InstanceContent paramInstanceContent)
  {
    super(paramInstanceContent);
    
    content = paramInstanceContent;
    
    children = new CompoundFolderChildren(paramArrayOfString, false);
    children.addPropertyChangeListener(listener);
    
    rebuild();
  }
  
  private void rebuild()
  {
    ArrayList localArrayList = new ArrayList();
    for (FileObject localFileObject : children.getChildren()) {
      if (localFileObject.isValid()) {
        try
        {
          DataObject localDataObject = DataObject.find(localFileObject);
          InstanceCookie localInstanceCookie = (InstanceCookie)localDataObject.getCookie(InstanceCookie.class);
          if (localInstanceCookie != null) {
            localArrayList.add(new ICItem(localDataObject, localInstanceCookie));
          }
        }
        catch (Exception localException)
        {
          LOG.log(Level.WARNING, "Can't create DataObject", localException);
        }
      }
    }
    content.setPairs(localArrayList);
  }
  
  private class PCL
    implements PropertyChangeListener
  {
    private PCL() {}
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      FolderPathLookup.this.rebuild();
    }
  }
  
  private static final class ICItem
    extends AbstractLookup.Pair
  {
    static final long serialVersionUID = 10L;
    static final ThreadLocal<ICItem> DANGEROUS = new ThreadLocal();
    private static final Logger ERR = Logger.getLogger(ICItem.class.getName());
    private FileObject fo;
    private transient InstanceCookie ic;
    private transient DataObject dataObject;
    private transient Reference<Object> ref;
    
    public ICItem(DataObject paramDataObject, InstanceCookie paramInstanceCookie)
    {
      ic = paramInstanceCookie;
      dataObject = paramDataObject;
      fo = paramDataObject.getPrimaryFile();
      if (ERR.isLoggable(Level.FINE)) {
        ERR.fine("New ICItem: " + paramDataObject);
      }
    }
    
    public void init()
    {
      if (ic != null) {
        return;
      }
      ICItem localICItem = (ICItem)DANGEROUS.get();
      try
      {
        DANGEROUS.set(this);
        if (dataObject == null) {
          try
          {
            dataObject = DataObject.find(fo);
          }
          catch (DataObjectNotFoundException localDataObjectNotFoundException)
          {
            ic = new BrokenInstance("No DataObject for " + fo.getPath(), localDataObjectNotFoundException); return;
          }
        }
        ic = ((InstanceCookie)dataObject.getCookie(InstanceCookie.class));
        if (ic == null) {
          ic = new BrokenInstance("No cookie for " + fo.getPath(), null);
        }
      }
      finally
      {
        DANGEROUS.set(localICItem);
      }
    }
    
    private static final class BrokenInstance
      implements InstanceCookie.Of
    {
      private final String message;
      private final Exception ex;
      
      public BrokenInstance(String paramString, Exception paramException)
      {
        message = paramString;
        ex = paramException;
      }
      
      public String instanceName()
      {
        return "java.lang.Object";
      }
      
      private ClassNotFoundException die()
      {
        if (ex != null) {
          return new ClassNotFoundException(message, ex);
        }
        return new ClassNotFoundException(message);
      }
      
      public Class instanceClass()
        throws IOException, ClassNotFoundException
      {
        throw die();
      }
      
      public Object instanceCreate()
        throws IOException, ClassNotFoundException
      {
        throw die();
      }
      
      public boolean instanceOf(Class paramClass)
      {
        return false;
      }
    }
    
    protected boolean instanceOf(Class paramClass)
    {
      init();
      if (ERR.isLoggable(Level.FINE)) {
        ERR.fine("instanceOf: " + paramClass.getName() + " obj: " + dataObject);
      }
      if ((ic instanceof InstanceCookie.Of))
      {
        InstanceCookie.Of localOf = (InstanceCookie.Of)ic;
        boolean bool2 = localOf.instanceOf(paramClass);
        if (ERR.isLoggable(Level.FINE)) {
          ERR.fine("  of: " + bool2);
        }
        return bool2;
      }
      try
      {
        boolean bool1 = paramClass.isAssignableFrom(ic.instanceClass());
        if (ERR.isLoggable(Level.FINE)) {
          ERR.fine("  plain: " + bool1);
        }
        return bool1;
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        exception(localClassNotFoundException, fo);
      }
      catch (IOException localIOException)
      {
        exception(localIOException, fo);
      }
      return false;
    }
    
    public Object getInstance()
    {
      init();
      try
      {
        Object localObject = ic.instanceCreate();
        if (ERR.isLoggable(Level.FINE)) {
          ERR.fine("  getInstance: " + localObject + " for " + dataObject);
        }
        ref = new WeakReference(localObject);
        return localObject;
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        exception(localClassNotFoundException, fo);
      }
      catch (IOException localIOException)
      {
        exception(localIOException, fo);
      }
      return null;
    }
    
    public int hashCode()
    {
      init();
      
      return System.identityHashCode(ic);
    }
    
    public boolean equals(Object paramObject)
    {
      if ((paramObject instanceof ICItem))
      {
        ICItem localICItem = (ICItem)paramObject;
        localICItem.init();
        init();
        return ic == ic;
      }
      return false;
    }
    
    public String getId()
    {
      init();
      if (dataObject == null) {
        return "<broken: " + fo.getPath() + ">";
      }
      return dataObject.getName();
    }
    
    public String getDisplayName()
    {
      init();
      if (dataObject == null) {
        return "<broken: " + fo.getPath() + ">";
      }
      return dataObject.getNodeDelegate().getDisplayName();
    }
    
    protected boolean creatorOf(Object paramObject)
    {
      Reference localReference = ref;
      if ((localReference != null) && (localReference.get() == paramObject)) {
        return true;
      }
      if ((dataObject instanceof InstanceDataObject)) {
        try
        {
          Method localMethod = InstanceDataObject.class.getDeclaredMethod("creatorOf", new Class[] { Object.class });
          return ((Boolean)localMethod.invoke(dataObject, new Object[] { paramObject })).booleanValue();
        }
        catch (Exception localException) {}
      }
      return false;
    }
    
    public Class getType()
    {
      init();
      try
      {
        return ic.instanceClass();
      }
      catch (IOException localIOException) {}catch (ClassNotFoundException localClassNotFoundException) {}
      return Object.class;
    }
    
    private static void exception(Exception paramException, FileObject paramFileObject)
    {
      Exceptions.attachMessage(paramException, "Bad file: " + paramFileObject);
      FolderPathLookup.LOG.log(Level.WARNING, null, paramException);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.editor.mimelookup.impl.FolderPathLookup
 * Java Class Versi
1 2

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