KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > plugin > IdentifiablePluginObject


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.core.plugin;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.pde.core.IIdentifiable;
15 import org.eclipse.pde.core.plugin.IPluginObject;
16 import org.eclipse.pde.core.plugin.ISharedPluginModel;
17
18 public abstract class IdentifiablePluginObject extends PluginObject implements
19         IIdentifiable {
20     protected String JavaDoc fID;
21
22     public IdentifiablePluginObject() {
23     }
24
25     public String JavaDoc getId() {
26         return fID;
27     }
28
29     public void setId(String JavaDoc id) throws CoreException {
30         ensureModelEditable();
31         String JavaDoc oldValue = fID;
32         fID = id;
33         firePropertyChanged(P_ID, oldValue, id);
34     }
35
36     public void restoreProperty(String JavaDoc name, Object JavaDoc oldValue, Object JavaDoc newValue)
37             throws CoreException {
38         if (name.equals(P_ID)) {
39             setId(newValue != null ? newValue.toString() : null);
40             return;
41         }
42         super.restoreProperty(name, oldValue, newValue);
43     }
44
45     /* (non-Javadoc)
46      * @see org.eclipse.pde.internal.core.plugin.PluginObject#reconnect(org.eclipse.pde.core.plugin.ISharedPluginModel, org.eclipse.pde.core.plugin.IPluginObject)
47      */

48     public void reconnect(ISharedPluginModel model, IPluginObject parent) {
49         super.reconnect(model, parent);
50         // No transient fields
51
}
52
53     
54 }
55
Popular Tags