当前位置: 首页>>代码示例>>Java>>正文


Java SVNWorkspaceRoot类代码示例

本文整理汇总了Java中org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot的典型用法代码示例。如果您正苦于以下问题:Java SVNWorkspaceRoot类的具体用法?Java SVNWorkspaceRoot怎么用?Java SVNWorkspaceRoot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SVNWorkspaceRoot类属于org.tigris.subversion.subclipse.core.resources包,在下文中一共展示了SVNWorkspaceRoot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTreeConflict

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
private SVNTreeConflict getTreeConflict(final IResource resource) {
	treeConflict = null;
	BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
		public void run() {
			ISVNClientAdapter client = null;
			try {
				client = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().getSVNClient();
				ISVNStatus[] statuses = client.getStatus(resource.getLocation().toFile(), true, true, true);
				for (int i = 0; i < statuses.length; i++) {
					if (statuses[i].hasTreeConflict()) {
						treeConflict = new SVNTreeConflict(statuses[i]);
						break;
					}
				}
			} catch (Exception e) {
				SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
			}
			finally {
				SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().returnSVNClient(client);
			}
		}			
	});
	return treeConflict;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:25,代码来源:MergeResultsView.java

示例2: getTreeConflict

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
private SVNTreeConflict getTreeConflict(final IResource resource) {
	BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
		public void run() {
			ISVNClientAdapter client = null;
			try {
				client = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().getSVNClient();
				ISVNStatus[] statuses = client.getStatus(resource.getLocation().toFile(), true, true, true);
				for (int i = 0; i < statuses.length; i++) {
					if (statuses[i].hasTreeConflict()) {
						treeConflict = new SVNTreeConflict(statuses[i]);
						break;
					}
				}
			} catch (Exception e) {
				SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
			}
			finally {
				SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().returnSVNClient(client);
			}
		}			
	});
	return treeConflict;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:24,代码来源:MergeViewResolveAction.java

示例3: isEnabledForMultipleResources

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
protected boolean isEnabledForMultipleResources() {
	try {
		// Must all be from same repository.
		ISVNRepositoryLocation repository = null;
		IResource[] selectedResources = getSelectedResources();
		for (int i = 0; i < selectedResources.length; i++) {
			ISVNRepositoryLocation compareToRepository = null;
			ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(selectedResources[i]);
			if (svnResource == null || !svnResource.isManaged()) {
				return false;
			}
			LocalResourceStatus status = svnResource.getStatusFromCache();
			if (status != null) {
				compareToRepository = status.getRepository();
			}
			if (compareToRepository == null) {
				return false;
			}
			if (repository != null && !compareToRepository.equals(repository)) {
				return false;
			}
			repository = compareToRepository;
		}
		return true;
	} catch (Exception e) { return false; }
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:27,代码来源:MergeAction.java

示例4: resourceChanged

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
public void resourceChanged(IResourceChangeEvent event) {	
	flushCache = false;
	try {
           event.getDelta().accept(new IResourceDeltaVisitor() {
               public boolean visit(IResourceDelta delta) throws CoreException {
               	IResource resource = delta.getResource();
               	if (resource.getType()==IResource.PROJECT) {
               		IProject project = (IProject)resource;
					if (!project.isAccessible()) {
						return false; // i.e., closed project
					}
					if (SVNWorkspaceRoot.isManagedBySubclipse(project)) {
						flushCache = true;
					}
					return false; // No need to check deeper than project.
               	}
                   return true;
               }
           });			
    } catch (CoreException e) {
      SVNProviderPlugin.log(e.getStatus());
    }
	if (flushCache) {
		statusCache.flushPendingStatuses();
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:27,代码来源:StatusCacheManager.java

示例5: onNotify

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
public void onNotify(File path, SVNNodeKind kind) {
	IPath pathEclipse = new Path(path.getAbsolutePath());
	IResource[] resources = SVNWorkspaceRoot.getResourcesFor(pathEclipse, false);
	for (IResource resource : resources) {			
		localRefreshList.add(resource);
	}
       
	if (operationNotifyListener != null)
	{
		operationNotifyListener.onNotify(path, kind);
		if ((operationNotifyListener.getMonitor() != null) && (operationNotifyListener.getMonitor().isCanceled()))
		{
			try {
				svnClient.cancelOperation();
			} catch (SVNClientException e) {
				SVNProviderPlugin.log(SVNException.wrapException(e));
			}
		}
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:21,代码来源:OperationManager.java

示例6: getSvnResource

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
private static ISVNLocalResource getSvnResource(String path) {
  	IResource resource = null;
  	ISVNLocalResource svnResource = null;
  	if (path != null) {
   	File file = new File(path);
	if (file.exists()) {
		if (file.isDirectory()) {
			resource = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(path));
		}
		else {
			resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));
		}
		if (resource != null) {
			svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
		}
	}
  	}
return svnResource;
  }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:20,代码来源:SVNExternal.java

示例7: isManagedBySubversion

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
/**
   * @return true if the container is managed by SVN
   */
  public boolean isManagedBySubversion(IPath folder)
  {
  	File svnDir = folder.append(getAdminDirectoryName()).toFile();
if (svnDir == null || !svnDir.exists() || !svnDir.isDirectory())
	return false;

      try {
      	LocalResourceStatus status = SVNWorkspaceRoot.peekResourceStatusFor(folder);
          if (status.hasRemote())
          	return true;
} catch (SVNException e) {
	if (e.getMessage() != null && e.getMessage().contains(UPGRADE_NEEDED)) {
		return true;				
	}
}

  	return false;
  }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:22,代码来源:SVNProviderPlugin.java

示例8: isSupervised

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
public boolean isSupervised(IResource resource) throws TeamException {
try {
	if (resource.isTeamPrivateMember() || SVNWorkspaceRoot.isLinkedResource(resource)) return false;
	RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId());
	if (provider == null) return false;
	// TODO: what happens for resources that don't exist?
	// TODO: is it proper to use ignored here?
	ISVNLocalResource svnThing = SVNWorkspaceRoot.getSVNResourceFor(resource);
	if (svnThing.isIgnored()) {
		// An ignored resource could have an incoming addition (conflict)
		return (remoteSyncStateStore.getBytes(resource) != null) || 
				((remoteSyncStateStore.members(resource) != null) && (remoteSyncStateStore.members(resource).length > 0));
	}
	return true;
} catch (TeamException e) {
	// If there is no resource in coe this measn there is no local and no remote
	// so the resource is not supervised.
	if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
		return false;
	}
	throw e;
}
  }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:24,代码来源:SVNWorkspaceSubscriber.java

