org.eclipse.team.core_3.6.0.I20110525-0800

esourceVariantCacheEntry)iter.next();
      entry.dispose();
    }
  }
  
  private synchronized void purgeFromCache(String id)
  {
    ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry)cacheEntries.get(id);
    File f = entry.getFile();
    try
    {
      deleteFile(f);
    }
    catch (TeamException localTeamException) {}
    cacheEntries.remove(id);
  }
  
  private synchronized void createCacheDirectory()
  {
    IPath cacheLocation = getCachePath();
    File file = cacheLocation.toFile();
    if (file.exists()) {
      try
      {
        deleteFile(file);
      }
      catch (TeamException e)
      {
        if ((file.exists()) && ((!file.isDirectory()) || (file.listFiles().length != 0))) {
          TeamPlugin.log(e);
        }
      }
    }
    if ((!file.exists()) && (!file.mkdirs())) {
      TeamPlugin.log(new TeamException(NLS.bind(Messages.RemoteContentsCache_fileError, new String[] { file.getAbsolutePath() })));
    }
    cacheEntries = new HashMap();
    lastCacheCleanup = -1L;
    cacheDirSize = 0;
  }
  
  private synchronized void deleteCacheDirectory()
  {
    cacheEntries = null;
    lastCacheCleanup = -1L;
    cacheDirSize = 0;
    IPath cacheLocation = getCachePath();
    File file = cacheLocation.toFile();
    if (file.exists()) {
      try
      {
        deleteFile(file);
      }
      catch (TeamException localTeamException) {}
    }
  }
  
  private void deleteFile(File file)
    throws TeamException
  {
    if (file.isDirectory())
    {
      File[] children = file.listFiles();
      for (int i = 0; i < children.length; i++) {
        deleteFile(children[i]);
      }
    }
    if (!file.delete()) {
      throw new TeamException(NLS.bind(Messages.RemoteContentsCache_fileError, new String[] { file.getAbsolutePath() }));
    }
  }
  
  protected void purgeFromCache(ResourceVariantCacheEntry entry)
  {
    purgeFromCache(entry.getId());
  }
  
  private synchronized ResourceVariantCacheEntry internalGetCacheEntry(String id)
  {
    if (cacheEntries == null) {
      throw new IllegalStateException(NLS.bind(Messages.RemoteContentsCache_cacheDisposed, new String[] { name }));
    }
    ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry)cacheEntries.get(id);
    if (entry != null) {
      entry.registerHit();
    }
    return entry;
  }
  
  public ResourceVariantCacheEntry getCacheEntry(String id)
  {
    return internalGetCacheEntry(id);
  }
  
  public synchronized ResourceVariantCacheEntry add(String id, CachedResourceVariant resource)
  {
    clearOldCacheEntries();
    String filePath = String.valueOf(cacheDirSize++);
    ResourceVariantCacheEntry entry = new ResourceVariantCacheEntry(this, lock, id, filePath);
    entry.setResourceVariant(resource);
    cacheEntries.put(id, entry);
    return entry;
  }
  
  public String getName()
  {
    return name;
  }
  
  public ResourceVariantCacheEntry[] getEntries()
  {
    return (ResourceVariantCacheEntry[])cacheEntries.values().toArray(new ResourceVariantCacheEntry[cacheEntries.size()]);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.ResourceVariantCache
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.variants.CachedResourceVariant;

public class ResourceVariantCacheEntry
{
  public static final int UNINITIALIZED = 0;
  public static final int READY = 1;
  public static final int DISPOSED = 2;
  private String id;
  private String filePath;
  private ResourceVariantCache cache;
  private int state = 0;
  private long lastAccess;
  private CachedResourceVariant resourceVariant;
  private ILock lock;
  
  public ResourceVariantCacheEntry(ResourceVariantCache cache, ILock lock, String id, String filePath)
  {
    this.lock = lock;
    state = 0;
    this.cache = cache;
    this.id = id;
    this.filePath = filePath;
    registerHit();
  }
  
  public InputStream getContents()
    throws TeamException
  {
    if (state != 1) {
      return null;
    }
    registerHit();
    File ioFile = getFile();
    try
    {
      if (ioFile.exists()) {
        return new FileInputStream(ioFile);
      }
    }
    catch (IOException e)
    {
      cache.purgeFromCache(this);
      throw e;
    }
    catch (IOException e)
    {
      throw new TeamException(NLS.bind(Messages.RemoteContentsCache_fileError, new String[] { ioFile.getAbsolutePath() }), e);
    }
    return new ByteArrayInputStream(new byte[0]);
  }
  
  protected File getFile()
  {
    return new File(cache.getCachePath().toFile(), filePath);
  }
  
  /* Error */
  public void setContents(InputStream stream, org.eclipse.core.runtime.IProgressMonitor monitor)
    throws TeamException
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 200	org/eclipse/team/internal/core/ResourceVariantCacheEntry:beginOperation	()V
    //   4: aload_0
    //   5: aload_1
    //   6: aload_2
    //   7: invokespecial 204	org/eclipse/team/internal/core/ResourceVariantCacheEntry:internalSetContents	(Ljava/io/InputStream;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   10: goto +10 -> 20
    //   13: astore_3
    //   14: aload_0
    //   15: invokespecial 201	org/eclipse/team/internal/core/ResourceVariantCacheEntry:endOperation	()V
    //   18: aload_3
    //   19: athrow
    //   20: aload_0
    //   21: invokespecial 201	org/eclipse/team/internal/core/ResourceVariantCacheEntry:endOperation	()V
    //   24: return
    // Line number table:
    //   Java source line #87	-> byte code offset #0
    //   Java source line #89	-> byte code offset #4
    //   Java source line #90	-> byte code offset #13
    //   Java source line #91	-> byte code offset #14
    //   Java source line #92	-> byte code offset #18
    //   Java source line #91	-> byte code offset #20
    //   Java source line #93	-> byte code offset #24
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	25	0	this	ResourceVariantCacheEntry
    //   0	25	1	stream	InputStream
    //   0	25	2	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   13	6	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   4	13	13	finally
  }
  
  private void endOperation()
  {
    lock.release();
  }
  
  private void beginOperation()
  {
    lock.acquire();
  }
  
  /* Error */
  private void internalSetContents(InputStream stream, org.eclipse.core.runtime.IProgressMonitor monitor)
    throws TeamException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 170	org/eclipse/team/internal/core/ResourceVariantCacheEntry:state	I
    //   4: iconst_2
    //   5: if_icmpne +38 -> 43
    //   8: new 100	org/eclipse/team/core/TeamException
    //   11: dup
    //   12: getstatic 168	org/eclipse/team/internal/core/Messages:RemoteContentsCacheEntry_3	Ljava/lang/String;
    //   15: iconst_2
    //   16: anewarray 95	java/lang/String
    //   19: dup
    //   20: iconst_0
    //   21: aload_0
    //   22: getfield 176	org/eclipse/team/internal/core/ResourceVariantCacheEntry:cache	Lorg/eclipse/team/internal/core/ResourceVariantCache;
    //   25: invokevirtual 197	org/eclipse/team/internal/core/ResourceVariantCache:getName	()Ljava/lang/String;
    //   28: aastore
    //   29: dup
    //   30: iconst_1
    //   31: aload_0
    //   32: getfield 173	org/eclipse/team/internal/core/ResourceVariantCacheEntry:id	Ljava/lang/String;
    //   35: aastore
    //   36: invokestatic 193	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   39: invokespecial 194	org/eclipse/team/core/TeamException:<init>	(Ljava/lang/String;)V
    //   42: athrow
    //   43: aload_0
    //   44: invokevirtual 202	org/eclipse/team/internal/core/ResourceVariantCacheEntry:registerHit	()V
    //   47: aload_0
    //   48: invokevirtual 203	org/eclipse/team/internal/core/ResourceVariantCacheEntry:getFile	()Ljava/io/File;
    //   51: astore_3
    //   52: aload_0
    //   53: getfield 170	org/eclipse/team/internal/core/ResourceVariantCacheEntry:state	I
    //   56: ifne +23 -> 79
    //   59: new 84	java/io/BufferedOutputStream
    //   62: dup
    //   63: new 90	java/io/FileOutputStream
    //   66: dup
    //   67: aload_3
    //   68: invokespecial 185	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   71: invokespecial 177	java/io/BufferedOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   74: astore 4
    //   76: goto +44 -> 120
    //   79: new 86	java/io/ByteArrayOutputStream
    //   82: dup
    //   83: invokespecial 179	java/io/ByteArrayOutputStream:<init>	()V
    //   86: astore 4
    //   88: goto +32 -> 120
    //   91: astore 5
    //   93: new 100	org/eclipse/team/core/TeamException
    //   96: dup
    //   97: getstatic 169	org/eclipse/team/internal/core/Messages:RemoteContentsCache_fileError	Ljava/lang/String;
    //   100: iconst_1
    //   101: anewarray 95	java/lang/String
    //   104: dup
    //   105: iconst_0
    //   106: aload_3
    //   107: invokevirtual 182	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   110: aastore
    //   111: invokestatic 193	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   114: aload 5
    //   116: invokespecial 195	org/eclipse/team/core/TeamException:<init>	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   119: athrow
    //   120: sipush 1024
    //   123: newarray <illegal type>
    //   125: astore 5
    //   127: goto +17 -> 144
    //   130: aload_2
    //   131: invokestatic 196	org/eclipse/team/internal/core/Policy:checkCanceled	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   134: aload 4
    //   136: aload 5
    //   138: iconst_0
    //   139: iload 6
    //   141: invokevirtual 189	java/io/OutputStream:write	([BII)V
    //   144: aload_1
    //   145: aload 5
    //   147: invokevirtual 187	java/io/InputStream:read	([B)I
    //   150: dup
    //   151: istore 6
    //   153: ifge -23 -> 130
    //   156: goto +13 -> 169
    //   159: astore 7
    //   161: aload 4
    //   163: invokevirtual 188	java/io/OutputStream:close	()V
    //   166: aload 7
    //   168: athrow
    //   169: aload 4
    //   171: invokevirtual 188	java/io/OutputStream:close	()V
    //   174: goto +16 -> 190
    //   177: astore 5
    //   179: aload_0
    //   180: getfield 176	org/eclipse/team/internal/core/ResourceVariantCacheEntry:cache	Lorg/eclipse/team/internal/core/ResourceVariantCache;
    //   183: aload_0
    //   184: invokevirtual 199	org/eclipse/team/internal/core/ResourceVariantCache:purgeFromCache	(Lorg/eclipse/team/internal/core/ResourceVariantCacheEntry;)V
    //   187: aload 5
    //   189: athrow
    //   190: aload_0
    //   191: iconst_1
    //   192: putfield 170	org/eclipse/team/internal/core/ResourceVariantCacheEntry:state	I
    //   195: goto +45 -> 240
    //   198: astore 4
    //   200: new 100	org/eclipse/team/core/TeamException
    //   203: dup
    //   204: getstatic 169	org/eclipse/team/internal/core/Messages:RemoteContentsCache_fileError	Ljava/lang/String;
    //   207: iconst_1
    //   208: anewarray 95	java/lang/String
    //   211: dup
    //   212: iconst_0
    //   213: aload_3
    //   214: invokevirtual 182	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   217: aastore
    //   218: invokestatic 193	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   221: aload 4
    //   223: invokespecial 195	org/eclipse/team/core/TeamException:<init>	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   226: athrow
    //   227: astore 8
    //   229: aload_1
    //   230: invokevirtual 186	java/io/InputStream:close	()V
    //   233: goto +4 -> 237
    //   236: pop
    //   237: aload 8
    //   239: athrow
    //   240: aload_1
    //   241: invokevirtual 186	java/io/InputStream:close	()V
    //   244: goto +4 -> 248
    //   247: pop
    //   248: return
    // Line number table:
    //   Java source line #105	-> byte code offset #0
    //   Java source line #106	-> byte code offset #8
    //   Java source line #109	-> byte code offset #43
    //   Java source line #110	-> byte code offset #47
    //   Java source line #116	-> byte code offset #52
    //   Java source line #117	-> byte code offset #59
    //   Java source line #121	-> byte code offset #79
    //   Java source line #123	-> byte code offset #91
    //   Java source line #124	-> byte code offset #93
    //   Java source line #130	-> byte code offset #120
    //   Java source line #132	-> byte code offset #127
    //   Java source line #133	-> byte code offset #130
    //   Java source line #134	-> byte code offset #134
    //   Java source line #132	-> byte code offset #144
    //   Java source line #136	-> byte code offset #159
    //   Java source line #137	-> byte code offset #161
    //   Java source line #138	-> byte code offset #166
    //   Java source line #137	-> byte code offset #169
    //   Java source line #139	-> byte code offset #177
    //   Java source line #141	-> byte code offset #179
    //   Java source line #142	-> byte code offset #187
    //   Java source line #146	-> byte code offset #190
    //   Java source line #147	-> byte code offset #198
    //   Java source line #148	-> byte code offset #200
    //   Java source line #149	-> byte code offset #227
    //   Java source line #151	-> byte code offset #229
    //   Java source line #152	-> byte code offset #236
    //   Java source line #155	-> byte code offset #237
    //   Java source line #151	-> byte code offset #240
    //   Java source line #152	-> byte code offset #247
    //   Java source line #157	-> byte code offset #248
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	249	0	this	ResourceVariantCacheEntry
    //   0	249	1	stream	InputStream
    //   0	249	2	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   51	163	3	ioFile	File
    //   74	3	4	out	java.io.OutputStream
    //   86	3	4	out	java.io.OutputStream
    //   120	50	4	out	java.io.OutputStream
    //   198	24	4	e	IOException
    //   91	24	5	e	java.io.FileNotFoundException
    //   125	21	5	buffer	byte[]
    //   177	11	5	e	IOException
    //   130	10	6	read	int
    //   151	3	6	read	int
    //   159	8	7	localObject1	Object
    //   227	11	8	localObject2	Object
    //   236	1	15	localIOException1	IOException
    //   247	1	16	localIOException2	IOException
    // Exception table:
    //   from	to	target	type
    //   52	88	91	java/io/FileNotFoundException
    //   120	159	159	finally
    //   120	174	177	java/io/IOException
    //   52	195	198	java/io/IOException
    //   52	227	227	finally
    //   229	233	236	java/io/IOException
    //   240	244	247	java/io/IOException
  }
  
  public int getState()
  {
    return state;
  }
  
  public long getSize()
  {
    if (state != 1) {
      return 0L;
    }
    File ioFile = getFile();
    if (ioFile.exists()) {
      return ioFile.length();
    }
    return 0L;
  }
  
  public long getLastAccessTimeStamp()
  {
    return lastAccess;
  }
  
  protected void registerHit()
  {
    lastAccess = new Date().getTime();
  }
  
  /* Error */
  public void dispose()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 200	org/eclipse/team/internal/core/ResourceVariantCacheEntry:beginOperation	()V
    //   4: aload_0
    //   5: iconst_2
    //   6: putfield 170	org/eclipse/team/internal/core/ResourceVariantCacheEntry:state	I
    //   9: aload_0
    //   10: getfield 176	org/eclipse/team/internal/core/ResourceVariantCacheEntry:cache	Lorg/eclipse/team/internal/core/ResourceVariantCache;
    //   13: aload_0
    //   14: invokevirtual 199	org/eclipse/team/internal/core/ResourceVariantCache:purgeFromCache	(Lorg/eclipse/team/internal/core/ResourceVariantCacheEntry;)V
    //   17: goto +10 -> 27
    //   20: astore_1
    //   21: aload_0
    //   22: invokespecial 201	org/eclipse/team/internal/core/ResourceVariantCacheEntry:endOperation	()V
    //   25: aload_1
    //   26: athrow
    //   27: aload_0
    //   28: invokespecial 201	org/eclipse/team/internal/core/ResourceVariantCacheEntry:endOperation	()V
    //   31: return
    // Line number table:
    //   Java source line #196	-> byte code offset #0
    //   Java source line #198	-> byte code offset #4
    //   Java source line #199	-> byte code offset #9
    //   Java source line #200	-> byte code offset #20
    //   Java source line #201	-> byte code offset #21
    //   Java source line #202	-> byte code offset #25
    //   Java source line #201	-> byte code offset #27
    //   Java source line #203	-> byte code offset #31
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	32	0	this	ResourceVariantCacheEntry
    //   20	6	1	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   4	20	20	finally
  }
  
  public String getId()
  {
    return id;
  }
  
  public CachedResourceVariant getResourceVariant()
  {
    return resourceVariant;
  }
  
  public void setResourceVariant(CachedResourceVariant resourceVariant)
  {
    this.resourceVariant = resourceVariant;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.ResourceVariantCacheEntry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.team.core.mapping.IStorageMerger;

class StorageMergerDescriptor
{
  private static final String CLASS_ATTRIBUTE = "class";
  private IConfigurationElement fElement;
  
  public StorageMergerDescriptor(IConfigurationElement element)
  {
    fElement = element;
  }
  
  public IStorageMerger createStreamMerger()
  {
    try
    {
      return (IStorageMerger)fElement.createExecutableExtension("class");
    }
    catch (CoreException localCoreException)
    {
      return null;
    }
    catch (ClassCastException localClassCastException) {}
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.StorageMergerDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core;

import java.util.HashMap;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.mapping.IStorageMerger;

public class StorageMergerRegistry
{
  private static final String ID_ATTRIBUTE = "id";
  private static final String EXTENSIONS_ATTRIBUTE = "extensions";
  private static final String CONTENT_TYPE_ID_ATTRIBUTE = "contentTypeId";
  private static final String STORAGE_MERGER_EXTENSION_POINT = "storageMergers";
  private static final Object STORAGE_MERGER = "storageMerger";
  private static final String CONTENT_TYPE_BINDING = "contentTypeBinding";
  private static final String STORAGE_MERGER_ID_ATTRIBUTE = "storageMergerId";
  private static boolean NORMALIZE_CASE = true;
  private static StorageMergerRegistry instance;
  private HashMap fIdMap;
  private HashMap fExtensionMap;
  private HashMap fContentTypeBindings;
  private boolean fRegistriesInitialized;
  
  public static StorageMergerRegistry getInstance()
  {
    if (instance == null) {
      instance = new StorageMergerRegistry();
    }
    return instance;
  }
  
  public IStorageMerger createStreamMerger(String type)
  {
    initializeRegistry();
    StorageMergerDescriptor descriptor = (StorageMergerDescriptor)search(type);
    if (descriptor != null) {
      return descriptor.createStreamMerger();
    }
    return null;
  }
  
  public IStorageMerger createStreamMerger(IContentType type)
  {
    initializeRegistry();
    StorageMergerDescriptor descriptor = (StorageMergerDescriptor)search(type);
    if (descriptor != null) {
      return descriptor.createStreamMerger();
    }
    return null;
  }
  
  private void initializeRegistry()
  {
    if (!fRegistriesInitialized)
    {
      registerExtensions();
      fRegistriesInitialized = true;
    }
  }
  
  private void registerExtensions()
  {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    
    IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.team.core", "storageMergers");
    for (int i = 0; i < elements.length; i++)
    {
      IConfigurationElement element = elements[i];
      if (STORAGE_MERGER.equals(element.getName())) {
        register(element, new StorageMergerDescriptor(element));
      } else if ("contentTypeBinding".equals(element.getName())) {
        createBinding(element, "storageMergerId");
      }
    }
  }
  
  private static String normalizeCase(String s)
  {
    if ((NORMALIZE_CASE) && (s != null)) {
      return s.toUpperCase();
    }
    return s;
  }
  
  void register(IConfigurationElement element, Object data)
  {
    String id = element.getAttribute("id");
    if (id != null)
    {
      if (fIdMap == null) {
        fIdMap = new HashMap();
      }
      fIdMap.put(id, data);
    }
    String types = element.getAttribute("extensions");
    if (types != null)
    {
      if (fExtensionMap == null) {
        fExtensionMap = new HashMap();
      }
      StringTokenizer tokenizer = new StringTokenizer(types, ",");
      while (tokenizer.hasMoreElements())
      {
        String extension = tokenizer.nextToken().trim();
        fExtensionMap.put(normalizeCase(extension), data);
      }
    }
  }
  
  void createBinding(IConfigurationElement element, String idAttributeName)
  {
    String type = element.getAttribute("contentTypeId");
    String id = element.getAttribute(idAttributeName);
    if (id == null) {
      logErrorMessage(NLS.bind("Target attribute id '{0}' missing", idAttributeName));
    }
    if ((type != null) && (id != null) && (fIdMap != null))
    {
      Object o = fIdMap.get(id);
      if (o != null)
      {
        IContentType ct = Platform.getContentTypeManager().getContentType(type);
        if (ct != null)
        {
          if (fContentTypeBindings == null) {
            fContentTypeBindings = new HashMap();
          }
          fContentTypeBindings.put(ct, o);
        }
        else
        {
          logErrorMessage(NLS.bind("Content type id '{0}' not found", type));
        }
      }
      else
      {
        logErrorMessage(NLS.bind("Target '{0}' not found", id));
      }
    }
  }
  
  private void logErrorMessage(String string)
  {
    TeamPlugin.log(4, string, null);
  }
  
  Object search(IContentType type)
  {
    if (fContentTypeBindings != null) {
      for (; type != null; type = type.getBaseType())
      {
        Object data = fContentTypeBindings.get(type);
        if (data != null) {
          return data;
        }
      }
    }
    return null;
  }
  
  Object search(String extension)
  {
    if (fExtensionMap != null) {
      return fExtensionMap.get(normalizeCase(extension));
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.StorageMergerRegistry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core;

public class StringMatcher$Position
{
  int start;
  int end;
  
  public StringMatcher$Position(int start, int end)
  {
    this.start = start;
    this.end = end;
  }
  
  public int getStart()
  {
    return start;
  }
  
  public int getEnd()
  {
    return end;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.StringMatcher.Position
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core;

import java.util.Vector;

public class StringMatcher
{
  protected String fPattern;
  protected int fLength;
  protected boolean fIgnoreWildCards;
  protected boolean fIgnoreCase;
  protected boolean fHasLeadingStar;
  protected boolean fHasTrailingStar;
  protected String[] fSegments;
  protected int fBound = 0;
  private boolean fPathPattern;
  protected static final char fSingleWildCard = '\000';
  
  public static class Position
  {
    int start;
    int end;
    
    public Position(int start, int end)
    {
      this.start = start;
      this.end = end;
    }
    
    public int getStart()
    {
      return start;
    }
    
    public int getEnd()
    {
      return end;
    }
  }
  
  public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards)
  {
    if (pattern == null) {
      throw new IllegalArgumentException();
    }
    fIgnoreCase = ignoreCase;
    fIgnoreWildCards = ignoreWildCards;
    fPattern = pattern;
    fLength = pattern.length();
    fPathPattern = (pattern.indexOf('/') != -1);
    if (fIgnoreWildCards) {
      parseNoWildCards();
    } else {
      parseWildCards();
    }
  }
  
  public Position find(String text, int start, int end)
  {
    if ((fPattern == null) || (text == null)) {
      throw new IllegalArgumentException();
    }
    int tlen = text.length();
    if (start < 0) {
      start = 0;
    }
    if (end > tlen) {
      end = tlen;
    }
    if ((end < 0) || (start >= end)) {
      return null;
    }
    if (fLength == 0) {
      return new Position(start, start);
    }
    if (fIgnoreWildCards)
    {
      int x = posIn(text, start, end);
      if (x < 0) {
        return null;
      }
      return new Position(x, x + fLength);
    }
    int segCount = fSegments.length;
    if (segCount == 0) {
      return new Position(start, end);
    }
    int curPos = start;
    int matchStart = -1;
    for (int i = 0; (i < segCount) && (curPos < end); i++)
    {
      String current = fSegments[i];
      int nextMatch = regExpPosIn(text, curPos, end, current);
      if (nextMatch < 0) {
        return null;
      }
      if (i == 0) {
        matchStart = nextMatch;
      }
      curPos = nextMatch + current.length();
    }
    if (i < segCount) {
      return null;
    }
    return new Position(matchStart, curPos);
  }
  
  public boolean match(String text)
  {
    return match(text, 0, text.length());
  }
  
  public boolean match(String text, int start, int end)
  {
    if (text == null) {
      throw new IllegalArgumentException();
    }
    if (start > end) {
      return false;
    }
    if (fIgnoreWildCards) {
      return (end - start == fLength) && (fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength));
    }
    int segCount = fSegments.length;
    if ((segCount == 0) && ((fHasLeadingStar) || (fHasTrailingStar))) {
      return true;
    }
    if (start == end) {
      return fLength == 0;
    }
    if (fLength == 0) {
      return start == end;
    }
    int tlen = text.length();
    if (start < 0) {
      start = 0;
    }
    if (end > tlen) {
      end = tlen;
    }
    int tCurPos = start;
    int bound = end - fBound;
    if (bound < 0) {
      return false;
    }
    int i = 0;
    String current = fSegments[i];
    int segLength = current.length();
    if (!fHasLeadingStar)
    {
      if (!regExpRegionMatches(text, start, current, 0, segLength)) {
        return false;
      }
      i++;
      tCurPos += segLength;
    }
    if ((fSegments.length == 1) && (!fHasLeadingStar) && (!fHasTrailingStar)) {
      return tCurPos == end;
    }
    while (i < segCount)
    {
      current = fSegments[i];
      
      int k = current.indexOf(0);
      int currentMatch;
      if (k < 0)
      {
        int currentMatch = textPosIn(text, tCurPos, end, current);
        if (currentMatch < 0) {
          return false;
        }
      }
      else
      {
        currentMatch = regExpPosIn(text, tCurPos, end, current);
        if (currentMatch < 0) {
          return false;
        }
      }
      tCurPos = currentMatch + current.length();
      i++;
    }
    if ((!fHasTrailingStar) && (tCurPos != end))
    {
      int clen = current.length();
      return regExpRegionMatches(text, end - clen, current, 0, clen);
    }
    return i == segCount;
  }
  
  public boolean isPathPattern()
  {
    return fPathPattern;
  }
  
  private void parseNoWildCards()
  {
    fSegments = new String[1];
    fSegments[0] = fPattern;
    fBound = fLength;
  }
  
  private void parseWildCards()
  {
    if (fPattern.startsWith("*")) {
      fHasLeadingStar = true;
    }
    if (fPattern.endsWith("*")) {
      if ((fLength > 1) && (fPattern.charAt(fLength - 2) != '\\')) {
        fHasTrailingStar = true;
      }
    }
    Vector temp = new Vector();
    
    int pos = 0;
    StringBuffer buf = new StringBuffer();
    while (pos < fLength)
    {
      char c = fPattern.charAt(pos++);
      switch (c)
      {
      case '\\': 
        if (pos >= fLength)
        {
          buf.append(c);
        }
        else
        {
          char next = fPattern.charAt(pos++);
          if ((next == '*') || (next == '?') || (next == '\\'))
          {
            buf.append(next);
          }
          else
          {
            buf.append(c);
            buf.append(next);
          }
        }
        break;
      case '*': 
        if (buf.length() > 0)
        {
          temp.addElement(buf.toString());
          fBound += buf.length();
          buf.setLength(0);
        }
        break;
      case '?': 
        buf.append('\000');
        break;
      default: 
        buf.append(c);
      }
    }
    if (buf.length() > 0)
    {
      temp.addElement(buf.toString());
      fBound += buf.length();
    }
    fSegments = new String[temp.size()];
    temp.copyInto(fSegments);
  }
  
  protected int posIn(String text, int start, int end)
  {
    int max = end - fLength;
    if (!fIgnoreCase)
    {
      int i = text.indexOf(fPattern, start);
      if ((i == -1) || (i > max)) {
        return -1;
      }
      return i;
    }
    for (int i = start; i <= max; i++) {
      if (text.regionMatches(true, i, fPattern, 0, fLength)) {
        return i;
      }
    }
    return -1;
  }
  
  protected int regExpPosIn(String text, int start, int end, String p)
  {
    int plen = p.length();
    
    int max = end - plen;
    for (int i = start; i <= max; i++) {
      if (regExpRegionMatches(text, i, p, 0, plen)) {
        return i;
      }
    }
    return -1;
  }
  
  protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen)
  {
    while (plen-- > 0)
    {
      char tchar = text.charAt(tStart++);
      char pchar = p.charAt(pStart++);
      if ((fIgnoreWildCards) || 
      
        (pchar != 0)) {
        if (pchar != tchar) {
          if (fIgnoreCase)
          {
            if (Character.toUpperCase(tchar) != Character.toUpperCase(pchar)) {
              if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar)) {}
            }
          }
          else {
            return false;
          }
        }
      }
    }
    return true;
  }
  
  protected int textPosIn(String text, int start, int end, String p)
  {
    int plen = p.length();
    int max = end - plen;
    if (!fIgnoreCase)
    {
      int i = text.indexOf(p, start);
      if ((i == -1) || (i > max)) {
        return -1;
      }
      return i;
    }
    for (int i = start; i <= max; i++) {
      if (text.regionMatches(true, i, p, 0, plen)) {
        return i;
      }
    }
    return -1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.StringMatcher
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core;

import org.eclipse.core.resources.team.ResourceRuleFactory;

class TeamHookDispatcher$1
  extends ResourceRuleFactory
{}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.TeamHookDispatcher.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core;

import java.net.URI;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceRuleFactory;
import org.eclipse.core.resources.team.ResourceRuleFactory;
import org.eclipse.core.resources.team.TeamHook;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.core.RepositoryProvider;

public class TeamHookDispatcher
  extends TeamHook
{
  private static final ResourceRuleFactory defaultFactory = new ResourceRuleFactory() {};
  private static TeamHookDispatcher instance;
  
  public static void setProviderRuleFactory(IProject project, IResourceRuleFactory factory)
  {
    if (instance != null)
    {
      if (factory == null) {
        factory = defaultFactory;
      }
      instance.setRuleFactory(project, factory);
    }
  }
  
  public TeamHookDispatcher()
  {
    instance = this;
  }
  
  public IStatus validateCreateLink(IFile file, int updateFlags, IPath location)
  {
    RepositoryProvider provider = getProvider(file);
    if (provider == null) {
      return super.validateCreateLink(file, updateFlags, location);
    }
    return provider.validateCreateLink(file, updateFlags, location);
  }
  
  public IStatus validateCreateLink(IFile file, int updateFlags, URI location)
  {
    RepositoryProvider provider = getProvider(file);
    if (provider == null) {
      return super.validateCreateLink(file, updateFlags, location);
    }
    return provider.validateCreateLink(file, updateFlags, location);
  }
  
  public IStatus validateCreateLink(IFolder folder, int updateFlags, IPath location)
  {
    RepositoryProvider provider = getProvider(folder);
    if (provider == null) {
      return super.validateCreateLink(folder, updateFlags, location);
    }
    return provider.validateCreateLink(folder, updateFlags, location);
  }
  
  public IStatus validateCreateLink(IFolder folder, int updateFlags, URI location)
  {
    RepositoryProvider provider = getProvider(folder);
    if (provider == null) {
      return super.validateCreateLink(folder, updateFlags, location);
    }
    return provider.validateCreateLink(folder, updateFlags, location);
  }
  
  private RepositoryProvider getProvider(IResource resource)
  {
    return RepositoryProvider.getProvider(resource.getProject());
  }
  
  public IResourceRuleFactory getRuleFactory(IProject project)
  {
    if (RepositoryProvider.isShared(project))
    {
      RepositoryProvider provider = getProvider(project);
      if (provider != null) {
        return provider.getRuleFactory();
      }
    }
    return super.getRuleFactory(project);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.TeamHookDispatcher
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.content.IContentTypeManager;
import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.mapping.IStreamMergerDelegate;
import org.osgi.framework.BundleContext;

public final class TeamPlugin
  extends Plugin
{
  public static final String ID = "org.eclipse.team.core";
  public static final String PROVIDER_EXTENSION = "repository-provider-type";
  public static final String FILE_TYPES_EXTENSION = "fileTypes";
  public static final String IGNORE_EXTENSION = "ignore";
  public static final String PROJECT_SET_EXTENSION = "projectSets";
  public static final String REPOSITORY_EXTENSION = "repository";
  public static final String DEFAULT_FILE_MODIFICATION_VALIDATOR_EXTENSION = "defaultFileModificationValidator";
  public static final QualifiedName PROVIDER_PROP_KEY = new QualifiedName("org.eclipse.team.core", "repository");
  public static final String EXTENSION_POINT_BUNDLE_IMPORTERS = "org.eclipse.team.core.bundleImporters";
  private static TeamPlugin plugin;
  private IStreamMergerDelegate mergerDelegate;
  
  public TeamPlugin()
  {
    plugin = this;
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    Team.startup();
  }
  
  /* Error */
  public void stop(BundleContext context)
    throws Exception
  {
    // Byte code:
    //   0: invokestatic 257	org/eclipse/team/core/Team:shutdown	()V
    //   3: invokestatic 260	org/eclipse/team/internal/core/ResourceVariantCache:shutdown	()V
    //   6: goto +11 -> 17
    //   9: astore_2
    //   10: aload_0
    //   11: aload_1
    //   12: invokespecial 253	org/eclipse/core/runtime/Plugin:stop	(Lorg/osgi/framework/BundleContext;)V
    //   15: aload_2
    //   16: athrow
    //   17: aload_0
    //   18: aload_1
    //   19: invokespecial 253	org/eclipse/core/runtime/Plugin:stop	(Lorg/osgi/framework/BundleContext;)V
    //   22: return
    // Line number table:
    //   Java source line #88	-> byte code offset #0
    //   Java source line #89	-> byte code offset #3
    //   Java source line #90	-> byte code offset #9
    //   Java source line #91	-> byte code offset #10
    //   Java source line #92	-> byte code offset #15
    //   Java source line #91	-> byte code offset #17
    //   Java source line #93	-> byte code offset #22
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	23	0	this	TeamPlugin
    //   0	23	1	context	BundleContext
    //   9	7	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	9	9	finally
  }
  
  public static TeamPlugin getPlugin()
  {
    return plugin;
  }
  
  public static void log(int severity, String message, Throwable e)
  {
    plugin.getLog().log(new Status(severity, "org.eclipse.team.core", 0, message, e));
  }
  
  public static void log(CoreException e)
  {
    log(e.getStatus().getSeverity(), e.getMessage(), e);
  }
  
  public static TeamException wrapException(CoreException e)
  {
    IStatus status = e.getStatus();
    return new TeamException(new Status(status.getSeverity(), "org.eclipse.team.core", status.getCode(), status.getMessage(), e));
  }
  
  public static String getCharset(String name, InputStream stream)
    throws IOException
  {
    IContentDescription description = getContentDescription(name, stream);
    return description == null ? null : description.getCharset();
  }
  
  public static IContentDescription getContentDescription(String name, InputStream stream)
    throws IOException
  {
    IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
    try
    {
      return contentTypeManager.getDescriptionFor(stream, name, IContentDescription.ALL);
    }
    finally
    {
      if (stream != null) {
        try
        {
          stream.close();
        }
        catch (IOException localIOException2) {}
      }
    }
  }
  
  public static RepositoryProviderType getAliasType(String 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

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-2019. Infinite Loop Ltd