public SimpleRiskFieldEditor(final Composite parent, final IMetricEnum owner) { this.owner = owner; shell = new Composite(parent, 0); final GridLayout l = new GridLayout(); l.numColumns = 3; shell.setLayout(l); method = new Combo(shell, 0); for (final RiskMethod m : RiskMethod.values()) { method.add(m.getText()); } method.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final RiskMethod newMethod = RiskMethod.myMethod(method.getSelectionIndex()); if (newMethod != old) { old = newMethod; updateSpinners(newMethod, false); firePropChanged(); } } }); method.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { firePropChanged(); } }); spinners = new Spinner[0]; listeners = new ArrayList<IRiskEditorListener>(); }
@Override public void loadDefault() { do_load(true); old = RiskMethod.myMethod(method.getSelectionIndex()); checkValid(); }
protected void do_load(final boolean toDefault) { final RiskMethod m = PreferenceManager.getRiskMethod(owner, toDefault); updateSpinners(m, toDefault); method.select(m.ordinal()); }