1 11 package org.eclipse.ui.internal.themes; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IConfigurationElement; 15 import org.eclipse.ui.IPluginContribution; 16 import org.eclipse.ui.internal.WorkbenchPlugin; 17 import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; 18 import org.eclipse.ui.themes.IThemePreview; 19 20 23 public class ThemeElementCategory implements IPluginContribution, 24 IThemeElementDefinition { 25 26 private String description; 27 28 private IConfigurationElement element; 29 30 private String id; 31 32 private String parentId; 33 34 private String label; 35 36 private String pluginId; 37 38 47 public ThemeElementCategory(String label, String id, String parentId, 48 String description, String pluginId, IConfigurationElement element) { 49 50 this.label = label; 51 this.id = id; 52 this.parentId = parentId; 53 this.description = description; 54 this.pluginId = pluginId; 55 this.element = element; 56 } 57 58 63 public IThemePreview createPreview() throws CoreException { 64 String classString = element.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS); 65 if (classString == null || "".equals(classString)) { return null; 67 } 68 return (IThemePreview) WorkbenchPlugin.createExtension(element, 69 IWorkbenchRegistryConstants.ATT_CLASS); 70 } 71 72 75 public String getDescription() { 76 return description; 77 } 78 79 82 public IConfigurationElement getElement() { 83 return element; 84 } 85 86 89 public String getId() { 90 return id; 91 } 92 93 96 public String getName() { 97 return label; 98 } 99 100 103 public String getLocalId() { 104 return id; 105 } 106 107 110 public String getPluginId() { 111 return pluginId; 112 } 113 114 117 public String getParentId() { 118 return parentId; 119 } 120 121 124 public boolean equals(Object obj) { 125 if (obj instanceof ThemeElementCategory) { 126 return getId().equals(((ThemeElementCategory)obj).getId()); 127 } 128 return false; 129 } 130 131 134 public int hashCode() { 135 return id.hashCode(); 136 } 137 } 138 | Popular Tags |