Bug 109389 [JFace] API - IntegerFieldEditor does not fire property change all the time
How to reproduce : JDT must be installed. Open Run->debug... Create a new Remote Java Application. Select (Standard)Socket Attach if not already selected. Change the default port value 8000 to 800011 (this value is invalid but is does not matter). Click on the Apply button. Select another debug configuration and come back to the configuration we have just created. Select the last two figures 11 in the port value and suppress them so that the port value is 8000 again. You will then notice that the apply button is still grayed out, because the IntegerFieldEditor did not fire a propertychange event. Here is the code that should correct it from org.eclipse.jface.preference.IntegerFieldEditor: /* (non-Javadoc) * Method declared on FieldEditor. */ protected void doLoad() { Text text = getTextControl(); if (text != null) { int value = getPreferenceStore().getInt(getPreferenceName()); text.setText("" + value);//$NON-NLS-1$ oldvalue = "" + value;<----------------------- this must be added } } and oldvalue must be made protected in the StringFieldEditor. I think that should correct the bug. Sebastien.
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringFieldEditor.java
* Text limit constant (value <code>-1</code>) indicating unlimited
     * text limit and width.
     */
    public static int UNLIMITED = -1;
    /**
     * Cached valid state.
     */
    private boolean isValid;
    /**
     * Old text value.
     */
    private String oldValue;
    /**
     * The text field, or <code>null</code> if none.
     */
    Text textField;
    /**
     * Width of text field in characters; initially unlimited.
     */
    private int widthInChars = UNLIMITED;
    /**
     * Text limit of text field in characters; initially unlimited.
     */
    private int textLimit = UNLIMITED;
    /**
     * The error message, or <code>null</code> if none.
     */
    private String errorMessage;
    /**
     * Indicates whether the empty string is legal;