Fixed a threading problem
@@ -20,9 +20,7 @@ package io.github.mzmine.modules.visualization.mzhistogram;
import java.util.Arrays;
import java.util.logging.Logger;
-
import com.google.common.collect.Range;
-
import io.github.msdk.MSDKRuntimeException;
import io.github.mzmine.datamodel.DataPoint;
import io.github.mzmine.datamodel.MZmineProject;
@@ -36,6 +34,7 @@ import io.github.mzmine.parameters.parametertypes.selectors.ScanSelection;
import io.github.mzmine.taskcontrol.AbstractTask;
import io.github.mzmine.taskcontrol.TaskStatus;
import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
+import javafx.application.Platform;
public class MZDistributionHistoTask extends AbstractTask {
private Logger logger = Logger.getLogger(this.getClass().getName());
@@ -79,6 +78,7 @@ public class MZDistributionHistoTask extends AbstractTask {
/**
* @see io.github.mzmine.taskcontrol.Task#getTaskDescription()
*/
+ @Override
public String getTaskDescription() {
return "Creating m/z distribution histogram of " + dataFile;
}
@@ -86,6 +86,7 @@ public class MZDistributionHistoTask extends AbstractTask {
/**
* @see io.github.mzmine.taskcontrol.Task#getFinishedPercentage()
*/
+ @Override
public double getFinishedPercentage() {
if (totalScans == 0)
return 0;
@@ -100,6 +101,7 @@ public class MZDistributionHistoTask extends AbstractTask {
/**
* @see Runnable#run()
*/
+ @Override
public void run() {
setStatus(TaskStatus.PROCESSING);
logger.info("Starting to build mz distribution histogram for " + dataFile);
@@ -141,9 +143,12 @@ public class MZDistributionHistoTask extends AbstractTask {
histo[i] = data.get(i);
// create histogram dialog
+ Platform.runLater(() -> {
EHistogramDialog dialog =
new EHistogramDialog("m/z distribution", "m/z", new HistogramData(histo), binWidth);
dialog.showAndWait();
+ });
+
} else {
throw new MSDKRuntimeException("Data was empty. Review your selected filters.");
}
