1 17 package org.eclipse.emf.ecore.plugin; 18 19 20 import org.eclipse.core.runtime.IConfigurationElement; 21 import org.eclipse.core.runtime.Platform; 22 23 import org.eclipse.emf.ecore.resource.Resource; 24 25 26 32 class ExtensionParserRegistryReader extends RegistryReader 33 { 34 static final String TAG_PARSER = "parser"; 35 static final String ATT_TYPE = "type"; 36 static final String ATT_CLASS = "class"; 37 38 public ExtensionParserRegistryReader() 39 { 40 super 41 (Platform.getExtensionRegistry(), 42 EcorePlugin.getPlugin().getBundle().getSymbolicName(), 43 EcorePlugin.EXTENSION_PARSER_PPID); 44 } 45 46 protected boolean readElement(IConfigurationElement element) 47 { 48 if (element.getName().equals(TAG_PARSER)) 49 { 50 String type = element.getAttribute(ATT_TYPE); 51 if (type == null) 52 { 53 logMissingAttribute(element, ATT_TYPE); 54 } 55 else if (element.getAttribute(ATT_CLASS) == null) 56 { 57 logMissingAttribute(element, ATT_CLASS); 58 } 59 else 60 { 61 Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put 62 (type, new ResourceFactoryDescriptor(element, ATT_CLASS)); 63 return true; 64 } 65 } 66 return false; 67 } 68 } 69 | Popular Tags |