1 11 package org.eclipse.pde.internal.ui.view; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.pde.core.plugin.IPluginModelBase; 15 import org.eclipse.pde.internal.core.ModelEntry; 16 import org.eclipse.ui.views.properties.IPropertyDescriptor; 17 import org.eclipse.ui.views.properties.IPropertySource; 18 import org.eclipse.ui.views.properties.PropertyDescriptor; 19 20 public class ModelEntryPropertySource implements IPropertySource { 21 private IPropertyDescriptor [] descriptors; 22 private ModelEntry entry; 23 24 27 public ModelEntryPropertySource() { 28 super(); 29 } 30 31 public void setEntry(ModelEntry entry) { 32 this.entry = entry; 33 } 34 35 38 public Object getEditableValue() { 39 return null; 40 } 41 42 45 public IPropertyDescriptor[] getPropertyDescriptors() { 46 if (descriptors==null) { 47 descriptors = new IPropertyDescriptor[8]; 48 descriptors[0] = new PropertyDescriptor("kind", "kind"); descriptors[1] = new PropertyDescriptor("name", "name"); descriptors[2] = new PropertyDescriptor("fragment", "fragment"); descriptors[3] = new PropertyDescriptor("path", "path"); descriptors[4] = new PropertyDescriptor("id", "id"); descriptors[5] = new PropertyDescriptor("version", "version"); descriptors[6] = new PropertyDescriptor("provider", "provider"); descriptors[7] = new PropertyDescriptor("enabled", "enabled"); } 57 return descriptors; 58 } 59 60 63 public Object getPropertyValue(Object id) { 64 String key = id.toString(); 65 IPluginModelBase model = entry.getActiveModel(); 66 IResource resource = model.getUnderlyingResource(); 67 if (key.equals("enabled")) return model.isEnabled()?"true":"false"; if (key.equals("kind")) return resource!=null?"workspace":"external"; if (key.equals("fragment")) return model.isFragmentModel()?"yes":"no"; if (key.equals("name")) return model.getPluginBase().getTranslatedName(); 75 if (key.equals("path")) { if (resource!=null) 77 return resource.getLocation().toOSString(); 78 return model.getInstallLocation(); 79 } 80 if (key.equals("id")) return model.getPluginBase().getId(); 82 if (key.equals("version")) return model.getPluginBase().getVersion(); 84 if (key.equals("provider")) return model.getPluginBase().getProviderName(); 86 return null; 87 } 88 89 92 public boolean isPropertySet(Object id) { 93 return false; 94 } 95 96 99 public void resetPropertyValue(Object id) { 100 } 101 102 105 public void setPropertyValue(Object id, Object value) { 106 } 107 108 } 109 | Popular Tags |