Search in sources :

Example 56 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project webtools.sourceediting by eclipse.

the class RegistryReader method readRegistry.

/**
 * Start the registry reading process using the supplied plugin ID and
 * extension point.
 */
protected void readRegistry(IExtensionRegistry registry, String pluginId, String extensionPoint) {
    IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
    if (point != null) {
        IExtension[] extensions = point.getExtensions();
        extensions = orderExtensions(extensions);
        for (int i = 0; i < extensions.length; i++) readExtension(extensions[i]);
    }
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtension(org.eclipse.core.runtime.IExtension) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint)

Example 57 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project eclipse-integration-commons by spring-projects.

the class DashboardMainPage method createNewProjectsSection.

private void createNewProjectsSection(Composite parent) {
    Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
    section.setText("Create");
    GridDataFactory.fillDefaults().grab(false, false).applyTo(section);
    section.setLayout(new GridLayout());
    final Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    headerComposite.setLayout(rowLayout);
    headerComposite.setBackground(null);
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    toolBarManager.createControl(headerComposite);
    section.setTextClient(headerComposite);
    toolBarManager.add(new NewWizardAction(getSite().getWorkbenchWindow()));
    toolBarManager.update(true);
    Composite container = toolkit.createComposite(section);
    container.setLayout(new GridLayout(2, false));
    GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_ID_NEW_WIZARD);
    IExtension[] extensions = extensionPoint.getExtensions();
    IConfigurationElement[] foundElements = new IConfigurationElement[6];
    String[] ids = new String[] { JAVA_WIZARD_ID, SPRING_WIZARD_ID, ROO_WIZARD_ID, GROOVY_WIZARD_ID, GRAILS_WIZARD_ID };
    for (IExtension extension : extensions) {
        IConfigurationElement[] elements = extension.getConfigurationElements();
        for (IConfigurationElement element : elements) {
            String id = element.getAttribute("id");
            for (int i = 0; i < ids.length; i++) {
                if (ids[i].equals(id) && element.getAttribute(ELEMENT_CLASS) != null && element.getAttribute(ELEMENT_NAME) != null && element.getAttribute(ELEMENT_ICON) != null) {
                    foundElements[i] = element;
                }
            }
        }
    }
    for (IConfigurationElement element : foundElements) {
        createNewProjectFromExtension(container, element);
    }
    section.setClient(container);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) NewWizardAction(org.eclipse.ui.actions.NewWizardAction) Section(org.eclipse.ui.forms.widgets.Section) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) GridLayout(org.eclipse.swt.layout.GridLayout) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtension(org.eclipse.core.runtime.IExtension) RowLayout(org.eclipse.swt.layout.RowLayout) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 58 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project webtools.sourceediting by eclipse.

the class JsTranslationAdapter method getJsTranslation.

/**
 * Returns the IJsTranslation for this adapter.
 *
 * @return a IJsTranslation
 */
public IJsTranslation getJsTranslation(boolean listenForChanges) {
    /*
		 * If no translation exists or switching from not listening to
		 * listening
		 */
    if (fJSTranslation == null || (!this.listenForChanges && listenForChanges)) {
        if (fJSTranslation != null)
            fJSTranslation.release();
        if (fTranslationAsFactory == null) {
            /* load the translation factory from the extension point */
            try {
                IExtensionRegistry registry = Platform.getExtensionRegistry();
                IExtensionPoint extensionPoint = registry.getExtensionPoint("org.eclipse.wst.jsdt.web.core.javascriptPreProcessor");
                IConfigurationElement[] points = extensionPoint.getConfigurationElements();
                int highestPriorityValue = -1;
                int highestPriorityIndex = -1;
                for (int i = 0; i < points.length; i++) {
                    String priority = points[i].getAttribute(PRIORITY_ATTRIB);
                    int value = Integer.parseInt(priority);
                    if (value > highestPriorityValue) {
                        highestPriorityIndex = i;
                        highestPriorityValue = value;
                    }
                }
                fTranslationAsFactory = (IJsTranslation) points[highestPriorityIndex].createExecutableExtension("class");
            } catch (Exception e) {
                Logger.logException(e);
            }
        }
        if (fTranslationAsFactory != null) {
            fJSTranslation = fTranslationAsFactory.getInstance(fHtmlDocument, getJavaProject(), listenForChanges);
        } else {
            fJSTranslation = new JsTranslation(fHtmlDocument, getJavaProject(), listenForChanges);
        }
        this.listenForChanges = listenForChanges;
    }
    shouldListenForChanges(listenForChanges);
    return fJSTranslation;
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 59 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project eclipse-integration-commons by spring-projects.

the class StartupExtensionPointReader method runStartupExtensions.

public static void runStartupExtensions() {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_ID_STARTUP);
    IExtension[] extensions = extensionPoint.getExtensions();
    for (IExtension extension : extensions) {
        IConfigurationElement[] elements = extension.getConfigurationElements();
        for (IConfigurationElement element : elements) {
            if (element.getName().compareTo(ELEMENT_STARTUP) == 0) {
                runStartupExtension(element);
            }
        }
    }
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtension(org.eclipse.core.runtime.IExtension) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 60 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project webtools.sourceediting by eclipse.

the class FileTaskScannerRegistryReader method readRegistry.

private void readRegistry() {
    fScannerInfos = new HashMap();
    // Just remember the elements, so plugins don't have to be activated,
    // unless extension attributes match those of interest
    IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(SCANNER_EXTENSION_POINT_ID);
    if (point != null) {
        fScannerElements = point.getConfigurationElements();
    }
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) HashMap(java.util.HashMap)

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