1 11 package org.eclipse.pde.internal.core.site; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.pde.core.IIdentifiable; 15 import org.w3c.dom.Node ; 16 17 public class IdentifiableObject extends SiteObject implements IIdentifiable { 18 19 private static final long serialVersionUID = 1L; 20 protected String id; 21 22 public String getId() { 23 return id; 24 } 25 26 protected void parse(Node node) { 27 super.parse(node); 28 id = getNodeAttribute(node, "id"); } 30 31 public boolean isValid() { 32 return id!=null; 33 } 34 35 public void setId(String id) throws CoreException { 36 ensureModelEditable(); 37 Object oldValue = this.id; 38 this.id = id; 39 firePropertyChanged(this, P_ID, oldValue, id); 40 } 41 42 public void restoreProperty(String name, Object oldValue, Object newValue) throws CoreException { 43 if (name.equals(P_ID)) { 44 setId(newValue!=null ? newValue.toString() : null); 45 } 46 else super.restoreProperty(name, oldValue, newValue); 47 } 48 49 protected void reset() { 50 super.reset(); 51 id = null; 52 } 53 } 54 | Popular Tags |