diff options
Diffstat (limited to 'org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/ScmUrl.java')
-rw-r--r-- | org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/ScmUrl.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/ScmUrl.java b/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/ScmUrl.java index 16c81a20..9dfc02ec 100644 --- a/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/ScmUrl.java +++ b/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/ScmUrl.java @@ -14,9 +14,11 @@ package org.eclipse.m2e.scm; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; + import org.eclipse.m2e.core.internal.IMavenConstants; import org.eclipse.m2e.scm.internal.Messages; -import org.eclipse.osgi.util.NLS; + /** * An SCM URL wrapper used to adapt 3rd party resources: @@ -27,18 +29,19 @@ import org.eclipse.osgi.util.NLS; * * @see http://maven.apache.org/scm/scm-url-format.html * @see org.eclipse.core.runtime.IAdapterManager - * * @author Eugene Kuleshov */ public class ScmUrl { private final String scmUrl; + private final String scmParentUrl; + private final ScmTag tag; public ScmUrl(String scmUrl) { this(scmUrl, null); } - + public ScmUrl(String scmUrl, String scmParentUrl) { this(scmUrl, scmParentUrl, null); } @@ -48,28 +51,28 @@ public class ScmUrl { this.scmParentUrl = scmParentUrl; this.tag = tag; } - + /** * Return SCM url */ public String getUrl() { return scmUrl; } - + /** * Return SCM url for the parent folder */ public String getParentUrl() { return scmParentUrl; } - + /** * Return SCM tag */ public ScmTag getTag() { return this.tag; } - + /** * Return provider-specific part of the SCM url * @@ -79,7 +82,7 @@ public class ScmUrl { try { String type = ScmUrl.getType(scmUrl); return scmUrl.substring(type.length() + 5); - + } catch(CoreException ex) { return null; } @@ -87,11 +90,13 @@ public class ScmUrl { public static synchronized String getType(String url) throws CoreException { if(!url.startsWith("scm:")) { //$NON-NLS-1$ - throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, NLS.bind(Messages.ScmUrl_error, url), null)); + throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, NLS.bind(Messages.ScmUrl_error, + url), null)); } int n = url.indexOf(":", 4); //$NON-NLS-1$ if(n == -1) { - throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, NLS.bind(Messages.ScmUrl_error, url), null)); + throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, NLS.bind(Messages.ScmUrl_error, + url), null)); } return url.substring(4, n); } |