Search in sources :

Example 21 with IResourceVariant

use of org.eclipse.team.core.variants.IResourceVariant in project ecf by eclipse.

the class RemoteShare method fetchMembers.

public synchronized IResourceVariant[] fetchMembers(ID ownId, ID remoteId, IResourceVariant variant, IProgressMonitor monitor) throws TeamException {
    RemoteResourceVariant remoteVariant = (RemoteResourceVariant) variant;
    if (!remoteVariant.hasMembers()) {
        // members, just return an empty array
        return new IResourceVariant[0];
    }
    monitor.subTask(NLS.bind(Messages.RemoteShare_FetchingVariant, variant.getName()));
    sendMessage(remoteId, new FetchVariantsRequest(ownId, remoteVariant.getPath(), remoteVariant.getType()));
    while (returnValue == null) {
        try {
            Thread.sleep(100);
            if (monitor.isCanceled()) {
                throw new OperationCanceledException();
            }
        } catch (InterruptedException e) {
            // TODO: do we want to handle this differently...?
            Thread.interrupted();
            // $NON-NLS-1$
            throw new TeamException("Interrupted whilst fetching members");
        }
    }
    monitor.done();
    Object tmpValue = returnValue;
    returnValue = null;
    return (IResourceVariant[]) tmpValue;
}
Also used : TeamException(org.eclipse.team.core.TeamException) RemoteResourceVariant(org.eclipse.team.internal.ecf.core.variants.RemoteResourceVariant) IResourceVariant(org.eclipse.team.core.variants.IResourceVariant)

Aggregations

IResourceVariant (org.eclipse.team.core.variants.IResourceVariant)21 Test (org.junit.Test)13 IFile (org.eclipse.core.resources.IFile)9 GitSynchronizeData (org.eclipse.egit.core.synchronize.dto.GitSynchronizeData)9 GitSynchronizeDataSet (org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet)8 ByteArrayInputStream (java.io.ByteArrayInputStream)6 IStorage (org.eclipse.core.resources.IStorage)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 IResourceVariantTree (org.eclipse.team.core.variants.IResourceVariantTree)4 IResource (org.eclipse.core.resources.IResource)3 File (java.io.File)2 ObjectId (org.eclipse.jgit.lib.ObjectId)2 RemoteResourceVariant (org.eclipse.team.internal.ecf.core.variants.RemoteResourceVariant)2 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 IContainer (org.eclipse.core.resources.IContainer)1 ResourceMapping (org.eclipse.core.resources.mapping.ResourceMapping)1 CoreException (org.eclipse.core.runtime.CoreException)1