1 11 package org.eclipse.help.internal.extension; 12 13 import org.eclipse.help.IContentExtension; 14 import org.eclipse.help.internal.UAElement; 15 import org.w3c.dom.Element ; 16 17 public class ContentExtension extends UAElement implements IContentExtension { 18 19 public static final String NAME_CONTRIBUTION = "contribution"; public static final String NAME_CONTRIBUTION_LEGACY = "topicExtension"; public static final String NAME_REPLACEMENT = "replacement"; public static final String NAME_REPLACEMENT_LEGACY = "topicReplace"; public static final String ATTRIBUTE_CONTENT = "content"; public static final String ATTRIBUTE_PATH = "path"; 26 public ContentExtension(IContentExtension src) { 27 super(src.getType() == IContentExtension.CONTRIBUTION ? NAME_CONTRIBUTION : NAME_REPLACEMENT, src); 28 setContent(src.getContent()); 29 setPath(src.getPath()); 30 } 31 32 public ContentExtension(Element src) { 33 super(src); 34 } 35 36 public String getContent() { 37 return getAttribute(ATTRIBUTE_CONTENT); 38 } 39 40 public String getPath() { 41 return getAttribute(ATTRIBUTE_PATH); 42 } 43 44 public int getType() { 45 String name = element.getNodeName(); 46 return (NAME_CONTRIBUTION.equals(name) || NAME_CONTRIBUTION_LEGACY.equals(name)) ? CONTRIBUTION : REPLACEMENT; 47 } 48 49 public void setContent(String content) { 50 setAttribute(ATTRIBUTE_CONTENT, content); 51 } 52 53 public void setPath(String path) { 54 setAttribute(ATTRIBUTE_PATH, path); 55 } 56 } 57 | Popular Tags |