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

 {
          List list = (List)it.next();
          totalWork += list.size();
          totalWork++;
        }
        if (totalWork != 0)
        {
          monitor.beginTask(CVSMessages.CVSTeamProvider_settingKSubst, totalWork);
          try
          {
            if (filesToCommitAsText.size() != 0)
            {
              Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true);
              session.open(Policy.subMonitorFor(monitor, 1), true);
              try
              {
                String keywordChangeComment = val$comment;
                if ((keywordChangeComment == null) || (keywordChangeComment.length() == 0)) {
                  keywordChangeComment = CVSMessages.CVSTeamProvider_changingKeywordComment;
                }
                val$result[0] = Command.COMMIT.execute(
                  session, 
                  Command.NO_GLOBAL_OPTIONS, 
                  new Command.LocalOption[] { Command.DO_NOT_RECURSE, Commit.FORCE, 
                  Command.makeArgumentOption(Command.MESSAGE_OPTION, keywordChangeComment) }, 
                  (ICVSResource[])filesToCommitAsText.toArray(new ICVSResource[filesToCommitAsText.size()]), 
                  filesToCommitAsText, 
                  null, 
                  Policy.subMonitorFor(monitor, filesToCommitAsText.size()));
              }
              finally
              {
                session.close();
              }
              if (!val$result[0].isOK()) {
                return;
              }
            }
            for (Iterator it = filesToAdmin.entrySet().iterator(); it.hasNext();)
            {
              Map.Entry entry = (Map.Entry)it.next();
              Command.KSubstOption toKSubst = (Command.KSubstOption)entry.getKey();
              List list = (List)entry.getValue();
              
              Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true);
              session.open(Policy.subMonitorFor(monitor, 1), true);
              try
              {
                val$result[0] = Command.ADMIN.execute(
                  session, 
                  Command.NO_GLOBAL_OPTIONS, 
                  new Command.LocalOption[] { toKSubst }, 
                  (ICVSResource[])list.toArray(new ICVSResource[list.size()]), 
                  new AdminKSubstListener(toKSubst), 
                  Policy.subMonitorFor(monitor, list.size()));
              }
              finally
              {
                session.close();
              }
              if (!val$result[0].isOK()) {
                return;
              }
            }
          }
          finally
          {
            monitor.done();
          }
          monitor.done();
        }
      }
    }, Policy.monitorFor(monitor));
    return result[0];
  }
  
  /* Error */
  public static void cleanLineDelimiters(IFile file, boolean useCRLF, IProgressMonitor progress)
    throws CVSException
  {
    // Byte code:
    //   0: new 272	java/io/ByteArrayOutputStream
    //   3: dup
    //   4: invokespecial 608	java/io/ByteArrayOutputStream:<init>	()V
    //   7: astore_3
    //   8: new 270	java/io/BufferedInputStream
    //   11: dup
    //   12: aload_0
    //   13: invokeinterface 696 1 0
    //   18: invokespecial 606	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   21: astore 4
    //   23: new 329	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream
    //   26: dup
    //   27: aload 4
    //   29: invokespecial 689	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream:<init>	(Ljava/io/InputStream;)V
    //   32: astore 4
    //   34: iload_1
    //   35: ifeq +23 -> 58
    //   38: new 330	org/eclipse/team/internal/core/streams/LFtoCRLFInputStream
    //   41: dup
    //   42: aload 4
    //   44: invokespecial 690	org/eclipse/team/internal/core/streams/LFtoCRLFInputStream:<init>	(Ljava/io/InputStream;)V
    //   47: astore 4
    //   49: goto +9 -> 58
    //   52: aload_3
    //   53: iload 5
    //   55: invokevirtual 611	java/io/ByteArrayOutputStream:write	(I)V
    //   58: aload 4
    //   60: invokevirtual 613	java/io/InputStream:read	()I
    //   63: dup
    //   64: istore 5
    //   66: iconst_m1
    //   67: if_icmpne -15 -> 52
    //   70: aload_3
    //   71: invokevirtual 609	java/io/ByteArrayOutputStream:close	()V
    //   74: goto +13 -> 87
    //   77: astore 6
    //   79: aload 4
    //   81: invokevirtual 614	java/io/InputStream:close	()V
    //   84: aload 6
    //   86: athrow
    //   87: aload 4
    //   89: invokevirtual 614	java/io/InputStream:close	()V
    //   92: new 271	java/io/ByteArrayInputStream
    //   95: dup
    //   96: aload_3
    //   97: invokevirtual 610	java/io/ByteArrayOutputStream:toByteArray	()[B
    //   100: invokespecial 607	java/io/ByteArrayInputStream:<init>	([B)V
    //   103: astore 5
    //   105: aload_0
    //   106: aload 5
    //   108: iconst_0
    //   109: iconst_0
    //   110: aload_2
    //   111: invokeinterface 697 5 0
    //   116: goto +23 -> 139
    //   119: astore_3
    //   120: aload_0
    //   121: getstatic 583	org/eclipse/team/internal/ccvs/core/CVSMessages:CVSTeamProvider_cleanLineDelimitersException	Ljava/lang/String;
    //   124: aload_3
    //   125: invokestatic 640	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_0
    //   131: getstatic 583	org/eclipse/team/internal/ccvs/core/CVSMessages:CVSTeamProvider_cleanLineDelimitersException	Ljava/lang/String;
    //   134: aload_3
    //   135: invokestatic 639	org/eclipse/team/internal/ccvs/core/CVSException:wrapException	(Lorg/eclipse/core/resources/IResource;Ljava/lang/String;Ljava/io/IOException;)Lorg/eclipse/team/internal/ccvs/core/CVSException;
    //   138: athrow
    //   139: return
    // Line number table:
    //   Java source line #439	-> byte code offset #0
    //   Java source line #440	-> byte code offset #8
    //   Java source line #443	-> byte code offset #23
    //   Java source line #444	-> byte code offset #34
    //   Java source line #446	-> byte code offset #38
    //   Java source line #448	-> byte code offset #49
    //   Java source line #449	-> byte code offset #70
    //   Java source line #450	-> byte code offset #77
    //   Java source line #451	-> byte code offset #79
    //   Java source line #452	-> byte code offset #84
    //   Java source line #451	-> byte code offset #87
    //   Java source line #454	-> byte code offset #92
    //   Java source line #455	-> byte code offset #105
    //   Java source line #456	-> byte code offset #119
    //   Java source line #457	-> byte code offset #120
    //   Java source line #458	-> byte code offset #129
    //   Java source line #459	-> byte code offset #130
    //   Java source line #461	-> byte code offset #139
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	140	0	file	IFile
    //   0	140	1	useCRLF	boolean
    //   0	140	2	progress	IProgressMonitor
    //   7	90	3	bos	ByteArrayOutputStream
    //   119	6	3	e	CoreException
    //   129	6	3	e	IOException
    //   21	67	4	is	InputStream
    //   52	2	5	b	int
    //   64	3	5	b	int
    //   103	4	5	bis	java.io.ByteArrayInputStream
    //   77	8	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   23	77	77	finally
    //   0	116	119	org/eclipse/core/runtime/CoreException
    //   0	116	129	java/io/IOException
  }
  
  public String getID()
  {
    return CVSProviderPlugin.getTypeId();
  }
  
  public IMoveDeleteHook getMoveDeleteHook()
  {
    return moveDeleteHook;
  }
  
  public IFileModificationValidator getFileModificationValidator()
  {
    return getFileModificationValidator2();
  }
  
  public FileModificationValidator getFileModificationValidator2()
  {
    return internalGetFileModificationValidator();
  }
  
  public void edit(IResource[] resources, boolean recurse, boolean notifyServer, boolean notifyForWritable, int notification, IProgressMonitor progress)
    throws CVSException
  {
    int notify;
    int notify;
    if (notification == 0)
    {
      int notify;
      if (CVSProviderPlugin.getPlugin().isWatchOnEdit()) {
        notify = 7;
      } else {
        notify = 0;
      }
    }
    else
    {
      notify = notification;
    }
    notifyEditUnedit(resources, recurse, notifyServer, new ICVSResourceVisitor()
    {
      private final boolean val$notifyForWritable;
      private final int val$notify;
      
      public void visitFile(ICVSFile file)
        throws CVSException
      {
        if ((val$notifyForWritable) || (file.isReadOnly())) {
          file.edit(val$notify, val$notifyForWritable, Policy.monitorFor(null));
        }
      }
      
      public void visitFolder(ICVSFolder folder)
        throws CVSException
      {}
    }, null, progress);
  }
  
  public void unedit(IResource[] resources, boolean recurse, boolean notifyServer, IProgressMonitor progress)
    throws CVSException
  {
    notifyEditUnedit(resources, recurse, notifyServer, new ICVSResourceVisitor()
    {
      public void visitFile(ICVSFile file)
        throws CVSException
      {
        if (!file.isReadOnly()) {
          file.unedit(Policy.monitorFor(null));
        }
      }
      
      public void visitFolder(ICVSFolder folder)
        throws CVSException
      {}
    }, getProject(), progress);
  }
  
  private void notifyEditUnedit(IResource[] resources, boolean recurse, boolean notifyServer, ICVSResourceVisitor editUneditVisitor, ISchedulingRule rule, IProgressMonitor monitor)
    throws CVSException
  {
    CVSException[] exception = new CVSException[1];
    IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable()
    {
      private final IResource[] val$resources;
      private final ICVSResourceVisitor val$editUneditVisitor;
      private final boolean val$recurse;
      private final CVSException[] val$exception;
      private final boolean val$notifyServer;
      
      /* Error */
      public void run(IProgressMonitor monitor)
        throws CoreException
      {
        // Byte code:
        //   0: aload_0
        //   1: getfield 113	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:this$0	Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;
        //   4: aload_0
        //   5: getfield 111	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$resources	[Lorg/eclipse/core/resources/IResource;
        //   8: invokestatic 120	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:access$3	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;[Lorg/eclipse/core/resources/IResource;)[Lorg/eclipse/team/internal/ccvs/core/ICVSResource;
        //   11: astore_2
        //   12: iconst_0
        //   13: istore_3
        //   14: goto +22 -> 36
        //   17: aload_2
        //   18: iload_3
        //   19: aaload
        //   20: aload_0
        //   21: getfield 114	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$editUneditVisitor	Lorg/eclipse/team/internal/ccvs/core/ICVSResourceVisitor;
        //   24: aload_0
        //   25: getfield 110	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$recurse	Z
        //   28: invokeinterface 130 3 0
        //   33: iinc 3 1
        //   36: iload_3
        //   37: aload_2
        //   38: arraylength
        //   39: if_icmplt -22 -> 17
        //   42: goto +12 -> 54
        //   45: astore_3
        //   46: aload_0
        //   47: getfield 112	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$exception	[Lorg/eclipse/team/internal/ccvs/core/CVSException;
        //   50: iconst_0
        //   51: aload_3
        //   52: aastore
        //   53: return
        //   54: aload_0
        //   55: getfield 109	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$notifyServer	Z
        //   58: ifeq +140 -> 198
        //   61: aload_1
        //   62: aconst_null
        //   63: bipush 100
        //   65: invokeinterface 129 3 0
        //   70: new 64	org/eclipse/team/internal/ccvs/core/client/Session
        //   73: dup
        //   74: aload_0
        //   75: getfield 113	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:this$0	Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;
        //   78: invokestatic 119	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:access$0	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;)Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
        //   81: invokevirtual 127	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getRemoteLocation	()Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;
        //   84: aload_0
        //   85: getfield 113	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:this$0	Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;
        //   88: invokestatic 119	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:access$0	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;)Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
        //   91: invokevirtual 126	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getLocalRoot	()Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;
        //   94: iconst_1
        //   95: invokespecial 125	org/eclipse/team/internal/ccvs/core/client/Session:<init>	(Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;Z)V
        //   98: astore_3
        //   99: aload_3
        //   100: aload_1
        //   101: bipush 10
        //   103: invokestatic 121	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
        //   106: iconst_1
        //   107: invokevirtual 124	org/eclipse/team/internal/ccvs/core/client/Session:open	(Lorg/eclipse/core/runtime/IProgressMonitor;Z)V
        //   110: goto +15 -> 125
        //   113: pop
        //   114: aload_3
        //   115: invokevirtual 123	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
        //   118: aload_1
        //   119: invokeinterface 128 1 0
        //   124: return
        //   125: getstatic 117	org/eclipse/team/internal/ccvs/core/client/Command:NOOP	Lorg/eclipse/team/internal/ccvs/core/client/NOOPCommand;
        //   128: aload_3
        //   129: getstatic 115	org/eclipse/team/internal/ccvs/core/client/Command:NO_GLOBAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;
        //   132: getstatic 116	org/eclipse/team/internal/ccvs/core/client/Command:NO_LOCAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;
        //   135: aload_2
        //   136: aconst_null
        //   137: aload_1
        //   138: bipush 90
        //   140: invokestatic 121	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
        //   143: invokevirtual 122	org/eclipse/team/internal/ccvs/core/client/NOOPCommand:execute	(Lorg/eclipse/team/internal/ccvs/core/client/Session;[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;[Lorg/eclipse/team/internal/ccvs/core/ICVSResource;Lorg/eclipse/team/internal/ccvs/core/client/listeners/ICommandOutputListener;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
        //   146: pop
        //   147: goto +41 -> 188
        //   150: astore 4
        //   152: aload_0
        //   153: getfield 112	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$exception	[Lorg/eclipse/team/internal/ccvs/core/CVSException;
        //   156: iconst_0
        //   157: aload 4
        //   159: aastore
        //   160: aload_3
        //   161: invokevirtual 123	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
        //   164: aload_1
        //   165: invokeinterface 128 1 0
        //   170: goto +28 -> 198
        //   173: astore 5
        //   175: aload_3
        //   176: invokevirtual 123	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
        //   179: aload_1
        //   180: invokeinterface 128 1 0
        //   185: aload 5
        //   187: athrow
        //   188: aload_3
        //   189: invokevirtual 123	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
        //   192: aload_1
        //   193: invokeinterface 128 1 0
        //   198: return
        // Line number table:
        //   Java source line #581	-> byte code offset #0
        //   Java source line #585	-> byte code offset #12
        //   Java source line #586	-> byte code offset #17
        //   Java source line #585	-> byte code offset #33
        //   Java source line #588	-> byte code offset #45
        //   Java source line #589	-> byte code offset #46
        //   Java source line #590	-> byte code offset #53
        //   Java source line #594	-> byte code offset #54
        //   Java source line #595	-> byte code offset #61
        //   Java source line #596	-> byte code offset #70
        //   Java source line #599	-> byte code offset #99
        //   Java source line #600	-> byte code offset #113
        //   Java source line #615	-> byte code offset #114
        //   Java source line #616	-> byte code offset #118
        //   Java source line #603	-> byte code offset #124
        //   Java source line #605	-> byte code offset #125
        //   Java source line #606	-> byte code offset #128
        //   Java source line #607	-> byte code offset #129
        //   Java source line #608	-> byte code offset #132
        //   Java source line #609	-> byte code offset #135
        //   Java source line #610	-> byte code offset #136
        //   Java source line #611	-> byte code offset #137
        //   Java source line #605	-> byte code offset #143
        //   Java source line #612	-> byte code offset #150
        //   Java source line #613	-> byte code offset #152
        //   Java source line #615	-> byte code offset #160
        //   Java source line #616	-> byte code offset #164
        //   Java source line #614	-> byte code offset #173
        //   Java source line #615	-> byte code offset #175
        //   Java source line #616	-> byte code offset #179
        //   Java source line #617	-> byte code offset #185
        //   Java source line #615	-> byte code offset #188
        //   Java source line #616	-> byte code offset #192
        //   Java source line #619	-> byte code offset #198
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	199	0	this	6
        //   0	199	1	monitor	IProgressMonitor
        //   11	125	2	cvsResources	ICVSResource[]
        //   13	24	3	i	int
        //   45	7	3	e	CVSException
        //   98	91	3	session	Session
        //   150	8	4	e	CVSException
        //   173	13	5	localObject	Object
        //   113	1	8	localCVSException1	CVSException
        // Exception table:
        //   from	to	target	type
        //   12	42	45	org/eclipse/team/internal/ccvs/core/CVSException
        //   99	110	113	org/eclipse/team/internal/ccvs/core/CVSException
        //   99	114	150	org/eclipse/team/internal/ccvs/core/CVSException
        //   125	147	150	org/eclipse/team/internal/ccvs/core/CVSException
        //   99	114	173	finally
        //   125	160	173	finally
      }
    };
    try
    {
      ResourcesPlugin.getWorkspace().run(workspaceRunnable, rule, 0, Policy.monitorFor(monitor));
    }
    catch (CoreException e)
    {
      if (exception[0] == null) {
        throw CVSException.wrapException(e);
      }
      CVSProviderPlugin.log(CVSException.wrapException(e));
    }
    if (exception[0] != null) {
      throw exception[0];
    }
  }
  
  public boolean getFetchAbsentDirectories()
    throws CVSException
  {
    try
    {
      String property = getProject().getPersistentProperty(FETCH_ABSENT_DIRECTORIES_PROP_KEY);
      if (property == null) {
        return CVSProviderPlugin.getPlugin().getFetchAbsentDirectories();
      }
      return Boolean.valueOf(property).booleanValue();
    }
    catch (CoreException e)
    {
      throw new CVSException(new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSTeamProvider_errorGettingFetchProperty, new String[] { project.getName() }), e, project));
    }
  }
  
  public void setFetchAbsentDirectories(boolean fetchAbsentDirectories)
    throws CVSException
  {
    internalSetFetchAbsentDirectories(fetchAbsentDirectories ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
  }
  
  public void internalSetFetchAbsentDirectories(String fetchAbsentDirectories)
    throws CVSException
  {
    try
    {
      getProject().setPersistentProperty(FETCH_ABSENT_DIRECTORIES_PROP_KEY, fetchAbsentDirectories);
    }
    catch (CoreException e)
    {
      IStatus status = new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSTeamProvider_errorSettingFetchProperty, new String[] { project.getName() }), e, project);
      throw new CVSException(status);
    }
  }
  
  public boolean canHandleLinkedResources()
  {
    return true;
  }
  
  public boolean canHandleLinkedResourceURI()
  {
    return true;
  }
  
  public IStatus validateCreateLink(IResource resource, int updateFlags, IPath location)
  {
    return internalValidateCreateLink(resource);
  }
  
  private IStatus internalValidateCreateLink(IResource resource)
  {
    ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(resource.getParent().getFolder(new Path(resource.getName())));
    try
    {
      if (cvsFolder.isCVSFolder()) {
        return new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSTeamProvider_overlappingRemoteFolder, new String[] { resource.getFullPath().toString() }), resource);
      }
      ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(resource.getParent().getFile(new Path(resource.getName())));
      if (cvsFile.isManaged()) {
        return new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSTeamProvider_overlappingFileDeletion, new String[] { resource.getFullPath().toString() }), resource);
      }
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
      return e.getStatus();
    }
    return Status.OK_STATUS;
  }
  
  public IStatus validateCreateLink(IResource resource, int updateFlags, URI location)
  {
    return internalValidateCreateLink(resource);
  }
  
  /* Error */
  public EditorsInfo[] editors(IResource[] resources, IProgressMonitor progress)
    throws CVSException
  {
    // Byte code:
    //   0: iconst_0
    //   1: anewarray 318	org/eclipse/team/internal/ccvs/core/client/Command$LocalOption
    //   4: astore_3
    //   5: aload_2
    //   6: bipush 10
    //   8: invokeinterface 714 2 0
    //   13: aload_0
    //   14: aload_1
    //   15: aload_3
    //   16: invokespecial 660	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:getValidArguments	([Lorg/eclipse/core/resources/IResource;[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;)[Ljava/lang/String;
    //   19: astore 4
    //   21: new 321	org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener
    //   24: dup
    //   25: invokespecial 673	org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener:<init>	()V
    //   28: astore 5
    //   30: aload_2
    //   31: invokeinterface 713 1 0
    //   36: ifeq +8 -> 44
    //   39: iconst_0
    //   40: anewarray 310	org/eclipse/team/internal/ccvs/core/EditorsInfo
    //   43: areturn
    //   44: new 320	org/eclipse/team/internal/ccvs/core/client/Session
    //   47: dup
    //   48: aload_0
    //   49: getfield 601	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:workspaceRoot	Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
    //   52: invokevirtual 678	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getRemoteLocation	()Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;
    //   55: aload_0
    //   56: getfield 601	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:workspaceRoot	Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
    //   59: invokevirtual 677	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getLocalRoot	()Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;
    //   62: invokespecial 672	org/eclipse/team/internal/ccvs/core/client/Session:<init>	(Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;)V
    //   65: astore 6
    //   67: aload_2
    //   68: invokeinterface 713 1 0
    //   73: ifeq +8 -> 81
    //   76: iconst_0
    //   77: anewarray 310	org/eclipse/team/internal/ccvs/core/EditorsInfo
    //   80: areturn
    //   81: aload_2
    //   82: aconst_null
    //   83: bipush 100
    //   85: invokeinterface 715 3 0
    //   90: aload 6
    //   92: aload_2
    //   93: bipush 20
    //   95: invokestatic 668	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   98: iconst_0
    //   99: invokevirtual 671	org/eclipse/team/internal/ccvs/core/client/Session:open	(Lorg/eclipse/core/runtime/IProgressMonitor;Z)V
    //   102: aload_2
    //   103: invokeinterface 713 1 0
    //   108: ifne +45 -> 153
    //   111: getstatic 604	org/eclipse/team/internal/ccvs/core/client/Command:EDITORS	Lorg/eclipse/team/internal/ccvs/core/client/Editors;
    //   114: aload 6
    //   116: getstatic 603	org/eclipse/team/internal/ccvs/core/client/Command:NO_GLOBAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;
    //   119: aload_3
    //   120: aload 4
    //   122: aload 5
    //   124: aload_2
    //   125: bipush 80
    //   127: invokestatic 668	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   130: invokevirtual 669	org/eclipse/team/internal/ccvs/core/client/Editors:execute	(Lorg/eclipse/team/internal/ccvs/core/client/Session;[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;[Ljava/lang/String;Lorg/eclipse/team/internal/ccvs/core/client/listeners/ICommandOutputListener;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
    //   133: pop
    //   134: goto +19 -> 153
    //   137: astore 7
    //   139: aload 6
    //   141: invokevirtual 670	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   144: aload_2
    //   145: invokeinterface 712 1 0
    //   150: aload 7
    //   152: athrow
    //   153: aload 6
    //   155: invokevirtual 670	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   158: aload_2
    //   159: invokeinterface 712 1 0
    //   164: aload 5
    //   166: invokevirtual 674	org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener:getEditorsInfos	()[Lorg/eclipse/team/internal/ccvs/core/EditorsInfo;
    //   169: areturn
    // Line number table:
    //   Java source line #729	-> byte code offset #0
    //   Java source line #731	-> byte code offset #5
    //   Java source line #733	-> byte code offset #13
    //   Java source line #736	-> byte code offset #21
    //   Java source line #739	-> byte code offset #30
    //   Java source line #740	-> byte code offset #39
    //   Java source line #744	-> byte code offset #44
    //   Java source line #745	-> byte code offset #48
    //   Java source line #746	-> byte code offset #55
    //   Java source line #744	-> byte code offset #62
    //   Java source line #743	-> byte code offset #65
    //   Java source line #749	-> byte code offset #67
    //   Java source line #750	-> byte code offset #76
    //   Java source line #752	-> byte code offset #81
    //   Java source line #755	-> byte code offset #90
    //   Java source line #757	-> byte code offset #102
    //   Java source line #759	-> byte code offset #111
    //   Java source line #760	-> byte code offset #114
    //   Java source line #761	-> byte code offset #116
    //   Java source line #762	-> byte code offset #119
    //   Java source line #763	-> byte code offset #120
    //   Java source line #764	-> byte code offset #122
    //   Java source line #765	-> byte code offset #124
    //   Java source line #759	-> byte code offset #130
    //   Java source line #767	-> byte code offset #137
    //   Java source line #768	-> byte code offset #139
    //   Java source line #769	-> byte code offset #144
    //   Java source line #770	-> byte code offset #150
    //   Java source line #768	-> byte code offset #153
    //   Java source line #769	-> byte code offset #158
    //   Java source line #772	-> byte code offset #164
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	170	0	this	CVSTeamProvider
    //   0	170	1	resources	IResource[]
    //   0	170	2	progress	IProgressMonitor
    //   4	116	3	commandOptions	Command.LocalOption[]
    //   19	102	4	arguments	String[]
    //   28	137	5	listener	org.eclipse.team.internal.ccvs.core.client.listeners.EditorsListener
    //   65	89	6	session	Session
    //   137	14	7	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   90	137	137	finally
  }
  
  public String getCommitTemplate()
    throws CVSException
  {
    ICVSFolder localFolder = getCVSWorkspaceRoot().getLocalRoot();
    ICVSFile templateFile = CVSWorkspaceRoot.getCVSFileFor(
      SyncFileWriter.getTemplateFile(
      (IContainer)localFolder.getIResource()));
    if (!templateFile.exists()) {
      return null;
    }
    InputStream in = new BufferedInputStream(templateFile.getContents());
    try
    {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      int b;
      do
      {
        b = in.read();
        if (b != -1) {
          out.write((byte)b);
        }
      } while (b != -1);
      out.close();
      return new String(out.toString());
    }
    catch (IOException e)
    {
      throw CVSException.wrapException(e);
    }
    finally
    {
      try
      {
        in.close();
      }
      catch (IOException e)
      {
        CVSProviderPlugin.log(CVSException.wrapException(e));
      }
    }
  }
  
  public boolean isWatchEditEnabled()
    throws CVSException
  {
    IProject project = getProject();
    try
    {
      String property = (String)project.getSessionProperty(WATCH_EDIT_PROP_KEY);
      if (property == null)
      {
        property = project.getPersistentProperty(WATCH_EDIT_PROP_KEY);
        if (property == null) {
          return CVSProviderPlugin.getPlugin().isWatchEditEnabled();
        }
        project.setSessionProperty(WATCH_EDIT_PROP_KEY, property);
      }
      return Boolean.valueOf(property).booleanValue();
    }
    catch (CoreException e)
    {
      if (project.isAccessible())
      {
        IStatus status = new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSTeamProvider_errorGettingWatchEdit, new String[] { project.getName() }), e, project);
        throw new CVSException(status);
      }
    }
    return false;
  }
  
  public void setWatchEditEnabled(boolean enabled)
    throws CVSException
  {
    internalSetWatchEditEnabled(enabled ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
  }
  
  private void internalSetWatchEditEnabled(String enabled)
    throws CVSException
  {
    try
    {
      IProject project = getProject();
      project.setPersistentProperty(WATCH_EDIT_PROP_KEY, enabled);
      project.setSessionProperty(WATCH_EDIT_PROP_KEY, enabled);
    }
    catch (CoreException e)
    {
      IStatus status = new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSTeamProvider_errorSettingWatchEdit, new String[] { this.project.getName() }), e, this.project);
      throw new CVSException(status);
    }
  }
  
  public IResourceRuleFactory getRuleFactory()
  {
    return RESOURCE_RULE_FACTORY;
  }
  
  public IFileHistoryProvider getFileHistoryProvider()
  {
    if (fileHistoryProvider == null) {
      fileHistoryProvider = new CVSFileHistoryProvider();
    }
    return fileHistoryProvider;
  }
}

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

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;

