public StringFieldEditor(FieldParameter fieldParam) { super(); m_FieldParam = fieldParam; m_Value = m_FieldParam.getType(); this.setText(m_Value.asString()); m_Valid = m_FieldParam.isValid(m_Value); this.getDocument().addDocumentListener(this); this.setToolTipText(m_Value.getTooltip()); this.setColumns(NUM_COLS); this.setHorizontalAlignment(JTextField.LEFT); }
private void textChanged() { if (isTextValid()) { boolean newState = m_Valid; try { m_Value = m_FieldParam.getType().parseString(this.getText()); newState = m_FieldParam.isValid(m_Value); } catch (Exception e) { newState = false; ErrorHandler.getInstance().handleException(e, Activator.getBundle()); } if (newState != m_Valid) { m_Valid = newState; this.notifyListeners(); } } }
private boolean isTextValid() { return m_FieldParam.getType().isValid(this.getText()); }