X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fstructure%2FStructureSelectionManager.java;h=f8134110f9f18bdf166e67aa60d7ac1641964491;hb=refs%2Fheads%2Fcodereviews%2FJAL-1990_IProgressIndicator_jalview.structure;hp=fb96b2218eb06e0db036eae5bbe9798009128f41;hpb=60073d3f838affacd3f4158c3e7d069652d26602;p=jalview.git diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index fb96b22..f813411 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -70,12 +70,8 @@ public class StructureSelectionManager private boolean addTempFacAnnot = false; - private IProgressIndicator progressIndicator; - private SiftsClient siftsClient = null; - private long progressSessionId; - /* * Set of any registered mappings between (dataset) sequences. */ @@ -321,9 +317,11 @@ public class StructureSelectionManager * @return null or the structure data parsed as a pdb file */ synchronized public StructureFile setMapping(SequenceI[] sequence, - String[] targetChains, String pdbFile, String protocol) + String[] targetChains, String pdbFile, String protocol, + IProgressIndicator progress) { - return setMapping(true, sequence, targetChains, pdbFile, protocol); + return computeMapping(true, sequence, targetChains, pdbFile, protocol, + progress); } @@ -338,7 +336,7 @@ public class StructureSelectionManager * - one or more sequences to be mapped to pdbFile * @param targetChainIds * - optional chain specification for mapping each sequence to pdb - * (may be nill, individual elements may be nill) + * (may be null, individual elements may be null) * @param pdbFile * - structure data resource * @param protocol @@ -350,6 +348,16 @@ public class StructureSelectionManager String pdbFile, String protocol) { + return computeMapping(forStructureView, sequenceArray, targetChainIds, + pdbFile, protocol, null); + } + + synchronized public StructureFile computeMapping( + boolean forStructureView, SequenceI[] sequenceArray, + String[] targetChainIds, String pdbFile, String protocol, + IProgressIndicator progress) + { + long progressSessionId = System.currentTimeMillis() * 3; /* * There will be better ways of doing this in the future, for now we'll use * the tried and tested MCview pdb mapping @@ -496,13 +504,14 @@ public class StructureSelectionManager { pdbFile = "INLINE" + pdb.getId(); } - ArrayList seqToStrucMapping = new ArrayList(); if (isMapUsingSIFTs) { - setProgressBar(null); - setProgressBar(MessageManager - .getString("status.obtaining_mapping_with_sifts")); + if (progress!=null) { + progress.setProgressBar(MessageManager + .getString("status.obtaining_mapping_with_sifts"), + progressSessionId); + } jalview.datamodel.Mapping sqmpping = maxAlignseq .getMappingFromS1(false); if (targetChainId != null && !targetChainId.trim().isEmpty()) @@ -559,17 +568,23 @@ public class StructureSelectionManager } else { - setProgressBar(null); - setProgressBar(MessageManager - .getString("status.obtaining_mapping_with_nw_alignment")); + if (progress != null) + { + progress.setProgressBar(MessageManager + .getString("status.obtaining_mapping_with_nw_alignment"), + progressSessionId); + } seqToStrucMapping.add(getNWMappings(seq, pdbFile, maxChainId, maxChain, pdb, maxAlignseq)); } - if (forStructureView) { mappings.addAll(seqToStrucMapping); } + if (progress != null) + { + progress.setProgressBar(null, progressSessionId); + } } return pdb; } @@ -1294,35 +1309,6 @@ public class StructureSelectionManager return null; } - public IProgressIndicator getProgressIndicator() - { - return progressIndicator; - } - - public void setProgressIndicator(IProgressIndicator progressIndicator) - { - this.progressIndicator = progressIndicator; - } - - public long getProgressSessionId() - { - return progressSessionId; - } - - public void setProgressSessionId(long progressSessionId) - { - this.progressSessionId = progressSessionId; - } - - public void setProgressBar(String message) - { - if (progressIndicator == null) - { - return; - } - progressIndicator.setProgressBar(message, progressSessionId); - } - public List getSequenceMappings() { return seqmappings;