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);
}
}
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;
}
Aggregations