org-netbeans-modules-masterfs

eCollection(previousProviders);
    } else {
      localObject = Collections.emptyList();
    }
    return new ProvidedExtensionsProxy((Collection)localObject);
  }
  
  public void resultChanged(LookupEvent paramLookupEvent)
  {
    Collection localCollection = annotationProviders.allInstances();
    Object localObject1;
    Object localObject3;
    if (previousProviders != null)
    {
      localObject1 = new HashSet(localCollection);
      ((Collection)localObject1).removeAll(previousProviders);
      
      localObject2 = new HashSet(previousProviders);
      ((HashSet)localObject2).removeAll(localCollection);
      for (localObject3 = ((HashSet)localObject2).iterator(); ((Iterator)localObject3).hasNext();)
      {
        AnnotationProvider localAnnotationProvider = (AnnotationProvider)((Iterator)localObject3).next();
        localAnnotationProvider.removeFileStatusListener(this);
      }
    }
    else
    {
      localObject1 = localCollection;
    }
    for (Object localObject2 = ((Collection)localObject1).iterator(); ((Iterator)localObject2).hasNext();)
    {
      localObject3 = (AnnotationProvider)((Iterator)localObject2).next();
      try
      {
        ((AnnotationProvider)localObject3).addFileStatusListener(this);
      }
      catch (TooManyListenersException localTooManyListenersException)
      {
        Exceptions.printStackTrace(localTooManyListenersException);
      }
    }
    previousProviders = localCollection;
  }
  
  public SystemAction[] getActions(Set<FileObject> paramSet)
  {
    Action[] arrayOfAction = null;
    Iterator localIterator = annotationProviders.allInstances().iterator();
    Object localObject;
    while ((arrayOfAction == null) && (localIterator.hasNext()))
    {
      localObject = (AnnotationProvider)localIterator.next();
      arrayOfAction = ((AnnotationProvider)localObject).actions(paramSet);
    }
    if (arrayOfAction != null)
    {
      localObject = new SystemAction[arrayOfAction.length];
      for (int i = 0; i < arrayOfAction.length; i++) {
        if ((arrayOfAction[i] instanceof SystemAction)) {
          localObject[i] = ((SystemAction)arrayOfAction[i]);
        }
      }
      return (SystemAction[])localObject;
    }
    return null;
  }
  
  public void annotationChanged(FileStatusEvent paramFileStatusEvent)
  {
    FileBasedFileSystem.access$000(this$0, paramFileStatusEvent);
  }
  
  public Image annotateIcon(Image paramImage, int paramInt, Set<? extends FileObject> paramSet)
  {
    Image localImage = null;
    
    Iterator localIterator = annotationProviders.allInstances().iterator();
    while ((localImage == null) && (localIterator.hasNext()))
    {
      AnnotationProvider localAnnotationProvider = (AnnotationProvider)localIterator.next();
      localImage = localAnnotationProvider.annotateIcon(paramImage, paramInt, paramSet);
    }
    if (localImage != null) {
      return localImage;
    }
    return paramImage;
  }
  
  public String annotateName(String paramString, Set<? extends FileObject> paramSet)
  {
    String str = null;
    Iterator localIterator = annotationProviders.allInstances().iterator();
    while ((str == null) && (localIterator.hasNext()))
    {
      AnnotationProvider localAnnotationProvider = (AnnotationProvider)localIterator.next();
      str = localAnnotationProvider.annotateName(paramString, paramSet);
    }
    if (str != null) {
      return str;
    }
    return paramString;
  }
  
  public String annotateNameHtml(String paramString, Set<? extends FileObject> paramSet)
  {
    String str = null;
    Iterator localIterator = annotationProviders.allInstances().iterator();
    while ((str == null) && (localIterator.hasNext()))
    {
      AnnotationProvider localAnnotationProvider = (AnnotationProvider)localIterator.next();
      str = localAnnotationProvider.annotateNameHtml(paramString, paramSet);
    }
    return str;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem.StatusImpl
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TooManyListenersException;
import javax.swing.Action;
import org.netbeans.modules.masterfs.ProvidedExtensionsProxy;
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj;
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory;
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.Caller;
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj;
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObjWindows;
import org.netbeans.modules.masterfs.providers.AnnotationProvider;
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileStatusEvent;
import org.openide.filesystems.FileStatusListener;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileSystem.AtomicAction;
import org.openide.filesystems.FileSystem.HtmlStatus;
import org.openide.filesystems.FileSystem.Status;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.Lookup.Template;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.Utilities;
import org.openide.util.actions.SystemAction;

public final class FileBasedFileSystem
  extends FileSystem
{
  private static FileBasedFileSystem INSTANCE = new FileBasedFileSystem();
  private transient RootObj<? extends FileObject> root;
  private final transient StatusImpl status = new StatusImpl();
  private static transient int modificationInProgress;
  
  public FileBasedFileSystem()
  {
    Object localObject;
    if (Utilities.isWindows())
    {
      localObject = new RootObjWindows();
      root = new RootObj((FileObject)localObject);
    }
    else
    {
      localObject = FileObjectFactory.getInstance(new File("/"));
      root = new RootObj(((FileObjectFactory)localObject).getRoot());
    }
  }
  
  public static synchronized boolean isModificationInProgress()
  {
    return modificationInProgress != 0;
  }
  
  private static synchronized void setModificationInProgress(boolean paramBoolean)
  {
    if (paramBoolean) {
      modificationInProgress += 1;
    } else {
      modificationInProgress -= 1;
    }
  }
  
  public static void runAsInconsistent(Runnable paramRunnable)
  {
    try
    {
      setModificationInProgress(true);
      paramRunnable.run();
    }
    finally
    {
      setModificationInProgress(false);
    }
  }
  
  public static <Retval> Retval runAsInconsistent(FSCallable<Retval> paramFSCallable)
    throws IOException
  {
    Object localObject1 = null;
    try
    {
      setModificationInProgress(true);
      localObject1 = paramFSCallable.call();
    }
    finally
    {
      setModificationInProgress(false);
    }
    return (Retval)localObject1;
  }
  
  public static Map<File, ? extends FileObjectFactory> factories()
  {
    return FileObjectFactory.factories();
  }
  
  public static FileObject getFileObject(File paramFile)
  {
    return getFileObject(paramFile, FileObjectFactory.Caller.GetFileObject);
  }
  
  public static FileObject getFileObject(File paramFile, FileObjectFactory.Caller paramCaller)
  {
    FileObjectFactory localFileObjectFactory = FileObjectFactory.getInstance(paramFile);
    Object localObject = null;
    if (localFileObjectFactory != null) {
      if ((paramFile.getParentFile() == null) && (Utilities.isUnix())) {
        localObject = getInstance().getRoot();
      } else {
        localObject = localFileObjectFactory.getValidFileObject(paramFile, paramCaller);
      }
    }
    return (FileObject)localObject;
  }
  
  public static FileBasedFileSystem getInstance()
  {
    return INSTANCE;
  }
  
  public void refresh(final boolean paramBoolean)
  {
    final Runnable local1 = new Runnable()
    {
      public void run()
      {
        refreshImpl(paramBoolean);
      }
    };
    try
    {
      getInstance().runAtomicAction(new FileSystem.AtomicAction()
      {
        public void run()
          throws IOException
        {
          FileBasedFileSystem.runAsInconsistent(local1);
        }
      });
    }
    catch (IOException localIOException)
    {
      Exceptions.printStackTrace(localIOException);
    }
  }
  
  public void refreshImpl(boolean paramBoolean)
  {
    FileObject localFileObject = root.getRealRoot();
    if ((localFileObject instanceof BaseFileObj))
    {
      ((BaseFileObj)localFileObject).getFactory().refresh(paramBoolean);
    }
    else if ((localFileObject instanceof RootObjWindows))
    {
      Collection localCollection = factories().values();
      for (FileObjectFactory localFileObjectFactory : localCollection) {
        localFileObjectFactory.refresh(paramBoolean);
      }
    }
  }
  
  public String getDisplayName()
  {
    return getClass().getName();
  }
  
  public boolean isReadOnly()
  {
    return false;
  }
  
  public FileObject getRoot()
  {
    return root;
  }
  
  public FileObject findResource(String paramString)
  {
    if (Utilities.isWindows())
    {
      if ("".equals(paramString)) {
        return getInstance().getRoot();
      }
    }
    else {
      paramString = "/" + paramString;
    }
    return getFileObject(new File(paramString));
  }
  
  public SystemAction[] getActions()
  {
    return new SystemAction[0];
  }
  
  public final SystemAction[] getActions(Set<FileObject> paramSet)
  {
    SystemAction[] arrayOfSystemAction = status.getActions(paramSet);
    if (arrayOfSystemAction != null) {
      return arrayOfSystemAction;
    }
    return new SystemAction[0];
  }
  
  public FileSystem.Status getStatus()
  {
    return status;
  }
  
  public final class StatusImpl
    implements FileSystem.HtmlStatus, LookupListener, FileStatusListener
  {
    private Lookup.Result<AnnotationProvider> annotationProviders;
    private Collection<? extends AnnotationProvider> previousProviders;
    
    public StatusImpl()
    {
      annotationProviders = Lookup.getDefault().lookup(new Lookup.Template(AnnotationProvider.class));
      annotationProviders.addLookupListener(this);
      resultChanged(null);
    }
    
    public ProvidedExtensions getExtensions()
    {
      Object localObject;
      if (previousProviders != null) {
        localObject = Collections.unmodifiableCollection(previousProviders);
      } else {
        localObject = Collections.emptyList();
      }
      return new ProvidedExtensionsProxy((Collection)localObject);
    }
    
    public void resultChanged(LookupEvent paramLookupEvent)
    {
      Collection localCollection = annotationProviders.allInstances();
      Object localObject1;
      Object localObject3;
      if (previousProviders != null)
      {
        localObject1 = new HashSet(localCollection);
        ((Collection)localObject1).removeAll(previousProviders);
        
        localObject2 = new HashSet(previousProviders);
        ((HashSet)localObject2).removeAll(localCollection);
        for (localObject3 = ((HashSet)localObject2).iterator(); ((Iterator)localObject3).hasNext();)
        {
          AnnotationProvider localAnnotationProvider = (AnnotationProvider)((Iterator)localObject3).next();
          localAnnotationProvider.removeFileStatusListener(this);
        }
      }
      else
      {
        localObject1 = localCollection;
      }
      for (Object localObject2 = ((Collection)localObject1).iterator(); ((Iterator)localObject2).hasNext();)
      {
        localObject3 = (AnnotationProvider)((Iterator)localObject2).next();
        try
        {
          ((AnnotationProvider)localObject3).addFileStatusListener(this);
        }
        catch (TooManyListenersException localTooManyListenersException)
        {
          Exceptions.printStackTrace(localTooManyListenersException);
        }
      }
      previousProviders = localCollection;
    }
    
    public SystemAction[] getActions(Set<FileObject> paramSet)
    {
      Action[] arrayOfAction = null;
      Iterator localIterator = annotationProviders.allInstances().iterator();
      Object localObject;
      while ((arrayOfAction == null) && (localIterator.hasNext()))
      {
        localObject = (AnnotationProvider)localIterator.next();
        arrayOfAction = ((AnnotationProvider)localObject).actions(paramSet);
      }
      if (arrayOfAction != null)
      {
        localObject = new SystemAction[arrayOfAction.length];
        for (int i = 0; i < arrayOfAction.length; i++) {
          if ((arrayOfAction[i] instanceof SystemAction)) {
            localObject[i] = ((SystemAction)arrayOfAction[i]);
          }
        }
        return (SystemAction[])localObject;
      }
      return null;
    }
    
    public void annotationChanged(FileStatusEvent paramFileStatusEvent)
    {
      fireFileStatusChanged(paramFileStatusEvent);
    }
    
    public Image annotateIcon(Image paramImage, int paramInt, Set<? extends FileObject> paramSet)
    {
      Image localImage = null;
      
      Iterator localIterator = annotationProviders.allInstances().iterator();
      while ((localImage == null) && (localIterator.hasNext()))
      {
        AnnotationProvider localAnnotationProvider = (AnnotationProvider)localIterator.next();
        localImage = localAnnotationProvider.annotateIcon(paramImage, paramInt, paramSet);
      }
      if (localImage != null) {
        return localImage;
      }
      return paramImage;
    }
    
    public String annotateName(String paramString, Set<? extends FileObject> paramSet)
    {
      String str = null;
      Iterator localIterator = annotationProviders.allInstances().iterator();
      while ((str == null) && (localIterator.hasNext()))
      {
        AnnotationProvider localAnnotationProvider = (AnnotationProvider)localIterator.next();
        str = localAnnotationProvider.annotateName(paramString, paramSet);
      }
      if (str != null) {
        return str;
      }
      return paramString;
    }
    
    public String annotateNameHtml(String paramString, Set<? extends FileObject> paramSet)
    {
      String str = null;
      Iterator localIterator = annotationProviders.allInstances().iterator();
      while ((str == null) && (localIterator.hasNext()))
      {
        AnnotationProvider localAnnotationProvider = (AnnotationProvider)localIterator.next();
        str = localAnnotationProvider.annotateNameHtml(paramString, paramSet);
      }
      return str;
    }
  }
  
  public Object writeReplace()
    throws ObjectStreamException
  {
    return new SerReplace(null);
  }
  
  private static class SerReplace
    implements Serializable
  {
    static final long serialVersionUID = -3714631266626840241L;
    
    public Object readResolve()
      throws ObjectStreamException
    {
      return FileBasedFileSystem.getInstance();
    }
  }
  
  public static abstract interface FSCallable<V>
  {
    public abstract V call()
      throws IOException;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj;
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.Caller;
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.filesystems.URLMapper;
import org.openide.util.Exceptions;

public final class FileBasedURLMapper
  extends URLMapper
{
  public final URL getURL(FileObject paramFileObject, int paramInt)
  {
    if (paramInt == 2) {
      return null;
    }
    URL localURL = null;
    try
    {
      Object localObject;
      if ((paramFileObject instanceof BaseFileObj))
      {
        localObject = (BaseFileObj)paramFileObject;
        localURL = fileToURL(((BaseFileObj)localObject).getFileName().getFile(), paramFileObject);
      }
      else if ((paramFileObject instanceof RootObj))
      {
        localObject = (RootObj)paramFileObject;
        return getURL(((RootObj)localObject).getRealRoot(), paramInt);
      }
    }
    catch (MalformedURLException localMalformedURLException)
    {
      localURL = null;
    }
    return localURL;
  }
  
  public final FileObject[] getFileObjects(URL paramURL)
  {
    if (!"file".equals(paramURL.getProtocol())) {
      return null;
    }
    if ((paramURL.getPath().equals("//")) || (paramURL.getPath().equals("////"))) {
      return null;
    }
    FileObject localFileObject = null;
    File localFile;
    try
    {
      localFile = FileUtil.normalizeFile(new File(paramURL.toURI()));
    }
    catch (URISyntaxException localURISyntaxException)
    {
      Exceptions.printStackTrace(localURISyntaxException);
      return null;
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      Exceptions.printStackTrace(Exceptions.attachMessage(localIllegalArgumentException, "URL=" + paramURL));
      return null;
    }
    localFileObject = FileBasedFileSystem.getFileObject(localFile, FileObjectFactory.Caller.ToFileObject);
    return new FileObject[] { localFileObject };
  }
  
  private static URL fileToURL(File paramFile, FileObject paramFileObject)
    throws MalformedURLException
  {
    URL localURL = toURI(paramFile, paramFileObject.isFolder()).toURL();
    if (paramFileObject.isFolder())
    {
      String str = localURL.toExternalForm();
      if (!str.endsWith("/")) {
        localURL = new URL(str + "/");
      }
    }
    return localURL;
  }
  
  private static URI toURI(File paramFile, boolean paramBoolean)
  {
    try
    {
      File localFile = paramFile.getAbsoluteFile();
      String str = slashify(localFile.getPath(), paramBoolean);
      if (str.startsWith("//")) {
        str = "//" + str;
      }
      return new URI("file", null, str, null);
    }
    catch (URISyntaxException localURISyntaxException)
    {
      throw new Error(localURISyntaxException);
    }
  }
  
  private static String slashify(String paramString, boolean paramBoolean)
  {
    String str = paramString;
    if (File.separatorChar != '/') {
      str = str.replace(File.separatorChar, '/');
    }
    if (!str.startsWith("/")) {
      str = "/" + str;
    }
    if ((!str.endsWith("/")) && (paramBoolean)) {
      str = str + "/";
    }
    return str;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.FileBasedURLMapper
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs;

class Statistics$1 {}

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

public final class Statistics$StopWatch
{
  private long startTime = 0L;
  private final Statistics.TimeConsumer activity;
  
  private Statistics$StopWatch(Statistics.TimeConsumer paramTimeConsumer)
  {
    activity = paramTimeConsumer;
  }
  
  public void start()
  {
    startTime = System.currentTimeMillis();
  }
  
  public void stop()
  {
    assert (startTime != 0L);
    Statistics.TimeConsumer.access$214(activity, System.currentTimeMillis() - startTime);
    Statistics.TimeConsumer.access$300(activity);
    startTime = 0L;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.Statistics.StopWatch
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs;

public final class Statistics$TimeConsumer
{
  private int elapsedTime;
  private int numberOfCalls;
  private final String description;
  
  private Statistics$TimeConsumer(String paramString)
  {
    description = paramString;
  }
  
  public int getConsumedTime()
  {
    return elapsedTime;
  }
  
  public int getNumberOfCalls()
  {
    return numberOfCalls;
  }
  
  public void reset()
  {
    elapsedTime = 0;
    numberOfCalls = 0;
  }
  
  public String toString()
  {
    return description + ": " + numberOfCalls + " calls in " + elapsedTime + "ms";
  }
  
  private void incrementNumerOfCalls()
  {
    numberOfCalls += 1;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.Statistics.TimeConsumer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs;

import org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory;
import org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory;

public final class Statistics
{
  public static final TimeConsumer REFRESH_FOLDER = new TimeConsumer("Folder refresh", null);
  public static final TimeConsumer REFRESH_FILE = new TimeConsumer("File refresh", null);
  public static final TimeConsumer REFRESH_FS = new TimeConsumer("FileSystem refresh", null);
  public static final TimeConsumer LISTENERS_CALLS = new TimeConsumer("Invocation of FileChangeListeners", null);
  
  public static StopWatch getStopWatch(TimeConsumer paramTimeConsumer)
  {
    return new StopWatch(paramTimeConsumer, null);
  }
  
  public static int fileSystems()
  {
    return FileObjectFactory.getFactoriesSize();
  }
  
  public static int fileNamings()
  {
    return NamingFactory.getSize();
  }
  
  public static int fileObjects()
  {
    int i = 0;
    for (FileObjectFactory localFileObjectFactory : FileObjectFactory.getInstances()) {
      i += fileObjectsPerFileSystem(localFileObjectFactory);
    }
    return i;
  }
  
  public static int fileObjectsPerFileSystem(FileObjectFactory paramFileObjectFactory)
  {
    return paramFileObjectFactory.getSize();
  }
  
  public static final class TimeConsumer
  {
    private int elapsedTime;
    private int numberOfCalls;
    private final String description;
    
    private TimeConsumer(String paramString)
    {
      description = paramString;
    }
    
    public int getConsumedTime()
    {
      return elapsedTime;
    }
    
    public int getNumberOfCalls()
    {
      return numberOfCalls;
    }
    
    public void reset()
    {
      elapsedTime = 0;
      numberOfCalls = 0;
    }
    
    public String toString()
    {
      return description + ": " + numberOfCalls + " calls in " + elapsedTime + "ms";
    }
    
    private void incrementNumerOfCalls()
    {
      numberOfCalls += 1;
    }
  }
  
  public static final class StopWatch
  {
    private long startTime = 0L;
    private final Statistics.TimeConsumer activity;
    
    private StopWatch(Statistics.TimeConsumer paramTimeConsumer)
    {
      activity = paramTimeConsumer;
    }
    
    public void start()
    {
      startTime = System.currentTimeMillis();
    }
    
    public void stop()
    {
      assert (startTime != 0L);
      Statistics.TimeConsumer.access$214(activity, System.currentTimeMillis() - startTime);
      Statistics.TimeConsumer.access$300(activity);
      startTime = 0L;
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.Statistics
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs.children;

import java.util.Map;
import java.util.Set;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming;
import org.openide.util.Mutex.Privileged;

public abstract interface ChildrenCache
{
  public static final Integer ADDED_CHILD = new Integer(0);
  public static final Integer REMOVED_CHILD = new Integer(1);
  
  public abstract FileNaming getChild(String paramString, boolean paramBoolean);
  
  public abstract void removeChild(FileNaming paramFileNaming);
  
  public abstract Set<FileNaming> getChildren(boolean paramBoolean);
  
  public abstract Set<FileNaming> getCachedChildren();
  
  public abstract boolean isCacheInitialized();
  
  public abstract Map<FileNaming, Integer> refresh();
  
  public abstract Mutex.Privileged getMutexPrivileged();
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.children.ChildrenCache
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs.children;

import java.io.File;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileName;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming;

class ChildrenSupport$1
  extends FileName
{
  ChildrenSupport$1(ChildrenSupport paramChildrenSupport, FileNaming paramFileNaming, File paramFile)
  {
    super(paramFileNaming, paramFile);
  }
  
  public boolean isDirectory()
  {
    return false;
  }
  
  public boolean isFile()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.children.ChildrenSupport.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs.children;

import java.io.File;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming;
import org.netbeans.modules.masterfs.providers.ProvidedExtensions.IOHandler;

class ChildrenSupport$1FakeNaming
  implements FileNaming
{
  public FileNaming lastEqual;
  
  public String getName()
  {
    return val$childName;
  }
  
  public FileNaming getParent()
  {
    return val$folder;
  }
  
  public boolean isRoot()
  {
    return false;
  }
  
  public File getFile()
  {
    return val$f;
  }
  
  public Integer getId()
  {
    return val$id;
  }
  
  public FileNaming rename(String paramString, ProvidedExtensions.IOHandler paramIOHandler)
  {
    throw new IllegalStateException();
  }
  
  public boolean equals(Object paramObject)
  {
    if (hashCode() == paramObject.hashCode())
    {
      assert (lastEqual == null) : "Just one can be there";
      if ((paramObject instanceof FileNaming)) {
        lastEqual = ((FileNaming)paramObject);
      }
      return true;
    }
    return false;
  }
  
  public int hashCode()
  {
    return val$id.intValue();
  }
  
  public boolean isFile()
  {
    return getFile().isFile();
  }
  
  public boolean isDirectory()
  {
    return !isFile();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.children.ChildrenSupport.1FakeNaming
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs.children;

import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileName;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming;
import org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory;
import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo;
import org.netbeans.modules.masterfs.providers.ProvidedExtensions.IOHandler;
import org.openide.util.Mutex;
import org.openide.util.Mutex.Privileged;

public class ChildrenSupport
{
  static final int NO_CHILDREN_CACHED = 0;
  static final int SOME_CHILDREN_CACHED = 1;
  static final int ALL_CHILDREN_CACHED = 2;
  private Set<FileNaming> notExistingChildren;
  private Set<FileNaming> existingChildren;
  private int status = 0;
  private static final Mutex.Privileged mutexPrivileged = new Mutex.Privileged();
  private static final Mutex mutex = new Mutex(mutexPrivileged);
  
  public final Mutex.Privileged getMutexPrivileged()
  {
    return mutexPrivileged;
  }
  
  public static boolean isLock()
  {
    return (mutex.isReadAccess()) || (mutex.isWriteAccess());
  }
  
  public Set<FileNaming> getCachedChildren()
  {
    return getExisting(false);
  }
  
  public synchronized Set<FileNaming> getChildren(FileNaming paramFileNaming, boolean paramBoolean)
  {
    if ((paramBoolean) || (!isStatus(2)))
    {
      rescanChildren(paramFileNaming, false);
      setStatus(2);
    }
    return getExisting(false);
  }
  
  public boolean isCacheInitialized()
  {
    return !isStatus(0);
  }
  
  public synchronized FileNaming getChild(String paramString, FileNaming paramFileNaming, boolean paramBoolean)
  {
    FileNaming localFileNaming = null;
    if ((paramBoolean) || (isStatus(0)))
    {
      localFileNaming = rescanChild(paramFileNaming, paramString, false);
    }
    else if (isStatus(1))
    {
      localFileNaming = lookupChildInCache(paramFileNaming, paramString, true);
      if ((localFileNaming == null) && (lookupChildInCache(paramFileNaming, paramString, false) == null)) {
        localFileNaming = rescanChild(paramFileNaming, paramString, false);
      }
    }
    else if (isStatus(2))
    {
      localFileNaming = lookupChildInCache(paramFileNaming, paramString, true);
    }
    setStatus(1);
    return localFileNaming;
  }
  
  public synchronized void removeChild(FileNaming paramFileNaming1, FileNaming paramFileNaming2)
  {
    assert (paramFileNaming2 != null);
    getExisting().remove(paramFileNaming2);
    if (paramFileNaming2.getParent().equals(paramFileNaming1)) {
      getNotExisting().add(paramFileNaming2);
    }
  }
  
  private synchronized void addChild(FileNaming paramFileNaming1, FileNaming paramFileNaming2)
  {
    assert (paramFileNaming2 != null);
    assert (paramFileNaming2.getParent().equals(paramFileNaming1)) : ("childName: " + paramFileNaming2.getFile() + " folderName: " + paramFileNaming1.getFile());
    getExisting().add(paramFileNaming2);
    getNotExisting().remove(paramFileNaming2);
  }
  
  public synchronized Map<FileNaming, Integer> refresh(FileNaming paramFileNaming)
  {
    Object localObject1 = new HashMap();
    HashSet localHashSet1 = new HashSet(getExisting(false));
    HashSet localHashSet2 = new HashSet(getNotExisting(false));
    Object localObject3;
    FileNaming localFileNaming1;
    if (isStatus(1))
    {
      HashSet localHashSet3 = new HashSet(localHashSet1);
      for (Object localObject2 = localHashSet3.iterator(); ((Iterator)localObject2).hasNext();)
      {
        localObject3 = (FileNaming)((Iterator)localObject2).next();
        localFileNaming1 = rescanChild(paramFileNaming, ((FileNaming)localObject3).getName(), true);
        if (localFileNaming1 == null) {
          ((Map)localObject1).put(localObject3, ChildrenCache.REMOVED_CHILD);
        }
      }
      localObject2 = new HashSet(localHashSet2);
      for (localObject3 = ((Set)localObject2).iterator(); ((Iterator)localObject3).hasNext();)
      {
        localFileNaming1 = (FileNaming)((Iterator)localObject3).next();
        assert (localFileNaming1 != null);
        FileNaming localFileNaming2 = rescanChild(paramFileNaming, localFileNaming1.getName(), true);
        if (localFileNaming2 != null) {
          ((Map)localObject1).put(localFileNaming1, ChildrenCache.ADDED_CHILD);
        }
      }
    }
    else if (isStatus(2))
    {
      localObject1 = rescanChildren(paramFileNaming, true);
    }
    return (Map<FileNaming, Integer>)localObject1;
  }
  
  public String toString()
  {
    return getExisting(false).toString();
  }
  
  boolean isStatus(int paramInt)
  {
    return status == paramInt;
  }
  
  private void setStatus(int paramInt)
  {
    if (status < paramInt) {
      status = paramInt;
    }
  }
  
  private FileNaming rescanChild(FileNaming paramFileNaming, String paramString, boolean paramBoolean)
  {
    File localFile1 = paramFileNaming.getFile();
    File localFile2 = new File(localFile1, paramString);
    FileInfo localFileInfo = new FileInfo(localFile2);
    
    FileNaming localFileNaming = localFileInfo.isConvertibleToFileObject() ? NamingFactory.fromFile(paramFileNaming, localFile2, paramBoolean) : null;
    if (localFileNaming != null)
    {
      addChild(paramFileNaming, localFileNaming);
    }
    else
    {
      FileName local1 = new FileName(paramFileNaming, localFile2)
      {
        public boolean isDirectory()
        {
          return false;
        }
        
        public boolean isFile()
        {
          return false;
        }
      };
      removeChild(paramFileNaming, local1);
    }
    return localFileNaming;
  }
  
  private Map<FileNaming, Integer> rescanChildren(FileNaming paramFileNaming, boolean paramBoolean)
  {
    IdentityHashMap localIdentityHashMap = new IdentityHashMap();
    LinkedHashSet localLinkedHashSet = new LinkedHashSet();
    
    File localFile = paramFileNaming.getFile();
    assert (paramFileNaming.getFile().getAbsolutePath().equals(paramFileNaming.toString()));
    
    File[] arrayOfFile = localFile.listFiles();
    if (arrayOfFile != null) {
      for (int i = 0; i < arrayOfFile.length; i++)
      {
        localObject1 = new FileInfo(arrayOfFile[i], 1);
        if (((FileInfo)localObject1).isConvertibleToFileObject())
        {
          localObject2 = NamingFactory.fromFile(paramFileNaming, arrayOfFile[i], paramBoolean);
          localLinkedHashSet.add(localObject2);
        }
      }
    } else if (localFile.exists()) {
      return localIdentityHashMap;
    }
    Set localSet = deepMinus(getExisting(false), localLinkedHashSet);
    for (Object localObject1 = localSet.iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (FileNaming)((Iterator)localObject1).next();
      removeChild(paramFileNaming, (FileNaming)localObject2);
      localIdentityHashMap.put(localObject2, ChildrenCache.REMOVED_CHILD);
    }
    localObject1 = deepMinus(localLinkedHashSet, getExisting(false));
    for (Object localObject2 = ((Set)localObject1).iterator(); ((Iterator)localObject2).hasNext();)
    {
      FileNaming localFileNaming = (FileNaming)((Iterator)localObject2).next();
      addChild(paramFileNaming, localFileNaming);
      localIdentityHashMap.put(localFileNaming, ChildrenCache.ADDED_CHILD);
    }
    return localIdentityHashMap;
  }
  
  private static Set<FileNaming> deepMinus(Set<FileNaming> paramSet1, Set<FileNaming> paramSet2)
  {
    HashMap localHashMap = new HashMap(paramSet1.size() * 2);
    for (Iterator localIterator = paramSet1.iterator(); localIterator.hasNext();)
    {
      localFileNaming1 = (FileNaming)localIterator.next();
      localHashMap.put(localFileNaming1, localFileNaming1);
    }
    FileNaming localFileNaming1;
    for (localIterator = paramSet2.iterator(); localIterator.hasNext();)
    {
      localFileNaming1 = (FileNaming)localIterator.next();
      FileNaming localFileNaming2 = (FileNaming)localHashMap.remove(localFileNaming1);
      if ((localFileNaming2 != null) && (localFileNaming2.isFile() != localFileNaming1.isFile())) {
        localHashMap.put(localFileNaming2, localFileNaming2);
      }
    }
    return localHashMap.keySet();
  }
  
  private FileNaming lookupChildInCache(final FileNaming paramFileNaming, final String paramString, boolean paramBoolean)
  {
    final File localFile = new File(paramFileNaming.getFile(), paramString);
    final Integer localInteger = NamingFactory.createID(localFile);
    
    FileNaming local1FakeNaming = new FileNaming()
    {
      public FileNaming lastEqual;
      
      public String getName()
      {
        return paramString;
      }
      
      public FileNaming getParent()
      {
        return paramFileNaming;
      }
      
      public boolean isRoot()
      {
        return false;
      }
      
      public File getFile()
      {
        return localFile;
      }
      
      public Integer getId()
      {
        return localInteger;
      }
      
      public FileNaming rename(String paramAnonymousString, ProvidedExtensions.IOHandler paramAnonymousIOHandler)
      {
        throw new IllegalStateException();
      }
      
      public boolean equals(Object paramAnonymousObject)
      {
        if (hashCode() == paramAnonymousObject.hashCode())
        {
          assert (lastEqual == null) : "Just one can be there";
          if ((paramAnonymousObject instanceof FileNaming)) {
            lastEqual = ((FileNaming)paramAnonymousObject);
          }
          return true;
        }
        return false;
      }
      
      public int hashCode()
      {
        return localInteger.intValue();
      }
      
      public boolean isFile()
      {
        return getFile().isFile();
      }
      
      public boolean isDirectory()
      {
        return !isFile();
      }
    };
    Set localSet = paramBoolean ? getExisting(false) : getNotExisting(false);
    if (localSet.contains(local1FakeNaming))
    {
      assert (lastEqual != null) : "If cache contains the object, we set lastEqual";
      return lastEqual;
    }
    return null;
  }
  
  private synchronized Set<FileNaming> getExisting()
  {
    return getExisting(true);
  }
  
  private synchronized Set<FileNaming> getExisting(boolean paramBoolean)
  {
    if ((paramBoolean) && (existingChildren == null)) {
      existingChildren = new HashSet();
    }
    return existingChildren != null ? existingChildren : new HashSet();
  }
  
  private synchronized Set<FileNaming> getNotExisting()
  {
    return getNotExisting(true);
  }
  
  private synchronized Set<FileNaming> getNotExisting(boolean paramBoolean)
  {
    if ((paramBoolean) && (notExistingChildren == null)) {
      notExistingChildren = new HashSet();
    }
    return notExistingChildren != null ? notExistingChildren : new HashSet();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.children.ChildrenSupport
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs.fileobjects;

import java.io.IOException;
import org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem.FSCallable;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming;
import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo;
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
import org.openide.filesystems.FileLock;

class BaseFileObj$1
  implements FileBasedFileSystem.FSCallable<Boolean>
{
  BaseFileObj$1(BaseFileObj paramBaseFileObj, FileLock paramFileLock, String paramString1, String paramString2) {}
  
  public Boolean call()
    throws IOException
  {
    ProvidedExtensions localProvidedExtensions = this$0.getProvidedExtensions();
    this$0.rename(val$lock, val$name, val$ext, localProvidedExtensions.getRenameHandler(this$0.getFileName().getFile(), FileInfo.composeName(val$name, val$ext)));
    return Boolean.valueOf(true);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.masterfs.filebasedfs.fileobjects;

import java.io.IOException;
import org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem.FSCallable;
import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming;
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
import org.openide.filesystems.FileLock;

class BaseFileObj$2
  implements FileBasedFileSystem.FSCallable<Boolean>
{
  BaseFileObj$2(BaseFileObj paramBaseFileObj, FileLock paramFileLock) {}
  
  public Boolean call()
    throws IOException
  {
    ProvidedExtensions localProvidedExtensions = this$0.getProvidedExtensions();
    localProvidedExtensions.beforeDelete(this$0);
    try
    {
      this$0.delete(val$lock, localProvidedExtensions.getDele
1 2 3 4 5 6 7 8

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