1 11 package org.eclipse.team.internal.core.subscribers; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.team.core.TeamException; 16 import org.eclipse.team.core.variants.IResourceVariant; 17 import org.eclipse.team.core.variants.ResourceVariantByteStore; 18 import org.eclipse.team.core.variants.ResourceVariantTree; 19 import org.eclipse.team.core.variants.ThreeWaySubscriber; 20 21 25 public final class ThreeWayBaseTree extends ResourceVariantTree { 26 27 private ThreeWaySubscriber subscriber; 28 29 34 static class BaseResourceVariantByteStore extends ResourceVariantByteStore { 35 private ThreeWaySubscriber subscriber; 36 public BaseResourceVariantByteStore(ThreeWaySubscriber subscriber) { 37 this.subscriber = subscriber; 38 } 39 public void dispose() { 40 } 42 public byte[] getBytes(IResource resource) throws TeamException { 43 return subscriber.getSynchronizer().getBaseBytes(resource); 44 } 45 public boolean setBytes(IResource resource, byte[] bytes) throws TeamException { 46 return false; 48 } 49 public boolean flushBytes(IResource resource, int depth) throws TeamException { 50 return false; 52 } 53 public boolean deleteBytes(IResource resource) throws TeamException { 54 return false; 56 } 57 public IResource[] members(IResource resource) throws TeamException { 58 return subscriber.getSynchronizer().members(resource); 59 } 60 } 61 62 67 public ThreeWayBaseTree(ThreeWaySubscriber subscriber) { 68 super(new BaseResourceVariantByteStore(subscriber)); 69 this.subscriber = subscriber; 70 } 71 72 75 public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { 76 return new IResource[0]; 77 } 78 79 82 protected IResourceVariant[] fetchMembers(IResourceVariant variant, IProgressMonitor progress) throws TeamException { 83 return new IResourceVariant[0]; 85 } 86 87 90 protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { 91 return null; 93 } 94 95 98 public IResource[] roots() { 99 return getSubscriber().roots(); 100 } 101 102 105 public IResourceVariant getResourceVariant(IResource resource) throws TeamException { 106 return getSubscriber().getResourceVariant(resource, getByteStore().getBytes(resource)); 107 } 108 109 private ThreeWaySubscriber getSubscriber() { 110 return subscriber; 111 } 112 113 } 114 | Popular Tags |