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


Java SVNWorkspaceRoot.getSVNResourceFor方法代码示例

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


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

示例1: execute

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) { 
        action.setEnabled(true);
    } 
    else {
        if (getSelectedResources() != null && getSelectedResources().length > 0) {
            IResource resource = (IResource)getSelectedResources()[0];
            final ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
            try {        
                SvnRevPropertiesView view = (SvnRevPropertiesView)showView(SvnRevPropertiesView.VIEW_ID);
                if (view != null)
                    view.showSvnProperties(svnResource);
                    view.refresh();
            } catch (SVNException e) {
                throw new InvocationTargetException(e);
            }
        }
    }
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:20,代码来源:ShowSvnRevPropertiesAction.java

示例2: 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

示例3: execute

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
       if (action != null && !action.isEnabled()) { 
       	action.setEnabled(true);
       } 
       else {
       	if (getSelectedResources() != null && getSelectedResources().length > 0) {
	        IResource resource = (IResource)getSelectedResources()[0];
			final ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
	        try {        
			    SvnPropertiesView view = (SvnPropertiesView)showView(SvnPropertiesView.VIEW_ID);
			    if (view != null)
			        view.showSvnProperties(svnResource);
			} catch (SVNException e) {
	            throw new InvocationTargetException(e);
			}
       	}
       }
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:19,代码来源:ShowSvnPropertiesAction.java

