Search in sources :

Example 91 with IExtensionPoint

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

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

the class AbstractMultiPageTalendEditor method createPage2.

// create jobscript editor
protected void createPage2() {
    if (!GlobalServiceRegister.getDefault().isServiceRegistered(ICreateXtextProcessService.class)) {
        return;
    }
    String scriptValue = "";
    try {
        IProject currentProject = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
        String jobScriptVersion = "";
        if (getEditorInput() != null && getEditorInput() instanceof RepositoryEditorInput) {
            Item item = ((RepositoryEditorInput) getEditorInput()).getItem();
            if (item != null) {
                Property property = item.getProperty();
                if (property != null) {
                    jobScriptVersion = "_" + property.getVersion();
                }
            }
        }
        IFile file = currentProject.getFolder("temp").getFile(getEditorInput().getName() + jobScriptVersion + "_job" + ".jobscript");
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(scriptValue.getBytes());
        if (file.exists()) {
            file.delete(true, null);
            file.create(byteArrayInputStream, true, null);
            file.setContents(byteArrayInputStream, 0, null);
        } else {
            file.create(byteArrayInputStream, true, null);
        }
        String pointId = "org.talend.metalanguage.jobscript.JobScriptForMultipage";
        // the way to get the xtextEditor programmly
        IEditorInput editorInput = new FileEditorInput(file);
        IExtensionPoint ep = RegistryFactory.getRegistry().getExtensionPoint("org.eclipse.ui.editors");
        IExtension[] extensions = ep.getExtensions();
        IExtension ex;
        IConfigurationElement confElem = null;
        for (IExtension extension : extensions) {
            ex = extension;
            if (ex.getContributor().getName().equals("org.talend.metalanguage.jobscript.ui")) {
                for (IConfigurationElement c : ex.getConfigurationElements()) {
                    if (c.getName().equals("editor") && c.getAttribute("id").equals(pointId)) {
                        confElem = c;
                        break;
                    }
                }
            }
        }
        if (confElem != null) {
            jobletEditor = (AbstractDecoratedTextEditor) confElem.createExecutableExtension("class");
            if (jobletEditor != null) {
                int index = addPage(jobletEditor, editorInput);
                setPageText(index, "Jobscript");
            }
        }
    } catch (PartInitException e) {
        ExceptionHandler.process(e);
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    } catch (CoreException e) {
        ExceptionHandler.process(e);
    }
}
Also used : RepositoryEditorInput(org.talend.core.repository.ui.editor.RepositoryEditorInput) IFile(org.eclipse.core.resources.IFile) ICreateXtextProcessService(org.talend.core.services.ICreateXtextProcessService) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IProject(org.eclipse.core.resources.IProject) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) ByteArrayInputStream(java.io.ByteArrayInputStream) IExtension(org.eclipse.core.runtime.IExtension) FileEditorInput(org.eclipse.ui.part.FileEditorInput) PersistenceException(org.talend.commons.exception.PersistenceException) PartInitException(org.eclipse.ui.PartInitException) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) Property(org.talend.core.model.properties.Property) IEditorInput(org.eclipse.ui.IEditorInput)

Example 93 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("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 94 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project eclipse.platform.text by eclipse.

the class DocumentProviderRegistry method initialize.

/**
 * Initializes the document provider registry. It retrieves all implementers of the <code>documentProviders</code>
 * extension point and remembers those implementers based on the name extensions and the editor input
 * types they are for.
 */
private void initialize() {
    IExtensionPoint extensionPoint;
    // $NON-NLS-1$
    extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EditorsUI.PLUGIN_ID, "documentProviders");
    if (extensionPoint == null) {
        String msg = NLSUtility.format(TextEditorMessages.DocumentProviderRegistry_error_extension_point_not_found, PlatformUI.PLUGIN_ID);
        Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
        ILog log = Platform.getLog(bundle);
        log.log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, msg, null));
        return;
    }
    IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
    for (int i = 0; i < elements.length; i++) {
        // $NON-NLS-1$
        read(fExtensionMapping, elements[i], "extensions");
        // $NON-NLS-1$
        read(fInputTypeMapping, elements[i], "inputTypes");
    }
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) Bundle(org.osgi.framework.Bundle) ILog(org.eclipse.core.runtime.ILog) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint)

Example 95 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project eclipse.platform.text by eclipse.

the class MarkerAnnotationPreferences method initializeSharedMakerAnnotationPreferences.

/**
 * Reads all extensions provided for the <code>markerAnnotationSpecification</code> extension point and
 * translates them into <code>AnnotationPreference</code> objects.
 */
private void initializeSharedMakerAnnotationPreferences() {
    // initialize lists - indicates that the initialization happened
    fFragments = new ArrayList<>(2);
    fPreferences = new ArrayList<>(2);
    // populate list
    // $NON-NLS-1$
    IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EditorsUI.PLUGIN_ID, "markerAnnotationSpecification");
    if (extensionPoint != null) {
        IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
        for (int i = 0; i < elements.length; i++) {
            AnnotationPreference spec = createSpec(elements[i]);
            if (spec != null)
                fFragments.add(spec);
            if (isComplete(spec))
                fPreferences.add(spec);
        }
    }
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint)

Aggregations

IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)187 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)160 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)107 IExtension (org.eclipse.core.runtime.IExtension)92 CoreException (org.eclipse.core.runtime.CoreException)70 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