org.eclipse.team.cvs.core_3.3.400.I20110510-0800

naged()) {
      EclipseSynchronizer.getInstance().setNotifyInfo(resource, info);
    }
  }
  
  public NotifyInfo getNotifyInfo()
    throws CVSException
  {
    if (isManaged()) {
      return EclipseSynchronizer.getInstance().getNotifyInfo(resource);
    }
    return null;
  }
  
  public void setBaserevInfo(BaserevInfo info)
    throws CVSException
  {
    if (isManaged()) {
      if (info == null)
      {
        EclipseSynchronizer.getInstance().deleteBaserevInfo(resource);
        EclipseSynchronizer.getInstance().deleteFileFromBaseDirectory(getIFile(), null);
      }
      else
      {
        EclipseSynchronizer.getInstance().setBaserevInfo(resource, info);
      }
    }
  }
  
  public BaserevInfo getBaserevInfo()
    throws CVSException
  {
    if (isManaged()) {
      return EclipseSynchronizer.getInstance().getBaserevInfo(resource);
    }
    return null;
  }
  
  public void edit(int notifications, boolean notifyForWritable, IProgressMonitor monitor)
    throws CVSException
  {
    if ((!notifyForWritable) && (!isReadOnly())) {
      return;
    }
    run(new ICVSRunnable()
    {
      private final int val$notifications;
      
      public void run(IProgressMonitor monitor)
        throws CVSException
      {
        byte[] syncBytes = getSyncBytes();
        if ((syncBytes == null) || (ResourceSyncInfo.isAddition(syncBytes))) {
          return;
        }
        char[] internalFormat;
        char[] internalFormat;
        if (val$notifications == 0)
        {
          internalFormat = (char[])null;
        }
        else
        {
          char[] internalFormat;
          if (val$notifications == 7)
          {
            internalFormat = NotifyInfo.ALL;
          }
          else
          {
            List notificationCharacters = new ArrayList();
            if ((val$notifications & 0x1) > 0) {
              notificationCharacters.add(new Character('E'));
            }
            if ((val$notifications & 0x2) > 0) {
              notificationCharacters.add(new Character('U'));
            }
            if ((val$notifications & 0x4) > 0) {
              notificationCharacters.add(new Character('C'));
            }
            internalFormat = new char[notificationCharacters.size()];
            for (int i = 0; i < internalFormat.length; i++) {
              internalFormat[i] = ((Character)notificationCharacters.get(i)).charValue();
            }
          }
        }
        NotifyInfo notifyInfo = new NotifyInfo(getName(), 'E', new Date(), internalFormat);
        setNotifyInfo(notifyInfo);
        if (!isModified(null))
        {
          EclipseSynchronizer.getInstance().copyFileToBaseDirectory(getIFile(), monitor);
          setBaserevInfo(new BaserevInfo(getName(), ResourceSyncInfo.getRevision(syncBytes)));
        }
        try
        {
          setReadOnly(false);
        }
        catch (CVSException e)
        {
          CVSProviderPlugin.log(e);
        }
      }
    }, monitor);
  }
  
  public void unedit(IProgressMonitor monitor)
    throws CVSException
  {
    if (isReadOnly()) {
      return;
    }
    run(new ICVSRunnable()
    {
      public void run(IProgressMonitor monitor)
        throws CVSException
      {
        NotifyInfo info = getNotifyInfo();
        if ((info != null) && (info.getNotificationType() == 'E')) {
          info = null;
        } else {
          info = new NotifyInfo(getName(), 'U', new Date(), null);
        }
        setNotifyInfo(info);
        if (isModified(null))
        {
          ResourceSyncInfo syncInfo = getSyncInfo();
          BaserevInfo baserevInfo = getBaserevInfo();
          EclipseSynchronizer.getInstance().restoreFileFromBaseDirectory(getIFile(), monitor);
          if (!syncInfo.getRevision().equals(baserevInfo.getRevision()))
          {
            MutableResourceSyncInfo newInfo = syncInfo.cloneMutable();
            newInfo.setRevision(baserevInfo.getRevision());
            newInfo.setTimeStamp(getTimeStamp());
            newInfo.setDeleted(false);
            setSyncInfo(newInfo, 1);
          }
          else
          {
            EclipseSynchronizer.getInstance().setModified(EclipseFile.this, 1);
          }
        }
        else
        {
          setSyncBytes(getSyncBytes(), 1);
        }
        setBaserevInfo(null);
        try
        {
          setReadOnly(true);
        }
        catch (CVSException e)
        {
          CVSProviderPlugin.log(e);
        }
      }
    }, monitor);
  }
  
  public void notificationCompleted()
    throws CVSException
  {
    EclipseSynchronizer.getInstance().deleteNotifyInfo(resource);
  }
  
  public NotifyInfo getPendingNotification()
    throws CVSException
  {
    return getNotifyInfo();
  }
  
  public void checkedIn(String entryLine, boolean commit)
    throws CVSException
  {
    ResourceSyncInfo oldInfo = getSyncInfo();
    ResourceSyncInfo newInfo = null;
    int modificationState = 1;
    if (entryLine == null)
    {
      if (oldInfo == null) {
        return;
      }
      if (!oldInfo.isAdded())
      {
        MutableResourceSyncInfo mutable = oldInfo.cloneMutable();
        mutable.setTimeStamp(getTimeStamp(), true);
        newInfo = mutable;
      }
    }
    else if (oldInfo == null)
    {
      newInfo = new ResourceSyncInfo(entryLine, null);
      
      modificationState = 2;
    }
    else
    {
      Date timeStamp;
      Date timeStamp;
      if (commit)
      {
        timeStamp = getTimeStamp();
      }
      else
      {
        timeStamp = oldInfo.getTimeStamp();
        if (timeStamp == null)
        {
          timeStamp = getTimeStamp();
        }
        else
        {
          setTimeStamp(timeStamp);
          
          timeStamp = getTimeStamp();
        }
      }
      newInfo = new ResourceSyncInfo(entryLine, timeStamp);
    }
    if (newInfo != null)
    {
      CVSTag tag = newInfo.getTag();
      if ((tag != null) && (CVSEntryLineTag.BASE.getName().equals(tag.getName())))
      {
        newInfo = newInfo.cloneMutable();
        ((MutableResourceSyncInfo)newInfo).setTag(oldInfo.getTag());
      }
      setSyncInfo(newInfo, modificationState);
    }
    clearCachedBase();
  }
  
  private void clearCachedBase()
    throws CVSException
  {
    BaserevInfo base = getBaserevInfo();
    if (base != null)
    {
      setBaserevInfo(null);
      try
      {
        setReadOnly(true);
      }
      catch (CVSException e)
      {
        CVSProviderPlugin.log(e);
      }
    }
    else
    {
      CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
      if ((provider != null) && (provider.isWatchEditEnabled())) {
        try
        {
          setReadOnly(true);
        }
        catch (CVSException e)
        {
          CVSProviderPlugin.log(e);
        }
      }
    }
  }
  
  public void unmanage(IProgressMonitor monitor)
    throws CVSException
  {
    run(new ICVSRunnable()
    {
      public void run(IProgressMonitor monitor)
        throws CVSException
      {
        EclipseFile.this.unmanage(monitor);
        EclipseFile.this.clearCachedBase();
      }
    }, monitor);
  }
  
  public boolean isEdited()
    throws CVSException
  {
    return EclipseSynchronizer.getInstance().isEdited(getIFile());
  }
  
  public void setSyncInfo(ResourceSyncInfo info, int modificationState)
    throws CVSException
  {
    setSyncBytes(info.getBytes(), info, modificationState);
  }
  
  public void setSyncBytes(byte[] syncBytes, int modificationState)
    throws CVSException
  {
    setSyncBytes(syncBytes, null, modificationState);
  }
  
  private void setSyncBytes(byte[] syncBytes, ResourceSyncInfo info, int modificationState)
    throws CVSException
  {
    Assert.isNotNull(syncBytes);
    setSyncBytes(syncBytes);
    EclipseSynchronizer.getInstance().setModified(this, modificationState);
  }
  
  public void handleModification(boolean forAddition)
    throws CVSException
  {
    if (isIgnored())
    {
      if (!resource.isDerived()) {
        EclipseSynchronizer.getInstance().setModified(this, 1);
      }
      return;
    }
    EclipseSynchronizer.getInstance().setModified(this, 0);
  }
  
  public String getRepositoryRelativePath()
    throws CVSException
  {
    if (!isManaged()) {
      return null;
    }
    String parentPath = getParent().getRepositoryRelativePath();
    if (parentPath == null) {
      return null;
    }
    return parentPath + "/" + getName();
  }
  
  protected boolean isDirty()
    throws CVSException
  {
    byte[] syncBytes = getSyncBytes();
    boolean dirty;
    boolean dirty;
    if (syncBytes == null)
    {
      dirty = exists();
    }
    else
    {
      boolean dirty;
      if ((ResourceSyncInfo.isAddition(syncBytes)) || 
        (ResourceSyncInfo.isMerge(syncBytes)) || 
        (ResourceSyncInfo.wasDeleted(syncBytes)) || (!exists()))
      {
        dirty = true;
      }
      else
      {
        ResourceSyncInfo info = new ResourceSyncInfo(syncBytes);
        dirty = !getTimeStamp().equals(info.getTimeStamp());
      }
    }
    return dirty;
  }
}

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

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Util;

