1 11 package org.eclipse.pde.internal.runtime.registry; 12 13 import java.util.Vector ; 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 P_INSTALL_URL="installURL"; public static final String P_NAME = "name"; public static final String P_ID = "id"; public static final String P_PROVIDER = "provider"; public static final String P_VERSION = "version"; public static final String P_ACTIVATED = "activated"; public PluginPropertySource(IPluginDescriptor pd) { 28 this.pd = pd; 29 } 30 public IPropertyDescriptor[] getPropertyDescriptors() { 31 Vector result = new Vector (); 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 getPropertyValue(Object 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"; return null; 55 } 56 } 57 | Popular Tags |