From 4297c9917b5069268b1370164e13b97061b304d3 Mon Sep 17 00:00:00 2001 From: "Thomas F. Dyrlund" Date: Tue, 22 Mar 2016 09:55:58 +0100 Subject: [PATCH] Fixed various Eclipse warnings --- .../joinaligner/JoinAlignerModule.java | 26 +++++----- .../ChromatogramBuilderModule.java | 11 +++-- .../ChromatogramBuilderTask.java | 6 +-- .../srmdetection/SrmDetectionModule.java | 7 +-- .../srmdetection/SrmDetectionTask.java | 4 +- .../featuretable/FeatureTableMenu.java | 4 +- .../featuretable/FeatureTableModule.java | 20 ++++---- .../FeatureTableImportModule.java | 3 +- .../FeatureTableImportParameters.java | 42 ++++++++-------- .../featurefilter/FeatureFilterModule.java | 30 +++++++++--- .../filtering/rowfilter/RowFilterModule.java | 48 ++++++++++++++----- .../peakfinder/PeakFinderModule.java | 6 +-- .../modules/io/csvexport/CsvExportModule.java | 8 ++++ .../isotopegrouper/IsotopeGrouperModule.java | 6 +-- .../MsSpectrumLayersDialogController.java | 2 +- .../datasets/MsSpectrumDataSet.java | 4 +- .../fxcomponents/SpinnerTableCell.java | 2 +- .../binning/BinningCentroidingModule.java | 3 +- .../exactmass/ExactMassCentroidingModule.java | 3 +- .../LocalMaxCentroidingModule.java | 3 +- .../recursive/RecursiveCentroidingModule.java | 3 +- .../wavelet/WaveletCentroidingModule.java | 3 +- .../rawdata/mzmlexport/MzMLExportModule.java | 2 - .../rawdataimport/RawDataImportModule.java | 2 - .../RawDataImportParameters.java | 2 - .../project/auditlog/AuditLogTaskRecord.java | 2 +- .../github/mzmine/taskcontrol/MSDKTask.java | 2 - .../github/mzmine/taskcontrol/MZmineTask.java | 2 - .../io/github/mzmine/util/TableUtils.java | 15 +++--- 29 files changed, 160 insertions(+), 111 deletions(-) diff --git a/src/main/java/io/github/mzmine/modules/alignment/joinaligner/JoinAlignerModule.java b/src/main/java/io/github/mzmine/modules/alignment/joinaligner/JoinAlignerModule.java index 4e57a75..3b53af8 100644 --- a/src/main/java/io/github/mzmine/modules/alignment/joinaligner/JoinAlignerModule.java +++ b/src/main/java/io/github/mzmine/modules/alignment/joinaligner/JoinAlignerModule.java @@ -64,33 +64,37 @@ public void runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection> tasks) { + // Parameter values final FeatureTablesSelection featureTables = parameters .getParameter(JoinAlignerParameters.featureTables).getValue(); - final MZTolerance mzTolerance = parameters .getParameter(JoinAlignerParameters.mzTolerance).getValue(); - final RTTolerance rtTolerance = parameters .getParameter(JoinAlignerParameters.rtTolerance).getValue(); - - final Integer mzWeight = parameters + Integer mzWeight = parameters .getParameter(JoinAlignerParameters.mzWeight).getValue(); - - final Integer rtWeight = parameters + Integer rtWeight = parameters .getParameter(JoinAlignerParameters.rtWeight).getValue(); - - final Boolean requireSameAnnotation = parameters + Boolean requireSameAnnotation = parameters .getParameter(JoinAlignerParameters.requireSameAnnotation) .getValue(); - - final Boolean requireSameCharge = parameters + Boolean requireSameCharge = parameters .getParameter(JoinAlignerParameters.requireSameCharge) .getValue(); - final String featureTableName = parameters .getParameter(JoinAlignerParameters.featureTableName) .getValue(); + // Default values + if (mzWeight == null) + mzWeight = 1; + if (rtWeight == null) + rtWeight = 1; + if (requireSameAnnotation == null) + requireSameAnnotation = false; + if (requireSameCharge == null) + requireSameCharge = false; + final Boolean removeOldTable = parameters .getParameter(JoinAlignerParameters.removeOldTable).getValue(); diff --git a/src/main/java/io/github/mzmine/modules/featuredetection/chromatogrambuilder/ChromatogramBuilderModule.java b/src/main/java/io/github/mzmine/modules/featuredetection/chromatogrambuilder/ChromatogramBuilderModule.java index fd79aaf..8f31fbf 100644 --- a/src/main/java/io/github/mzmine/modules/featuredetection/chromatogrambuilder/ChromatogramBuilderModule.java +++ b/src/main/java/io/github/mzmine/modules/featuredetection/chromatogrambuilder/ChromatogramBuilderModule.java @@ -68,9 +68,9 @@ public void runModule(@Nonnull MZmineProject project, final MZTolerance mzTolerance = parameters .getParameter(ChromatogramBuilderParameters.mzTolerance) .getValue(); - final Float noiseLevel = parameters + final Double noiseLevel = parameters .getParameter(ChromatogramBuilderParameters.noiseLevel) - .getValue().floatValue(); + .getValue(); final Double minDuration = parameters .getParameter(ChromatogramBuilderParameters.minDuration) .getValue(); @@ -81,7 +81,8 @@ public void runModule(@Nonnull MZmineProject project, .getParameter(ChromatogramBuilderParameters.nameSuffix) .getValue(); - if (rawDataFiles.getMatchingRawDataFiles().isEmpty()) { + if (rawDataFiles == null + || rawDataFiles.getMatchingRawDataFiles().isEmpty()) { logger.warn( "Chromatogram builder module started with no raw data files selected"); return; @@ -99,8 +100,8 @@ public void runModule(@Nonnull MZmineProject project, // 2. ChromatogramToFeatureTableMethod ChromatogramBuilderTask newTask = new ChromatogramBuilderTask( "Chromatogram builder", rawDataFile.getName(), rawDataFile, - dataStore, mzTolerance, noiseLevel, minDuration, minHeight, - nameSuffix); + dataStore, mzTolerance, noiseLevel, + minDuration, minHeight, nameSuffix); // Add the feature table to the project newTask.setOnSucceeded(e -> { diff --git a/src/main/java/io/github/mzmine/modules/featuredetection/chromatogrambuilder/ChromatogramBuilderTask.java b/src/main/java/io/github/mzmine/modules/featuredetection/chromatogrambuilder/ChromatogramBuilderTask.java index 8632d15..de44b22 100644 --- a/src/main/java/io/github/mzmine/modules/featuredetection/chromatogrambuilder/ChromatogramBuilderTask.java +++ b/src/main/java/io/github/mzmine/modules/featuredetection/chromatogrambuilder/ChromatogramBuilderTask.java @@ -54,12 +54,12 @@ public class ChromatogramBuilderTask extends Task private String title, message; private FeatureTable featureTable; - private MSDKMethod chromatogramBuilderMethod; - private MSDKMethod chromatogramToFeatureTableMethod; + private MSDKMethod> chromatogramBuilderMethod; + private MSDKMethod chromatogramToFeatureTableMethod; public ChromatogramBuilderTask(String title, @Nullable String message, @Nonnull RawDataFile rawDataFile, @Nonnull DataPointStore dataStore, - @Nonnull MZTolerance mzTolerance, @Nonnull Float noiseLevel, + @Nonnull MZTolerance mzTolerance, @Nonnull Double noiseLevel, @Nonnull Double minDuration, @Nonnull Double minHeight, @Nullable String nameSuffix) { this.rawDataFile = rawDataFile; diff --git a/src/main/java/io/github/mzmine/modules/featuredetection/srmdetection/SrmDetectionModule.java b/src/main/java/io/github/mzmine/modules/featuredetection/srmdetection/SrmDetectionModule.java index a9cebd4..c6311b0 100644 --- a/src/main/java/io/github/mzmine/modules/featuredetection/srmdetection/SrmDetectionModule.java +++ b/src/main/java/io/github/mzmine/modules/featuredetection/srmdetection/SrmDetectionModule.java @@ -30,13 +30,10 @@ import io.github.msdk.datamodel.datastore.DataPointStoreFactory; import io.github.msdk.datamodel.featuretables.FeatureTable; import io.github.msdk.datamodel.rawdata.RawDataFile; -import io.github.msdk.featdet.srmdetection.SrmDetectionMethod; import io.github.mzmine.modules.MZmineProcessingModule; -import io.github.mzmine.modules.featuredetection.chromatogrambuilder.ChromatogramBuilderTask; import io.github.mzmine.parameters.ParameterSet; import io.github.mzmine.parameters.parametertypes.selectors.RawDataFilesSelection; import io.github.mzmine.project.MZmineProject; -import io.github.mzmine.taskcontrol.MSDKTask; import javafx.concurrent.Task; /** @@ -88,8 +85,8 @@ public void runModule(@Nonnull MZmineProject project, // 1. SrmDetectionMethod // 2. ChromatogramToFeatureTableMethod SrmDetectionTask newTask = new SrmDetectionTask( - "SRM feature detection", rawDataFile.getName(), rawDataFile, dataStore, - nameSuffix); + "SRM feature detection", rawDataFile.getName(), rawDataFile, + dataStore, nameSuffix); // Add the feature table to the project newTask.setOnSucceeded(e -> { diff --git a/src/main/java/io/github/mzmine/modules/featuredetection/srmdetection/SrmDetectionTask.java b/src/main/java/io/github/mzmine/modules/featuredetection/srmdetection/SrmDetectionTask.java index 5566ec5..188aa36 100644 --- a/src/main/java/io/github/mzmine/modules/featuredetection/srmdetection/SrmDetectionTask.java +++ b/src/main/java/io/github/mzmine/modules/featuredetection/srmdetection/SrmDetectionTask.java @@ -52,8 +52,8 @@ public class SrmDetectionTask extends Task implements MZmineTask { private String title, message; private FeatureTable featureTable; - private MSDKMethod srmDetectionMethod; - private MSDKMethod chromatogramToFeatureTableMethod; + private MSDKMethod> srmDetectionMethod; + private MSDKMethod chromatogramToFeatureTableMethod; public SrmDetectionTask(String title, @Nullable String message, @Nonnull RawDataFile rawDataFile, @Nonnull DataPointStore dataStore, diff --git a/src/main/java/io/github/mzmine/modules/featuretable/FeatureTableMenu.java b/src/main/java/io/github/mzmine/modules/featuretable/FeatureTableMenu.java index d49902a..db11caa 100644 --- a/src/main/java/io/github/mzmine/modules/featuretable/FeatureTableMenu.java +++ b/src/main/java/io/github/mzmine/modules/featuretable/FeatureTableMenu.java @@ -175,7 +175,7 @@ public void handle(MouseEvent event) { cm.getItems().add(new SeparatorMenuItem()); // Sample specific columns - for (TreeTableColumn col : tableColumn.getColumns()) { + for (TreeTableColumn col : tableColumn.getColumns()) { cb = new CheckBox("Sample: " + col.getText()); // Bind to all equal sample specific columns @@ -184,7 +184,7 @@ public void handle(MouseEvent event) { int childrenColumns2 = tableColumn2.getColumns().size(); if (childrenColumns2 != 0) { - for (TreeTableColumn col2 : tableColumn2 + for (TreeTableColumn col2 : tableColumn2 .getColumns()) { if (col.getText().equals(col2.getText())) { cb.selectedProperty().bindBidirectional( diff --git a/src/main/java/io/github/mzmine/modules/featuretable/FeatureTableModule.java b/src/main/java/io/github/mzmine/modules/featuretable/FeatureTableModule.java index f44d267..5cd3ff4 100644 --- a/src/main/java/io/github/mzmine/modules/featuretable/FeatureTableModule.java +++ b/src/main/java/io/github/mzmine/modules/featuretable/FeatureTableModule.java @@ -103,9 +103,9 @@ public void runModule(@Nonnull MZmineProject project, TreeItem treeItem; // Group rows - FeatureTableColumn groupColoumn = featureTable + FeatureTableColumn groupColoumn = featureTable .getColumn(ColumnName.GROUPID, null); - FeatureTableColumn idColoumn = featureTable.getColumn(ColumnName.ID, + FeatureTableColumn idColoumn = featureTable.getColumn(ColumnName.ID, null); for (FeatureTableRow row : rows) { // No group column @@ -118,18 +118,18 @@ else if (row.getData(groupColoumn) == null) { treeItem = new TreeItem<>(row); treeItem.setExpanded(true); root.getChildren().add(treeItem); - rowMap.put((int) row.getData(idColoumn), treeItem); + rowMap.put(row.getData(idColoumn), treeItem); } // The row has a group id else { - Integer groupID = (int) row.getData(groupColoumn); + Integer groupID = row.getData(groupColoumn); TreeItem parentTreeItem = rowMap.get(groupID); if (parentTreeItem == null) { parentTreeItem = root; } treeItem = new TreeItem<>(row); parentTreeItem.getChildren().add(treeItem); - rowMap.put((int) row.getData(idColoumn), treeItem); + rowMap.put(row.getData(idColoumn), treeItem); } } @@ -172,7 +172,7 @@ public ObservableValue call( }); // Set column renderer - Class renderClass = ColumnRenderers + Class renderClass = ColumnRenderers .getRenderClass(column.getName()); Callback, TreeTableCell> rendeder = null; try { @@ -228,7 +228,7 @@ public ObservableValue call( }); // Set column renderer - Class renderClass = ColumnRenderers + Class renderClass = ColumnRenderers .getRenderClass(column.getName()); Callback, TreeTableCell> rendeder = null; try { @@ -267,11 +267,11 @@ public void handle(MouseEvent event) { if (event.isPrimaryButtonDown() && event.getClickCount() == 2) { // Find feature table row Node node = ((Node) event.getTarget()).getParent(); - TreeTableRow row; + TreeTableRow row; while (!(node instanceof TreeTableRow)) { node = node.getParent(); } - row = (TreeTableRow) node; + row = (TreeTableRow) node; FeatureTableRow featureTableRow = (FeatureTableRow) row .getItem(); @@ -281,7 +281,7 @@ public void handle(MouseEvent event) { .getSelectionModel().getSelectedCells(); for (TreeTablePosition cell : cells) { if (cell.getTableColumn().getParentColumn() != null) { - TreeTableColumn parentColumn = (TreeTableColumn) cell + TreeTableColumn parentColumn = (TreeTableColumn) cell .getTableColumn().getParentColumn(); List samples = featureTable.getSamples(); for (Sample s : samples) { diff --git a/src/main/java/io/github/mzmine/modules/featuretableimport/FeatureTableImportModule.java b/src/main/java/io/github/mzmine/modules/featuretableimport/FeatureTableImportModule.java index 99f5419..80fee04 100644 --- a/src/main/java/io/github/mzmine/modules/featuretableimport/FeatureTableImportModule.java +++ b/src/main/java/io/github/mzmine/modules/featuretableimport/FeatureTableImportModule.java @@ -102,6 +102,7 @@ public void runModule(@Nonnull MZmineProject project, .getExtension(fileName.getAbsolutePath()); MSDKMethod method = null; switch (fileExtension.toUpperCase()) { + default: case "CSV": method = new CsvFileImportMethod(fileName, dataStore); break; @@ -122,7 +123,7 @@ public void runModule(@Nonnull MZmineProject project, // Remove common prefix if (!Strings.isNullOrEmpty(removePrefix)) { String name = featureTable.getName(); - if (name.startsWith(removePrefix)) + if (removePrefix != null && name.startsWith(removePrefix)) name = name.substring(removePrefix.length()); featureTable.setName(name); } diff --git a/src/main/java/io/github/mzmine/modules/featuretableimport/FeatureTableImportParameters.java b/src/main/java/io/github/mzmine/modules/featuretableimport/FeatureTableImportParameters.java index 22d732c..5e27893 100644 --- a/src/main/java/io/github/mzmine/modules/featuretableimport/FeatureTableImportParameters.java +++ b/src/main/java/io/github/mzmine/modules/featuretableimport/FeatureTableImportParameters.java @@ -66,14 +66,16 @@ public class FeatureTableImportParameters extends ParameterSet { src = src.getParent(); } - for (PropertySheet.Item item : sheet.getItems()) { - if (item instanceof FileNamesParameter) { - List fileNames = (List) item.getValue(); - if (fileNames == null) - return; - String commonPrefix = FileNameUtil - .findCommonPrefix(fileNames); - editor.setValue(commonPrefix); + if (sheet != null && editor != null) { + for (PropertySheet.Item item : sheet.getItems()) { + if (item instanceof FileNamesParameter) { + List fileNames = (List) item.getValue(); + if (fileNames == null) + return; + String commonPrefix = FileNameUtil + .findCommonPrefix(fileNames); + editor.setValue(commonPrefix); + } } } }); @@ -95,17 +97,19 @@ public class FeatureTableImportParameters extends ParameterSet { src = src.getParent(); } - for (PropertySheet.Item item : sheet.getItems()) { - if (item instanceof FileNamesParameter) { - List fileNames = (List) item.getValue(); - if (fileNames == null) - continue; - String commonSuffix = FileNameUtil - .findCommonSuffix(fileNames); - // If no common suffix then remove file extension - if (Strings.isNullOrEmpty(commonSuffix)) - commonSuffix = ".*"; - editor.setValue(commonSuffix); + if (sheet != null && editor != null) { + for (PropertySheet.Item item : sheet.getItems()) { + if (item instanceof FileNamesParameter) { + List fileNames = (List) item.getValue(); + if (fileNames == null) + continue; + String commonSuffix = FileNameUtil + .findCommonSuffix(fileNames); + // If no common suffix then remove file extension + if (Strings.isNullOrEmpty(commonSuffix)) + commonSuffix = ".*"; + editor.setValue(commonSuffix); + } } } }); diff --git a/src/main/java/io/github/mzmine/modules/filtering/featurefilter/FeatureFilterModule.java b/src/main/java/io/github/mzmine/modules/filtering/featurefilter/FeatureFilterModule.java index 9b7e681..7d01d32 100644 --- a/src/main/java/io/github/mzmine/modules/filtering/featurefilter/FeatureFilterModule.java +++ b/src/main/java/io/github/mzmine/modules/filtering/featurefilter/FeatureFilterModule.java @@ -66,22 +66,38 @@ public void runModule(@Nonnull MZmineProject project, @Nonnull Collection> tasks) { // Boolean values - final Boolean filterByDuration = parameters + Boolean filterByDuration = parameters .getParameter(FeatureFilterParameters.duration).getValue(); - final Boolean filterByArea = parameters + Boolean filterByArea = parameters .getParameter(FeatureFilterParameters.area).getValue(); - final Boolean filterByHeight = parameters + Boolean filterByHeight = parameters .getParameter(FeatureFilterParameters.height).getValue(); - final Boolean filterByDataPoints = parameters + Boolean filterByDataPoints = parameters .getParameter(FeatureFilterParameters.dataPoints).getValue(); - final Boolean filterByFWHM = parameters + Boolean filterByFWHM = parameters .getParameter(FeatureFilterParameters.fwhm).getValue(); - final Boolean filterByTailingFactor = parameters + Boolean filterByTailingFactor = parameters .getParameter(FeatureFilterParameters.tailingFactor).getValue(); - final Boolean filterByAsymmetryFactor = parameters + Boolean filterByAsymmetryFactor = parameters .getParameter(FeatureFilterParameters.asymmetryFactor) .getValue(); + // Default values + if (filterByDuration == null) + filterByDuration = false; + if (filterByArea == null) + filterByArea = false; + if (filterByHeight == null) + filterByHeight = false; + if (filterByDataPoints == null) + filterByDataPoints = false; + if (filterByFWHM == null) + filterByFWHM = false; + if (filterByTailingFactor == null) + filterByTailingFactor = false; + if (filterByAsymmetryFactor == null) + filterByAsymmetryFactor = false; + // Embedded values final Range durationRange = parameters .getParameter(FeatureFilterParameters.duration) diff --git a/src/main/java/io/github/mzmine/modules/filtering/rowfilter/RowFilterModule.java b/src/main/java/io/github/mzmine/modules/filtering/rowfilter/RowFilterModule.java index d1ff9ca..01d050a 100644 --- a/src/main/java/io/github/mzmine/modules/filtering/rowfilter/RowFilterModule.java +++ b/src/main/java/io/github/mzmine/modules/filtering/rowfilter/RowFilterModule.java @@ -67,21 +67,37 @@ public void runModule(@Nonnull MZmineProject project, @Nonnull Collection> tasks) { // Boolean values - final Boolean filterByMz = parameters + Boolean filterByMz = parameters .getParameter(RowFilterParameters.mzRange).getValue(); - final Boolean filterByRt = parameters + Boolean filterByRt = parameters .getParameter(RowFilterParameters.rtRange).getValue(); - final Boolean filterByDuration = parameters + Boolean filterByDuration = parameters .getParameter(RowFilterParameters.durationRange).getValue(); - final Boolean filterByCount = parameters + Boolean filterByCount = parameters .getParameter(RowFilterParameters.minCount).getValue(); - final Boolean filterByIsotopes = parameters + Boolean filterByIsotopes = parameters .getParameter(RowFilterParameters.minIsotopes).getValue(); - final Boolean filterByIonAnnotation = parameters + Boolean filterByIonAnnotation = parameters .getParameter(RowFilterParameters.ionAnnotation).getValue(); - final Boolean requireAnnotation = parameters + Boolean requireAnnotation = parameters .getParameter(RowFilterParameters.requireAnnotation).getValue(); + // Default values + if (filterByMz == null) + filterByMz = false; + if (filterByRt == null) + filterByRt = false; + if (filterByDuration == null) + filterByDuration = false; + if (filterByCount == null) + filterByCount = false; + if (filterByIsotopes == null) + filterByIsotopes = false; + if (filterByIonAnnotation == null) + filterByIonAnnotation = false; + if (requireAnnotation == null) + requireAnnotation = false; + // Embedded values final Range mzRange = parameters .getParameter(RowFilterParameters.mzRange) @@ -92,8 +108,7 @@ public void runModule(@Nonnull MZmineProject project, final Range durationRange = parameters .getParameter(RowFilterParameters.durationRange) .getEmbeddedParameter().getValue(); - Double minCount = parameters - .getParameter(RowFilterParameters.minCount) + Double minCount = parameters.getParameter(RowFilterParameters.minCount) .getEmbeddedParameter().getValue(); final Integer minIsotopes = parameters .getParameter(RowFilterParameters.minIsotopes) @@ -103,7 +118,7 @@ public void runModule(@Nonnull MZmineProject project, .getEmbeddedParameter().getValue(); // Remove duplicate parameters - final Boolean removeDuplicates = parameters + Boolean removeDuplicates = parameters .getParameter(RowFilterParameters.removeDuplicates).getValue(); final MZTolerance duplicateMzTolerance = parameters .getParameter(RowFilterParameters.removeDuplicates) @@ -113,12 +128,18 @@ public void runModule(@Nonnull MZmineProject project, .getParameter(RowFilterParameters.removeDuplicates) .getEmbeddedParameters() .getParameter(DuplicateFilterParameters.rtTolerance).getValue(); - final Boolean duplicateRequireSameID = parameters + Boolean duplicateRequireSameID = parameters .getParameter(RowFilterParameters.removeDuplicates) .getEmbeddedParameters() .getParameter(DuplicateFilterParameters.requireSameID) .getValue(); + // Default values + if (removeDuplicates == null) + removeDuplicates = false; + if (duplicateRequireSameID == null) + duplicateRequireSameID = false; + // Other values final FeatureTablesSelection featureTables = parameters .getParameter(RowFilterParameters.featureTables).getValue(); @@ -127,7 +148,8 @@ public void runModule(@Nonnull MZmineProject project, final String nameSuffix = parameters .getParameter(RowFilterParameters.nameSuffix).getValue(); - if (featureTables == null || featureTables.getMatchingFeatureTables().isEmpty()) { + if (featureTables == null + || featureTables.getMatchingFeatureTables().isEmpty()) { logger.warn( "Row filter module started with no feature table selected"); return; @@ -142,6 +164,8 @@ public void runModule(@Nonnull MZmineProject project, .getMemoryDataStore(); // Handle < 1 values for minCount + if (minCount == null) + minCount = 0d; if (minCount < 1) minCount = featureTable.getSamples().size() * minCount; // Round value down to nearest hole number diff --git a/src/main/java/io/github/mzmine/modules/gapfilling/peakfinder/PeakFinderModule.java b/src/main/java/io/github/mzmine/modules/gapfilling/peakfinder/PeakFinderModule.java index abb2aec..c76b936 100644 --- a/src/main/java/io/github/mzmine/modules/gapfilling/peakfinder/PeakFinderModule.java +++ b/src/main/java/io/github/mzmine/modules/gapfilling/peakfinder/PeakFinderModule.java @@ -71,7 +71,7 @@ public void runModule(@Nonnull MZmineProject project, .getParameter(PeakFinderParameters.mzTolerance).getValue(); final RTTolerance rtTolerance = parameters .getParameter(PeakFinderParameters.rtTolerance).getValue(); - final boolean isIntensityTolSet = parameters + final Boolean isIntensityTolSet = parameters .getParameter(PeakFinderParameters.intensityTolerance) .getValue(); Double intensityTolerance = parameters @@ -104,7 +104,7 @@ public void runModule(@Nonnull MZmineProject project, // If intensity tolerance is not active then set the // intensityTolerance value to a very high value to avoid any // filtering the peak shape - if (!isIntensityTolSet) + if (isIntensityTolSet == null || !isIntensityTolSet) intensityTolerance = Double.MAX_VALUE; // New feature filter task @@ -121,7 +121,7 @@ public void runModule(@Nonnull MZmineProject project, project.addFeatureTable(newFeatureTable); // If selected, remove old feature table - if (removeOldTable) { + if (removeOldTable != null && removeOldTable) { project.removeFeatureTable(featureTable); } }); diff --git a/src/main/java/io/github/mzmine/modules/io/csvexport/CsvExportModule.java b/src/main/java/io/github/mzmine/modules/io/csvexport/CsvExportModule.java index f1ea467..4783899 100644 --- a/src/main/java/io/github/mzmine/modules/io/csvexport/CsvExportModule.java +++ b/src/main/java/io/github/mzmine/modules/io/csvexport/CsvExportModule.java @@ -101,6 +101,14 @@ public void runModule(@Nonnull MZmineProject project, return; } + if (tableColumns == null) { + MZmineGUI.displayMessage( + "Feature table export module started with no columns selected."); + logger.warn( + "Feature table export module started with no columns selected."); + return; + } + List> columns; // Add a task for each feature table diff --git a/src/main/java/io/github/mzmine/modules/isotopes/isotopegrouper/IsotopeGrouperModule.java b/src/main/java/io/github/mzmine/modules/isotopes/isotopegrouper/IsotopeGrouperModule.java index e442126..437290b 100644 --- a/src/main/java/io/github/mzmine/modules/isotopes/isotopegrouper/IsotopeGrouperModule.java +++ b/src/main/java/io/github/mzmine/modules/isotopes/isotopegrouper/IsotopeGrouperModule.java @@ -78,9 +78,9 @@ public void runModule(@Nonnull MZmineProject project, .getParameter(IsotopeGrouperParameters.maximumCharge) .getValue(); - final RepresentativeIsotope representativeIsotope = parameters - .getParameter(IsotopeGrouperParameters.representativeIsotope) - .getValue(); + //final RepresentativeIsotope representativeIsotope = parameters + // .getParameter(IsotopeGrouperParameters.representativeIsotope) + // .getValue(); final Boolean monotonicShape = parameters .getParameter(IsotopeGrouperParameters.monotonicShape) diff --git a/src/main/java/io/github/mzmine/modules/plots/msspectrum/MsSpectrumLayersDialogController.java b/src/main/java/io/github/mzmine/modules/plots/msspectrum/MsSpectrumLayersDialogController.java index 533e2fc..8c6b921 100644 --- a/src/main/java/io/github/mzmine/modules/plots/msspectrum/MsSpectrumLayersDialogController.java +++ b/src/main/java/io/github/mzmine/modules/plots/msspectrum/MsSpectrumLayersDialogController.java @@ -91,7 +91,7 @@ public void initialize() { column -> new CheckBoxTableCell() { { tableRowProperty().addListener(e -> { - TableRow row = getTableRow(); + TableRow row = getTableRow(); if (row == null) return; MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row diff --git a/src/main/java/io/github/mzmine/modules/plots/msspectrum/datasets/MsSpectrumDataSet.java b/src/main/java/io/github/mzmine/modules/plots/msspectrum/datasets/MsSpectrumDataSet.java index 7218c5d..5365de0 100644 --- a/src/main/java/io/github/mzmine/modules/plots/msspectrum/datasets/MsSpectrumDataSet.java +++ b/src/main/java/io/github/mzmine/modules/plots/msspectrum/datasets/MsSpectrumDataSet.java @@ -55,6 +55,8 @@ public class MsSpectrumDataSet extends AbstractXYDataset implements MsSpectrumPlotDataSet { + private static final long serialVersionUID = -3188441074323131747L; + private static final ScheduledThreadPoolExecutor threadPool = new ScheduledThreadPoolExecutor( 1); @@ -282,7 +284,7 @@ public int getSeriesCount() { } @Override - public Comparable getSeriesKey(int series) { + public Comparable getSeriesKey(int series) { return getName(); } diff --git a/src/main/java/io/github/mzmine/modules/plots/msspectrum/fxcomponents/SpinnerTableCell.java b/src/main/java/io/github/mzmine/modules/plots/msspectrum/fxcomponents/SpinnerTableCell.java index 077c135..874d606 100644 --- a/src/main/java/io/github/mzmine/modules/plots/msspectrum/fxcomponents/SpinnerTableCell.java +++ b/src/main/java/io/github/mzmine/modules/plots/msspectrum/fxcomponents/SpinnerTableCell.java @@ -38,7 +38,7 @@ public SpinnerTableCell(TableColumn column, int min, int max) { spinner.disableProperty().bind(column.editableProperty().not()); tableRowProperty().addListener(e -> { - TableRow row = getTableRow(); + TableRow row = getTableRow(); if (row == null) return; MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row diff --git a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/binning/BinningCentroidingModule.java b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/binning/BinningCentroidingModule.java index bad7f19..f1a7c7a 100644 --- a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/binning/BinningCentroidingModule.java +++ b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/binning/BinningCentroidingModule.java @@ -71,7 +71,8 @@ public void runModule(@Nonnull MZmineProject project, final String suffix = parameters .getParameter(BinningCentroidingParameters.suffix).getValue(); - if (rawDataFiles.getMatchingRawDataFiles().isEmpty()) { + if (rawDataFiles == null + || rawDataFiles.getMatchingRawDataFiles().isEmpty()) { logger.warn( "Centroiding module started with no raw data files selected"); return; diff --git a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/exactmass/ExactMassCentroidingModule.java b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/exactmass/ExactMassCentroidingModule.java index 5d51516..ab125ec 100644 --- a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/exactmass/ExactMassCentroidingModule.java +++ b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/exactmass/ExactMassCentroidingModule.java @@ -69,7 +69,8 @@ public void runModule(@Nonnull MZmineProject project, final String suffix = parameters .getParameter(ExactMassCentroidingParameters.suffix).getValue(); - if (rawDataFiles.getMatchingRawDataFiles().isEmpty()) { + if (rawDataFiles == null + || rawDataFiles.getMatchingRawDataFiles().isEmpty()) { logger.warn( "Centroiding module started with no raw data files selected"); return; diff --git a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/localmaxima/LocalMaxCentroidingModule.java b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/localmaxima/LocalMaxCentroidingModule.java index 2f55d2e..ab33eba 100644 --- a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/localmaxima/LocalMaxCentroidingModule.java +++ b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/localmaxima/LocalMaxCentroidingModule.java @@ -69,7 +69,8 @@ public void runModule(@Nonnull MZmineProject project, final String suffix = parameters .getParameter(LocalMaxCentroidingParameters.suffix).getValue(); - if (rawDataFiles.getMatchingRawDataFiles().isEmpty()) { + if (rawDataFiles == null + || rawDataFiles.getMatchingRawDataFiles().isEmpty()) { logger.warn( "Centroiding module started with no raw data files selected"); return; diff --git a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/recursive/RecursiveCentroidingModule.java b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/recursive/RecursiveCentroidingModule.java index 104e4ac..1c5308d 100644 --- a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/recursive/RecursiveCentroidingModule.java +++ b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/recursive/RecursiveCentroidingModule.java @@ -73,7 +73,8 @@ public void runModule(@Nonnull MZmineProject project, final String suffix = parameters .getParameter(RecursiveCentroidingParameters.suffix).getValue(); - if (rawDataFiles.getMatchingRawDataFiles().isEmpty()) { + if (rawDataFiles == null + || rawDataFiles.getMatchingRawDataFiles().isEmpty()) { logger.warn( "Centroiding module started with no raw data files selected"); return; diff --git a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/wavelet/WaveletCentroidingModule.java b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/wavelet/WaveletCentroidingModule.java index bc574ff..ea39b0a 100644 --- a/src/main/java/io/github/mzmine/modules/rawdata/centroiding/wavelet/WaveletCentroidingModule.java +++ b/src/main/java/io/github/mzmine/modules/rawdata/centroiding/wavelet/WaveletCentroidingModule.java @@ -75,7 +75,8 @@ public void runModule(@Nonnull MZmineProject project, final String suffix = parameters .getParameter(WaveletCentroidingParameters.suffix).getValue(); - if (rawDataFiles.getMatchingRawDataFiles().isEmpty()) { + if (rawDataFiles == null + || rawDataFiles.getMatchingRawDataFiles().isEmpty()) { logger.warn( "Centroiding module started with no raw data files selected"); return; diff --git a/src/main/java/io/github/mzmine/modules/rawdata/mzmlexport/MzMLExportModule.java b/src/main/java/io/github/mzmine/modules/rawdata/mzmlexport/MzMLExportModule.java index ccf4ce6..3b27441 100644 --- a/src/main/java/io/github/mzmine/modules/rawdata/mzmlexport/MzMLExportModule.java +++ b/src/main/java/io/github/mzmine/modules/rawdata/mzmlexport/MzMLExportModule.java @@ -46,13 +46,11 @@ public class MzMLExportModule implements MZmineProcessingModule { private static final String MODULE_NAME = "mzML export"; private static final String MODULE_DESCRIPTION = "This module exports raw data into mzML"; - @SuppressWarnings("null") @Override public @Nonnull String getName() { return MODULE_NAME; } - @SuppressWarnings("null") @Override public @Nonnull String getDescription() { return MODULE_DESCRIPTION; diff --git a/src/main/java/io/github/mzmine/modules/rawdata/rawdataimport/RawDataImportModule.java b/src/main/java/io/github/mzmine/modules/rawdata/rawdataimport/RawDataImportModule.java index 5b8e9da..3cb8376 100644 --- a/src/main/java/io/github/mzmine/modules/rawdata/rawdataimport/RawDataImportModule.java +++ b/src/main/java/io/github/mzmine/modules/rawdata/rawdataimport/RawDataImportModule.java @@ -52,13 +52,11 @@ public class RawDataImportModule implements MZmineProcessingModule { private static final String MODULE_NAME = "Raw data import"; private static final String MODULE_DESCRIPTION = "This module imports raw data into the project."; - @SuppressWarnings("null") @Override public @Nonnull String getName() { return MODULE_NAME; } - @SuppressWarnings("null") @Override public @Nonnull String getDescription() { return MODULE_DESCRIPTION; diff --git a/src/main/java/io/github/mzmine/modules/rawdata/rawdataimport/RawDataImportParameters.java b/src/main/java/io/github/mzmine/modules/rawdata/rawdataimport/RawDataImportParameters.java index 1484e04..33ee533 100644 --- a/src/main/java/io/github/mzmine/modules/rawdata/rawdataimport/RawDataImportParameters.java +++ b/src/main/java/io/github/mzmine/modules/rawdata/rawdataimport/RawDataImportParameters.java @@ -53,13 +53,11 @@ public class RawDataImportParameters extends ParameterSet { new ExtensionFilter("XML files", "*.xml"), new ExtensionFilter("All files", "*.*") }; - @SuppressWarnings("null") public static final FileNamesParameter fileNames = new FileNamesParameter( "File names", "Add raw data files", "Input files", ParameterValidator.createNonEmptyValidator(), Arrays.asList(filters)); - @SuppressWarnings("null") public static final ComboParameter importMode = new ComboParameter<>( "Import mode", "Select how the raw data points will be handled", "Mode", Arrays.asList(RawDataImportMode.values()), diff --git a/src/main/java/io/github/mzmine/project/auditlog/AuditLogTaskRecord.java b/src/main/java/io/github/mzmine/project/auditlog/AuditLogTaskRecord.java index 87dec56..5d76fa8 100644 --- a/src/main/java/io/github/mzmine/project/auditlog/AuditLogTaskRecord.java +++ b/src/main/java/io/github/mzmine/project/auditlog/AuditLogTaskRecord.java @@ -40,7 +40,7 @@ public AuditLogTaskRecord(@Nonnull Task task) { this.taskTitle = task.getTitle(); task.stateProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, State oldState, + public void changed(ObservableValue ov, State oldState, State newState) { taskStatus = newState; } diff --git a/src/main/java/io/github/mzmine/taskcontrol/MSDKTask.java b/src/main/java/io/github/mzmine/taskcontrol/MSDKTask.java index 422e1f2..27e7282 100644 --- a/src/main/java/io/github/mzmine/taskcontrol/MSDKTask.java +++ b/src/main/java/io/github/mzmine/taskcontrol/MSDKTask.java @@ -27,8 +27,6 @@ import io.github.msdk.MSDKMethod; import io.github.mzmine.gui.MZmineGUI; import javafx.concurrent.Task; -import javafx.concurrent.WorkerStateEvent; -import javafx.event.EventHandler; public class MSDKTask extends Task implements MZmineTask { diff --git a/src/main/java/io/github/mzmine/taskcontrol/MZmineTask.java b/src/main/java/io/github/mzmine/taskcontrol/MZmineTask.java index 8b51d35..6a37cd1 100644 --- a/src/main/java/io/github/mzmine/taskcontrol/MZmineTask.java +++ b/src/main/java/io/github/mzmine/taskcontrol/MZmineTask.java @@ -19,8 +19,6 @@ package io.github.mzmine.taskcontrol; -import javafx.scene.Node; - public interface MZmineTask { /** diff --git a/src/main/java/io/github/mzmine/util/TableUtils.java b/src/main/java/io/github/mzmine/util/TableUtils.java index 3c50bf9..ed1776e 100644 --- a/src/main/java/io/github/mzmine/util/TableUtils.java +++ b/src/main/java/io/github/mzmine/util/TableUtils.java @@ -23,7 +23,6 @@ import java.util.Map; import io.github.msdk.datamodel.chromatograms.Chromatogram; -import io.github.msdk.datamodel.featuretables.ColumnName; import io.github.msdk.datamodel.featuretables.FeatureTableRow; import io.github.msdk.datamodel.ionannotations.IonAnnotation; import io.github.msdk.datamodel.rawdata.ChromatographyInfo; @@ -88,15 +87,13 @@ public void handle(final KeyEvent keyEvent) { public void copySelectionToClipboard(TreeTableView table) { StringBuilder clipboardString = new StringBuilder(); - // ObservableList positionList = - // table.getSelectionModel().getSelectedCells(); ObservableList> positionList = table .getSelectionModel().getSelectedCells(); int prevRow = -1; // Add sample headers int hiddenColumns = 0; - for (TreeTablePosition position : positionList) { + for (TreeTablePosition position : positionList) { int rowNr = position.getRow(); int columnNr = position.getColumn() + hiddenColumns; @@ -108,7 +105,7 @@ public void copySelectionToClipboard(TreeTableView table) { // Get the column from the map to avoid trouble with sample // headers - TreeTableColumn column = columnMap.get(columnNr); + TreeTableColumn column = columnMap.get(columnNr); Object object = (Object) column.getCellData(rowNr); // Skip chromatogram column @@ -135,7 +132,7 @@ public void copySelectionToClipboard(TreeTableView table) { // Add column headers hiddenColumns = 0; - for (TreeTablePosition position : positionList) { + for (TreeTablePosition position : positionList) { int rowNr = position.getRow(); int columnNr = position.getColumn() + hiddenColumns; @@ -147,7 +144,7 @@ public void copySelectionToClipboard(TreeTableView table) { // Get the column from the map to avoid trouble with sample // headers - TreeTableColumn column = columnMap.get(columnNr); + TreeTableColumn column = columnMap.get(columnNr); Object object = (Object) column.getCellData(rowNr); // Skip chromatogram column @@ -169,7 +166,7 @@ public void copySelectionToClipboard(TreeTableView table) { // Add data hiddenColumns = 0; - for (TreeTablePosition position : positionList) { + for (TreeTablePosition position : positionList) { int rowNr = position.getRow(); if (prevRow != rowNr) { @@ -185,7 +182,7 @@ public void copySelectionToClipboard(TreeTableView table) { // Get the column from the map to avoid trouble with sample // headers - TreeTableColumn column = columnMap.get(columnNr); + TreeTableColumn column = columnMap.get(columnNr); String text = null; Object object = (Object) column.getCellData(rowNr);