Search in sources :

Example 1 with PluginAware

use of com.intellij.openapi.extensions.PluginAware in project intellij-community by JetBrains.

the class ExtensionComponentAdapter method getComponentInstance.

@Override
public Object getComponentInstance(final PicoContainer container) throws PicoException, ProcessCanceledException {
    if (myComponentInstance == null) {
        try {
            if (Element.class.equals(getComponentImplementation())) {
                myComponentInstance = myExtensionElement;
            } else {
                Object componentInstance = getDelegate().getComponentInstance(container);
                if (myDeserializeInstance) {
                    try {
                        XmlSerializer.deserializeInto(componentInstance, myExtensionElement);
                    } catch (Exception e) {
                        throw new PicoInitializationException(e);
                    }
                }
                myComponentInstance = componentInstance;
            }
        } catch (ProcessCanceledException e) {
            throw e;
        } catch (Throwable t) {
            PluginId pluginId = myPluginDescriptor != null ? myPluginDescriptor.getPluginId() : null;
            throw new PicoPluginExtensionInitializationException(t.getMessage(), t, pluginId);
        }
        if (myComponentInstance instanceof PluginAware) {
            PluginAware pluginAware = (PluginAware) myComponentInstance;
            pluginAware.setPluginDescriptor(myPluginDescriptor);
        }
    }
    return myComponentInstance;
}
Also used : PluginAware(com.intellij.openapi.extensions.PluginAware) PluginId(com.intellij.openapi.extensions.PluginId) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Aggregations

PluginAware (com.intellij.openapi.extensions.PluginAware)1 PluginId (com.intellij.openapi.extensions.PluginId)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1