class CVSTeamProviderType$1
  extends JobChangeAdapter
{
  public void done(IJobChangeEvent event)
  {
    if (!CVSTeamProviderType.access$0().isQueueEmpty()) {
      CVSTeamProviderType.access$0().schedule();
    }
  }
}

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

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;

public class CVSTeamProviderType$AutoShareJob
  extends Job
{
  List projectsToShare = new ArrayList();
  
  CVSTeamProviderType$AutoShareJob()
  {
    super(CVSMessages.CVSTeamProviderType_0);
  }
  
  public boolean isQueueEmpty()
  {
    return projectsToShare.isEmpty();
  }
  
  public boolean shouldSchedule()
  {
    return !isQueueEmpty();
  }
  
  public boolean shouldRun()
  {
    synchronized (projectsToShare)
    {
      for (Iterator iter = projectsToShare.iterator(); iter.hasNext();)
      {
        IProject project = (IProject)iter.next();
        if (RepositoryProvider.isShared(project)) {
          iter.remove();
        }
      }
      return !projectsToShare.isEmpty();
    }
  }
  
  public void share(IProject project)
  {
    if (!RepositoryProvider.isShared(project))
    {
      synchronized (projectsToShare)
      {
        if (!projectsToShare.contains(project)) {
          projectsToShare.add(project);
        }
      }
      if ((getState() == 0) && (!isQueueEmpty())) {
        schedule();
      }
    }
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    IProject next = null;
    next = getNextProject();
    monitor.beginTask(null, -1);
    while (next != null)
    {
      autoconnectCVSProject(next, Policy.subMonitorFor(monitor, -1));
      next = getNextProject();
    }
    monitor.done();
    return Status.OK_STATUS;
  }
  
  private IProject getNextProject()
  {
    IProject next = null;
    synchronized (projectsToShare)
    {
      if (!projectsToShare.isEmpty()) {
        next = (IProject)projectsToShare.remove(0);
      }
    }
    return next;
  }
  
  private void autoconnectCVSProject(IProject project, IProgressMonitor monitor)
  {
    try
    {
      ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
      FolderSyncInfo info = folder.getFolderSyncInfo();
      if (info != null) {
        CVSWorkspaceRoot.setSharing(project, info, monitor);
      }
    }
    catch (TeamException e)
    {
      CVSProviderPlugin.log(4, "Could not auto-share project " + project.getName(), e);
    }
  }
}

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

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.team.core.ProjectSetCapability;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.mapping.IChangeGroupingRequestor;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager;

