1 11 package org.eclipse.team.internal.ui.registry; 12 13 import org.eclipse.core.runtime.*; 14 import org.eclipse.jface.resource.ImageDescriptor; 15 import org.eclipse.jface.wizard.IWizard; 16 import org.eclipse.team.internal.ui.TeamUIPlugin; 17 18 21 public class SynchronizeWizardDescription { 22 23 public static final String ATT_ID = "id"; public static final String ATT_NAME = "name"; public static final String ATT_ICON = "icon"; public static final String ATT_CLASS = "class"; public static final String ATT_DESCRIPTION = "description"; 29 private String label; 30 private String className; 31 private String description; 32 private String id; 33 private ImageDescriptor imageDescriptor; 34 35 private IConfigurationElement configElement; 36 37 public SynchronizeWizardDescription(IConfigurationElement e, String descText) throws CoreException { 38 configElement = e; 39 loadFromExtension(); 40 } 41 42 public IWizard createWizard() throws CoreException { 43 Object obj = RegistryReader.createExtension(configElement, ATT_CLASS); 44 return (IWizard) obj; 45 } 46 47 private void loadFromExtension() throws CoreException { 48 String identifier = configElement.getAttribute(ATT_ID); 49 label = configElement.getAttribute(ATT_NAME); 50 className = configElement.getAttribute(ATT_CLASS); 51 description = configElement.getAttribute(ATT_DESCRIPTION); 52 53 if ((label == null) || (className == null) || (identifier == null) || (description == null)) { 55 throw new CoreException(new Status(IStatus.ERROR, configElement.getNamespace(), 0, "Invalid extension (missing label or class name): " + identifier, null)); 57 } 58 59 id = identifier; 60 } 61 62 public String getId() { 63 return id; 64 } 65 66 public String getDescription() { 67 return description; 68 } 69 70 public ImageDescriptor getImageDescriptor() { 71 if (imageDescriptor != null) 72 return imageDescriptor; 73 String iconName = configElement.getAttribute(ATT_ICON); 74 if (iconName == null) 75 return null; 76 imageDescriptor = TeamUIPlugin.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), iconName); 77 return imageDescriptor; 78 } 79 80 public String getName() { 81 return label; 82 } 83 84 public String toString() { 85 return "Synchronize Participant Creation Wizard(" + getId() + ")"; } 87 } 88 | Popular Tags |