示例4: getLogMessages

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
private ISVNLogMessage[] getLogMessages() throws Exception {
	if (logMessages == null) {
		ISVNClientAdapter svnClient = null;
		try {
			svnClient = svnResource.getRepository().getSVNClient();
			IProject project = treeConflict.getResource().getProject();
			ISVNLocalResource svnProject =  SVNWorkspaceRoot.getSVNResourceFor(project);
			SVNRevision revision1 = new SVNRevision.Number(treeConflict.getConflictDescriptor().getSrcLeftVersion().getPegRevision());
			SVNRevision revision2 = new SVNRevision.Number(treeConflict.getConflictDescriptor().getSrcRightVersion().getPegRevision());
			logMessages = svnClient.getLogMessages(svnProject.getUrl(), revision1, revision2, true); 
		} catch (Exception e) {
			throw e;
		}
		finally {
			svnResource.getRepository().returnSVNClient(svnClient);
		}
	}
	return logMessages;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:20,代码来源:ResolveTreeConflictWizard.java

示例5: 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

示例6: getModifiedResources

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
protected IResource[] getModifiedResources(IResource[] resources, IProgressMonitor iProgressMonitor) throws SVNException {
    final List modified = new ArrayList();
    for (int i = 0; i < resources.length; i++) {
		 IResource resource = resources[i];
		 ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
		 
		 // get adds, deletes, updates and property updates.
		 GetStatusCommand command = new GetStatusCommand(svnResource, true, false);
		 command.run(iProgressMonitor);
		 ISVNStatus[] statuses = command.getStatuses();
		 for (int j = 0; j < statuses.length; j++) {
		     if (SVNStatusUtils.isReadyForRevert(statuses[j]) ||
		   		  !SVNStatusUtils.isManaged(statuses[j])) {
		         IResource currentResource = SVNWorkspaceRoot.getResourceFor(resource, statuses[j]);
		         if (currentResource != null)
		             modified.add(currentResource);
		     }
		 }
	}
    return (IResource[]) modified.toArray(new IResource[modified.size()]);
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:22,代码来源:WorkspaceAction.java

示例7: decorateImage

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
public Image decorateImage(Image image, Object element) {
//			return null;
			if (element instanceof ISynchronizeModelElement) {
				IResource resource = ((ISynchronizeModelElement) element).getResource();
				if (resource == null) return null;
				ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
				try {
					if (svnResource.getStatus().hasTreeConflict()) {
						image = resourceDecorator.getImage(image, ResourceSelectionTreeDecorator.TREE_CONFLICT);
					}
					else if (svnResource.getStatus().isTextConflicted()) {
						image = resourceDecorator.getImage(image, ResourceSelectionTreeDecorator.TEXT_CONFLICTED);
					}
					else if (svnResource.getStatus().isPropConflicted()) {
						
					}							
				} catch (SVNException e) {}
			}
			return image;
		}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:21,代码来源:SVNSynchronizeParticipant.java

示例8: getPropertyStatus

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
public static String getPropertyStatus(IResource resource) {
  ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
     String result = null;
     try {
          LocalResourceStatus status = svnResource.getStatus();
          if (status.isPropConflicted())
              result = Policy.bind("CommitDialog.conflicted"); //$NON-NLS-1$		            
          else if ((svnResource.getStatus() != null) &&
              (svnResource.getStatus().getPropStatus() != null) &&
              (svnResource.getStatus().getPropStatus().equals(SVNStatusKind.MODIFIED)))
              result = Policy.bind("CommitDialog.modified"); //$NON-NLS-1$		
             else
                 result = ""; //$NON-NLS-1$
} catch (TeamException e) {
    result = ""; //$NON-NLS-1$
}                   
  return result;
 }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:19,代码来源:ResourceWithStatusUtil.java

示例9: promptForAddOfIgnored

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
/**
 * asks the user if he wants to add the resources if some of them are ignored
    * @return false if he answered no
 */
private boolean promptForAddOfIgnored() {
	IResource[] resources = getSelectedResources();
	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) {
			handle(e);
		}
	}
	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,代码行数:24,代码来源:AddAction.java

示例10: getSyncInfoFilter

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
protected FastSyncInfoFilter getSyncInfoFilter() {
	return new FastSyncInfoFilter() {
		public boolean select(SyncInfo info) {
		    IStructuredSelection selection = getStructuredSelection();
		    Iterator iter = selection.iterator();
		    while (iter.hasNext()) {
		        ISynchronizeModelElement element = (ISynchronizeModelElement)iter.next();
		        if (element.getResource() instanceof IFile) {
	                ISVNLocalResource svnResource = SVNWorkspaceRoot
	                .getSVNResourceFor(element.getResource());	
	                try {
	                    if (svnResource.getStatus().isTextConflicted() || svnResource.getStatus().hasTreeConflict()) return true;
	                } catch (SVNException e) {}
		        }			        
		    }
               return false;
		}
	};
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:20,代码来源:ResolveSynchronizeAction.java

示例11: run

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
public void run(IProgressMonitor monitor) throws SVNException { 
	ISVNClientAdapter svnClient = null;
	ISVNRepositoryLocation repository = null;
    try {
    	final OperationManager operationManager = OperationManager.getInstance();
    	ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);   
    	repository = svnResource.getRepository();
    	svnClient = repository.getSVNClient();
    	svnClient.addNotifyListener(operationResourceCollector);
        operationManager.beginOperation(svnClient);

    	 LocalResourceStatus status = SVNWorkspaceRoot.getSVNResourceFor( resource ).getStatus();
        	if (!status.isManaged()) {
        		try {
		resource.delete(true, monitor);
	}
	catch (CoreException ex) {
		throw SVNException.wrapException(ex);
	}
        	}
        	else {
        		File path = resource.getLocation().toFile();
                svnClient.revert(path, true);
                if (resource.getType() != IResource.FILE)
                	operationManager.onNotify(path, SVNNodeKind.UNKNOWN);
                monitor.worked(100);
        	}
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
    	if (repository != null) {
    		repository.returnSVNClient(svnClient);
    	}
        OperationManager.getInstance().endOperation(true, operationResourceCollector.getOperationResources());
        monitor.done();
    }
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:38,代码来源:UndoMergeCommand.java

示例12: getCommonRoot

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public String getCommonRoot() {
	if (commonRoot == null) {
    	ArrayList urlList = new ArrayList();
    	for (int i = 0; i < resources.length; i++) {
    		ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
    		try {
                String anUrl = svnResource.getStatus().getUrlString();
                if (anUrl != null) urlList.add(anUrl);
            } catch (SVNException e1) {}    		
    	}
    	urlStrings = new String[urlList.size()];
    	urlList.toArray(urlStrings);
    	if (urlStrings.length == 0) return null;
    	String urlString = urlStrings[0];
    	if (urlStrings.length == 1) return urlString;
    	commonRoot = null;
    	tag1:
    	for (int i = 0; i < urlString.length(); i++) {
    		String partialPath = urlString.substring(0, i+1);
    		if (partialPath.endsWith("/")) { //$NON-NLS-1$
	    		for (int j = 1; j < urlStrings.length; j++) {
	    			if (!urlStrings[j].startsWith(partialPath)) break tag1;
	    		}
	    		commonRoot = partialPath.substring(0, i);
    		}
    	}			
	}
	return commonRoot;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:31,代码来源:MergeWizard.java

示例13: getStatusKind

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
public static SVNStatusKind getStatusKind(IResource resource) {
	ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
	SVNStatusKind statusKind = null;
       try {
           LocalResourceStatus status = svnResource.getStatus();
	       if (status.isTextConflicted())
	    	   statusKind = SVNStatusKind.CONFLICTED;
	       else	            
            if (status.isAdded())
               statusKind = SVNStatusKind.ADDED;
              else
              if (status.isDeleted())
           	   statusKind = SVNStatusKind.DELETED;
              else
       	   if (status.isMissing())
       		   statusKind = SVNStatusKind.MISSING;
       	   else
       	   if (status.isReplaced())
       		   statusKind = SVNStatusKind.REPLACED;
       	   else
              if (status.isTextModified())
           	   statusKind = SVNStatusKind.MODIFIED;			           
              else
              if (!status.isManaged())
           	   statusKind = SVNStatusKind.UNVERSIONED;
       } catch (TeamException e) {}
	return statusKind;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:29,代码来源:ResourceWithStatusUtil.java

示例14: getSyncInfoFilter

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
protected FastSyncInfoFilter getSyncInfoFilter() {
	return new FastSyncInfoFilter() {
		@SuppressWarnings("rawtypes")
		public boolean select(SyncInfo info) {
			SyncInfoDirectionFilter outgoingFilter = new SyncInfoDirectionFilter(new int[] {SyncInfo.OUTGOING, SyncInfo.CONFLICTING});
		    if (!outgoingFilter.select(info)) return false;
		    IStructuredSelection selection = getStructuredSelection();
		    Iterator iter = selection.iterator();
		    boolean removeUnAdded  = SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_REMOVE_UNADDED_RESOURCES_ON_REPLACE);
		    
		    while (iter.hasNext()) {
		    	ISynchronizeModelElement element = (ISynchronizeModelElement)iter.next();
		    	IResource resource = element.getResource();
		    	if (resource == null) continue;
		    	if (resource.isLinked()) return false;
		    	if(!removeUnAdded)
		    	{
                ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);			    
                try {
                	if (!svnResource.isManaged()) return false;
                } catch (SVNException e) {
                    return false;
                }
		    	}
		    }
            return true;
		}
	};
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:30,代码来源:RevertSynchronizeAction.java

示例15: getStatus

import org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot; //导入方法依赖的package包/类
public static String getStatus(IResource resource) {
  ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
     String result = null;
     try {
         LocalResourceStatus status = svnResource.getStatus();
      if (status.isTextConflicted())
          result = Policy.bind("CommitDialog.conflicted"); //$NON-NLS-1$
      else	            
          if (status.isAdded())
                result = Policy.bind("CommitDialog.added"); //$NON-NLS-1$
            else
            if (status.isDeleted())
                result = Policy.bind("CommitDialog.deleted"); //$NON-NLS-1$
            else
     	   if (status.isMissing())
     		   result = Policy.bind("CommitDialog.missing"); //$NON-NLS-1$
     	   else
     	   if (status.isReplaced())
     		   result = Policy.bind("CommitDialog.replaced"); //$NON-NLS-1$
     	   else
            if (status.isTextModified())
                result = Policy.bind("CommitDialog.modified"); //$NON-NLS-1$				           
            else
            if (!status.isManaged())
                result = Policy.bind("CommitDialog.unversioned"); //$NON-NLS-1$
            else
                result = ""; //$NON-NLS-1$
} catch (TeamException e) {
    result = ""; //$NON-NLS-1$
}                   
  return result;
 }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:33,代码来源:ResourceWithStatusUtil.java


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