use of org.eclipse.core.runtime.IExtensionPoint in project knime-core by knime.
the class DataTypeRegistry method getExtensionPoint.
private static IExtensionPoint getExtensionPoint() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint(EXT_POINT_ID);
assert point != null : "Invalid extension point id: " + EXT_POINT_ID;
return point;
}
use of org.eclipse.core.runtime.IExtensionPoint in project knime-core by knime.
the class ExtensibleUtilityFactory method readRenderersFromExtensionPoint.
private void readRenderersFromExtensionPoint() {
if (m_renderers != null) {
return;
}
synchronized (m_logger) {
if (m_renderers != null) {
return;
}
Map<String, DataValueRendererFactory> renderers = new HashMap<String, DataValueRendererFactory>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint(EXT_POINT_ID);
assert point != null : "Invalid extension point id: " + EXT_POINT_ID;
String defaultRendererId = null;
for (IExtension ext : point.getExtensions()) {
IConfigurationElement[] elements = ext.getConfigurationElements();
for (IConfigurationElement valueClassElement : elements) {
String valueClassName = valueClassElement.getAttribute("valueClass");
if (!m_valueClass.getName().equals(valueClassName)) {
continue;
}
for (IConfigurationElement rendererClassElement : valueClassElement.getChildren()) {
boolean suggestAsDefault = Boolean.parseBoolean(rendererClassElement.getAttribute("suggestAsDefault"));
try {
DataValueRendererFactory rendererFactory = (DataValueRendererFactory) rendererClassElement.createExecutableExtension("rendererFactoryClass");
renderers.put(rendererFactory.getId(), rendererFactory);
if (suggestAsDefault || (defaultRendererId == null)) {
defaultRendererId = rendererFactory.getId();
CORE_DEFAULT_PREFS.put(getPreferenceKey(), defaultRendererId);
}
} catch (CoreException ex) {
m_logger.error("Could not load registered renderer factory " + rendererClassElement.getAttribute("rendererFactoryClass") + " for " + valueClassName + " from plug-in " + valueClassElement.getNamespaceIdentifier() + ": " + ex.getMessage(), ex);
}
}
}
}
m_renderers = renderers;
}
}
use of org.eclipse.core.runtime.IExtensionPoint in project xtext-eclipse by eclipse.
the class SharedStateContributionRegistryImpl method initializeContributions.
private synchronized ImmutableList<? extends SharedStateContribution> initializeContributions() {
if (contributions == null) {
final ImmutableList.Builder<SharedStateContribution> listBuilder = ImmutableList.builder();
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(EXTENSION_POINT);
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : configurationElements) {
try {
Module childModule = (Module) configurationElement.createExecutableExtension("class");
SharedStateContribution contribution = createContribution(childModule);
listBuilder.add(contribution);
} catch (CoreException e) {
logger.error(e.getMessage(), e);
} catch (ProvisionException e) {
logger.error(e.getMessage(), e);
}
}
}
contributions = listBuilder.build();
}
return contributions;
}
use of org.eclipse.core.runtime.IExtensionPoint in project xtext-eclipse by eclipse.
the class Activator method initializeInjector.
protected void initializeInjector(BundleContext context) throws CoreException {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID + ".overridingGuiceModule");
IExtension[] extensions = point.getExtensions();
Module module = new SharedModule(context);
if (extensions.length != 0) {
int numberOfMixedInModules = 0;
for (IExtension iExtension : extensions) {
IConfigurationElement[] elements = iExtension.getConfigurationElements();
for (IConfigurationElement e : elements) {
try {
Module m = (Module) e.createExecutableExtension("class");
module = Modules.override(module).with(m);
numberOfMixedInModules++;
if (numberOfMixedInModules == 2) {
log.warn("Multiple overriding guice modules. Will use them in unspecified order.");
}
} catch (CoreException e1) {
log.error(e1.getMessage(), e1);
}
}
}
}
try {
injector = Guice.createInjector(module);
injector.createChildInjector(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(EagerContributionInitializer.class);
}
}).injectMembers(this);
} catch (Throwable t) {
handleGuiceInitializationError(t);
}
}
use of org.eclipse.core.runtime.IExtensionPoint in project xtext-eclipse by eclipse.
the class RegisteredGenmodelTest method testCanResolveGenmodelURIs.
@Ignore
@Test
public void testCanResolveGenmodelURIs() {
String declaringPlugin = "org.eclipse.emf.ecore";
String pointId = "generated_package";
IExtensionPoint point = registry.getExtensionPoint(declaringPlugin + "." + pointId);
IExtension[] extensions = point.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : configurationElements) {
String attribute = configurationElement.getAttribute("genModel");
if (attribute != null && attribute.length() != 0) {
String name = extension.getContributor().getName();
String uriAsString = "platform:/plugin/" + name + "/" + attribute;
URI uri = URI.createURI(uriAsString);
boolean exists = URIConverter.INSTANCE.exists(uri, Collections.emptyMap());
if (!exists) {
fail(uriAsString + " does not exist");
}
}
}
}
}
Aggregations