1 11 package org.eclipse.pde.internal.core.feature; 12 13 import java.io.PrintWriter ; 14 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.pde.internal.core.ifeature.IFeatureInstallHandler; 17 import org.w3c.dom.Node ; 18 19 public class FeatureInstallHandler 20 extends FeatureObject 21 implements IFeatureInstallHandler { 22 private static final long serialVersionUID = 1L; 23 private String fLibrary; 24 private String fHandlerName; 25 26 29 public String getLibrary() { 30 return fLibrary; 31 } 32 33 36 public String getHandlerName() { 37 return fHandlerName; 38 } 39 40 43 public void setLibrary(String library) throws CoreException { 44 ensureModelEditable(); 45 Object oldValue = this.fLibrary; 46 this.fLibrary = library; 47 firePropertyChanged(P_LIBRARY, oldValue, library); 48 } 49 50 53 public void setHandlerName(String handlerName) throws CoreException { 54 ensureModelEditable(); 55 Object oldValue = this.fHandlerName; 56 this.fHandlerName = handlerName; 57 firePropertyChanged(P_HANDLER_NAME, oldValue, handlerName); 58 } 59 public void restoreProperty(String name, Object oldValue, Object newValue) 60 throws CoreException { 61 if (name.equals(P_LIBRARY)) { 62 setLibrary((String ) newValue); 63 } else if (name.equals(P_HANDLER_NAME)) { 64 setHandlerName((String ) newValue); 65 } else 66 super.restoreProperty(name, oldValue, newValue); 67 } 68 protected void parse(Node node) { 69 fLibrary = getNodeAttribute(node, "library"); fHandlerName = getNodeAttribute(node, "handler"); } 72 public void write(String indent, PrintWriter writer) { 73 writer.print(indent + "<install-handler"); if (fLibrary != null) { 75 writer.print(" library=\"" + fLibrary + "\""); } 77 if (fHandlerName != null) { 78 writer.print(" handler=\"" + fHandlerName + "\""); } 80 writer.println("/>"); } 83 } 84 | Popular Tags |