1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.core.runtime.IConfigurationElement; 14 import org.eclipse.core.runtime.IExtensionRegistry; 15 import org.eclipse.core.runtime.Platform; 16 import org.eclipse.ui.PlatformUI; 17 import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; 18 import org.eclipse.ui.internal.registry.RegistryReader; 19 20 24 public class ObjectActionContributorReader extends RegistryReader { 25 26 private ObjectActionContributorManager manager; 27 28 31 protected void processObjectContribution(IConfigurationElement element) { 32 String objectClassName = element.getAttribute(IWorkbenchRegistryConstants.ATT_OBJECTCLASS); 33 if (objectClassName == null) { 34 logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_OBJECTCLASS); 35 return; 36 } 37 38 IObjectContributor contributor = new ObjectActionContributor(element); 39 manager.registerContributor(contributor, objectClassName); 40 } 41 42 45 protected boolean readElement(IConfigurationElement element) { 46 String tagName = element.getName(); 47 if (tagName.equals(IWorkbenchRegistryConstants.TAG_OBJECT_CONTRIBUTION)) { 48 processObjectContribution(element); 49 return true; 50 } 51 if (tagName.equals(IWorkbenchRegistryConstants.TAG_VIEWER_CONTRIBUTION)) { 52 return true; 53 } 54 55 return false; 56 } 57 58 64 public void readPopupContributors(ObjectActionContributorManager mng) { 65 setManager(mng); 66 IExtensionRegistry registry = Platform.getExtensionRegistry(); 67 readRegistry(registry, PlatformUI.PLUGIN_ID, 68 IWorkbenchRegistryConstants.PL_POPUP_MENU); 69 } 70 71 76 public void setManager(ObjectActionContributorManager mng) { 77 manager = mng; 78 } 79 } 80 | Popular Tags |