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++; } } }
@NbBundle.Messages("AddPluginsPanel.validate.empty=Plugin name is empty.") public void runVagrantPluginInstall() { try { String plugin = getPlugin(); if (StringUtils.isEmpty(plugin)) { showDialog(); VagrantUtils.showWarnigDialog(Bundle.AddPluginsPanel_validate_empty()); return; } Vagrant vagrant = Vagrant.getDefault(); Future<Integer> result = vagrant.plugin(Vagrant.PLUGIN.INSTALL, Collections.singletonList(plugin)); try { result.get(); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } catch (ExecutionException ex) { Exceptions.printStackTrace(ex); } installedPlugins.add(plugin); setPluginsTable(); } catch (InvalidVagrantExecutableException ex) { VagrantUtils.showWarnigDialog(ex.getMessage()); } }