Search in sources :

Example 6 with IExtensionRegistry

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

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

use of org.eclipse.core.runtime.IExtensionRegistry in project cubrid-manager by CUBRID.

the class QueryEditorToolBar method loadDbNavigatorMenu.

/**
	 * 
	 * Load the database selection pop-up menu from extension points
	 * 
	 */
private void loadDbNavigatorMenu() {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint extension = registry.getExtensionPoint(CommonUIPlugin.PLUGIN_ID + "." + QUERY_POPUP_MENUS_EXTENSION_POINT);
    if (extension == null) {
        dbMenu = null;
    } else {
        IConfigurationElement[] configElements = extension.getConfigurationElements();
        for (IConfigurationElement ce : configElements) {
            try {
                dbMenu = (DatabaseNavigatorMenu) ce.createExecutableExtension("class");
            } catch (CoreException e) {
                dbMenu = null;
            }
        }
    }
    if (dbMenu == null) {
        dbMenu = new DatabaseNavigatorMenu();
    }
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 9 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)

Example 10 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)

Aggregations

IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)15 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)14 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)11 IExtension (org.eclipse.core.runtime.IExtension)10 CoreException (org.eclipse.core.runtime.CoreException)7 ArrayList (java.util.ArrayList)3 List (java.util.List)2 AbstractComponentsProvider (org.talend.core.model.components.AbstractComponentsProvider)2 IBrandingService (org.talend.core.ui.branding.IBrandingService)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)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 Separator (org.eclipse.jface.action.Separator)1 IPreferenceNode (org.eclipse.jface.preference.IPreferenceNode)1 IPreferencePage (org.eclipse.jface.preference.IPreferencePage)1 PreferenceManager (org.eclipse.jface.preference.PreferenceManager)1