Search in sources :

Example 1 with ImplementationConflictException

use of com.intellij.diagnostic.ImplementationConflictException in project intellij-community by JetBrains.

the class PluginManager method processException.

public static void processException(Throwable t) {
    if (!IdeaApplication.isLoaded()) {
        @SuppressWarnings("ThrowableResultOfMethodCallIgnored") StartupAbortedException se = findCause(t, StartupAbortedException.class);
        if (se == null)
            se = new StartupAbortedException(t);
        @SuppressWarnings("ThrowableResultOfMethodCallIgnored") PluginException pe = findCause(t, PluginException.class);
        PluginId pluginId = pe != null ? pe.getPluginId() : null;
        if (Logger.isInitialized() && !(t instanceof ProcessCanceledException)) {
            try {
                getLogger().error(t);
            } catch (Throwable ignore) {
            }
        }
        final ImplementationConflictException conflictException = findCause(t, ImplementationConflictException.class);
        if (conflictException != null) {
            PluginConflictReporter.INSTANCE.reportConflictByClasses(conflictException.getConflictingClasses());
        }
        if (pluginId != null && !CORE_PLUGIN_ID.equals(pluginId.getIdString())) {
            disablePlugin(pluginId.getIdString());
            StringWriter message = new StringWriter();
            message.append("Plugin '").append(pluginId.getIdString()).append("' failed to initialize and will be disabled. ");
            message.append(" Please restart ").append(ApplicationNamesInfo.getInstance().getFullProductName()).append('.');
            message.append("\n\n");
            pe.getCause().printStackTrace(new PrintWriter(message));
            Main.showMessage("Plugin Error", message.toString(), false);
            System.exit(Main.PLUGIN_ERROR);
        } else {
            Main.showMessage("Start Failed", t);
            System.exit(se.exitCode());
        }
    } else if (!(t instanceof ProcessCanceledException)) {
        getLogger().error(t);
    }
}
Also used : StringWriter(java.io.StringWriter) PluginException(com.intellij.diagnostic.PluginException) PluginId(com.intellij.openapi.extensions.PluginId) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) ImplementationConflictException(com.intellij.diagnostic.ImplementationConflictException) PrintWriter(java.io.PrintWriter)

Aggregations

ImplementationConflictException (com.intellij.diagnostic.ImplementationConflictException)1 PluginException (com.intellij.diagnostic.PluginException)1 PluginId (com.intellij.openapi.extensions.PluginId)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1