1 11 package org.eclipse.pde.internal.runtime.registry; 12 13 import java.util.Vector ; 14 15 import org.eclipse.core.runtime.IPluginPrerequisite; 16 import org.eclipse.pde.internal.runtime.PDERuntimeMessages; 17 import org.eclipse.ui.views.properties.*; 18 19 public class PrerequisitePropertySource extends RegistryPropertySource { 20 private IPluginPrerequisite prereq; 21 public static final String P_ID = "id"; public static final String P_VERSION = "version"; public static final String P_EXPORTED = "exported"; public static final String P_MATCH = "match"; public static final String P_OPTIONAL = "optional"; public PrerequisitePropertySource(IPluginPrerequisite prereq) { 27 this.prereq = prereq; 28 } 29 public IPropertyDescriptor[] getPropertyDescriptors() { 30 Vector result = new Vector (); 31 32 result.addElement( 33 new PropertyDescriptor( 34 P_EXPORTED, 35 PDERuntimeMessages.RegistryView_prerequisitePR_exported)); 36 result.addElement( 37 new PropertyDescriptor( 38 P_ID, 39 PDERuntimeMessages.RegistryView_prerequisitePR_id)); 40 result.addElement( 41 new PropertyDescriptor( 42 P_VERSION, 43 PDERuntimeMessages.RegistryView_prerequisitePR_version)); 44 result.addElement( 45 new PropertyDescriptor( 46 P_MATCH, 47 PDERuntimeMessages.RegistryView_prerequisitePR_match)); 48 result.addElement( 49 new PropertyDescriptor( 50 P_OPTIONAL, 51 PDERuntimeMessages.RegistryView_prerequisitePR_optional)); 52 return toDescriptorArray(result); 53 54 } 55 56 public Object getPropertyValue(Object name) { 57 if (name.equals(P_ID)) 58 return prereq.getUniqueIdentifier(); 59 60 if (name.equals(P_EXPORTED)) 61 return prereq.isExported() ? "true" : "false"; 63 if (name.equals(P_VERSION)) { 64 Object version = prereq.getVersionIdentifier(); 65 return version != null ? version.toString() : ""; } 67 68 if (name.equals(P_OPTIONAL)) 69 return prereq.isOptional() ? "true" : "false"; 71 if (name.equals(P_MATCH)) { 72 if (prereq.isMatchedAsCompatible()) 73 return PDERuntimeMessages.RegistryView_prerequisitePR_matchedCompatible; 74 if (prereq.isMatchedAsEquivalent()) 75 return PDERuntimeMessages.RegistryView_prerequisitePR_matchedEquivalent; 76 if (prereq.isMatchedAsExact()) 77 return PDERuntimeMessages.RegistryView_prerequisitePR_matchedExact; 78 if (prereq.isMatchedAsGreaterOrEqual()) 79 return PDERuntimeMessages.RegistryView_prerequisitePR_matchedGreaterOrEqual; 80 if (prereq.isMatchedAsPerfect()) 81 return PDERuntimeMessages.RegistryView_prerequisitePR_matchedPerfect; 82 } 83 return ""; } 85 } 86 | Popular Tags |