Search in sources :

Example 1 with IExtensionPoint

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

the class SchemaNode method addExtensionNodes.

/**
     * Add Extension nodes.
     */
//$NON-NLS-1$
@SuppressWarnings("unchecked")
private void addExtensionNodes() {
    String databaseProductName = getSession().getRoot().getDatabaseProductName().toLowerCase().trim();
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    //$NON-NLS-1$ //$NON-NLS-2$
    IExtensionPoint point = registry.getExtensionPoint("net.sourceforge.sqlexplorer", "node");
    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 {
                // include only nodes that are attachted to the schema
                // node..
                //$NON-NLS-1$
                String parent = ces[j].getAttribute("parent-node");
                if (parent.indexOf("schema") == -1) {
                    //$NON-NLS-1$
                    continue;
                }
                boolean isValidProduct = false;
                //$NON-NLS-1$ //$NON-NLS-2$
                String[] validProducts = ces[j].getAttribute("database-product-name").split(",");
                // include only nodes valid for this database
                for (int k = 0; k < validProducts.length; k++) {
                    String product = validProducts[k].toLowerCase().trim();
                    if (product.length() == 0) {
                        continue;
                    }
                    if (product.equals("*")) {
                        //$NON-NLS-1$
                        isValidProduct = true;
                        break;
                    }
                    //$NON-NLS-1$
                    String regex = TextUtil.replaceChar(product, '*', ".*");
                    if (databaseProductName.matches(regex)) {
                        isValidProduct = true;
                        break;
                    }
                }
                if (!isValidProduct) {
                    continue;
                }
                //$NON-NLS-1$
                String imagePath = ces[j].getAttribute("icon");
                //$NON-NLS-1$
                String id = ces[j].getAttribute("id");
                //$NON-NLS-1$
                String type = ces[j].getAttribute("table-type").trim();
                //$NON-NLS-1$
                AbstractNode childNode = (AbstractNode) ces[j].createExecutableExtension("class");
                childNode.setParent(this);
                childNode.setSession(psessionNode);
                childNode.setType(type);
                String fragmentId = id.substring(0, id.indexOf('.', END_INDEX));
                if (imagePath != null && imagePath.trim().length() != 0) {
                    childNode.setImage(ImageUtil.getFragmentImage(fragmentId, imagePath));
                }
                pchildNames.add(childNode.getLabelText());
                if (!isExcludedByFilter(childNode.getLabelText())) {
                    addChildNode(childNode);
                }
            } catch (Throwable ex) {
                //$NON-NLS-1$
                SqlBuilderPlugin.log(Messages.getString("SchemaNode.logMessage1"), ex);
            }
        }
    }
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtension(org.eclipse.core.runtime.IExtension) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 2 with IExtensionPoint

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

the class ExtendedNodeManager method getExtendedNodeHandler.

public static List<IExtendedNodeHandler> getExtendedNodeHandler() {
    if (extendedNodeHandler == null) {
        extendedNodeHandler = new ArrayList<IExtendedNodeHandler>();
        IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
        IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(//$NON-NLS-1$
        "org.talend.designer.core.extended_node_handler");
        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 IExtendedNodeHandler) {
                            extendedNodeHandler.add((IExtendedNodeHandler) service);
                        }
                    } catch (CoreException e) {
                        ExceptionHandler.process(e);
                    }
                }
            }
        }
    }
    return extendedNodeHandler;
}
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 3 with IExtensionPoint

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

the class TalendPaletteSearchIndex method getTalendDocPlugins.

protected PluginVersionInfo getTalendDocPlugins() {
    Set<String> totalIds = new HashSet<String>();
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint = registry.getExtensionPoint(TocFileProvider.EXTENSION_POINT_ID_TOC);
    IExtension[] extensions = extensionPoint.getExtensions();
    for (IExtension extension : extensions) {
        try {
            totalIds.add(extension.getNamespaceIdentifier());
        } catch (InvalidRegistryObjectException e) {
        // ignore this extension and move on
        }
    }
    Collection<String> additionalPluginIds = BaseHelpSystem.getLocalSearchManager().getPluginsWithSearchParticipants();
    totalIds.addAll(additionalPluginIds);
    Iterator<String> idIter = totalIds.iterator();
    while (idIter.hasNext()) {
        String id = idIter.next();
        if (!id.startsWith("org.talend.")) {
            idIter.remove();
        }
    }
    return new PluginVersionInfo(INDEXED_CONTRIBUTION_INFO_FILE, totalIds, indexDir, !exists());
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtension(org.eclipse.core.runtime.IExtension) InvalidRegistryObjectException(org.eclipse.core.runtime.InvalidRegistryObjectException) HashSet(java.util.HashSet) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry) PluginVersionInfo(org.eclipse.help.internal.search.PluginVersionInfo)

Example 4 with IExtensionPoint

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

the class CustomizeJetFilesProviderManager method loadJetsProvidersFromExtension.

private void loadJetsProvidersFromExtension() {
    providers = new ArrayList<AbstractJetFileProvider>();
    IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
    //$NON-NLS-1$
    IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("org.talend.designer.codegen.additional_jetfile");
    IExtension[] extensions = extensionPoint.getExtensions();
    for (IExtension extension : extensions) {
        IConfigurationElement[] configurationElements = extension.getConfigurationElements();
        for (IConfigurationElement configurationElement : configurationElements) {
            //$NON-NLS-1$               
            String id = configurationElement.getAttribute("id");
            try {
                AbstractJetFileProvider jetProvider = (AbstractJetFileProvider) configurationElement.createExecutableExtension(//$NON-NLS-1$
                "class");
                jetProvider.setId(id);
                providers.add(jetProvider);
            } catch (CoreException e) {
                //$NON-NLS-1$
                log.error(Messages.getString("JetFilesProviderManager.unableLoad", id), e);
            }
        }
    }
}
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 5 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint 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(Messages.getString("ComponentsProviderManager.unableLoad") + 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

IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)186 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)159 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)106 IExtension (org.eclipse.core.runtime.IExtension)91 CoreException (org.eclipse.core.runtime.CoreException)69 ArrayList (java.util.ArrayList)29 HashMap (java.util.HashMap)17 Platform (org.eclipse.core.runtime.Platform)17 Stream (java.util.stream.Stream)16 List (java.util.List)15 NodeLogger (org.knime.core.node.NodeLogger)15 Map (java.util.Map)14 Optional (java.util.Optional)14 Collection (java.util.Collection)9 Bundle (org.osgi.framework.Bundle)9 Collectors (java.util.stream.Collectors)8 IOException (java.io.IOException)6 Collections (java.util.Collections)6 LinkedList (java.util.LinkedList)6 Objects (java.util.Objects)6