1 11 12 package org.eclipse.pde.internal.core.cheatsheet.simple; 13 14 import java.io.IOException ; 15 import java.io.PrintWriter ; 16 import java.util.ArrayList ; 17 import java.util.List ; 18 19 import org.eclipse.pde.internal.core.XMLPrintHandler; 20 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSModel; 21 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSObject; 22 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSOnCompletion; 23 import org.eclipse.pde.internal.core.util.CheatSheetUtil; 24 import org.eclipse.pde.internal.core.util.PDETextHelper; 25 import org.w3c.dom.Element ; 26 27 31 public class SimpleCSOnCompletion extends SimpleCSObject implements 32 ISimpleCSOnCompletion { 33 34 37 private String fContent; 38 39 42 private static final long serialVersionUID = 1L; 43 44 48 public SimpleCSOnCompletion(ISimpleCSModel model, ISimpleCSObject parent) { 49 super(model, parent); 50 reset(); 51 } 52 53 56 public void parse(Element element) { 57 fContent = CheatSheetUtil.parseElementText(element).trim(); 58 } 59 60 63 public void write(String indent, PrintWriter writer) { 64 65 String newIndent = indent + XMLPrintHandler.XML_INDENT; 66 67 try { 68 XMLPrintHandler.printBeginElement(writer, ELEMENT_ONCOMPLETION, 70 indent, false); 71 if ((fContent != null) && 73 (fContent.length() > 0)) { 74 writer.write(newIndent 75 + PDETextHelper.translateWriteText(fContent.trim(), 76 TAG_EXCEPTIONS, SUBSTITUTE_CHARS) + "\n"); } 78 XMLPrintHandler.printEndElement(writer, ELEMENT_ONCOMPLETION, indent); 80 } catch (IOException e) { 81 } 84 } 85 86 89 public void reset() { 90 fContent = null; 91 } 92 93 97 public String getContent() { 98 return fContent; 99 } 100 101 105 public void setContent(String content) { 106 String old = fContent; 107 fContent = content; 108 if (isEditable()) { 109 firePropertyChanged(ELEMENT_DESCRIPTION, old, fContent); 110 } 111 } 112 113 116 public int getType() { 117 return TYPE_ON_COMPLETION; 118 } 119 120 123 public String getName() { 124 return ELEMENT_ONCOMPLETION; 125 } 126 127 130 public List getChildren() { 131 return new ArrayList (); 132 } 133 134 } 135 | Popular Tags |