private void doAnalysis() { if (project != null) { if (output.getIterations() != null) { if (!output.getIterations().isEmpty()) { numIterations = Integer.parseInt(output.getIterations()); } } else { numIterations = NO_OF_ITERATIONS; } if (output.getOutputPath() != null) { String[] nlsprogressResult = null; String outputPath = project.getResultsFolder(true) + File.separator + output.getOutputPath(); File outputFolder = new File(outputPath); if (outputFolder.exists()) { resultsfolder = FileUtil.toFileObject(outputFolder); if (resultsfolder.getChildren().length > 0) { try { resultsfolder = FileUtil.createFolder( resultsfolder.getParent(), FileUtil.findFreeFolderName( resultsfolder.getParent(), resultsfolder.getName())); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } } else { try { FileUtil.createFolder(outputFolder); resultsfolder = outputFolder.exists() ? FileUtil.toFileObject(outputFolder) : null; } catch (IOException ex) { Exceptions.printStackTrace(ex); } } datasets = getDatasets(datasetContainer); modelCalls.add(getModelCall(modelReference, 0)); fitModelCall = getFitModelCall(datasets, modelCalls, modelDifferences, output, numIterations); if (isValidAnalysis(datasets, modelReference)) { timpcontroller = Lookup.getDefault().lookup(TimpControllerInterface.class); if (timpcontroller != null) { results = timpcontroller.runAnalysis(datasets, modelCalls, fitModelCall); nlsprogressResult = timpcontroller.getStringArray( TimpControllerInterface.NAME_OF_RESULT_OBJECT + "$nlsprogress"); } } else { // TODO: CoreErrorMessages warning return; } if (results != null) { writeResults(results, modelReference, nlsprogressResult); } else { try { writeSummary( resultsfolder, FileUtil.findFreeFileName( resultsfolder, resultsfolder.getName() + "_errorlog", "summary")); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } timpcontroller.cleanup(); } } }