1 11 package org.eclipse.team.internal.core.mapping; 12 13 import java.util.Date ; 14 15 import org.eclipse.core.resources.*; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.team.core.TeamException; 18 import org.eclipse.team.core.variants.IResourceVariant; 19 20 public class LocalResourceVariant implements IResourceVariant { 21 private final IResource resource; 22 23 public LocalResourceVariant(IResource resource) { 24 this.resource = resource; 25 } 26 27 public byte[] asBytes() { 28 return getContentIdentifier().getBytes(); 29 } 30 31 public String getContentIdentifier() { 32 return new Date (resource.getLocalTimeStamp()).toString(); 33 } 34 35 public IStorage getStorage(IProgressMonitor monitor) throws TeamException { 36 if (resource.getType() == IResource.FILE) { 37 return (IFile)resource; 38 } 39 return null; 40 } 41 42 public boolean isContainer() { 43 return resource.getType() != IResource.FILE; 44 } 45 46 public String getName() { 47 return resource.getName(); 48 } 49 } | Popular Tags |