Java Code Examples for org.tigris.subversion.svnclientadapter.ISVNStatus#getUrlString()

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNStatus#getUrlString() . 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: PeekStatusCommand.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private String getURL(ISVNStatus status) {
	String url = status.getUrlString();
	if (url == null && info != null) {
    	SVNUrl svnurl = info.getUrl();
    	url = (svnurl != null) ? svnurl.toString() : null;
	}
	return url;
}
 
Example 2
Source File: ResourceStatus.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param status
 * @param url - Only needed when status.getUrl is Null, such as
 *  for an svn:externals folder
 */
public ResourceStatus(ISVNStatus status, String url, boolean useUrlHack) {
	super();
   	/** a temporary variable serving as immediate cache for various status values */
   	Object aValue = null;

   	aValue = status.getUrlString();
       if (aValue == null) {
       	if (url == null)
       		this.url = null;
       	else
       		this.url = url;
       } else {
           this.url = (String) aValue;
       }

       // This is a hack to get the URL for incoming additions if when URL is null due to a JavaHL bug.
       // See Issue #1312 for details.  This should only be done for RemoteResourceStatus (useUrlHack == true),
       // not LocalResourceStatus.
       if (this.url == null && useUrlHack) {
       	File file = status.getFile();
       	if (file != null) {
       		List<String> segments = new ArrayList<String>();
       		segments.add(file.getName());
       		File parentFile = file.getParentFile();
       		while (parentFile != null) {
       			if (parentFile.exists()) {
       				IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(parentFile.getPath()));
       				if (container != null) {
						ISVNLocalFolder localFolder = SVNWorkspaceRoot.getSVNFolderFor(container);
						SVNUrl parentUrl = localFolder.getUrl();
						if (parentUrl != null) {
							StringBuffer sb = new StringBuffer(parentUrl.toString());
							for (int i = segments.size() - 1; i >= 0; i--) {
								sb.append("/" + segments.get(i));
							}
							this.url = sb.toString();
							break;
						}
       				}
       			}
       			segments.add(parentFile.getName());
       			parentFile = parentFile.getParentFile();
       		}
       	}
       }

       aValue = status.getLastChangedRevision();
       if (aValue == null) {
           this.lastChangedRevision = SVNRevision.SVN_INVALID_REVNUM;
       } else {
           this.lastChangedRevision = ((SVNRevision.Number) aValue).getNumber();
       }

       aValue = status.getLastChangedDate();
       if (aValue == null) {
           this.lastChangedDate = -1;
       } else {
           this.lastChangedDate = ((Date) aValue).getTime();
       }

       this.lastCommitAuthor = status.getLastCommitAuthor();
       this.textStatus = status.getTextStatus().toInt();
       this.propStatus = status.getPropStatus().toInt();
       this.treeConflicted = status.hasTreeConflict();
       this.fileExternal = status.isFileExternal();
       this.conflictDescriptor = status.getConflictDescriptor();

       this.nodeKind = status.getNodeKind().toInt();
       
       this.file = status.getFile();
}