1 11 package org.eclipse.help.internal.workingset; 12 13 import org.eclipse.help.*; 14 import org.w3c.dom.*; 15 16 19 public class AdaptableToc extends AdaptableHelpResource { 20 21 protected AdaptableTopic[] children; 22 23 26 AdaptableToc(IToc element) { 27 super(element); 28 } 29 30 33 public Object getAdapter(Class adapter) { 34 if (adapter == IToc.class) 35 return element; 36 return super.getAdapter(adapter); 37 } 38 39 public AdaptableHelpResource[] getChildren() { 40 if (children == null) { 41 ITopic[] topics = ((IToc) element).getTopics(); 42 children = new AdaptableTopic[topics.length]; 43 for (int i = 0; i < topics.length; i++) { 44 children[i] = new AdaptableTopic(topics[i]); 45 children[i].setParent(this); 46 } 47 } 48 return children; 49 } 50 51 54 public ITopic getTopic(String href) { 55 return ((IToc) element).getTopic(href); 56 } 57 58 61 public ITopic[] getTopics() { 62 return ((IToc) element).getTopics(); 63 } 64 65 public void saveState(Element element) { 66 element.setAttribute("toc", getHref()); } 68 } 69 | Popular Tags |