示例9: compare

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
public boolean compare(IResource local, IResourceVariant remote) {
	if( local == null && remote == null )
	    return true;
	if( local == null || remote == null )
	    return false;
	ISVNLocalResource a = SVNWorkspaceRoot.getSVNResourceFor(local);
	ISVNRemoteResource b = (ISVNRemoteResource)remote;
	try {
		return a.getStatus().getLastChangedRevision().getNumber() == b.getLastChangedRevision().getNumber();
	} catch (SVNException e) {
           Util.logError("Cannot compare local resource with remote resource",e);
	} catch(NullPointerException npe) {
		// When svn:externals are used several of the above methods can return null
		// We have already checked for the important/expected nulls
		return true;
	}
	return false;
	
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:20,代码来源:SVNRevisionComparator.java

示例10: autoconnectSVNProject

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
private void autoconnectSVNProject(IProject project, IProgressMonitor monitor) {
     try {
 		PeekStatusCommand command = new PeekStatusCommand(project);
 		try {
	command.execute();
} catch (SVNException e1) {
	if (e1.getMessage() != null && e1.getMessage().contains(SVNProviderPlugin.UPGRADE_NEEDED)) {
		if (!SVNProviderPlugin.handleQuestion("Upgrade Working Copy", project.getName() + " appears to be managed by Subversion, but the working copy needs to be upgraded.  Do you want to upgrade the working copy now?\n\nWarning:  This operation cannot be undone.")) {
			return;			
		}
	}
	 SVNWorkspaceRoot.upgradeWorkingCopy(project, monitor);
}
         SVNWorkspaceRoot.setSharing(project, monitor);
     } catch (TeamException e) {
         SVNProviderPlugin.log(IStatus.ERROR, "Could not auto-share project " + project.getName(), e); //$NON-NLS-1$
     }
 }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:19,代码来源:SVNTeamProviderType.java

示例11: promptForAddOfIgnored

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
private boolean promptForAddOfIgnored(IResource[] resources) {
	boolean prompt = false;
	for (int i = 0; i < resources.length; i++) {
		ISVNLocalResource resource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
		try {
			if (resource.isIgnored()) {
				prompt = true;
				break;
			} 
		} catch (SVNException e) {
			return false;
		}
	}
	if (prompt) {
		return MessageDialog.openQuestion(getShell(), Policy.bind("AddAction.addIgnoredTitle"), Policy.bind("AddAction.addIgnoredQuestion")); //$NON-NLS-1$ //$NON-NLS-2$
	}
	return true;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:19,代码来源:AddSynchronizeOperation.java

示例12: importExistingProject

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
/**
 * Imports a existing SVN Project to the workbench
 * 
 * @param monitor
 *            project monitor
 * @return true if loaded, else false
 * @throws TeamException
 */

boolean importExistingProject(IProgressMonitor monitor)
        throws TeamException {
    if (directory == null) {
        return false;
    }
    try {
        monitor.beginTask("Importing", 3 * 1000);

        createExistingProject(new SubProgressMonitor(monitor, 1000));

        monitor.subTask("Refreshing " + project.getName());
        RepositoryProvider.map(project, SVNProviderPlugin.getTypeId());
        monitor.worked(1000);
        SVNWorkspaceRoot.setSharing(project, new SubProgressMonitor(
                monitor, 1000));

        return true;
    } catch (CoreException ce) {
        throw new SVNException("Failed to import External SVN Project"
                + ce, ce);
    } finally {
        monitor.done();
    }
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:34,代码来源:SVNProjectSetCapability.java

示例13: getSchedulingRule

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
/**
 * Retgurn the scheduling rule to be obtained before work
 * begins on the given provider. By default, it is the provider's project.
 * This can be changed by subclasses.
 * @param provider
 * @return
 */
protected ISchedulingRule getSchedulingRule(SVNTeamProvider provider) {
	IResourceRuleFactory ruleFactory = provider.getRuleFactory();
	HashSet rules = new HashSet();
	IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	for (int i = 0; i < resources.length; i++) {			
		IResource[] pathResources = SVNWorkspaceRoot.getResourcesFor(new Path(resources[i].getLocation().toOSString()), false);
		for (IResource pathResource : pathResources) {
			IProject resourceProject = pathResource.getProject();				
			rules.add(ruleFactory.modifyRule(resourceProject));
			if (resourceProject.getLocation() != null) {
				// Add nested projects
				for (IProject project : projects) {
					if (project.getLocation() != null) {
						if (!project.getLocation().equals(resourceProject.getLocation()) && resourceProject.getLocation().isPrefixOf(project.getLocation())) {
							rules.add(ruleFactory.modifyRule(project));
						}
					}
				}	
			}
		}
	}
	return MultiRule.combine((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:31,代码来源:RepositoryProviderOperation.java

示例14: execute

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
	ISVNClientAdapter client = null;
	ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(fromUrl.toString());
	if (repository != null)
		client = repository.getSVNClient();
	if (client == null)
		client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
	try {
		SVNRevision pegRevision = null;
		if (fromUrl.toString().equals(toUrl.toString()) && localResource != null) {
			if (localResource.getResource() == null) pegRevision = SVNRevision.HEAD;
			else {
				IResource resource = localResource.getResource();
				ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
				pegRevision = svnResource.getRevision();
			}
		}
		if (pegRevision == null) client.diff(fromUrl, fromRevision, toUrl, toRevision, file, true);
		else client.diff(fromUrl, pegRevision, fromRevision, toRevision, file, true); 
	} catch (SVNClientException e) {
		throw SVNException.wrapException(e);
	} finally {
		monitor.done();
		SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
	}      
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:27,代码来源:ShowDifferencesAsUnifiedDiffOperation.java

示例15: execute

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入依赖的package包/类
protected void execute(SVNTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws SVNException, InterruptedException {
    try {
        for (int i = 0; i < resources.length; i++) {
            IResource resource = resources[i];
            String pattern = dialog.getIgnorePatternFor(resource);
            ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
            new AddIgnoredPatternCommand(svnResource.getParent(), pattern).run(monitor);
        }
    } catch (SVNException e) {
    	if (e.operationInterrupted()) {
    		showCancelledMessage();
    	} else {
    		collectStatus(e.getStatus());
    	}
    } finally {
        monitor.done();
    }
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:19,代码来源:IgnoreOperation.java


注:本文中的org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。