Search in sources :

Example 31 with IExtensionRegistry

use of org.eclipse.core.runtime.IExtensionRegistry in project tesb-studio-se by Talend.

the class ESBService method addExtensionRepositoryNodes.

private void addExtensionRepositoryNodes(List<ERepositoryObjectType> arraysList) {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IConfigurationElement[] configurationElements = registry.getConfigurationElementsFor("org.talend.core.repository.repository_node_provider");
    for (IConfigurationElement element : configurationElements) {
        String type = element.getAttribute("type");
        ERepositoryObjectType repositoryNodeType = ERepositoryObjectType.valueOf(ERepositoryObjectType.class, type);
        if (repositoryNodeType != null) {
            arraysList.add(repositoryNodeType);
        }
    }
}
Also used : ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 32 with IExtensionRegistry

use of org.eclipse.core.runtime.IExtensionRegistry in project tdi-studio-se by Talend.

the class DataSetTableActionGroup method fillContextMenu.

/**
     * Fill the context menu with all the correct actions.
     * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
     */
public void fillContextMenu(IMenuManager menu) {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    //$NON-NLS-1$ //$NON-NLS-2$
    IExtensionPoint point = registry.getExtensionPoint("net.sourceforge.sqlexplorer", "dataSetTableContextAction");
    IExtension[] extensions = point.getExtensions();
    for (int i = 0; i < extensions.length; i++) {
        IExtension e = extensions[i];
        IConfigurationElement[] ces = e.getConfigurationElements();
        for (int j = 0; j < ces.length; j++) {
            try {
                //$NON-NLS-1$
                String group = ces[j].getAttribute("group");
                if (group == null || !group.equalsIgnoreCase("export")) {
                    //$NON-NLS-1$
                    // check if the action thinks it is suitable..
                    AbstractDataSetTableContextAction action = (AbstractDataSetTableContextAction) ces[j].createExecutableExtension(//$NON-NLS-1$
                    "class");
                    action.setTable(ptable);
                    action.setTableCursor(pcursor);
                    if (action.isAvailable()) {
                        menu.add(action);
                    }
                }
            } catch (Throwable ex) {
                //$NON-NLS-1$
                SqlBuilderPlugin.log(Messages.getString("DataSetTableActionGroup.logMessage1"), ex);
            }
        }
    }
    menu.add(new Separator());
    // add export options
    //$NON-NLS-1$
    MenuManager subMenu = new MenuManager(Messages.getString("DataSetTable.Actions.ExportSubMenu"));
    for (int i = 0; i < extensions.length; i++) {
        IExtension e = extensions[i];
        IConfigurationElement[] ces = e.getConfigurationElements();
        for (int j = 0; j < ces.length; j++) {
            try {
                //$NON-NLS-1$
                String group = ces[j].getAttribute("group");
                if (group != null && group.equalsIgnoreCase("export")) {
                    //$NON-NLS-1$
                    // check if the action thinks it is suitable..
                    AbstractDataSetTableContextAction action = (AbstractDataSetTableContextAction) ces[j].createExecutableExtension(//$NON-NLS-1$
                    "class");
                    action.setTable(ptable);
                    action.setTableCursor(pcursor);
                    if (action.isAvailable()) {
                        subMenu.add(action);
                    }
                }
            } catch (Throwable ex) {
                //$NON-NLS-1$
                SqlBuilderPlugin.log(Messages.getString("DataSetTableActionGroup.logMessage1"), ex);
            }
        }
    }
    menu.add(subMenu);
    menu.add(new Separator());
    menu.add(pcopyTableAction);
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtension(org.eclipse.core.runtime.IExtension) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) AbstractDataSetTableContextAction(org.talend.sqlbuilder.dataset.actions.AbstractDataSetTableContextAction) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) Separator(org.eclipse.jface.action.Separator) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 33 with IExtensionRegistry

use of org.eclipse.core.runtime.IExtensionRegistry in project tdi-studio-se by Talend.

the class AfterImportProjectUtil method getAfterImportProjectActions.

