use of org.eclipse.core.runtime.IConfigurationElement 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.IConfigurationElement in project knime-core by knime.
the class MissingCellHandlerFactoryManager method registerExtensionPoints.
/**
* Registers all extension point implementations.
* @param extPointId id of the extension point
* @param extPointAttrDf attribute of the factory class within the handler extension point
*/
protected void registerExtensionPoints(final String extPointId, final String extPointAttrDf) {
try {
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint point = registry.getExtensionPoint(extPointId);
if (point == null) {
LOGGER.error("Invalid extension point: " + extPointId);
throw new IllegalStateException("ACTIVATION ERROR: " + " --> Invalid extension point: " + extPointId);
}
for (final IConfigurationElement elem : point.getConfigurationElements()) {
final String operator = elem.getAttribute(extPointAttrDf);
final String decl = elem.getDeclaringExtension().getUniqueIdentifier();
if ((operator == null) || operator.isEmpty()) {
LOGGER.error("The extension '" + decl + "' doesn't provide the required attribute '" + extPointAttrDf + "'");
LOGGER.error("Extension " + decl + " ignored.");
continue;
}
try {
final MissingCellHandlerFactory factory = (MissingCellHandlerFactory) elem.createExecutableExtension(extPointAttrDf);
addMissingCellHandlerFactory(factory);
} catch (final Exception t) {
LOGGER.error("Problems during initialization of missing value handler factory (with id '" + operator + "'.)");
if (decl != null) {
LOGGER.error("Extension " + decl + " ignored.", t);
}
}
}
} catch (final Exception e) {
LOGGER.error("Exception while registering MissingCellHandler extensions");
}
}
use of org.eclipse.core.runtime.IConfigurationElement in project knime-core by knime.
the class AbstractWizardNodeView method getAllWizardNodeViews.
/**
* Queries extension point for additional {@link AbstractWizardNodeView} implementations.
* @return A list with all registered view implementations.
*/
@SuppressWarnings("unchecked")
public static List<WizardNodeViewExtension> getAllWizardNodeViews() {
List<WizardNodeViewExtension> viewExtensionList = new ArrayList<WizardNodeViewExtension>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint(EXT_POINT_ID);
assert point != null : "Invalid extension point id: " + EXT_POINT_ID;
for (IExtension ext : point.getExtensions()) {
IConfigurationElement[] elements = ext.getConfigurationElements();
for (IConfigurationElement viewElement : elements) {
String viewClassName = viewElement.getAttribute("viewClass");
String viewName = viewElement.getAttribute("name");
String viewDesc = viewElement.getAttribute("description");
Class<AbstractWizardNodeView<?, ?, ?>> viewClass;
try {
viewClass = (Class<AbstractWizardNodeView<?, ?, ?>>) Class.forName(viewClassName);
viewExtensionList.add(new WizardNodeViewExtension(viewClass, viewName, viewDesc));
} catch (ClassNotFoundException ex) {
NodeLogger.getLogger(AbstractWizardNodeView.class).coding("Could not find implementation for " + viewClassName, ex);
}
}
}
return viewExtensionList;
}
use of org.eclipse.core.runtime.IConfigurationElement in project knime-core by knime.
the class WebResourceController method getConfigurationFromID.
private static IConfigurationElement getConfigurationFromID(final String extensionPointId, final String configurationID, final String jsObjectID) {
if (jsObjectID != null) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] configurationElements = registry.getConfigurationElementsFor(extensionPointId);
for (IConfigurationElement element : configurationElements) {
if (jsObjectID.equals(element.getAttribute(configurationID))) {
return element;
}
}
}
return null;
}
use of org.eclipse.core.runtime.IConfigurationElement in project bndtools by bndtools.
the class PluginsPart method doEdit.
void doEdit() {
HeaderClause header = (HeaderClause) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
if (header != null) {
Attrs copyOfProperties = new Attrs(header.getAttribs());
IConfigurationElement configElem = configElements.get(header.getName());
PluginEditWizard wizard = new PluginEditWizard(configElem, copyOfProperties);
WizardDialog dialog = new WizardDialog(getManagedForm().getForm().getShell(), wizard);
if (dialog.open() == Window.OK && wizard.isChanged()) {
header.getAttribs().clear();
header.getAttribs().putAll(copyOfProperties);
viewer.update(header, null);
markDirty();
}
}
}
Aggregations