1 11 package org.eclipse.ui.internal.registry; 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.WorkbenchPlugin; 18 19 22 public class ViewRegistryReader extends RegistryReader { 23 26 public static String GENERAL_VIEW_ID = "org.eclipse.ui"; 28 private ViewRegistry viewRegistry; 29 30 33 public ViewRegistryReader() { 34 super(); 35 } 36 37 40 protected void readCategory(IConfigurationElement element) { 41 try { 42 viewRegistry.add(new Category(element)); 43 } catch (CoreException e) { 44 WorkbenchPlugin.log( 46 "Unable to create view category.", e.getStatus()); } 48 } 49 50 53 protected boolean readElement(IConfigurationElement element) { 54 if (element.getName().equals(IWorkbenchRegistryConstants.TAG_VIEW)) { 55 readView(element); 56 return true; 57 } 58 if (element.getName().equals(IWorkbenchRegistryConstants.TAG_CATEGORY)) { 59 readCategory(element); 60 readElementChildren(element); 61 return true; 62 } 63 if (element.getName().equals(IWorkbenchRegistryConstants.TAG_STICKYVIEW)) { 64 readSticky(element); 65 return true; 66 } 67 68 return false; 69 } 70 71 74 protected void readSticky(IConfigurationElement element) { 75 try { 76 viewRegistry.add(new StickyViewDescriptor(element)); 77 } catch (CoreException e) { 78 WorkbenchPlugin.log( 80 "Unable to create sticky view descriptor.", e.getStatus()); 82 } 83 } 84 85 88 protected void readView(IConfigurationElement element) { 89 try { 90 viewRegistry.add(new ViewDescriptor(element)); 91 } catch (CoreException e) { 92 WorkbenchPlugin.log( 94 "Unable to create view descriptor.", e.getStatus()); } 96 } 97 98 103 public void readViews(IExtensionRegistry in, ViewRegistry out) { 104 viewRegistry = out; 106 readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_VIEWS); 107 } 108 } 109 | Popular Tags |