static void logPlugins() { List<String> loadedBundled = new ArrayList<String>(); List<String> disabled = new ArrayList<String>(); List<String> loadedCustom = new ArrayList<String>(); for (IdeaPluginDescriptor descriptor : ourPlugins) { final String version = descriptor.getVersion(); String s = descriptor.getName() + (version != null ? " (" + version + ")" : ""); if (descriptor.isEnabled()) { if (descriptor.isBundled() || SPECIAL_IDEA_PLUGIN.equals(descriptor.getName())) loadedBundled.add(s); else loadedCustom.add(s); } else { disabled.add(s); } } Collections.sort(loadedBundled); Collections.sort(loadedCustom); Collections.sort(disabled); getLogger().info("Loaded bundled plugins: " + StringUtil.join(loadedBundled, ", ")); if (!loadedCustom.isEmpty()) { getLogger().info("Loaded custom plugins: " + StringUtil.join(loadedCustom, ", ")); } if (!disabled.isEmpty()) { getLogger().info("Disabled plugins: " + StringUtil.join(disabled, ", ")); } }
@Nullable static ClassLoader createPluginClassLoader( @NotNull File[] classPath, @NotNull ClassLoader[] parentLoaders, @NotNull IdeaPluginDescriptor pluginDescriptor) { if (pluginDescriptor.getUseIdeaClassLoader()) { try { final ClassLoader loader = PluginManagerCore.class.getClassLoader(); final Method addUrlMethod = getAddUrlMethod(loader); for (File aClassPath : classPath) { final File file = aClassPath.getCanonicalFile(); addUrlMethod.invoke(loader, file.toURI().toURL()); } return loader; } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } PluginId pluginId = pluginDescriptor.getPluginId(); File pluginRoot = pluginDescriptor.getPath(); // if (classPath.length == 0) return null; if (isUnitTestMode()) return null; try { final List<URL> urls = new ArrayList<URL>(classPath.length); for (File aClassPath : classPath) { final File file = aClassPath .getCanonicalFile(); // it is critical not to have "." and ".." in classpath // elements urls.add(file.toURI().toURL()); } return new PluginClassLoader( urls, parentLoaders, pluginId, pluginDescriptor.getVersion(), pluginRoot); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }