1 11 package org.eclipse.equinox.internal.app; 12 13 import java.util.HashMap ; 14 import org.eclipse.core.runtime.*; 15 import org.osgi.framework.Bundle; 16 17 public class ProductExtensionBranding implements IBranding{ 18 private static final String ATTR_DESCRIPTION = "description"; private static final String ATTR_NAME = "name"; private static final String ATTR_APPLICATION = "application"; private static final String ATTR_VALUE = "value"; 23 String application = null; 24 String name = null; 25 String id = null; 26 String description = null; 27 HashMap properties; 28 Bundle definingBundle = null; 29 30 public ProductExtensionBranding(String id, IConfigurationElement element) { 31 this.id = id; 32 if (element == null) 33 return; 34 application = element.getAttribute(ATTR_APPLICATION); 35 name = element.getAttribute(ATTR_NAME); 36 description = element.getAttribute(ATTR_DESCRIPTION); 37 loadProperties(element); 38 } 39 40 private void loadProperties(IConfigurationElement element) { 41 IConfigurationElement[] children = element.getChildren(); 42 properties = new HashMap (children.length); 43 for (int i = 0; i < children.length; i++) { 44 IConfigurationElement child = children[i]; 45 String key = child.getAttribute(ATTR_NAME); 46 String value = child.getAttribute(ATTR_VALUE); 47 if (key != null && value != null) 48 properties.put(key, value); 49 } 50 definingBundle = Activator.getBundle(element.getContributor()); 51 } 52 53 public Bundle getDefiningBundle() { 54 return definingBundle; 55 } 56 57 public String getApplication() { 58 return application; 59 } 60 61 public String getName() { 62 return name; 63 } 64 65 public String getDescription() { 66 return description; 67 } 68 69 public String getId() { 70 return id; 71 } 72 73 public String getProperty(String key) { 74 return (String ) properties.get(key); 75 } 76 77 public Object getProduct() { 78 return null; 79 } 80 } 81 | Popular Tags |