public void handleEvent(Event event) { InputDialog dialog = new InputDialog(Labels.getLabel("title.find"), Labels.getLabel("text.find")); String text = dialog.open(lastText, Labels.getLabel("button.find.next")); if (text == null) { return; } lastText = text; try { statusBar.setStatusText(Labels.getLabel("state.searching")); findText(text, statusBar.getShell()); } finally { statusBar.setStatusText(null); } }
public void transitionTo(final ScanningState state, final Transition transition) { if (statusBar.isDisposed() || transition == Transition.INIT) return; // TODO: separate GUI and non-GUI stuff switch (state) { case IDLE: // reset state text button.setEnabled(true); updateProgress(null, 0, 0); statusBar.setStatusText(null); break; case STARTING: // start the scan from scratch! resultTable.removeAll(); try { scannerThread = scannerThreadFactory.createScannerThread( feederRegistry.createFeeder(), StartStopScanningAction.this, createResultsCallback(state)); stateMachine.startScanning(); mainWindowTitle = statusBar.getShell().getText(); } catch (RuntimeException e) { stateMachine.reset(); throw e; } break; case RESTARTING: // restart the scanning - rescan resultTable.resetSelection(); try { scannerThread = scannerThreadFactory.createScannerThread( feederRegistry.createRescanFeeder(resultTable.getSelection()), StartStopScanningAction.this, createResultsCallback(state)); stateMachine.startScanning(); mainWindowTitle = statusBar.getShell().getText(); } catch (RuntimeException e) { stateMachine.reset(); throw e; } break; case SCANNING: scannerThread.start(); break; case STOPPING: statusBar.setStatusText(Labels.getLabel("state.waitForThreads")); break; case KILLING: button.setEnabled(false); statusBar.setStatusText(Labels.getLabel("state.killingThreads")); break; } // change button image button.setImage(buttonImages[state.ordinal()]); button.setText(buttonTexts[state.ordinal()]); }