KickJava   Java API By Example, From Geeks To Geeks.

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


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.IPluginDescriptor;
14 import org.eclipse.core.runtime.InvalidRegistryObjectException;
15 import org.osgi.framework.Bundle;
16
17 /**
18  * This class contains only compatibility-specific code.
19  *
20  * @deprecated marked as deprecated to supress warnings
21  */

22 public class ExtensionHandle extends BaseExtensionHandle {
23
24     static final ExtensionHandle[] EMPTY_ARRAY = new ExtensionHandle[0];
25
26     public ExtensionHandle(IObjectManager objectManager, int id) {
27         super(objectManager, id);
28     }
29
30     public IPluginDescriptor getDeclaringPluginDescriptor() throws InvalidRegistryObjectException {
31         String JavaDoc namespace = getContributor().getName();
32         IPluginDescriptor result = RegistryCompatibilityHelper.getPluginDescriptor(namespace);
33         if (result == null) {
34             Bundle underlyingBundle = BundleHelper.getDefault().getBundle(namespace);
35             if (underlyingBundle != null) {
36                 Bundle[] hosts = BundleHelper.getDefault().getHosts(underlyingBundle);
37                 if (hosts != null)
38                     result = RegistryCompatibilityHelper.getPluginDescriptor(hosts[0].getSymbolicName());
39             }
40         }
41
42         return result;
43     }
44 }
45
Popular Tags