1 11 package org.eclipse.pde.internal.core.feature; 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 FeatureObject implements IIdentifiable { 18 private static final long serialVersionUID = 1L; 19 protected String id; 20 21 public String getId() { 22 return id; 23 } 24 25 protected void parse(Node node) { 26 super.parse(node); 27 id = getNodeAttribute(node, "id"); } 29 30 public void setId(String id) throws CoreException { 31 ensureModelEditable(); 32 Object oldValue = this.id; 33 this.id = id; 34 firePropertyChanged(this, P_ID, oldValue, id); 35 } 36 37 public void restoreProperty(String name, Object oldValue, Object newValue) throws CoreException { 38 if (name.equals(P_ID)) { 39 setId(newValue!=null ? newValue.toString() : null); 40 } 41 else super.restoreProperty(name, oldValue, newValue); 42 } 43 44 protected void reset() { 45 super.reset(); 46 id = null; 47 } 48 } 49 | Popular Tags |