1 11 package org.eclipse.pde.internal.core.site; 12 13 import java.io.PrintWriter ; 14 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.pde.internal.core.isite.ISiteArchive; 17 import org.w3c.dom.Node ; 18 19 public class SiteArchive extends SiteObject implements ISiteArchive { 20 private static final long serialVersionUID = 1L; 21 private String url; 22 private String path; 23 24 public boolean isValid() { 25 return url!=null && path!=null; 26 } 27 28 public String getURL() { 29 return url; 30 } 31 public void setURL(String url) throws CoreException { 32 ensureModelEditable(); 33 Object oldValue = this.url; 34 this.url = url; 35 firePropertyChanged(P_URL, oldValue, url); 36 } 37 public String getPath() { 38 return path; 39 } 40 public void setPath(String path) throws CoreException { 41 ensureModelEditable(); 42 Object oldValue = this.path; 43 this.path = path; 44 firePropertyChanged(P_PATH, oldValue, path); 45 } 46 public void reset() { 47 super.reset(); 48 url = null; 49 path = null; 50 } 51 protected void parse(Node node) { 52 super.parse(node); 53 path = getNodeAttribute(node, "path"); url = getNodeAttribute(node, "url"); } 56 public void write(String indent, PrintWriter writer) { 57 writer.print(indent); 58 writer.print("<archive"); if (path != null) 60 writer.print(" path=\"" + SiteObject.getWritableString(path) + "\""); if (url != null) 62 writer.print(" url=\"" + SiteObject.getWritableString(url) + "\""); writer.println("/>"); } 65 public void restoreProperty(String name, Object oldValue, Object newValue) 66 throws CoreException { 67 if (name.equals(P_PATH)) { 68 setPath(newValue != null ? newValue.toString() : null); 69 } else if (name.equals(P_URL)) { 70 setURL(newValue != null ? newValue.toString() : null); 71 } else 72 super.restoreProperty(name, oldValue, newValue); 73 } 74 75 } 76 | Popular Tags |