Fix: when no files indexed, user could still press enter and start search

This commit is contained in:
adam-m 2012-01-24 09:41:38 -05:00
parent e145d545ca
commit 338662fc90

View File

@ -37,15 +37,20 @@ public class KeywordSearchDataExplorer implements DataExplorer {
private static KeywordSearchDataExplorer theInstance; private static KeywordSearchDataExplorer theInstance;
private KeywordSearchTabsTopComponent tc; private KeywordSearchTabsTopComponent tc;
private int filesIndexed;
public KeywordSearchDataExplorer() { public KeywordSearchDataExplorer() {
this.setTheInstance(); this.setTheInstance();
this.filesIndexed = 0;
this.tc = new KeywordSearchTabsTopComponent(); this.tc = new KeywordSearchTabsTopComponent();
this.tc.addSearchButtonListener(new ActionListener() { this.tc.addSearchButtonListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (filesIndexed == 0)
return;
tc.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); tc.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try { try {
@ -124,6 +129,7 @@ public class KeywordSearchDataExplorer implements DataExplorer {
if (newValue != null) { if (newValue != null) {
if (changed.equals(KeywordSearch.NUM_FILES_CHANGE_EVT)) { if (changed.equals(KeywordSearch.NUM_FILES_CHANGE_EVT)) {
int newFilesIndexed = ((Integer) newValue).intValue(); int newFilesIndexed = ((Integer) newValue).intValue();
filesIndexed = newFilesIndexed;
tc.setFilesIndexed(newFilesIndexed); tc.setFilesIndexed(newFilesIndexed);
} else { } else {