KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > runtime > registry > PluginPropertySource


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 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.runtime.registry;
12
13 import java.util.Vector JavaDoc;
14
15 import org.eclipse.core.runtime.IPluginDescriptor;
16 import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
17 import org.eclipse.ui.views.properties.*;
18
19 public class PluginPropertySource extends RegistryPropertySource {
20     private IPluginDescriptor pd;
21     public static final String JavaDoc P_INSTALL_URL="installURL"; //$NON-NLS-1$
22
public static final String JavaDoc P_NAME = "name"; //$NON-NLS-1$
23
public static final String JavaDoc P_ID = "id"; //$NON-NLS-1$
24
public static final String JavaDoc P_PROVIDER = "provider"; //$NON-NLS-1$
25
public static final String JavaDoc P_VERSION = "version"; //$NON-NLS-1$
26
public static final String JavaDoc P_ACTIVATED = "activated"; //$NON-NLS-1$
27
public PluginPropertySource(IPluginDescriptor pd) {
28     this.pd = pd;
29 }
30 public IPropertyDescriptor[] getPropertyDescriptors() {
31     Vector JavaDoc result = new Vector JavaDoc();
32
33     result.addElement(new PropertyDescriptor(P_INSTALL_URL, PDERuntimeMessages.RegistryView_pluginPR_installURL));
34     result.addElement(new PropertyDescriptor(P_NAME, PDERuntimeMessages.RegistryView_pluginPR_name));
35     result.addElement(new PropertyDescriptor(P_ID, PDERuntimeMessages.RegistryView_pluginPR_id));
36     result.addElement(new PropertyDescriptor(P_PROVIDER, PDERuntimeMessages.RegistryView_pluginPR_providerName));
37     result.addElement(new PropertyDescriptor(P_VERSION, PDERuntimeMessages.RegistryView_pluginPR_version));
38     result.addElement(new PropertyDescriptor(P_ACTIVATED, PDERuntimeMessages.RegistryView_pluginPR_activated));
39     return toDescriptorArray(result);
40 }
41 public Object JavaDoc getPropertyValue(Object JavaDoc name) {
42     if (name.equals(P_INSTALL_URL))
43         return pd.getInstallURL();
44     if (name.equals(P_NAME))
45         return pd.getLabel();
46     if (name.equals(P_ID))
47         return pd.getUniqueIdentifier();
48     if (name.equals(P_PROVIDER))
49         return pd.getProviderName();
50     if (name.equals(P_VERSION))
51         return pd.getVersionIdentifier();
52     if (name.equals(P_ACTIVATED))
53         return pd.isPluginActivated() ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
54
return null;
55 }
56 }
57
Popular Tags