use of org.eclipse.core.runtime.IExtensionRegistry in project knime-core by knime.
the class StartupMessage method getAllStartupMessages.
/**
* Returns all startup messages.
*
* @return a list with all startup messages, never <code>null</code>
*/
public static List<StartupMessage> getAllStartupMessages() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint("org.knime.workbench.ui.startupMessages");
assert point != null : "Invalid extension point id: org.knime.workbench.ui.startupMessages";
List<StartupMessage> messages = new ArrayList<>();
for (IExtension ext : point.getExtensions()) {
IConfigurationElement[] elements = ext.getConfigurationElements();
for (IConfigurationElement providerElement : elements) {
try {
StartupMessageProvider provider = (StartupMessageProvider) providerElement.createExecutableExtension("class");
messages.addAll(provider.getMessages());
} catch (CoreException ex) {
NodeLogger.getLogger(StartupMessage.class).error("Could not create startup message provider " + providerElement.getAttribute("class") + " from plug-in " + providerElement.getNamespaceIdentifier() + ": " + ex.getMessage(), ex);
}
}
}
return messages;
}
use of org.eclipse.core.runtime.IExtensionRegistry in project knime-core by knime.
the class KNIMEApplicationActionBarAdvisor method createMultiInstanceViewActions.
private List<IAction> createMultiInstanceViewActions() {
List<IAction> result = new LinkedList<IAction>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint("org.knime.workbench.ui.multipleInstanceViews");
if (point == null) {
return result;
}
IExtension[] ext = point.getExtensions();
if (ext == null) {
return result;
}
for (IExtension extension : ext) {
IConfigurationElement[] conf = extension.getConfigurationElements();
if (conf == null) {
continue;
}
for (IConfigurationElement c : conf) {
String viewId = c.getAttribute("id");
if (viewId == null || viewId.isEmpty()) {
continue;
}
IAction viewAction = createViewAction(viewId);
if (viewAction == null) {
continue;
}
result.add(viewAction);
}
}
// sort actions by view name
Collections.sort(result, new Comparator<IAction>() {
@Override
public int compare(final IAction o1, final IAction o2) {
if (o1 == null) {
return -1;
}
if (o2 == null) {
return 1;
}
return o1.getText().compareTo(o2.getText());
}
});
return result;
}
use of org.eclipse.core.runtime.IExtensionRegistry in project yamcs-studio by yamcs.
the class AutoCompleteUIPlugin method readExtensionRegistry.
private void readExtensionRegistry() throws Exception {
// Registry lookup
final IExtensionRegistry registry = RegistryFactory.getRegistry();
final IConfigurationElement[] configs = registry.getConfigurationElementsFor(EXT_ID);
if (configs.length > 1)
throw new Exception("Found " + configs.length + " Auto-Complete UI Helper implementations, expecting at most one");
if (configs.length == 1) {
// Use implementations from extension point
Logger.getLogger(getClass().getName()).config("UI Helper provided by " + configs[0].getContributor().getName());
AutoCompleteUIPlugin.ui = (UIHelper) configs[0].createExecutableExtension("ui");
} else {
// Use default implementations
AutoCompleteUIPlugin.ui = new UIHelper();
}
}
use of org.eclipse.core.runtime.IExtensionRegistry in project yamcs-studio by yamcs.
the class WidgetsService method loadAllFeedbackFactories.
@SuppressWarnings("nls")
private void loadAllFeedbackFactories() {
IExtensionRegistry extReg = Platform.getExtensionRegistry();
IConfigurationElement[] confElements = extReg.getConfigurationElementsFor(OPIBuilderPlugin.EXTPOINT_FEEDBACK_FACTORY);
for (IConfigurationElement element : confElements) {
String typeId = element.getAttribute("typeId");
if (typeId != null) {
try {
feedbackFactoriesMap.put(typeId, (IGraphicalFeedbackFactory) element.createExecutableExtension("class"));
} catch (CoreException e) {
OPIBuilderPlugin.getLogger().log(Level.WARNING, "Cannot load feedback provider", e);
}
}
}
}
use of org.eclipse.core.runtime.IExtensionRegistry in project yamcs-studio by yamcs.
the class SimplePVLayer method getAllPVFactoryExtensions.
/**
* Get all available PV Factory extensions.
*
* @return the IDs of all available PV Factory extensions.
*/
public static String[] getAllPVFactoryExtensions() {
IExtensionRegistry extReg = Platform.getExtensionRegistry();
IConfigurationElement[] confElements = extReg.getConfigurationElementsFor(EXTPOINT_PVFACTORY);
String[] result = new String[confElements.length];
int i = 0;
for (IConfigurationElement element : confElements) {
String name = element.getAttribute("id");
result[i++] = name;
}
return result;
}
Aggregations