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 ProtocolParserRegistryReader extends RegistryReader 33 { 34 static final String TAG_PARSER = "parser"; 35 static final String ATT_PROTOCOLNAME = "protocolName"; 36 static final String ATT_CLASS = "class"; 37 38 public ProtocolParserRegistryReader() 39 { 40 super 41 (Platform.getExtensionRegistry(), 42 EcorePlugin.getPlugin().getBundle().getSymbolicName(), 43 EcorePlugin.PROTOCOL_PARSER_PPID); 44 } 45 46 protected boolean readElement(IConfigurationElement element) 47 { 48 if (element.getName().equals(TAG_PARSER)) 49 { 50 String protocolName = element.getAttribute(ATT_PROTOCOLNAME); 51 if (protocolName == null) 52 { 53 logMissingAttribute(element, ATT_PROTOCOLNAME); 54 } 55 else if (element.getAttribute(ATT_CLASS) == null) 56 { 57 logMissingAttribute(element, ATT_CLASS); 58 } 59 else 60 { 61 Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put 62 (protocolName, new ResourceFactoryDescriptor(element, ATT_CLASS)); 63 return true; 64 } 65 } 66 67 return false; 68 } 69 } 70 | Popular Tags |