public static List<IAfterImportProjectAction> getAfterImportProjectActions() {
    try {
        IExtensionRegistry registry = Platform.getExtensionRegistry();
        IConfigurationElement[] configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT);
        List<IAfterImportProjectAction> models = new ArrayList<IAfterImportProjectAction>();
        for (int i = 0; i < configurationElements.length; i++) {
            IConfigurationElement element = configurationElements[i];
            IAfterImportProjectAction modelcalss = (IAfterImportProjectAction) element.createExecutableExtension(CLASS);
            models.add(modelcalss);
        }
        return models;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
    return new ArrayList<IAfterImportProjectAction>();
}
Also used : ArrayList(java.util.ArrayList) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 34 with IExtensionRegistry

use of org.eclipse.core.runtime.IExtensionRegistry in project tdi-studio-se by Talend.

the class CheckNodeManager method getCheckNodesService.

public static List<ICheckNodesService> getCheckNodesService() {
    if (checkNodeServices == null) {
        checkNodeServices = new ArrayList<ICheckNodesService>();
        IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
        //$NON-NLS-1$
        IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("org.talend.designer.core.check_nodes");
        if (extensionPoint != null) {
            IExtension[] extensions = extensionPoint.getExtensions();
            for (IExtension extension : extensions) {
                IConfigurationElement[] configurationElements = extension.getConfigurationElements();
                for (IConfigurationElement configurationElement : configurationElements) {
                    try {
                        //$NON-NLS-1$
                        Object service = configurationElement.createExecutableExtension("class");
                        if (service instanceof ICheckNodesService) {
                            checkNodeServices.add((ICheckNodesService) service);
                        }
                    } catch (CoreException e) {
                        ExceptionHandler.process(e);
                    }
                }
            }
        }
    }
    return checkNodeServices;
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 35 with IExtensionRegistry

use of org.eclipse.core.runtime.IExtensionRegistry in project tdi-studio-se by Talend.

the class ComponentsProviderManager method loadComponentsProvidersFromExtension.

private void loadComponentsProvidersFromExtension() {
    if (providers == null) {
        providers = new ArrayList<AbstractComponentsProvider>();
        IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
        //$NON-NLS-1$
        IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("org.talend.core.components_provider");
        IExtension[] extensions = extensionPoint.getExtensions();
        for (IExtension extension : extensions) {
            IConfigurationElement[] configurationElements = extension.getConfigurationElements();
            for (IConfigurationElement configurationElement : configurationElements) {
                //$NON-NLS-1$
                String id = configurationElement.getAttribute("id");
                //$NON-NLS-1$
                String folderName = configurationElement.getAttribute("folderName");
                String contributerName = configurationElement.getContributor().getName();
                IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
                if (!brandingService.isPoweredOnlyCamel() && id.equals("org.talend.designer.camel.components.localprovider.CamelLocalComponentsProvider")) {
                    folderName = "camel";
                }
                try {
                    AbstractComponentsProvider componentsProvider = (AbstractComponentsProvider) configurationElement.createExecutableExtension(//$NON-NLS-1$
                    "class");
                    componentsProvider.setId(id);
                    componentsProvider.setFolderName(folderName);
                    componentsProvider.setContributer(contributerName);
                    providers.add(componentsProvider);
                } catch (CoreException e) {
                    //$NON-NLS-1$
                    log.error("unable to load component provider" + id, e);
                }
            }
        }
    }
}
Also used : AbstractComponentsProvider(org.talend.core.model.components.AbstractComponentsProvider) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) IBrandingService(org.talend.core.ui.branding.IBrandingService) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Aggregations

IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)55 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)50 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)33 CoreException (org.eclipse.core.runtime.CoreException)25 IExtension (org.eclipse.core.runtime.IExtension)20 ArrayList (java.util.ArrayList)13 HashMap (java.util.HashMap)11 Platform (org.eclipse.core.runtime.Platform)9 Map (java.util.Map)8 Optional (java.util.Optional)8 Stream (java.util.stream.Stream)8 NodeLogger (org.knime.core.node.NodeLogger)8 Collection (java.util.Collection)7 List (java.util.List)6 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)6 DataTableSpec (org.knime.core.data.DataTableSpec)5 GlobalClassCreator (org.knime.core.eclipseUtil.GlobalClassCreator)5 SerializerMethodLoader (org.knime.core.internal.SerializerMethodLoader)5 File (java.io.File)4 Collections (java.util.Collections)4