KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 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.core.internal.registry;
12
13 import org.eclipse.core.runtime.*;
14
15 /**
16  * This is the copy of the ExtensionHandle minus the getDeclaringPluginDescriptor()
17  * method that was moved into compatibility plugin.
18  *
19  * This class should not be used directly. Use ExtensionHandle instead.
20  *
21  * @since org.eclipse.equinox.registry 3.2
22  */

23 public class BaseExtensionHandle extends Handle implements IExtension {
24
25     public BaseExtensionHandle(IObjectManager objectManager, int id) {
26         super(objectManager, id);
27     }
28
29     protected Extension getExtension() {
30         return (Extension) objectManager.getObject(getId(), RegistryObjectManager.EXTENSION);
31     }
32
33     protected boolean shouldPersist() {
34         return getExtension().shouldPersist();
35     }
36
37     // Method left for backward compatiblity only
38
public String JavaDoc getNamespace() {
39         return getContributor().getName();
40     }
41
42     public String JavaDoc getNamespaceIdentifier() {
43         return getExtension().getNamespaceIdentifier();
44     }
45
46     public IContributor getContributor() {
47         return getExtension().getContributor();
48     }
49     
50     String JavaDoc getContributorId() {
51         return getExtension().getContributorId();
52     }
53
54     public String JavaDoc getExtensionPointUniqueIdentifier() {
55         return getExtension().getExtensionPointIdentifier();
56     }
57
58     public String JavaDoc getLabel() {
59         return getExtension().getLabel();
60     }
61
62     public String JavaDoc getSimpleIdentifier() {
63         return getExtension().getSimpleIdentifier();
64     }
65
66     public String JavaDoc getUniqueIdentifier() {
67         return getExtension().getUniqueIdentifier();
68     }
69
70     public IConfigurationElement[] getConfigurationElements() {
71         return (IConfigurationElement[]) objectManager.getHandles(getExtension().getRawChildren(), RegistryObjectManager.CONFIGURATION_ELEMENT);
72     }
73
74     RegistryObject getObject() {
75         return getExtension();
76     }
77
78     public boolean isValid() {
79         try {
80             getExtension();
81         } catch (InvalidRegistryObjectException e) {
82             return false;
83         }
84         return true;
85     }
86 }
87
Popular Tags