01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.core.plugin;
11:
12: import org.eclipse.core.runtime.CoreException;
13: import org.eclipse.pde.core.IIdentifiable;
14: import org.eclipse.pde.core.plugin.IPluginObject;
15: import org.eclipse.pde.core.plugin.ISharedPluginModel;
16:
17: public abstract class IdentifiablePluginObject extends PluginObject
18: implements IIdentifiable {
19: protected String fID;
20:
21: public IdentifiablePluginObject() {
22: }
23:
24: public String getId() {
25: return fID;
26: }
27:
28: public void setId(String id) throws CoreException {
29: ensureModelEditable();
30: String oldValue = fID;
31: fID = id;
32: firePropertyChanged(P_ID, oldValue, id);
33: }
34:
35: public void restoreProperty(String name, Object oldValue,
36: Object newValue) throws CoreException {
37: if (name.equals(P_ID)) {
38: setId(newValue != null ? newValue.toString() : null);
39: return;
40: }
41: super .restoreProperty(name, oldValue, newValue);
42: }
43:
44: /* (non-Javadoc)
45: * @see org.eclipse.pde.internal.core.plugin.PluginObject#reconnect(org.eclipse.pde.core.plugin.ISharedPluginModel, org.eclipse.pde.core.plugin.IPluginObject)
46: */
47: public void reconnect(ISharedPluginModel model, IPluginObject parent) {
48: super .reconnect(model, parent);
49: // No transient fields
50: }
51:
52: }
|