- createNewGroup.setEnabled(false);
-
- String searchString = textfield.getText().trim();
-
- if(searchString.length()<1)
- return;
- // TODO: extend finder to match descriptions, features and annotation, and other stuff
- // TODO: add switches to control what is searched - sequences, IDS, descriptions, features
- jalview.analysis.Finder finder=new jalview.analysis.Finder(av.alignment, av.getSelectionGroup(), seqIndex, resIndex);
- finder.setCaseSensitive(caseSensitive.isSelected());
- finder.setFindAll(findAll);
-
- finder.find(searchString); // returns true if anything was actually found
-
- seqIndex=finder.getSeqIndex();
- resIndex=finder.getResIndex();
-
- searchResults = finder.getSearchResults(); // find(regex, caseSensitive.isSelected(), )
- Vector idMatch = finder.getIdMatch();
- // set or reset the GUI
- if ((searchResults.getSize() == 0) && (idMatch.size() > 0))
- {
- ap.idPanel.highlightSearchResults(idMatch);
- }
-
-
- int resultSize = searchResults.getSize();
-
- if (searchResults.getSize() > 0)
- createNewGroup.setEnabled(true);
- else
- searchResults = null;
-
- // if allResults is null, this effectively switches displaySearch flag in seqCanvas
- ap.highlightSearchResults(searchResults);
- // TODO: add enablers for 'SelectSequences' or 'SelectColumns' or 'SelectRegion' selection
- if(!findAll && resultSize==0)
- {
- JOptionPane.showInternalMessageDialog(this, "Finished searching",
- null, JOptionPane.INFORMATION_MESSAGE);
- resIndex = 0;
- seqIndex = 0;
- }
-
- if (findAll)
- {
- String message = resultSize + " matches found.";
- JOptionPane.showInternalMessageDialog(this, message, null,
- JOptionPane.INFORMATION_MESSAGE);
- }