Search in sources :

Example 61 with IConfigurationElement

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

the class BuildErrorDetailsHandlers method findHandler.

public BuildErrorDetailsHandler findHandler(String type) {
    if (type == null)
        return DefaultBuildErrorDetailsHandler.INSTANCE;
    BuildErrorDetailsHandler handler = cache.get(type);
    if (handler != null)
        return handler;
    handler = DefaultBuildErrorDetailsHandler.INSTANCE;
    IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(Plugin.PLUGIN_ID, "buildErrorDetailsHandlers");
    if (elements != null) {
        for (IConfigurationElement element : elements) {
            if (type.equals(element.getAttribute("typeMatch"))) {
                try {
                    handler = (BuildErrorDetailsHandler) element.createExecutableExtension("class");
                    break;
                } catch (Exception e) {
                    logger.logError("Error instantiating build error handler for type " + type, e);
                }
            }
        }
    }
    BuildErrorDetailsHandler mapped = cache.putIfAbsent(type, handler);
    if (mapped != null)
        return mapped;
    return handler;
}
Also used : IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 62 with IConfigurationElement

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

the class MarkerSupport method loadValidators.

static List<IValidator> loadValidators() {
    List<IValidator> validators = null;
    IConfigurationElement[] validatorElems = Platform.getExtensionRegistry().getConfigurationElementsFor(CORE_PLUGIN_ID, "validators");
    if (validatorElems != null && validatorElems.length > 0) {
        validators = new ArrayList<IValidator>(validatorElems.length);
        for (IConfigurationElement elem : validatorElems) {
            try {
                validators.add((IValidator) elem.createExecutableExtension("class"));
            } catch (Exception e) {
                logger.logError("Unable to instantiate validator: " + elem.getAttribute("name"), e);
            }
        }
    }
    return validators;
}
Also used : IValidator(org.bndtools.api.IValidator) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) CoreException(org.eclipse.core.runtime.CoreException)

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