Java Code Examples for org.eclipse.core.runtime.IConfigurationElement.getName()

The following are Jave code examples for showing how to use getName() of the org.eclipse.core.runtime.IConfigurationElement class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: gemoc-studio-modeldebugging   File: LanguageDefinitionExtension.java   Source Code and License Vote up 6 votes
/**
 * 
 * @return the list of file extensions defined in the XDSML_Definition_customization
 */
public List<String> getFileExtensions() {
	ArrayList<String> fileExtensions = new ArrayList<String>();
	for (IConfigurationElement childConfElement : _configurationElement
			.getChildren(LanguageDefinitionExtensionPoint.GEMOC_LANGUAGE_EXTENSION_POINT_XDSML_CUSTOMIZATION_DEF)) {
		childConfElement.getName();
		final String fileExtensionsString = childConfElement
				.getAttribute(LanguageDefinitionExtensionPoint.GEMOC_LANGUAGE_EXTENSION_POINT_XDSML_CUSTOMIZATION_DEF_FILEEXTENSIONS_ATT);
		if (fileExtensionsString != null) {
			for( String fileExtension : fileExtensionsString.split(",")){
				fileExtensions.add(fileExtension.trim());
			}
		}
	}
	return fileExtensions;
}
 
Example 2
Project: n4js   File: FileExtensionsRegistry.java   Source Code and License Vote up 5 votes
/**
 * Read information from extensions defined in plugin.xml files
 */
private void initialize() {
	if (isInitialized) {
		throw new IllegalStateException("may invoke method initialize() only once");
	}
	isInitialized = true;

	final IExtensionRegistry registry = RegistryFactory.getRegistry();
	if (registry != null) {
		final IExtension[] extensions = registry.getExtensionPoint(FILE_EXTENSIONS_POINT_ID).getExtensions();
		for (IExtension extension : extensions) {
			final IConfigurationElement[] configElems = extension.getConfigurationElements();
			for (IConfigurationElement elem : configElems) {
				try {
					List<String> fileExtensions = Splitter.on(',').trimResults().omitEmptyStrings()
							.splitToList(elem.getAttribute(ATT_FILE_EXTENSION));

					String elementName = elem.getName();
					if (ATT_TRANSPILABLE_FILE_EXTENSIONS.equals(elementName)) {
						transpilableFileExtensions.addAll(fileExtensions);
					} else if (ATT_TEST_FILE_EXTENSIONS.equals(elementName)) {
						testFileExtensions.addAll(fileExtensions);
					} else if (ATT_RUNNABLE_FILE_EXTENSIONS.equals(elementName)) {
						runnableFileExtensions.addAll(fileExtensions);
					} else if (ATT_TYPABLE_FILE_EXTENSIONS.equals(elementName)) {
						typableFileExtensions.addAll(fileExtensions);
					} else if (ATT_RAW_FILE_EXTENSIONS.equals(elementName)) {
						rawFileExtensions.addAll(fileExtensions);
					} else {
						LOGGER.error(new UnsupportedOperationException(
								"This file extension type " + elementName + " is not supported yet"));
					}
				} catch (Exception ex) {
					LOGGER.error("Error while reading extensions for extension point " + FILE_EXTENSIONS_POINT_ID,
							ex);
				}
			}
		}
	}
}
 
Example 3
Project: gemoc-studio-modeldebugging   File: LanguageDefinitionExtension.java   Source Code and License Vote up 5 votes
final public Collection<IEngineAddon> instanciateEngineAddons() throws CoreException {
	ArrayList<IEngineAddon> addons = new ArrayList<IEngineAddon>();
	for (IConfigurationElement childConfElement : _configurationElement
			.getChildren(LanguageDefinitionExtensionPoint.GEMOC_LANGUAGE_EXTENSION_POINT_ENGINE_ADDON_DEF)) {
		childConfElement.getName();
		final Object addon = childConfElement
				.createExecutableExtension(LanguageDefinitionExtensionPoint.GEMOC_LANGUAGE_EXTENSION_POINT_ENGINE_ADDON_DEF_ENGINE_ADDON_ATT);
		if (addon instanceof IEngineAddon) {
			addons.add((IEngineAddon) addon);
		}
	}
	return addons;
}