Search in sources :

Example 1 with IExtension

use of org.eclipse.core.runtime.IExtension 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 2 with IExtension

use of org.eclipse.core.runtime.IExtension 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)

Example 3 with IExtension

use of org.eclipse.core.runtime.IExtension 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 4 with IExtension

use of org.eclipse.core.runtime.IExtension 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 5 with IExtension

use of org.eclipse.core.runtime.IExtension 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)

Aggregations

IExtension (org.eclipse.core.runtime.IExtension)15 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)12 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)12 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)10 CoreException (org.eclipse.core.runtime.CoreException)8 ActionSetRegistry (org.eclipse.ui.internal.registry.ActionSetRegistry)2 IActionSetDescriptor (org.eclipse.ui.internal.registry.IActionSetDescriptor)2 AbstractComponentsProvider (org.talend.core.model.components.AbstractComponentsProvider)2 IBrandingService (org.talend.core.ui.branding.IBrandingService)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 InvalidRegistryObjectException (org.eclipse.core.runtime.InvalidRegistryObjectException)1 PluginVersionInfo (org.eclipse.help.internal.search.PluginVersionInfo)1 IAction (org.eclipse.jface.action.IAction)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1