/** * Default constructor * * @param editor the editor where to open a file * @param uuid the tab uuid */ public SearchFile(SciNotes editor, String uuid) { super(SciNotesMessages.SEARCHINFILES, uuid == null ? UUID.randomUUID().toString() : uuid); this.editor = editor; editor.addSearchInFiles(this); ConfigSciNotesManager.saveSearchInFilesState(editor.getPersistentId(), getPersistentId()); initTab(); restoreSearchFile(); WindowsConfigurationManager.restorationFinished(this); }
/** Called when the results are available */ @Override public synchronized void done() { SearchManager.MatchingPositions pos = getResults(); if (pos == null) { if (component != null) { component.firePropertyChange(SEARCHDONE, false, true); } return; } SearchFile searchFile = editor.getSearchInFiles(); final SearchFile sf; if (searchFile == null) { editor.addSearchInFiles(); sf = editor.getSearchInFiles(); } else { sf = searchFile; } sf.fillTab( pos, base, recursive, ignoreCR, filePattern, fileCaseSensitive, wordPattern, wordCaseSensitive, wholeWord, regexp); sf.setMyBackgroundSearch(this); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { sf.getJTree().addSelectionRow(0); sf.getJTree().requestFocus(); long time = getElapsedTime(); sf.getInfoBar() .setText(String.format(SciNotesMessages.ELAPSEDTIME, ((double) time) / 1000)); } }); if (component != null) { component.firePropertyChange(SEARCHDONE, false, true); } }