1 11 package org.eclipse.pde.internal.core.target; 12 13 import java.io.PrintWriter ; 14 15 import org.eclipse.pde.internal.core.itarget.ITargetModel; 16 import org.eclipse.pde.internal.core.itarget.ITargetPlugin; 17 import org.w3c.dom.Element ; 18 import org.w3c.dom.Node ; 19 20 public class TargetPlugin extends TargetObject implements ITargetPlugin { 21 22 private static final long serialVersionUID = 1L; 23 private String fId; 24 private boolean fOptional = false; 25 26 public TargetPlugin(ITargetModel model) { 27 super(model); 28 } 29 30 public String getId() { 31 return fId.trim(); 32 } 33 34 public void setId(String id) { 35 fId = id; 36 } 37 38 public void parse(Node node) { 39 if (node.getNodeType() == Node.ELEMENT_NODE) { 40 Element element = (Element )node; 41 fId = element.getAttribute("id"); fOptional = element.getAttribute("optional").equalsIgnoreCase("true"); } 44 } 45 46 public void write(String indent, PrintWriter writer) { 47 writer.print(indent + "<plugin id=\"" + getWritableString(fId)); writer.println((fOptional) ? "\" optional=\"true\"/>" : "\"/>"); } 50 51 public boolean isOptional() { 52 return fOptional; 53 } 54 55 public void setOptional(boolean optional) { 56 fOptional = optional; 57 } 58 59 } 60 | Popular Tags |