JComponent (@NotNull Consumer<? super PluginsGroupComponent> selectionListener) { MultiSelectionEventHandler eventHandler = new MultiSelectionEventHandler(); myMarketplacePanel = new PluginsGroupComponentWithProgress(eventHandler) { @Override protected @NotNull ListPluginComponent createListComponent(@NotNull IdeaPluginDescriptor descriptor, @NotNull PluginsGroup group) { return new ListPluginComponent(myPluginModel, descriptor, group, mySearchListener, true); } }; myMarketplacePanel.setSelectionListener(selectionListener); myMarketplacePanel.getAccessibleContext().setAccessibleName(IdeBundle.message("plugin.manager.marketplace.panel.accessible.name")); registerCopyProvider(myMarketplacePanel); //noinspection ConstantConditions ((SearchUpDownPopupController)myMarketplaceSearchPanel.controller).setEventHandler(eventHandler); Project project = ProjectUtil.getActiveProject(); Runnable runnable = () -> { List<PluginsGroup> groups = new ArrayList<>(); try { Map<String, List<PluginNode>> customRepositoriesMap = CustomPluginRepositoryService.getInstance() .getCustomRepositoryPluginMap(); try { if (project != null) { addSuggestedGroup(groups, project, customRepositoriesMap); } PluginsViewCustomizer.PluginsGroupDescriptor internalPluginsGroupDescriptor = getPluginsViewCustomizer().getInternalPluginsGroupDescriptor(); if (internalPluginsGroupDescriptor != null) { List<IdeaPluginDescriptor> customPlugins = internalPluginsGroupDescriptor.getPlugins(); addGroup( groups, internalPluginsGroupDescriptor.getName(), PluginsGroupType.INTERNAL, SearchWords.INTERNAL.getValue(), customPlugins, group -> customPlugins.size() >= ITEMS_PER_GROUP ); } addGroupViaLightDescriptor( groups, IdeBundle.message("plugins.configurable.staff.picks"), PluginsGroupType.STAFF_PICKS, "is_featured_search=true", SearchWords.STAFF_PICKS.getValue() ); addGroupViaLightDescriptor( groups, IdeBundle.message("plugins.configurable.new.and.updated"), PluginsGroupType.NEW_AND_UPDATED, "orderBy=update+date", "/sortBy:updated" ); addGroupViaLightDescriptor( groups, IdeBundle.message("plugins.configurable.top.downloads"), PluginsGroupType.TOP_DOWNLOADS, "orderBy=downloads", "/sortBy:downloads" ); addGroupViaLightDescriptor( groups, IdeBundle.message("plugins.configurable.top.rated"), PluginsGroupType.TOP_RATED, "orderBy=rating", "/sortBy:rating" ); } catch (IOException e) { LOG.info("Main plugin repository is not available ('" + e.getMessage() + "'). Please check your network settings."); } for (String host : UpdateSettings.getInstance().getPluginHosts()) { List<PluginNode> allDescriptors = customRepositoriesMap.get(host); if (allDescriptors != null) { String groupName = IdeBundle.message("plugins.configurable.repository.0", host); LOG.info("Marketplace tab: '" + groupName + "' group load started"); addGroup(groups, groupName, PluginsGroupType.CUSTOM_REPOSITORY, "/repository:\"" + host + "\"", allDescriptors, group -> { PluginsGroup.sortByName(group.descriptors); return allDescriptors.size() > ITEMS_PER_GROUP; }); } } } finally { ApplicationManager.getApplication().invokeLater(() -> { myMarketplacePanel.stopLoading(); try { PluginLogo.startBatchMode(); for (PluginsGroup group : groups) { myMarketplacePanel.addGroup(group); } } finally { PluginLogo.endBatchMode(); } myMarketplacePanel.doLayout(); myMarketplacePanel.initialSelection(); if (PluginDetailsPageComponent.isMultiTabs()) { myPluginUpdatesService.calculateUpdates(updates -> { if (ContainerUtil.isEmpty(updates)) { clearUpdates(myMarketplacePanel); clearUpdates(myMarketplaceSearchPanel.getPanel()); } else { applyUpdates(myMarketplacePanel, updates); applyUpdates(myMarketplaceSearchPanel.getPanel(), updates); } selectionListener.accept(myMarketplacePanel); }); } }, ModalityState.any()); } }; myMarketplaceRunnable = () -> { myMarketplacePanel.clear(); myMarketplacePanel.startLoading(); ApplicationManager.getApplication().executeOnPooledThread(runnable); }; myMarketplacePanel.getEmptyText().setText(IdeBundle.message("plugins.configurable.marketplace.plugins.not.loaded")) .appendSecondaryText(IdeBundle.message("message.check.the.internet.connection.and") + " ", StatusText.DEFAULT_ATTRIBUTES, null) .appendSecondaryText(IdeBundle.message("message.link.refresh"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES, e -> myMarketplaceRunnable.run()); ApplicationManager.getApplication().executeOnPooledThread(runnable); return createScrollPane(myMarketplacePanel, false); }