public class CVSTeamProviderType
  extends RepositoryProviderType
  implements IAdaptable
{
  private static AutoShareJob autoShareJob;
  
  public static class AutoShareJob
    extends Job
  {
    List projectsToShare = new ArrayList();
    
    AutoShareJob()
    {
      super();
    }
    
    public boolean isQueueEmpty()
    {
      return projectsToShare.isEmpty();
    }
    
    public boolean shouldSchedule()
    {
      return !isQueueEmpty();
    }
    
    public boolean shouldRun()
    {
      synchronized (projectsToShare)
      {
        for (Iterator iter = projectsToShare.iterator(); iter.hasNext();)
        {
          IProject project = (IProject)iter.next();
          if (RepositoryProvider.isShared(project)) {
            iter.remove();
          }
        }
        return !projectsToShare.isEmpty();
      }
    }
    
    public void share(IProject project)
    {
      if (!RepositoryProvider.isShared(project))
      {
        synchronized (projectsToShare)
        {
          if (!projectsToShare.contains(project)) {
            projectsToShare.add(project);
          }
        }
        if ((getState() == 0) && (!isQueueEmpty())) {
          schedule();
        }
      }
    }
    
    protected IStatus run(IProgressMonitor monitor)
    {
      IProject next = null;
      next = getNextProject();
      monitor.beginTask(null, -1);
      while (next != null)
      {
        autoconnectCVSProject(next, Policy.subMonitorFor(monitor, -1));
        next = getNextProject();
      }
      monitor.done();
      return Status.OK_STATUS;
    }
    
    private IProject getNextProject()
    {
      IProject next = null;
      synchronized (projectsToShare)
      {
        if (!projectsToShare.isEmpty()) {
          next = (IProject)projectsToShare.remove(0);
        }
      }
      return next;
    }
    
    private void autoconnectCVSProject(IProject project, IProgressMonitor monitor)
    {
      try
      {
        ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
        FolderSyncInfo info = folder.getFolderSyncInfo();
        if (info != null) {
          CVSWorkspaceRoot.setSharing(project, info, monitor);
        }
      }
      catch (TeamException e)
      {
        CVSProviderPlugin.log(4, "Could not auto-share project " + project.getName(), e);
      }
    }
  }
  
  private static synchronized AutoShareJob getAutoShareJob()
  {
    if (autoShareJob == null)
    {
      autoShareJob = new AutoShareJob();
      autoShareJob.addJobChangeListener(new JobChangeAdapter()
      {
        public void done(IJobChangeEvent event)
        {
          if (!CVSTeamProviderType.autoShareJob.isQueueEmpty()) {
            CVSTeamProviderType.autoShareJob.schedule()
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