Search in sources :

Example 26 with IConfigurationElement

use of org.eclipse.core.runtime.IConfigurationElement in project bndtools by bndtools.

the class PluginClassSorter method compare.

@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    IConfigurationElement elem1 = (IConfigurationElement) e1;
    IConfigurationElement elem2 = (IConfigurationElement) e2;
    // Sort undeprecated plugins before deprecated ones.
    int result = sortDeprecation(elem1, elem2);
    if (result != 0)
        return result;
    // Sort by rank
    result = sortByRank(elem1, elem2);
    if (result != 0)
        return result;
    // Finally sort on name
    return sortName(elem1, elem2);
}
Also used : IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 27 with IConfigurationElement

use of org.eclipse.core.runtime.IConfigurationElement in project bndtools by bndtools.

the class Activator method getReleaseParticipants.

public static List<IReleaseParticipant> getReleaseParticipants() {
    //$NON-NLS-1$
    IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(PLUGIN_ID, "bndtoolsReleaseParticipant");
    if (elements.length == 0) {
        return Collections.emptyList();
    }
    List<IReleaseParticipant> participants = new ArrayList<IReleaseParticipant>();
    for (IConfigurationElement element : elements) {
        try {
            //$NON-NLS-1$
            IReleaseParticipant participant = (IReleaseParticipant) element.createExecutableExtension("class");
            //$NON-NLS-1$
            String strRanking = element.getAttribute("ranking");
            int ranking = 0;
            if (strRanking != null && strRanking.length() > 0) {
                ranking = Integer.parseInt(strRanking);
            }
            participant.setRanking(ranking);
            participants.add(participant);
        } catch (CoreException e) {
            logError(Messages.errorExecutingStartupParticipant, e);
        }
    }
    return participants;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) IReleaseParticipant(bndtools.release.api.IReleaseParticipant) ArrayList(java.util.ArrayList) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 28 with IConfigurationElement

use of org.eclipse.core.runtime.IConfigurationElement in project che by eclipse.

the class ExtensionsRegistry method getDocumentSetupParticipants.

/**
	 * Returns the set of setup participants for the given file name or extension.
	 *
	 * @param nameOrExtension the name or extension to be used for lookup
	 * @return the sharable set of document setup participants
	 */
protected List getDocumentSetupParticipants(String nameOrExtension) {
    Set set = (Set) fSetupParticipantDescriptors.get(nameOrExtension);
    if (set == null)
        return null;
    List participants = new ArrayList();
    Iterator e = set.iterator();
    while (e.hasNext()) {
        IConfigurationElement entry = (IConfigurationElement) e.next();
        Object participant = getExtension(entry, fSetupParticipants, IDocumentSetupParticipant.class);
        if (participant != null)
            participants.add(participant);
    }
    return participants;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 29 with IConfigurationElement

use of org.eclipse.core.runtime.IConfigurationElement in project flux by eclipse.

the class ContributionContextTypeRegistry method createContextType.

/**
	 * Tries to create a context type given an id. Contributions to the
	 * <code>org.eclipse.ui.editors.templates</code> extension point are
	 * searched for the given identifier and the specified context type
	 * instantiated if it is found. Any contributed
	 * {@link org.eclipse.jface.text.templates.TemplateVariableResolver}s
	 * are also instantiated and added to the context type.
	 *
	 * @param id the id for the context type as specified in XML
	 * @return the instantiated and configured context type, or
	 *         <code>null</code> if it is not found or cannot be instantiated
	 */
public static TemplateContextType createContextType(String id) {
    Assert.isNotNull(id);
    IConfigurationElement[] extensions = getTemplateExtensions();
    TemplateContextType type;
    try {
        type = createContextType(extensions, id);
        if (type != null) {
            TemplateVariableResolver[] resolvers = createResolvers(extensions, id);
            for (int i = 0; i < resolvers.length; i++) type.addResolver(resolvers[i]);
        }
    } catch (CoreException e) {
        //EditorsPlugin.log(e);
        type = null;
    }
    return type;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) TemplateContextType(org.eclipse.jface.text.templates.TemplateContextType) TemplateVariableResolver(org.eclipse.jface.text.templates.TemplateVariableResolver)

Example 30 with IConfigurationElement

use of org.eclipse.core.runtime.IConfigurationElement in project translationstudio8 by heartsome.

the class SelfHelpDisplay method createHelpDisplay.

private static void createHelpDisplay() {
    IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(HELP_DISPLAY_EXTENSION_ID);
    if (point != null) {
        IExtension[] extensions = point.getExtensions();
        if (extensions.length != 0) {
            // We need to pick up the non-default configuration
            IConfigurationElement[] elements = extensions[0].getConfigurationElements();
            if (elements.length == 0)
                return;
            IConfigurationElement displayElement = elements[0];
            // Instantiate the help display
            try {
                helpDisplay = (AbstractHelpDisplay) (displayElement.createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE));
            } catch (CoreException e) {
                HelpBasePlugin.logStatus(e.getStatus());
            }
        }
    }
}
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)

Aggregations

IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)62 CoreException (org.eclipse.core.runtime.CoreException)32 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)14 IExtension (org.eclipse.core.runtime.IExtension)12 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)12 ISafeRunnable (org.eclipse.core.runtime.ISafeRunnable)11 ArrayList (java.util.ArrayList)8 List (java.util.List)5 GridData (org.eclipse.swt.layout.GridData)4 HashSet (java.util.HashSet)3 Set (java.util.Set)3 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 Image (org.eclipse.swt.graphics.Image)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 HeaderClause (aQute.bnd.build.model.clauses.HeaderClause)2 File (java.io.File)2 URL (java.net.URL)2