private void updatePluginsTable() { DefaultListModel<String> model = (DefaultListModel<String>) availablePluginsList.getModel(); model.clear(); filteredPlugins.clear(); String filter = getFilter(); boolean isEmpty = StringUtils.isEmpty(filter); // get filters filter = filter.replaceAll(" +", " "); // NOI18N String[] filters = filter.split(" "); // NOI18N // add int i = 0; for (VagrantPluginItem plugin : plugins) { String name = plugin.getName(); // don't add installed plugins if (installedPlugins.contains(name)) { continue; } String category = plugin.getCategory(); if (isEmpty || StringUtils.containsAll( name.toLowerCase() + " " + category.toLowerCase(), filters)) { // NOI18N model.add( i, String.format( "<html><b>%s</b> (<i>%s</i>) <a href=\"%s\">%s</a></html>", name, plugin.getCategory(), plugin.getUrl(), plugin.getUrl())); // NOI18N filteredPlugins.add(i, plugin); i++; } } }
private void changePlugin() { if (plugins.isEmpty() || filteredPlugins.isEmpty()) { return; } int selectedIndex = availablePluginsList.getSelectedIndex(); if (selectedIndex < 0) { return; } VagrantPluginItem plugin = filteredPlugins.get(selectedIndex); pluginTextField.setText(plugin.getName()); }