1 11 package org.eclipse.team.internal.core.mapping; 12 13 import org.eclipse.core.resources.IStorage; 14 import org.eclipse.core.runtime.*; 15 import org.eclipse.team.core.history.IFileRevision; 16 import org.eclipse.team.core.history.provider.FileRevision; 17 import org.eclipse.team.core.variants.IResourceVariant; 18 19 public class ResourceVariantFileRevision extends FileRevision implements IAdaptable { 20 private final IResourceVariant variant; 21 22 public ResourceVariantFileRevision(IResourceVariant variant) { 23 this.variant = variant; 24 } 25 26 public IStorage getStorage(IProgressMonitor monitor) throws CoreException { 27 return variant.getStorage(monitor); 28 } 29 30 public String getName() { 31 return variant.getName(); 32 } 33 34 public String getContentIdentifier() { 35 return variant.getContentIdentifier(); 36 } 37 38 public IResourceVariant getVariant() { 39 return variant; 40 } 41 42 public boolean isPropertyMissing() { 43 return false; 44 } 45 46 public IFileRevision withAllProperties(IProgressMonitor monitor) throws CoreException { 47 return this; 48 } 49 50 public Object getAdapter(Class adapter) { 51 if (adapter == IResourceVariant.class) 52 return variant; 53 Object object = Platform.getAdapterManager().getAdapter(this, adapter); 54 if (object != null) 55 return object; 56 if (variant instanceof IAdaptable ) { 57 IAdaptable adaptable = (IAdaptable ) variant; 58 return adaptable.getAdapter(adapter); 59 } 60 return null; 61 } 62 63 public boolean equals(Object obj) { 64 if (obj instanceof ResourceVariantFileRevision) { 65 ResourceVariantFileRevision fileRevision = (ResourceVariantFileRevision) obj; 66 return fileRevision.getVariant().equals(getVariant()); 67 } 68 return false; 69 } 70 71 public int hashCode() { 72 return getVariant().hashCode(); 73 } 74 } | Popular Tags |