X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFinder.java;h=5a2dfe996e7e1571a2413244692ad88a6e3e2745;hb=9be2898dd1635c87539a90de321975f043d005f3;hp=1ff31fe25eddb2c68b36d2c1b79968e8adf794c8;hpb=1f183a4e9d63b2af6cf7184274affc80e11ef344;p=jalview.git diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 1ff31fe..5a2dfe9 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -6,7 +6,6 @@ import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; -import java.util.regex.*; import java.awt.*; public class Finder extends GFinder @@ -14,7 +13,6 @@ public class Finder extends GFinder AlignViewport av; AlignmentPanel ap; JInternalFrame frame; - String searchString; SuperGroup searchGroup; int seqIndex = 0; @@ -68,6 +66,7 @@ public class Finder extends GFinder try{ // if allResults is null, this effectively switches displaySearch flag in seqCanvas ap.highlightSearchResults( null ); + ap.idPanel.highlightSearchResults( null ); // frame.setClosed(true); }catch(Exception ex){ } } @@ -86,22 +85,25 @@ public class Finder extends GFinder void doSearch(boolean findAll) { createNewGroup.setEnabled(false); - searchString = textfield.getText().toUpperCase(); + + String searchString = textfield.getText().toUpperCase(); + + com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString); ArrayList searchResults = new ArrayList(); int [] allResults = null; Sequence seq; - String item; + String item=null; boolean found = false; - /// is the searchString a residue number? + ////// is the searchString a residue number? try{ int res = Integer.parseInt(searchString); found = true; - if(av.getSelection().size()>0) - seq = (Sequence)(av.getSelection().sequenceAt(0)); + if(av.getSelectionGroup().getSize()>0) + seq = (Sequence)(av.getSelectionGroup().getSequenceAt(0)); else seq = (Sequence)av.getAlignment().getSequenceAt(0); @@ -109,9 +111,9 @@ public class Finder extends GFinder searchResults.add( Integer.toString( seq.findIndex(res)-1 ) ); searchResults.add( Integer.toString( seq.findIndex(res)-1 ) ); - - //av.getAlignment().getSequenceAt(seq).findPosition(res) }catch(NumberFormatException ex){} + /////////////////////////////////////////////// + jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(); Color [] newColors = new Color[24]; @@ -122,18 +124,29 @@ public class Finder extends GFinder searchGroup = new SuperGroup(searchString, ucs , true, true, false); - while( !found && seqIndex0 && !av.getSelection().contains(seq)) + seq = (Sequence)av.alignment.getSequenceAt(seqIndex); + + + if(selection!=null && !selection.sequences.contains(seq)) { - // if a selection has been made, only search within that selection seqIndex++; resIndex=0; continue; } - item = seq.getSequence(); + item = seq.getSequence().toUpperCase(); + + if(selection!=null && selection.getEndRes()0) + ap.idPanel.highlightSearchResults( idMatch ); + if(searchResults.size()>0) {