Changeset 13277
- Timestamp:
- 2006-11-15T16:03:23+13:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
r13244 r13277 950 950 951 951 if (event.getSource() == add_button) { 952 new AddPluginTask(suitable_plugins_combobox.getSelectedItem().toString()).start(); 953 } 954 } 955 } 956 957 958 private class AddPluginTask 959 extends Thread 960 { 961 private String plugin_name; 962 963 public AddPluginTask(String plugin_name) 952 AddPluginWithoutConfigurationTask add_plugin_task = new AddPluginWithoutConfigurationTask(suitable_plugins_combobox.getSelectedItem().toString()); 953 add_plugin_task.start(); 954 955 // We have to wait for this task to complete before continuing, otherwise 956 // we might offer to add the same plugin again before the task has completed 957 try { 958 add_plugin_task.join(); 959 } 960 catch (Exception exception) { 961 DebugStream.printStackTrace(exception); 962 } 963 } 964 } 965 966 967 private class AddPluginWithoutConfigurationTask 968 extends Thread 964 969 { 965 this.plugin_name = plugin_name; 966 } 967 968 public void run() 969 { 970 // Retrieve the plugin 971 Plugin plugin = Plugins.getPlugin(plugin_name, true); 972 if (plugin == null) { 973 System.err.println("Error: getPlugin() returned null."); 974 return; 975 } 976 977 // Create a new element in the DOM 978 Element new_plugin_element = CollectionConfiguration.createElement(StaticStrings.PLUGIN_ELEMENT); 979 new_plugin_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, plugin.getName()); 980 Plugin new_plugin = new Plugin(new_plugin_element, plugin); 981 982 // Just assign the plugin with no argument configuration 983 assignPlugin(new_plugin); 970 private String plugin_name; 971 972 public AddPluginWithoutConfigurationTask(String plugin_name) 973 { 974 this.plugin_name = plugin_name; 975 } 976 977 public void run() 978 { 979 // Retrieve the plugin 980 Plugin plugin = Plugins.getPlugin(plugin_name, true); 981 if (plugin == null) { 982 System.err.println("Error: getPlugin() returned null."); 983 return; 984 } 985 986 // Create a new element in the DOM 987 Element new_plugin_element = CollectionConfiguration.createElement(StaticStrings.PLUGIN_ELEMENT); 988 new_plugin_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, plugin.getName()); 989 Plugin new_plugin = new Plugin(new_plugin_element, plugin); 990 991 // Just assign the plugin with no argument configuration 992 assignPlugin(new_plugin); 993 } 984 994 } 985 995 }
Note:
See TracChangeset
for help on using the changeset viewer.