From: Renia Correya Date: Wed, 3 Jul 2024 09:49:27 +0000 (+0100) Subject: JAL-4392 Code Refactoring X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9660ad220459678b9361983921c7d65cb8d21c99;p=jalview.git JAL-4392 Code Refactoring Removed the usage of Message.properties in non UI classes --- diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index 3ca5bcb..0284498 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -3082,7 +3082,7 @@ public class AlignmentUtils if (aa != null) { - if (ssSource.equals(MessageManager.getString("option.ss_providers_all"))) + if (ssSource.equals(Constants.SS_ALL_PROVIDERS)) { ssAnnots.addAll(Arrays.asList(aa)); continue; @@ -3133,7 +3133,7 @@ public class AlignmentUtils if (label.equals(aa.label)) { - if (selectedSSSource.equals(MessageManager.getString("option.ss_providers_all"))) + if (selectedSSSource.equals(Constants.SS_ALL_PROVIDERS)) { ssAlignmentAnnotationForSequences .computeIfAbsent(aa.sequenceRef.getDatasetSequence(), diff --git a/src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java b/src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java index 4e3a3de..d7859f1 100644 --- a/src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java +++ b/src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java @@ -31,6 +31,7 @@ import jalview.datamodel.SeqCigar; import jalview.datamodel.SequenceI; import jalview.math.Matrix; import jalview.math.MatrixI; +import jalview.util.Constants; import jalview.util.MessageManager; import java.util.ArrayList; @@ -114,7 +115,7 @@ public class SecondaryStructureDistanceModel extends DistanceScoreModel //secondary structure source parameter selected by the user from the drop down. String ssSource = params.getSecondaryStructureSource(); if(ssSource == null || ssSource == "") { - ssSource = MessageManager.getString("option.ss_providers_all"); + ssSource = Constants.SS_ALL_PROVIDERS; } ssRateMatrix = ScoreModels.getInstance().getSecondaryStructureMatrix(); diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 75d4460..29e18a6 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -37,6 +37,7 @@ import jalview.analysis.Conservation; import jalview.renderer.ResidueShader; import jalview.renderer.ResidueShaderI; import jalview.schemes.ColourSchemeI; +import jalview.util.Constants; import jalview.util.MessageManager; /** @@ -635,7 +636,7 @@ public class SequenceGroup implements AnnotatedCollectionI ssSources = AlignmentUtils.extractSSSourceInAlignmentAnnotation(aa.getAlignmentAnnotation()); } if(ssSources != null) { - ssSources.add(MessageManager.getString("option.ss_providers_all")); + ssSources.add(Constants.SS_ALL_PROVIDERS); for(String ssSource : ssSources) { ProfilesI hSSConsensus = AAFrequency.calculateSS(sequences, startRes, endRes + 1, showSequenceLogo, diff --git a/src/jalview/util/Constants.java b/src/jalview/util/Constants.java index f8e4e4f..59f88ae 100644 --- a/src/jalview/util/Constants.java +++ b/src/jalview/util/Constants.java @@ -47,5 +47,9 @@ public class Constants // Add other secondary structure labels here if needed } - public static final String SS_PROVIDER_PROPERTY = "SS_PROVIDER"; + public static final String SS_PROVIDER_PROPERTY = "SS_PROVIDER"; + + //generic secondary structure provider options + public static final String SS_ALL_PROVIDERS = "All"; + public static final String SS_NONE_PROVIDER = "None"; } diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 684e355..7a5e47a 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -71,6 +71,7 @@ import jalview.structure.CommandListener; import jalview.structure.StructureSelectionManager; import jalview.structure.VamsasSource; import jalview.util.Comparison; +import jalview.util.Constants; import jalview.util.MapList; import jalview.util.MappingUtils; import jalview.util.MessageManager; @@ -779,7 +780,7 @@ public abstract class AlignmentViewport if(aa!=null) { sources = AlignmentUtils.extractSSSourceInAlignmentAnnotation(aa); if(sources != null) { - sources.add(0,MessageManager.getString("option.ss_providers_all")); + sources.add(0,Constants.SS_ALL_PROVIDERS); viewStyle.setSecondaryStructureSources(sources); } } diff --git a/src/jalview/workers/SecondaryStructureConsensusThread.java b/src/jalview/workers/SecondaryStructureConsensusThread.java index bd4b78c..6629f27 100644 --- a/src/jalview/workers/SecondaryStructureConsensusThread.java +++ b/src/jalview/workers/SecondaryStructureConsensusThread.java @@ -35,6 +35,7 @@ import jalview.datamodel.Annotation; import jalview.datamodel.ProfilesI; import jalview.datamodel.SequenceI; import jalview.renderer.ResidueShaderI; +import jalview.util.Constants; import jalview.util.MessageManager; public class SecondaryStructureConsensusThread extends AlignCalcWorker @@ -200,7 +201,7 @@ public class SecondaryStructureConsensusThread extends AlignCalcWorker if(aa!=null) { sources = AlignmentUtils.extractSSSourceInAlignmentAnnotation(aa); if(sources != null) { - sources.add(0, MessageManager.getString("option.ss_providers_all")); + sources.add(0, Constants.SS_ALL_PROVIDERS); alignViewport.setSecondaryStructureSources(sources); } }