RawDataFile selectedFiles[] = MZmineCore.getDesktop()
.getSelectedDataFiles();
PeakList selectedPeakLists[] = MZmineCore.getDesktop()
.getSelectedPeakLists();
ParameterSet moduleParameters = MZmineCore.getConfiguration()
.getModuleParameters(module.getClass());
boolean allParametersOK = true;
LinkedList<String> errorMessages = new LinkedList<String>();
for (Parameter p : moduleParameters.getParameters()) {
if (p instanceof RawDataFilesParameter) {
RawDataFilesParameter rdp = (RawDataFilesParameter) p;
rdp.setValue(selectedFiles);
boolean checkOK = rdp.checkValue(errorMessages);
if (!checkOK) {
allParametersOK = false;
}
}
if (p instanceof PeakListsParameter) {
PeakListsParameter plp = (PeakListsParameter) p;
plp.setValue(selectedPeakLists);
boolean checkOK = plp.checkValue(errorMessages);
if (!checkOK) {
allParametersOK = false;
}
}
}
if (!allParametersOK) {
StringBuilder message = new StringBuilder();
for (String m : errorMessages) {
message.append(m);
message.append("\n");
}
MZmineCore.getDesktop().displayMessage(message.toString());
return;
}
logger.finest("Setting parameters for module " + module.getName());
ExitCode exitCode = moduleParameters.showSetupDialog();
if (exitCode == ExitCode.OK) {
ParameterSet parametersCopy = moduleParameters.cloneParameter();
logger.finest("Starting module " + module.getName()
+ " with parameters " + parametersCopy);
ArrayList<Task> tasks = new ArrayList<Task>();
module.runModule(parametersCopy, tasks);
MZmineCore.getTaskController().addTasks(