1 11 package org.eclipse.ui.internal.intro; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IConfigurationElement; 15 import org.eclipse.core.runtime.IExtensionRegistry; 16 import org.eclipse.ui.PlatformUI; 17 import org.eclipse.ui.internal.IWorkbenchConstants; 18 import org.eclipse.ui.internal.WorkbenchPlugin; 19 import org.eclipse.ui.internal.registry.RegistryReader; 20 21 26 public class IntroRegistryReader extends RegistryReader { 27 private static final String TAG_INTRO = "intro"; private static final String TAG_INTROPRODUCTBINDING = "introProductBinding"; private IntroRegistry introRegistry; 30 31 33 public IntroRegistryReader() { 34 super(); 35 } 36 37 40 protected boolean readElement(IConfigurationElement element) { 41 if (element.getName().equals(TAG_INTRO)) { 42 readIntro(element); 43 return true; 44 } 45 else if (element.getName().equals(TAG_INTROPRODUCTBINDING)) { 46 readBinding(element); 47 return true; 48 } 49 return false; 50 } 51 52 57 private void readBinding(IConfigurationElement element) { 58 try { 59 introRegistry.addBinding(element); 60 } 61 catch (CoreException e) { 62 WorkbenchPlugin.log(IntroMessages.getString("Intro.could_not_create_binding") , e.getStatus()); } 65 } 66 67 72 private void readIntro(IConfigurationElement element) { 73 try { 74 IIntroDescriptor descriptor = new IntroDescriptor(element); 75 introRegistry.add(descriptor); 76 } 77 catch (CoreException e) { 78 WorkbenchPlugin.log(IntroMessages.getString("Intro.could_not_create_descriptor") , e.getStatus()); } 81 } 82 83 89 public void readIntros(IExtensionRegistry in, IntroRegistry out) { 90 introRegistry = out; 91 readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_INTRO); 92 } 93 } 94 | Popular Tags |