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