Changeset 9991
- Timestamp:
- 2005-05-31T14:18:22+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
r9878 r9991 1161 1161 implements ActionListener { 1162 1162 /** Any implementation of <i>ActionListener</i> must include this method so that we can be informed when an action has occured on one of our target controls. 1163 * @param event An <strong>ActionEvent</strong> containing information garnered from the control action. 1164 */ 1165 public void actionPerformed(ActionEvent event) { 1166 int selected_index = plugin_list.getSelectedIndex(); 1167 if(selected_index != -1) { 1168 Plugin selected_plugin = (Plugin) plugin_list.getSelectedValue(); 1169 removePlugin(selected_plugin); 1170 selected_plugin = null; 1171 // Select the next plugin if available 1172 if(selected_index < plugin_list.getModel().getSize()) { 1173 // If the new selection is above the separator we can remove it 1174 if(selected_index < findSeparatorIndex()) { 1175 plugin_list.setSelectedIndex(selected_index); 1176 1177 // don't let people remove special plugins such GAPlug an METSPlug, 1178 // unless they are in systems mode or above 1179 int mode = Configuration.getMode(); 1180 for (int i=0; i<StaticStrings.KEEP_PLUG.length; i++) { 1181 String selected_plugin_name 1182 = ((Plugin)plugin_list.getSelectedValue()).getName(); 1183 if ((selected_plugin_name.equals(StaticStrings.KEEP_PLUG[i])) && 1184 (mode < Configuration.SYSTEMS_MODE)) { 1185 remove.setEnabled(false); 1186 break; 1187 } else { 1188 remove.setEnabled(true); 1189 } 1190 } 1191 } 1192 // Otherwise select the first non-removable plugin 1193 else { 1194 plugin_list.setSelectedIndex(selected_index + 1); 1195 remove.setEnabled(false); 1196 } 1163 * @param event An <strong>ActionEvent</strong> containing information garnered from the control action. 1164 */ 1165 public void actionPerformed(ActionEvent event) { 1166 int selected_index = plugin_list.getSelectedIndex(); 1167 if(selected_index != -1) { 1168 Plugin selected_plugin = (Plugin) plugin_list.getSelectedValue(); 1169 removePlugin(selected_plugin); 1170 selected_plugin = null; 1171 // Select the next plugin if available 1172 if(selected_index < plugin_list.getModel().getSize()) { 1173 // If the new selection is above the separator we can remove it 1174 if(selected_index < findSeparatorIndex()) { 1175 plugin_list.setSelectedIndex(selected_index); 1176 1177 // don't let people remove special plugins such GAPlug an METSPlug, 1178 // unless they are in systems mode or above 1179 int mode = Configuration.getMode(); 1180 for (int i=0; i<StaticStrings.KEEP_PLUG.length; i++) { 1181 String selected_plugin_name 1182 = ((Plugin)plugin_list.getSelectedValue()).getName(); 1183 if ((selected_plugin_name.equals(StaticStrings.KEEP_PLUG[i])) && 1184 (mode < Configuration.SYSTEMS_MODE)) { 1185 remove.setEnabled(false); 1186 break; 1187 } else { 1188 remove.setEnabled(true); 1197 1189 } 1198 else { 1199 remove.setEnabled(false); 1200 } 1201 // Refresh the available plugins 1202 plugin.setModel(new DefaultComboBoxModel(getAvailable())); 1190 } 1203 1191 } 1192 // Otherwise select the first non-removable plugin 1204 1193 else { 1205 remove.setEnabled(false); 1194 plugin_list.setSelectedIndex(selected_index + 1); 1195 remove.setEnabled(false); 1206 1196 } 1207 } 1208 } 1209 } 1210 1197 } 1198 else { 1199 remove.setEnabled(false); 1200 } 1201 // Refresh the available plugins 1202 plugin.setModel(new DefaultComboBoxModel(getAvailable())); 1203 } 1204 else { 1205 remove.setEnabled(false); 1206 } 1207 } 1208 } 1209 } 1210 1211 1211 1212 1212 private class PluginSuggestionPrompt
Note:
See TracChangeset
for help on using the changeset viewer.