Search in sources :

Example 1 with NodeTripleProviderFactory

use of org.knime.workbench.workflowcoach.data.NodeTripleProviderFactory in project knime-core by knime.

the class ConfigureAction method run.

/**
 * {@inheritDoc}
 */
@Override
public void run() {
    List<NodeTripleProviderFactory> nodeTripleProviderFactories = NodeRecommendationManager.getInstance().getNodeTripleProviderFactories();
    String[] prefPageIDs = new String[nodeTripleProviderFactories.size()];
    for (int i = 0; i < prefPageIDs.length; i++) {
        prefPageIDs[i] = nodeTripleProviderFactories.get(i).getPreferencePageID();
    }
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(m_viewer.getControl().getShell(), WorkflowCoachPreferencePage.ID, prefPageIDs, null);
    dialog.open();
}
Also used : PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) NodeTripleProviderFactory(org.knime.workbench.workflowcoach.data.NodeTripleProviderFactory)

Example 2 with NodeTripleProviderFactory

use of org.knime.workbench.workflowcoach.data.NodeTripleProviderFactory in project knime-core by knime.

the class NodeRecommendationManager method getNodeTripleProviderFactories.

/**
 * Returns all available {@link NodeTripleProviderFactory}s. Node triple provider factories can be added via the
 * respective extension point.
 *
 * @return a list of available node triple provider factories
 */
public List<NodeTripleProviderFactory> getNodeTripleProviderFactories() {
    List<NodeTripleProviderFactory> l = new ArrayList<NodeTripleProviderFactory>(3);
    // get node triple providers from extension points
    IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(TRIPLE_PROVIDER_EXTENSION_POINT_ID);
    assert (extPoint != null) : "Invalid extension point: " + TRIPLE_PROVIDER_EXTENSION_POINT_ID;
    IExtension[] extensions = extPoint.getExtensions();
    for (IExtension ext : extensions) {
        for (IConfigurationElement conf : ext.getConfigurationElements()) {
            try {
                NodeTripleProviderFactory factory = (NodeTripleProviderFactory) conf.createExecutableExtension("factory-class");
                l.add(factory);
            } catch (CoreException e) {
                LOGGER.warn("Could not create factory from " + conf.getAttribute("factory-class"));
            }
        }
    }
    return l;
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) ArrayList(java.util.ArrayList) NodeTripleProviderFactory(org.knime.workbench.workflowcoach.data.NodeTripleProviderFactory) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Aggregations

NodeTripleProviderFactory (org.knime.workbench.workflowcoach.data.NodeTripleProviderFactory)2 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IExtension (org.eclipse.core.runtime.IExtension)1 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)1 PreferenceDialog (org.eclipse.jface.preference.PreferenceDialog)1