Search in sources :

Example 96 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project linuxtools by eclipse.

the class ChangeLogPreferencesPage method populateEditorList.

private void populateEditorList(IPreferenceStore store) {
    IExtensionPoint editorExtensions = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.linuxtools.changelog.core", // $NON-NLS-1$ //$NON-NLS-2$
    "editorContribution");
    if (editorExtensions != null) {
        IConfigurationElement[] elements = editorExtensions.getConfigurationElements();
        for (IConfigurationElement element : elements) {
            if (element.getName().equals("editor")) {
                // $NON-NLS-1$
                // $NON-NLS-1$
                String fname = element.getAttribute("name");
                editorList.add(fname);
                if (fname.equals(store.getString("IChangeLogConstants.DEFAULT_EDITOR"))) {
                    // $NON-NLS-1$
                    editorList.setSelection(editorList.getItemCount() - 1);
                }
            }
        }
    }
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 97 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project linuxtools by eclipse.

the class GprofLaunchTest method setUp.

@Before
public void setUp() throws Exception {
    // $NON-NLS-1$
    proj = createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), "fibTest");
    ProjectScope ps = new ProjectScope(proj.getProject());
    ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, ProviderProfileConstants.PLUGIN_ID);
    scoped.setSearchContexts(new IScopeContext[] { ps, InstanceScope.INSTANCE });
    scoped.setValue(ProviderProfileConstants.PREFS_KEY + GPROF_CATEGORY, GPROF_PROVIDER_ID);
    scoped.setValue(ProviderProfileConstants.USE_PROJECT_SETTINGS + GPROF_CATEGORY, true);
    scoped.save();
    IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(LAUNCH_SHORT_EXTPT);
    IConfigurationElement[] configs = extPoint.getConfigurationElements();
    for (IConfigurationElement cfg : configs) {
        if (cfg.getAttribute("id").equals(ID)) {
            // $NON-NLS-1$
            try {
                // $NON-NLS-1$
                shortcut = (ProviderLaunchShortcut) cfg.createExecutableExtension("class");
                // $NON-NLS-1$
                launchConfigTypeId = cfg.getChildren("class")[0].getChildren("parameter")[1].getAttribute("value");
            } catch (Exception e) {
                fail(e.getMessage());
            }
        }
    }
    config = createConfiguration(proj.getProject());
    // (otherwise test hangs on 'enable GGprof support' dialogue. )
    enableGprofSupport();
    // ---- Continue with launch.
    launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
    wc = config.getWorkingCopy();
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) Launch(org.eclipse.debug.core.Launch) ILaunch(org.eclipse.debug.core.ILaunch) ScopedPreferenceStore(org.eclipse.ui.preferences.ScopedPreferenceStore) CoreException(org.eclipse.core.runtime.CoreException) Before(org.junit.Before)

Example 98 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project linuxtools by eclipse.

the class GprofShortcutTest method setUp.

@Before
public void setUp() throws Exception {
    // $NON-NLS-1$
    proj = createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), "fibTest2");
    ProjectScope ps = new ProjectScope(proj.getProject());
    ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, ProviderProfileConstants.PLUGIN_ID);
    scoped.setSearchContexts(new IScopeContext[] { ps, InstanceScope.INSTANCE });
    scoped.setValue(ProviderProfileConstants.PREFS_KEY + GPROF_CATEGORY, GPROF_PROVIDER_ID);
    scoped.setValue(ProviderProfileConstants.USE_PROJECT_SETTINGS + GPROF_CATEGORY, true);
    scoped.save();
    IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(LAUNCH_SHORT_EXTPT);
    IConfigurationElement[] configs = extPoint.getConfigurationElements();
    for (IConfigurationElement cfg : configs) {
        if (cfg.getAttribute("id").equals(ID)) {
            // $NON-NLS-1$
            try {
                // $NON-NLS-1$
                shortcut = (ProviderLaunchShortcut) cfg.createExecutableExtension("class");
                // $NON-NLS-1$
                launchConfigTypeId = cfg.getChildren("class")[0].getChildren("parameter")[1].getAttribute("value");
            } catch (Exception e) {
                fail(e.getMessage());
            }
        }
    }
    config = createConfiguration(proj.getProject());
    launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
    wc = config.getWorkingCopy();
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) Launch(org.eclipse.debug.core.Launch) ILaunch(org.eclipse.debug.core.ILaunch) ScopedPreferenceStore(org.eclipse.ui.preferences.ScopedPreferenceStore) CModelException(org.eclipse.cdt.core.model.CModelException) Before(org.junit.Before)

Example 99 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project linuxtools by eclipse.

the class ChangeLogEditor method getConfig.

/**
 * Gets appropriate style editor from user pref.
 *
 * @return configuration for the Changelog editor
 */
private SourceViewerConfiguration getConfig() {
    IExtensionPoint editorExtensions = null;
    IEditorChangeLogContrib editorContrib = null;
    // get editor which is stored in preference.
    IPreferenceStore store = ChangelogPlugin.getDefault().getPreferenceStore();
    // $NON-NLS-1$
    String pref_Editor = store.getString("IChangeLogConstants.DEFAULT_EDITOR");
    editorExtensions = // $NON-NLS-1$
    Platform.getExtensionRegistry().getExtensionPoint(// $NON-NLS-1$
    "org.eclipse.linuxtools.changelog.core", // $NON-NLS-1$
    "editorContribution");
    if (editorExtensions != null) {
        IConfigurationElement[] elements = editorExtensions.getConfigurationElements();
        for (int i = 0; i < elements.length; i++) {
            if (// $NON-NLS-1$
            elements[i].getName().equals("editor") && (elements[i].getAttribute("name").equals(pref_Editor))) {
                try {
                    IConfigurationElement bob = elements[i];
                    // $NON-NLS-1$
                    editorContrib = (IEditorChangeLogContrib) bob.createExecutableExtension("class");
                    return (SourceViewerConfiguration) editorContrib;
                } catch (CoreException e) {
                    ChangelogPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
                }
            }
        }
    }
    return null;
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IEditorChangeLogContrib(org.eclipse.linuxtools.changelog.core.IEditorChangeLogContrib) CoreException(org.eclipse.core.runtime.CoreException) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint)

Example 100 with IExtensionPoint

use of org.eclipse.core.runtime.IExtensionPoint in project linuxtools by eclipse.

the class CApplicationLaunchShortcut method getProxy.

private ILaunchShortcut2 getProxy() {
    if (proxy == null) {
        // Get a proxy to CDT's CApplicationLaunchShortcut class which is internal
        // This plug-in has a dependency on org.eclipe.cdt.debug.ui so this extension is expected to be found.
        IExtensionPoint extPoint = // $NON-NLS-1$
        Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.debug.ui.launchShortcuts");
        IConfigurationElement[] configs = extPoint.getConfigurationElements();
        for (IConfigurationElement config : configs) {
            Object obj = null;
            if (config.getName().equals("shortcut")) {
                // $NON-NLS-1$
                // $NON-NLS-1$
                String id = config.getAttribute("id");
                if (id.equals(CDT_LAUNCH_SHORTCUT_ID)) {
                    try {
                        // $NON-NLS-1$
                        obj = config.createExecutableExtension("class");
                    } catch (CoreException e) {
                        ProfileLaunchPlugin.log(e);
                    }
                    if (obj instanceof ILaunchShortcut2) {
                        proxy = (ILaunchShortcut2) obj;
                        break;
                    }
                }
            }
            if (proxy != null)
                break;
        }
    }
    return proxy;
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) ILaunchShortcut2(org.eclipse.debug.ui.ILaunchShortcut2) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

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