@Nullable private EditorNotificationPanel createPanel( final String extension, final Set<PluginsAdvertiser.Plugin> plugins) { final EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText("Plugins supporting " + extension + " files found."); final IdeaPluginDescriptor disabledPlugin = PluginsAdvertiser.getDisabledPlugin(plugins); if (disabledPlugin != null) { panel.createActionLabel( "Enable " + disabledPlugin.getName() + " plugin", () -> { myEnabledExtensions.add(extension); myNotifications.updateAllNotifications(); PluginsAdvertiser.enablePlugins(myProject, Collections.singletonList(disabledPlugin)); }); } else if (hasNonBundledPlugin(plugins)) { panel.createActionLabel( "Install plugins", () -> { Set<String> pluginIds = new HashSet<>(); for (PluginsAdvertiser.Plugin plugin : plugins) { pluginIds.add(plugin.myPluginId); } PluginsAdvertiser.installAndEnablePlugins( pluginIds, () -> { myEnabledExtensions.add(extension); myNotifications.updateAllNotifications(); }); }); } else if (PluginsAdvertiser.hasBundledPluginToInstall(plugins) != null) { if (PropertiesComponent.getInstance() .isTrueValue(PluginsAdvertiser.IGNORE_ULTIMATE_EDITION)) { return null; } panel.setText( extension + " files are supported by " + PluginsAdvertiser.IDEA_ULTIMATE_EDITION); panel.createActionLabel( PluginsAdvertiser.CHECK_ULTIMATE_EDITION_TITLE, () -> { myEnabledExtensions.add(extension); PluginsAdvertiser.openDownloadPage(); }); panel.createActionLabel( PluginsAdvertiser.ULTIMATE_EDITION_SUGGESTION, () -> { PropertiesComponent.getInstance() .setValue(PluginsAdvertiser.IGNORE_ULTIMATE_EDITION, "true"); myNotifications.updateAllNotifications(); }); } else { return null; } panel.createActionLabel( "Ignore extension", () -> { UnknownFeaturesCollector.getInstance(myProject) .ignoreFeature(createExtensionFeature(extension)); myNotifications.updateAllNotifications(); }); return panel; }
private boolean isIgnored(String extension) { return myEnabledExtensions.contains(extension) || UnknownFeaturesCollector.getInstance(myProject) .isIgnored(createExtensionFeature(extension)); }