public Object getValueAt(int r, int c) { PluginDefinition def = getPluginDefinitionAt(r); switch (c) { case 0: switch (def.getStatus()) { case NOT_INSTALLED: return "Not installed"; case UPDATE_AVAILABLE: return "Update available"; default: return "Installed"; } case 1: return def.getName(); case 2: String local = def.getLocalVersion(); return local == null ? "<N/A>" : local; case 3: String remote = def.getRemoteVersion(); return remote == null ? "<Unknown>" : remote; case 4: return def.getShortDescription(); default: return def.getAuthor(); } }
/** Set what actions are available depending on state */ private void setAvailableActions() { int sel = table.getSelectedRow(); if (sel != -1) { PluginDefinition def = model.getPluginDefinitionAt(sel); info.setText(def.getInformation()); url.setText(def.getURL()); removeAction.setEnabled(def.getStatus() != NOT_INSTALLED); installAction.setEnabled(def.getStatus() == NOT_INSTALLED); updateAction.setEnabled(def.getStatus() == UPDATE_AVAILABLE); configureAction.setEnabled( def.getStatus() != NOT_INSTALLED && def.getPlugin() instanceof ConfigurablePlugin); } else { info.setText(" "); url.setText(" "); removeAction.setEnabled(false); installAction.setEnabled(false); updateAction.setEnabled(false); configureAction.setEnabled(false); } refresh.setEnabled(!updating); }