Java Code Examples for org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addNotifyListener()

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addNotifyListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResolveResourcesCommand.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void run(IProgressMonitor monitor) throws SVNException {
	ISVNClientAdapter svnClient = root.getRepository().getSVNClient();
    try {            
        svnClient.addNotifyListener(operationResourceCollector);           
        OperationManager.getInstance().beginOperation(svnClient);           
        for (int i = 0; i < resources.length; i++) {
            svnClient.resolve(resources[i].getLocation().toFile(), resolution);
            monitor.worked(100);
        }
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
    	Set<IResource> operationResources = operationResourceCollector.getOperationResources();
        OperationManager.getInstance().endOperation(true, operationResources);
        if (svnClient != null) {
         svnClient.removeNotifyListener(operationResourceCollector);
         root.getRepository().returnSVNClient(svnClient);
        }
        monitor.done();
    }
}
 
Example 2
Source File: UnlockResourcesCommand.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void run(IProgressMonitor monitor) throws SVNException {
      final ISVNClientAdapter svnClient = root.getRepository().getSVNClient();
      
      final File[] resourceFiles = new File[resources.length];
      for (int i = 0; i < resources.length;i++)
          resourceFiles[i] = resources[i].getLocation().toFile(); 
      
      try {
          monitor.beginTask(null, 100);
          
          svnClient.addNotifyListener(operationResourceCollector);
          
          OperationManager.getInstance().beginOperation(svnClient);

          svnClient.unlock(resourceFiles, force);
      } catch (SVNClientException e) {
          throw SVNException.wrapException(e);
      } finally {
      	Set<IResource> operationResources = operationResourceCollector.getOperationResources();
          OperationManager.getInstance().endOperation(true, operationResources);
          svnClient.removeNotifyListener(operationResourceCollector);
          root.getRepository().returnSVNClient(svnClient);
          monitor.done();
      }
}
 
Example 3
Source File: LockResourcesCommand.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void run(IProgressMonitor monitor) throws SVNException {
       final ISVNClientAdapter svnClient = root.getRepository().getSVNClient();
       
       final File[] resourceFiles = new File[resources.length];
       for (int i = 0; i < resources.length;i++)
           resourceFiles[i] = resources[i].getLocation().toFile(); 
       try {
           monitor.beginTask(null, 100);
           
           svnClient.addNotifyListener(operationResourceCollector);
           
           OperationManager.getInstance().beginOperation(svnClient);

           svnClient.lock(resourceFiles,message,force);
       } catch (SVNClientException e) {
           throw SVNException.wrapException(e);
       } finally {
       	Set<IResource> operationResources = operationResourceCollector.getOperationResources();
           OperationManager.getInstance().endOperation(true, operationResources, refreshLocal);
           if (svnClient != null) {
            svnClient.removeNotifyListener(operationResourceCollector);
            root.getRepository().returnSVNClient(svnClient);
           }
           monitor.done();
       }
}
 
Example 4
Source File: LocalResource.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void setSvnProperty(String name, String value, boolean recurse) throws SVNException {
	OperationResourceCollector operationResourceCollector = new OperationResourceCollector();
	ISVNClientAdapter svnClient = getRepository().getSVNClient();
	try {			
		svnClient.addNotifyListener(operationResourceCollector);
		OperationManager.getInstance().beginOperation(svnClient);
		svnClient.propertySet(getFile(),name,value,recurse);
	} catch (SVNClientException e) {
		throw SVNException.wrapException(e); 
	} finally {
		OperationManager.getInstance().endOperation(true, operationResourceCollector.getOperationResources());
		if (svnClient != null) {
			svnClient.removeNotifyListener(operationResourceCollector);
			getRepository().returnSVNClient(svnClient);
		}
	}
}
 
Example 5
Source File: LocalResource.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void deleteSvnProperty(String name,boolean recurse) throws SVNException {
	OperationResourceCollector operationResourceCollector = new OperationResourceCollector();
	ISVNClientAdapter svnClient = getRepository().getSVNClient();
	try {			
		svnClient.addNotifyListener(operationResourceCollector);
		OperationManager.getInstance().beginOperation(svnClient);
		svnClient.propertyDel(getFile(),name,recurse);
	} catch (SVNClientException e) {
		throw SVNException.wrapException(e); 
	} finally {
		OperationManager.getInstance().endOperation(true, operationResourceCollector.getOperationResources());
		if (svnClient != null) {
			svnClient.removeNotifyListener(operationResourceCollector);
			getRepository().returnSVNClient(svnClient);
		}
	}
}
 
Example 6
Source File: SwitchToUrlCommand.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void run(IProgressMonitor monitor) throws SVNException {    
	final IProgressMonitor subPm = Policy.infiniteSubMonitorFor(monitor, 100);
	ISVNClientAdapter svnClient = null;
       try {
   		subPm.beginTask(null, Policy.INFINITE_PM_GUESS_FOR_SWITCH);
           svnClient = root.getRepository().getSVNClient();
   		if (conflictResolver != null) {
   			svnClient.addConflictResolutionCallback(conflictResolver);
   		}
           svnClient.addNotifyListener(operationResourceCollector);
           OperationManager.getInstance().beginOperation(svnClient, new OperationProgressNotifyListener(subPm, svnClient));
           File file = resource.getLocation().toFile();
           svnClient.switchToUrl(file, svnUrl, svnRevision, svnRevision, depth, setDepth, ignoreExternals, force, ignoreAncestry);
           OperationManager.getInstance().onNotify(resource.getLocation().toFile(), SVNNodeKind.UNKNOWN);
       } catch (SVNClientException e) {
           throw SVNException.wrapException(e);
       } finally {
       	Set<IResource> operationResources = operationResourceCollector.getOperationResources();
       	if (operationResources.size() == 0) {
       		IResource[] resources = SVNWorkspaceRoot.getResourcesFor(resource);
       		for (IResource refreshResource : resources) {
       			operationResources.add(refreshResource);
       		}
       	}
           OperationManager.getInstance().endOperation(true, operationResources);
           if (svnClient != null) {
    		if (conflictResolver != null) {
    			svnClient.addConflictResolutionCallback(null);
    		}
    		root.getRepository().returnSVNClient(svnClient);
           }
           subPm.done();
       }
}
 
Example 7
Source File: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * get the svn client corresponding to the repository
 * @throws SVNException
 */
public ISVNClientAdapter getSVNClient() throws SVNException {
	ISVNClientAdapter svnClient =
		SVNProviderPlugin.getPlugin().getSVNClient();

	svnClient.addNotifyListener(NotificationListener.getInstance());

	return svnClient;
}
 
Example 8
Source File: OperationManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Begins a batch of operations.
 */
public void beginOperation(ISVNClientAdapter aSvnClient) {
	lock.acquire();
	this.svnClient = aSvnClient;
	aSvnClient.addNotifyListener(this);
	if (operationNotifyListener != null) {
		aSvnClient.setProgressListener(operationNotifyListener);
	}
}