diff options
5 files changed, 57 insertions, 13 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java index 1b4d791cf..c4005dd27 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2002 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v0.5 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v05.html + * + * Contributors: + * IBM - Initial API and implementation + ******************************************************************************/ package org.eclipse.team.core.target; import java.net.URL; @@ -5,6 +15,17 @@ import java.net.URL; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.sync.IRemoteResource; +/** + * Interface for target resources that are not local. This is a handle to a + * clients-side 'proxy' for the server resource. There are no guarantees that + * the handle is not stale or invalid. + * <p> + * Use <code>exists()</code> to verify is the associated server resource + * exists. + * </p> + * + * @see IRemoteResource + */ public interface IRemoteTargetResource extends IRemoteResource { /** * Returns the URL of this remote resource. @@ -15,4 +36,10 @@ public interface IRemoteTargetResource extends IRemoteResource { * Returns the size of the resource. */ public int getSize() throws TeamException; + + /** + * Return a boolean value indicating whether or not this resource exists on the + * remote server. + */ + public boolean exists() throws TeamException; } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/Site.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/Site.java index 8bae8a499..d65818bc2 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/Site.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/Site.java @@ -12,8 +12,10 @@ package org.eclipse.team.core.target; import java.io.ObjectOutputStream; import java.net.URL; +import java.security.Provider; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.sync.IRemoteResource; @@ -68,6 +70,16 @@ public abstract class Site { * @param os the object stream into which to write it's state */ public abstract void writeObject(ObjectOutputStream os); + + /** + * Returns a handle to the remote resource that represents this site + * on the server. + * + * @return a remote handle to this site that may or may not exist + */ + public IRemoteTargetResource getRemoteResource() throws TeamException { + return newProvider(Path.EMPTY).getRemoteResource(); + } /** * Compares two Sites. The result is <code>true</code> if and only if @@ -98,10 +110,4 @@ public abstract class Site { public String toString() { return getDisplayName(); } - - /** - * Returns a remote resource handle for this site. The handle can be used to - * browse the remote site. - */ - public abstract IRemoteTargetResource getRemoteResource() throws TeamException; }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java index 1c7059e37..44ddb349b 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java @@ -67,9 +67,25 @@ public abstract class TargetProvider { */ public abstract void put(IResource[] resources, IProgressMonitor progress) throws TeamException; + /** + * Returns a remote resource handle at the path of the given local resource. The remote + * resource handles URL will be: + * <blockquote><pre> + * getURL() + resource.getProjectRelativePath() + * </pre></blockquote> + * + * @param resource local resource path to be used to construct the remote handle's path + * @return a handle to a remote resource that may or may not exist + */ public abstract IRemoteTargetResource getRemoteResourceFor(IResource resource); /** + *Returns a remote resource handle at the path of this target provider's URL. + * @return a handle to a remote resource that may or may not exist + */ + public abstract IRemoteTargetResource getRemoteResource(); + + /** * Replies true if its believed possible to get the given resource. * This intended to be a relatively quick operation, presumably based on local state of the provider. */ diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Symmetria.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Symmetria.java index 605109f05..116193b25 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Symmetria.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Symmetria.java @@ -1,6 +1,5 @@ package org.eclipse.team.internal.core.target; -import java.io.File; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; @@ -9,18 +8,13 @@ import java.util.Set; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; - import org.eclipse.team.core.TeamException; -import sun.security.action.GetLongAction; -import org.eclipse.team.core.RepositoryProvider; import org.eclipse.team.internal.core.Assert; -import org.eclipse.team.internal.core.TeamPlugin; /** * Synchronizes the given folder between the workspace and provider. diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java index 0d096c563..59b4474aa 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java @@ -264,7 +264,7 @@ public class ConfigureTargetWizard extends Wizard implements IConfigurationWizar public static boolean validateSite(final Site site, final IWizardContainer container) { final boolean[] valid = new boolean[] {true}; - final String[] message = new String[] {"ok"}; + final String[] message = new String[] {"URL doesn't exist on the server"}; final int[] code = new int[] {-1}; try { container.run(true, false, new IRunnableWithProgress() { @@ -273,6 +273,7 @@ public class ConfigureTargetWizard extends Wizard implements IConfigurationWizar try { monitor.beginTask("Validating connection to Site...", monitor.UNKNOWN); IRemoteTargetResource remote = site.getRemoteResource(); + valid[0] = remote.exists(); } catch(TeamException e) { message[0] = e.getStatus().getMessage(); code[0] = e.getStatus().getCode(); |