private void parseTime(final Date defaultDate, String string) { clearError(ConditionsExportDateSelectionPage.class); try { date = DATE_STRINGIFIER.getJavaObject(string, defaultDate); } catch (ParseException e) { setError(ConditionsExportDateSelectionPage.class, e.getMessage()); } }
@Override protected Composite buildFileChooser(Composite parent) { Composite composite = super.buildFileChooser(parent); Label dateLabel = new Label(composite, SWT.NONE); dateLabel.setText("Time:"); final Date defaultDate = getDefaultDate(); final Text text = new Text(composite, SWT.BORDER | SWT.SINGLE); text.setText(DATE_STRINGIFIER.getDisplayString(defaultDate)); text.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { WidgetUtils.runInDisplayThread( text, new Runnable() { @Override public void run() { parseTime(defaultDate, text.getText()); } }); } }); return composite; }