1 11 package org.eclipse.help.internal.workingset; 12 13 import org.eclipse.core.runtime.*; 14 import org.eclipse.help.*; 15 import org.w3c.dom.*; 16 17 20 public abstract class AdaptableHelpResource 21 implements 22 IAdaptable, 23 IHelpResource { 24 protected IHelpResource element; 25 protected IAdaptable parent; 26 27 30 public AdaptableHelpResource(IHelpResource element) { 31 this.element = element; 32 } 33 34 37 public Object getAdapter(Class adapter) { 38 if (adapter == IHelpResource.class) 39 return element; 40 return null; 41 } 42 43 public abstract void saveState(Element element); 44 45 public abstract AdaptableHelpResource[] getChildren(); 46 47 public IAdaptable getParent() { 48 return parent; 49 } 50 51 protected void setParent(IAdaptable parent) { 52 this.parent = parent; 53 } 54 55 63 public boolean equals(Object object) { 64 if (this == object) 65 return true; 66 else if (object instanceof AdaptableHelpResource) 67 return (element == ((AdaptableHelpResource) object).element); 68 else if (object instanceof IHelpResource) 69 return element == object; 70 else 71 return false; 72 } 73 74 79 public int hashCode() { 80 if (element == null) 81 return -1; 82 return element.hashCode(); 83 } 84 85 88 public abstract ITopic getTopic(String href); 89 90 93 public String getHref() { 94 return element.getHref(); 95 } 96 97 100 public String getLabel() { 101 return element.getLabel(); 102 } 103 104 } 105 | Popular Tags |