class EclipseFolder$1
  implements ICVSRunnable
{
  final EclipseFolder this$0;
  private final FolderSyncInfo val$folderInfo;
  
  EclipseFolder$1(EclipseFolder paramEclipseFolder, FolderSyncInfo paramFolderSyncInfo)
  {
    this$0 = paramEclipseFolder;val$folderInfo = paramFolderSyncInfo;
  }
  
  public void run(IProgressMonitor monitor)
    throws CVSException
  {
    EclipseSynchronizer synchronizer = EclipseSynchronizer.getInstance();
    synchronizer.setFolderSync((IContainer)this$0.resource, val$folderInfo);
    
    byte[] newSyncBytes = new ResourceSyncInfo(this$0.getName()).getBytes();
    byte[] oldSyncBytes = this$0.getSyncBytes();
    if ((oldSyncBytes == null) || (!Util.equals(newSyncBytes, oldSyncBytes))) {
      this$0.setSyncBytes(newSyncBytes);
    }
  }
}

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

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.Policy;

class EclipseFolder$2
  implements ICVSRunnable
{
  final EclipseFolder this$0;
  
  EclipseFolder$2(EclipseFolder paramEclipseFolder)
  {
    this$0 = paramEclipseFolder;
  }
  
  public void run(IProgressMonitor monitor)
    throws CVSException
  {
    monitor = Policy.monitorFor(monitor);
    monitor.beginTask(null, 100);
    EclipseFolder.recursiveUnmanage((IContainer)this$0.resource, Policy.subMonitorFor(monitor, 99));
    EclipseFolder.access$0(this$0, Policy.subMonitorFor(monitor, 1));
    monitor.done();
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Util;

class EclipseFolder
  extends EclipseResource
  implements ICVSFolder
{
  protected EclipseFolder(IContainer container)
  {
    super(container);
  }
  
  public ICVSResource[] members(int flags)
    throws CVSException
  {
    List result = new ArrayList();
    IResource[] resources = EclipseSynchronizer.getInstance().members((IContainer)this.resource);
    boolean includeFiles = ((flags & 0x1) != 0) || ((flags & 0x3) == 0);
    boolean includeFolders = ((flags & 0x2) != 0) || ((flags & 0x3) == 0);
    boolean includeManaged = ((flags & 0x10) != 0) || ((flags & 0x1C) == 0);
    boolean includeUnmanaged = ((flags & 0x8) != 0) || ((flags & 0x1C) == 0);
    boolean includeIgnored = (flags & 0x4) != 0;
    boolean includeExisting = ((flags & 0x20) != 0) || ((flags & 0x60) == 0);
    boolean includePhantoms = ((flags & 0x40) != 0) || ((flags & 0x60) == 0);
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      int type = resource.getType();
      if (((includeFiles) && (type == 1)) || (
        (includeFolders) && (type == 2)))
      {
        boolean exists = resource.exists();
        if (((includeExisting) && (exists)) || ((includePhantoms) && (!exists)))
        {
          ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
          boolean includeResource = false;
          if ((includeManaged) && (includeUnmanaged) && (includeIgnored))
          {
            includeResource = true;
          }
          else
          {
            boolean isManaged = cvsResource.isManaged();
            if ((isManaged) && (includeManaged))
            {
              includeResource = true;
            }
            else if (exists)
            {
              boolean isIgnored = cvsResource.isIgnored();
              if ((isIgnored) && (includeIgnored)) {
                includeResource = true;
              } else if ((!isManaged) && (!isIgnored) && (includeUnmanaged)) {
                includeResource = true;
              }
            }
          }
          if (includeResource) {
            result.add(cvsResource);
          }
        }
      }
    }
    return (ICVSResource[])result.toArray(new ICVSResource[result.size()]);
  }
  
  public ICVSFolder getFolder(String name)
    throws CVSException
  {
    if ((".".equals(name)) || ("./".equals(name))) {
      return this;
    }
    IPath path = new Path(null, name);
    if ((resource.getType() == 8) && (path.segmentCount() == 1)) {
      return new EclipseFolder(((IWorkspaceRoot)resource).getProject(name));
    }
    return new EclipseFolder(((IContainer)resource).getFolder(path));
  }
  
  public ICVSFile getFile(String name)
    throws CVSException
  {
    return new EclipseFile(((IContainer)resource).getFile(new Path(null, name)));
  }
  
  /* Error */
  public void mkdir()
    throws CVSException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_1
    //   2: invokestatic 398	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:getInstance	()Lorg/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer;
    //   5: aload_0
    //   6: getfield 355	org/eclipse/team/internal/ccvs/core/resources/EclipseFolder:resource	Lorg/eclipse/core/resources/IResource;
    //   9: aconst_null
    //   10: invokevirtual 402	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:beginBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   13: astore_1
    //   14: aload_0
    //   15: getfield 355	org/eclipse/team/internal/ccvs/core/resources/EclipseFolder:resource	Lorg/eclipse/core/resources/IResource;
    //   18: invokeinterface 420 1 0
    //   23: iconst_4
    //   24: if_icmpne +28 -> 52
    //   27: aload_0
    //   28: getfield 355	org/eclipse/team/internal/ccvs/core/resources/EclipseFolder:resource	Lorg/eclipse/core/resources/IResource;
    //   31: checkcast 172	org/eclipse/core/resources/IProject
    //   34: astore_2
    //   35: aload_2
    //   36: aconst_null
    //   37: invokeinterface 418 2 0
    //   42: aload_2
    //   43: aconst_null
    //   44: invokeinterface 419 2 0
    //   49: goto +95 -> 144
    //   52: aload_0
    //   53: getfield 355	org/eclipse/team/internal/ccvs/core/resources/EclipseFolder:resource	Lorg/eclipse/core/resources/IResource;
    //   56: checkcast 171	org/eclipse/core/resources/IFolder
    //   59: iconst_0
    //   60: iconst_1
    //   61: aconst_null
    //   62: invokeinterface 416 4 0
    //   67: invokestatic 398	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:getInstance	()Lorg/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer;
    //   70: aload_0
    //   71: invokevirtual 381	org/eclipse/team/internal/ccvs/core/resources/EclipseFolder:getIResource	()Lorg/eclipse/core/resources/IResource;
    //   74: invokevirtual 395	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:created	(Lorg/eclipse/core/resources/IResource;)V
    //   77: goto +67 -> 144
    //   80: astore_2
    //   81: aload_0
    //   82: getfield 355	org/eclipse/team/internal/ccvs/core/resources/EclipseFolder:resource	Lorg/eclipse/core/resources/IResource;
    //   85: getstatic 354	org/eclipse/team/internal/ccvs/core/CVSMessages:EclipseFolder_problem_creating	Ljava/lang/String;
    //   88: iconst_2
    //   89: anewarray 165	java/lang/String
    //   92: dup
    //   93: iconst_0
    //   94: aload_0
    //   95: getfield 355	org/eclipse/team/internal/ccvs/core/resources/EclipseFolder:resource	Lorg/eclipse/core/resources/IResource;
    //   98: invokeinterface 425 1 0
    //   103: invokeinterface 429 1 0
    //   108: aastore
    //   109: dup
    //   110: iconst_1
    //   111: aload_2
    //   112: invokevirtual 364	org/eclipse/core/runtime/CoreException:getStatus	()Lorg/eclipse/core/runtime/IStatus;
    //   115: invokeinterface 434 1 0
    //   120: aastore
    //   121: invokestatic 366	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   124: aload_2
    //   125: invokestatic 369	org/eclipse/team/internal/ccvs/core/CVSException:wrapException	(Lorg/eclipse/core/resources/IResource;Ljava/lang/String;Lorg/eclipse/core/runtime/CoreException;)Lorg/eclipse/team/internal/ccvs/core/CVSException;
    //   128: athrow
    //   129: astore_3
    //   130: aload_1
    //   131: ifnull +11 -> 142
    //   134: invokestatic 398	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:getInstance	()Lorg/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer;
    //   137: aload_1
    //   138: aconst_null
    //   139: invokevirtual 400	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:endBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   142: aload_3
    //   143: athrow
    //   144: aload_1
    //   145: ifnull +11 -> 156
    //   148: invokestatic 398	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:getInstance	()Lorg/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer;
    //   151: aload_1
    //   152: aconst_null
    //   153: invokevirtual 400	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:endBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   156: return
    // Line number table:
    //   Java source line #110	-> byte code offset #0
    //   Java source line #112	-> byte code offset #2
    //   Java source line #113	-> byte code offset #14
    //   Java source line #114	-> byte code offset #27
    //   Java source line #115	-> byte code offset #35
    //   Java source line #116	-> byte code offset #42
    //   Java source line #118	-> byte code offset #52
    //   Java source line #122	-> byte code offset #67
    //   Java source line #124	-> byte code offset #80
    //   Java source line #125	-> byte code offset #81
    //   Java source line #126	-> byte code offset #129
    //   Java source line #127	-> byte code offset #130
    //   Java source line #128	-> byte code offset #134
    //   Java source line #129	-> byte code offset #142
    //   Java source line #127	-> byte code offset #144
    //   Java source line #128	-> byte code offset #148
    //   Java source line #130	-> byte code offset #156
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	157	0	this	EclipseFolder
    //   1	151	1	rule	org.eclipse.core.runtime.jobs.ISchedulingRule
    //   34	9	2	project	IProject
    //   80	45	2	e	CoreException
    //   129	14	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   2	77	80	org/eclipse/core/runtime/CoreException
    //   2	129	129	finally
  }
  
  public boolean isFolder()
  {
    return true;
  }
  
  public void acceptChildren(ICVSResourceVisitor visitor)
    throws CVSException
  {
    ICVSResource[] subFiles = members(1);
    for (int i = 0; i < subFiles.length; i++) {
      subFiles[i].accept(visitor);
    }
    ICVSResource[] subFolders = members(2);
    for (int i = 0; i < subFolders.length; i++) {
      subFolders[i].accept(visitor);
    }
  }
  
  public void accept(ICVSResourceVisitor visitor)
    throws CVSException
  {
    visitor.visitFolder(this);
  }
  
  public void accept(ICVSResourceVisitor visitor, boolean recurse)
    throws CVSException
  {
    visitor.visitFolder(this);
    ICVSResource[] resources;
    ICVSResource[] resources;
    if (recurse) {
      resources = members(127);
    } else {
      resources = members(1);
    }
    for (int i = 0; i < resources.length; i++) {
      resources[i].accept(visitor, recurse);
    }
  }
  
  public String getRemoteLocation(ICVSFolder stopSearching)
    throws CVSException
  {
    if (getFolderSyncInfo() != null) {
      return getFolderSyncInfo().getRemoteLocation();
    }
    ICVSFolder parent = getParent();
    if ((parent != null) && (!equals(stopSearching)))
    {
      String parentLocation = parent.getRemoteLocation(stopSearching);
      if (parentLocation != null) {
        return parentLocation + "/" + getName();
      }
    }
    return null;
  }
  
  public FolderSyncInfo getFolderSyncInfo()
    throws CVSException
  {
    if ((resource.getType() != 8) && (!resource.getProject().isAccessible())) {
      return null;
    }
    return EclipseSynchronizer.getInstance().getFolderSync((IContainer)resource);
  }
  
  public void setFolderSyncInfo(FolderSyncInfo folderInfo)
    throws CVSException
  {
    if (resource.getType() == 8) {
      return;
    }
    run(new ICVSRunnable()
    {
      private final FolderSyncInfo val$folderInfo;
      
      public void run(IProgressMonitor monitor)
        throws CVSException
      {
        EclipseSynchronizer synchronizer = EclipseSynchronizer.getInstance();
        synchronizer.setFolderSync((IContainer)resource, val$folderInfo);
        
        byte[] newSyncBytes = new ResourceSyncInfo(getName()).getBytes();
        byte[] oldSyncBytes = getSyncBytes();
        if ((oldSyncBytes == null) || (!Util.equals(newSyncBytes, oldSyncBytes))) {
          setSyncBytes(newSyncBytes);
        }
      }
    }, null);
  }
  
  public boolean isCVSFolder()
    throws CVSException
  {
    return EclipseSynchronizer.getInstance().getFolderSync((IContainer)resource) != null;
  }
  
  public void unmanage(IProgressMonitor monitor)
    throws CVSException
  {
    run(new ICVSRunnable()
    {
      public void run(IProgressMonitor monitor)
        throws CVSException
      {
        monitor = Policy.monitorFor(monitor);
        monitor.beginTask(null, 100);
        EclipseFolder.recursiveUnmanage((IContainer)resource, Policy.subMonitorFor(monitor, 99));
        EclipseFolder.this.unmanage(Policy.subMonitorFor(monitor, 1));
        monitor.done();
      }
    }, Policy.subMonitorFor(monitor, 99));
  }
  
  /* Error */
  static void recursiveUnmanage(IContainer container, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_1
    //   1: aconst_null
    //   2: bipush 10
    //   4: invokeinterface 433 3 0
    //   9: aload_1
    //   10: getstatic 352	org/eclipse/team/internal/ccvs/core/CVSMessages:EclipseFolder_0	Ljava/lang/String;
    //   13: iconst_1
    //   14: anewarray 165	java/lang/String
    //   17: dup
    //   18: iconst_0
    //   19: aload_0
    //   20: invokeinterface 412 1 0
    //   25: invokeinterface 429 1 0
    //   30: aastore
    //   31: invokestatic 366	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   34: invokeinterface 432 2 0
    //   39: invokestatic 398	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:getInstance	()Lorg/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer;
    //   42: aload_0
    //   43: invokevirtual 393	org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer:deleteFolderSync	(Lorg/eclipse/core/resources/IContainer;)V
    //   46: aload_0
    //   47: iconst_1
    //   48: invokeinterface 411 2 0
    //   53: astore_2
    //   54: iconst_0
    //   55: istore_3
    //   56: goto +78 -> 134
    //   59: aload_1
    //   60: iconst_1
    //   61: invokeinterface 431 2 0
    //   66: aload_2
    //   67: iload_3
    //   68: aaload
    //   69: astore 4
    //   71: aload 4
    //   73: invokeinterface 420 1 0
    //   78: iconst_1
    //   79: if_icmpne +43 -> 122
    //   82: aload 4
    //   84: invokeinterface 423 1 0
    //   89: astore 5
    //   91: aload 5
    //   93: ifnull +38 -> 131
    //   96: aload 5
    //   98: invokevirtual 362	org/eclipse/core/resources/ResourceAttributes:isReadOnly	()Z
    //   101: ifeq +30 -> 131
    //   104: aload 5
    //   106: iconst_0
    //   107: invokevirtual 363	org/eclipse/core/resources/ResourceAttributes:setReadOnly	(Z)V
    //   110: aload 4
    //   112: aload 5
    //   114: invokeinterface 424 2 0
    //   119: goto +12 -> 131
    //   122: aload 4
    //   124: checkcast 169	org/eclipse/core/resources/IContainer
    //   127: aload_1
    //   128: invokestatic 386	org/eclipse/team/internal/ccvs/core/resources/EclipseFolder:recursiveUnmanage	(Lorg/eclipse/core/resources/IContainer;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   131: iinc 3 1
    //   134: iload_3
    //   135: aload_2
    //   136: arraylength
    //   137: if_icmplt -78 -> 59
    //   140: goto +24 -> 164
    //   143: pop
    //   144: aload_1
    //   145: invokeinterface 430 1 0
    //   150: goto +20 -> 170
    //   153: astore 6
    //   155: aload_1
    //   156: invokeinterface 430 1 0
    //   161: aload 6
    //   163: athrow
    //   164: aload_1
    //   165: invokeinterface 430 1 0
    //   170: return
    // Line number table:
    //   Java source line #255	-> byte code offset #0
    //   Java source line #256	-> byte code offset #9
    //   Java source line #257	-> byte code offset #39
    //   Java source line #259	-> byte code offset #46
    //   Java source line #260	-> byte code offset #54
    //   Java source line #261	-> byte code offset #59
    //   Java source line #262	-> byte code offset #66
    //   Java source line #263	-> byte code offset #71
    //   Java source line #264	-> byte code offset #82
    //   Java source line #265	-> byte code offset #91
    //   Java source line #266	-> byte code offset #104
    //   Java source line #267	-> byte code offset #110
    //   Java source line #270	-> byte code offset #122
    //   Java source line #260	-> byte code offset #131
    //   Java source line #273	-> byte code offset #143
    //   Java source line #276	-> byte code offset #144
    //   Java source line #275	-> byte code offset #153
    //   Java source line #276	-> byte code offset #155
    //   Java source line #277	-> byte code offset #161
    //   Java source line #276	-> byte code offset #164
    //   Java source line #278	-> byte code offset #170
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	171	0	container	IContainer
    //   0	171	1	monitor	IProgressMonitor
    //   53	83	2	members	IResource[]
    //   55	80	3	i	int
    //   69	54	4	resource	IResource
    //   89	24	5	attrs	org.eclipse.core.resources.ResourceAttributes
    //   153	9	6	localObject	Object
    //   143	1	7	localCoreException	CoreException
    // Exception table:
    //   from	to	target	type
    //   0	140	143	org/eclipse/core/runtime/CoreException
    //   0	144	153	finally
  }
  
  public boolean isIgnored()
    throws CVSException
  {
    if (isCVSFolder()) {
      return false;
    }
    return super.isIgnored();
  }
  
  public ICVSResource getChild(String namedPath)
    throws CVSException
  {
    if (namedPath.equals(".")) {
      return this;
    }
    IPath path = new Path(null, namedPath);
    if (path.segmentCount() == 0) {
      return this;
    }
    IResource child = ((IContainer)resource).findMember(path, true);
    if (child != null)
    {
      if (child.getType() == 1) {
        return new EclipseFile((IFile)child);
      }
      return new EclipseFolder((IContainer)child);
    }
    return null;
  }
  
  public ICVSResource[] fetchChildren(IProgressMonitor monitor)
    throws CVSException
  {
    return members(3);
  }
  
  public void delete()
    throws CVSException
  {
    if (!exists()) {
      return;
    }
    try
    {
      resource.delete(false, null);
    }
    catch (CoreException e)
    {
      throw new CVSException(e.getStatus());
    }
  }
  
  public boolean isModified(IProgressMonitor monitor)
    throws CVSException
  {
    try
    {
      monitor = Policy.monitorFor(monitor);
      monitor.beginTask(NLS.bind(CVSMessages.EclipseFolder_isModifiedProgress, new String[] { resource.getFullPath().toString() }), 1000);
      
      IContainer container = (IContainer)getIResource();
      if (RepositoryProvider.getProvider(container.getProject(), CVSProviderPlugin.getTypeId()) == null) {
        return false;
      }
      int state = EclipseSynchronizer.getInstance().getModificationState(getIResource());
      boolean bool1;
      boolean modified;
      if (state == 0)
      {
        if ((!isCVSFolder()) && (container.getType() == 2)) {
          return container.exists();
        }
        boolean modified = calculateAndSaveChildModificationStates(monitor);
        EclipseSynchronizer.getInstance().setModified(this, modified);
      }
      else
      {
        modified = state == 2;
      }
      return modified;
    }
    finally
    {
      monitor.done();
    }
  }
  
  public void handleModification(boolean forAddition)
    throws CVSException
  {
    if ((isIgnored()) || (!forAddition)) {
      return;
    }
    FolderSyncInfo info = getFolderSyncInfo();
    if (info == null) {
      EclipseSynchronizer.getInstance().setDirtyIndicator(getIResource(), true);
    }
  }
  
  private boolean calculateAndSaveChildModificationStates(IProgressMonitor monitor)
    throws CVSException
  {
    ICVSResource[] children = members(123);
    for (int i = 0; i < children.length; i++)
    {
      ICVSResource resource = children[i];
      if (resource.isModified(null)) {
        return true;
      }
      monitor.worked(1);
    }
    return false;
  }
  
  public String getRepositoryRelativePath()
    throws CVSException
  {
    FolderSyncInfo info = getFolderSyncInfo();
    if (info == null) {
      return null;
    }
    return info.getRepository();
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;

class EclipseResource$1
  implements ICVSRunnable
{
  final EclipseResource this$0;
  private final String val$pattern;
  
  EclipseResource$1(EclipseResource paramEclipseResource, String paramString)
  {
    this$0 = paramEclipseResource;val$pattern = paramString;
  }
  
  public void run(IProgressMonitor monitor)
    throws CVSException
  {
    EclipseSynchronizer.getInstance().addIgnored(this$0.resource.getParent(), val$pattern);
  }
}

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

import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;

class EclipseResource$2
  implements IWorkspaceRunnable
{
  final EclipseResource this$0;
  private final ICVSRunnable val$job;
  private final CVSException[] val$error;
  
  EclipseResource$2(EclipseResource paramEclipseResource, ICVSRunnable paramICVSRunnable, CVSException[] paramArrayOfCVSException)
  {
    this$0 = paramEclipseResource;val$job = paramICVSRunnable;val$error = paramArrayOfCVSException;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException
  {
    try
    {
      EclipseSynchronizer.getInstance().run(this$0.getIResource(), val$job, monitor);
    }
    catch (CVSException e)
    {
      val$error[0] = e;
    }
  }
}

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

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.core.Team;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Util;

abstract class EclipseResource
  implements ICVSResource, Comparable
{
  protected static final String SEPARATOR = "/";
  protected static final String CURRENT_LOCAL_FOLDER = ".";
  IResource resource;
  
  protected EclipseResource(IResource resource)
  {
    Assert.isNotNull(resource);
    this.resource = resource;
  }
  
  public String getRelativePath(ICVSFolder root)
    throws CVSException
  {
    try
    {
      EclipseResource rootFolder = (EclipseResource)root;
      String result = Util.getRelativePath(rootFolder.getPath(), getPath());
      if (result.length() == 0) {
        return ".";
      }
      return result;
    }
    catch (ClassCastException e)
    {
      IStatus status = new CVSStatus(4, 4, CVSMessages.EclipseResource_invalidResourceClass, e, root);
      throw new CVSException(status);
    }
  }
  
  public boolean exists()
  {
    return resource.exists();
  }
  
  public ICVSFolder getParent()
  {
    IContainer parent = resource.getParent();
    if (parent == null) {
      return null;
    }
    return new EclipseFolder(parent);
  }
  
  public String getName()
  {
    return resource.getName();
  }
  
  public boolean isIgnored()
    throws CVSException
  {
    if ((isManaged()) || (resource.getType() == 8) || (resource.getType() == 4)) {
      return false;
    }
    if ((resource.isDerived()) || (resource.isLinked())) {
      return true;
    }
    String name = getName();
    if (name.equals("CVS")) {
      return true;
    }
    if (Team.isIgnoredHint(resource)) {
      return true;
    }
    if (EclipseSynchronizer.getInstance().isIgnored(resource)) {
      return true;
    }
    ICVSFolder parent = getParent();
    if (parent == null) {
      return false;
    }
    if (parent.isIgnored()) {
      return true;
    }
    FolderSyncInfo info = parent.getFolderSyncInfo();
    if (info == null) {
      return false;
    }
    return info.isVirtualDirectory();
  }
  
  public void setIgnoredAs(String pattern)
    throws CVSException
  {
    run(new ICVSRunnable()
    {
      private final String val$pattern;
      
      public void run(IProgressMonitor monitor)
        throws CVSException
      {
        EclipseSynchronizer.getInstance().addIgnored(resource.getParent(), val$pattern);
      }
    }, null);
  }
  
  public boolean isManaged()
    throws CVSException
  {
    return isManaged(getSyncBytes());
  }
  
  public boolean isManaged(byte[] syncBytes)
  {
    return syncBytes != null;
  }
  
  public boolean equals(Object obj)
  {
    if (!(obj instanceof EclipseResource)) {
      return false;
    }
    return getPath().equals(((EclipseResource)obj).getPath());
  }
  
  public String getPath()
  {
    return resource.getFullPath().toString();
  }
  
  public boolean isFolder()
  {
    return false;
  }
  
  public byte[] getSyncBytes()
    throws CVSException
  {
    return EclipseSynchronizer.getInstance().getSyncBytes(getIResource());
  }
  
  public void setSyncBytes(byte[] syncBytes)
    throws CVSException
  {
    if (getParent().isCVSFolder()) {
      EclipseSynchronizer.getInstance().setSyncBytes(getIResource(), syncBytes);
    }
  }
  
  public ResourceSyncInfo getSyncInfo()
    throws CVSException
  {
    return EclipseSynchronizer.getInstance().getResourceSync(resource);
  }
  
  public int hashCode()
  {
    return getPath().hashCode();
  }
  
  public String toString()
  {
    return getPath();
  }
  
  public void unmanage(IProgressMonitor monitor)
    throws CVSException
  {
    EclipseSynchronizer.getInstance().deleteResourceSync(resource);
  }
  
  public int compareTo(Object arg0)
  {
    EclipseResource other = (EclipseResource)arg0;
    return resource.getFullPath().toString().compareTo(resource.getFullPath().toString());
  }
  
  public IResource getIResource()
  {
    return resource;
  }
  
  public abstract void handleModification(boolean paramBoolean)
    throws CVSException;
  
  public void run(ICVSRunnable job, IProgressMonitor monitor)
    throws CVSException
  {
    CVSException[] error = new CVSException[1];
    try
    {
      ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable()
      {
        private final ICVSRunnable val$job;
        private final CVSException[] val$error;
        
        public vo
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 27 28 29 30 31 32 33 34 35 36

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