KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > registry > RegistryModelObject


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

11 package org.eclipse.core.internal.registry;
12
13 import org.eclipse.core.internal.runtime.InternalPlatform;
14
15 /**
16  * An object which has the general characteristics of all elements
17  * in a plug-in manifest.
18  * <p>
19  * This class may be subclassed.
20  * </p>
21  */

22
23 public abstract class RegistryModelObject {
24     // DTD properties (included in plug-in manifest)
25
protected String JavaDoc name = null;
26
27     /**
28      * Returns the name of this element.
29      *
30      * @return the name of this element or <code>null</code>
31      */

32     public String JavaDoc getName() {
33         return name;
34     }
35
36     /**
37      * Sets the name of this element.
38      *
39      * @param value the new name of this element. May be <code>null</code>.
40      */

41     public void setName(String JavaDoc value) {
42         name = value;
43     }
44
45     /**
46      * Return a string representation of this object. This value is not to be relied
47      * on and can change at any time. To be used for debugging purposes only.
48      *
49      * @see java.lang.Object#toString()
50      */

51     public String JavaDoc toString() {
52         return this.getClass() + ":" + getName() + "[" + super.toString() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
53
}
54
55     public Object JavaDoc getAdapter(Class JavaDoc type) {
56         return InternalPlatform.getDefault().getAdapterManager().getAdapter(this, type);
57     }
58
59     /*
60      * Return null for the default case.
61      */

62     ExtensionRegistry getRegistry() {
63         return null;
64     }
65
66     /**
67      * Optimization to replace a non-localized key with its localized value. Avoids having
68      * to access resource bundles for further lookups.
69      */

70     public void setLocalizedName(String JavaDoc value) {
71         name = value;
72         ((ExtensionRegistry) InternalPlatform.getDefault().getRegistry()).setDirty(true);
73     }
74 }
Popular Tags