/** * Attempts to start a multicone job. If insufficient or incorrect information is present in the * component state, a popup error message will be delivered instead. */ private void startMatch() { MatchWorker worker; try { worker = createMatchWorker(); } catch (RuntimeException e) { Object msg = new String[] { "Query not specified:", e.getMessage(), }; JOptionPane.showMessageDialog(this, msg, "Incomplete Query", JOptionPane.ERROR_MESSAGE); return; } setActive(worker); worker.start(); }
/** * Marks a given worker thread as currently working on behalf of this panel. If null is given, no * worker is active. Any existing active thread is interrupted. * * @param worker worker thread */ private void setActive(MatchWorker worker) { if (matchWorker_ != null && !matchWorker_.done_) { matchWorker_.cancel(); } matchWorker_ = worker; updateState(); }
/** * Schedules a runnable on the event dispatch thread, which will execute only if this handler's * match worker is still active. * * @param runnable object to run */ protected void schedule(Runnable runnable) { matchWorker_.schedule(runnable); }