Search in sources :

Example 1 with RemoteResourceVariant

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

the class RemoteShare method sendFetchVariantsResponse.

private void sendFetchVariantsResponse(ID fromId, IContainer container) {
    // the container will be null if an invalid resource type was provided
    if (container == null) {
        sendMessage(fromId, new FetchResponse());
        return;
    }
    try {
        IResource[] members = container.members();
        List variants = new ArrayList();
        for (int i = 0; i < members.length; i++) {
            if (!members[i].isDerived()) {
                variants.add(new RemoteResourceVariant(members[i]));
            }
        }
        IResourceVariant[] variantsArray = (IResourceVariant[]) variants.toArray(new IResourceVariant[variants.size()]);
        sendMessage(fromId, new FetchResponse(variantsArray));
    } catch (CoreException e) {
        TeamSynchronization.log(// $NON-NLS-1$
        "Could not retrieve container members: " + container.getFullPath(), e);
    }
}
Also used : RemoteResourceVariant(org.eclipse.team.internal.ecf.core.variants.RemoteResourceVariant) IResourceVariant(org.eclipse.team.core.variants.IResourceVariant)

Example 2 with RemoteResourceVariant

use of org.eclipse.team.internal.ecf.core.variants.RemoteResourceVariant 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)2 RemoteResourceVariant (org.eclipse.team.internal.ecf.core.variants.RemoteResourceVariant)2 TeamException (org.eclipse.team.core.TeamException)1