1 11 package org.eclipse.core.internal.resources.mapping; 12 13 import org.eclipse.core.resources.IContainer; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.core.runtime.PlatformObject; 16 17 20 public class ShallowContainer extends PlatformObject { 21 22 private IContainer container; 23 24 public ShallowContainer(IContainer container) { 25 this.container = container; 26 } 27 28 public IContainer getResource() { 29 return container; 30 } 31 32 public boolean equals(Object obj) { 33 if (obj == this) 34 return true; 35 if (obj instanceof ShallowContainer) { 36 ShallowContainer other = (ShallowContainer) obj; 37 return other.getResource().equals(getResource()); 38 } 39 return false; 40 } 41 42 public int hashCode() { 43 return getResource().hashCode(); 44 } 45 46 public Object getAdapter(Class adapter) { 47 if (adapter == IResource.class || adapter == IContainer.class) 48 return container; 49 return super.getAdapter(adapter); 50 } 51 52 } 53 | Popular Tags |