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("AddPluignsPanel.invalid.plugin.url=Plugin url is invalid.") private void availablePluginsListMouseClicked( java.awt.event.MouseEvent evt) { // GEN-FIRST:event_availablePluginsListMouseClicked int clickCount = evt.getClickCount(); if (clickCount == 1) { changePlugin(); } else if (clickCount == 2) { int selectedIndex = availablePluginsList.getSelectedIndex(); VagrantPluginItem item = filteredPlugins.get(selectedIndex); try { HtmlBrowser.URLDisplayer.getDefault().showURL(new URL(item.getUrl())); // NOI18N } catch (MalformedURLException ex) { VagrantUtils.showWarnigDialog(Bundle.AddPluignsPanel_invalid_plugin_url()); } } } // GEN-LAST:event_availablePluginsListMouseClicked