1 11 12 package org.eclipse.ui.internal.intro.impl.model; 13 14 import org.osgi.framework.Bundle; 15 import org.w3c.dom.Element ; 16 import org.w3c.dom.Node ; 17 18 21 public class IntroText extends AbstractBaseIntroElement { 22 23 protected static final String TAG_TEXT = "text"; 25 private String text; 26 30 private boolean isFormatted = false; 31 32 IntroText(Element element, Bundle bundle) { 33 super(element, bundle); 34 Node textNode = element.getFirstChild(); 35 if (textNode == null) 36 return; 37 if (textNode.getNodeType() == Node.TEXT_NODE 38 || textNode.getNodeType() == Node.CDATA_SECTION_NODE) { 39 text = textNode.getNodeValue(); 41 isFormatted = checkIfFormatted(); 42 } 43 } 44 45 48 public String getText() { 49 IntroModelRoot root = getModelRoot(); 50 if (root!=null) 51 return root.resolveVariables(text); 52 return text; 53 } 54 55 60 public int getType() { 61 return AbstractIntroElement.TEXT; 62 } 63 64 68 public boolean checkIfFormatted() { 69 if (text == null) 70 return false; 71 int i = text.indexOf("<"); return i == -1 ? false : true; 73 } 74 75 76 79 public boolean isFormatted() { 80 return isFormatted; 81 } 82 } 83 | Popular Tags |