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
* <code>true</code> by default.
     */
    private boolean emptyStringAllowed = true;
    /**
     * The validation strategy; 
     * <code>VALIDATE_ON_KEY_STROKE</code> by default.
     */
    private int validateStrategy = VALIDATE_ON_KEY_STROKE;
    /**
     * Creates a new string field editor 
     */
    protected StringFieldEditor() {
    }
    /**
     * Creates a string field editor.
     * Use the method <code>setTextLimit</code> to limit the text.
     * 
     * @param name the name of the preference this field editor works on
     * @param labelText the label text of the field editor
     * @param width the width of the text input field in characters,
     *  or <code>UNLIMITED</code> for no limit
     * @param strategy either <code>VALIDATE_ON_KEY_STROKE</code> to perform
     *  on the fly checking (the default), or <code>VALIDATE_ON_FOCUS_LOST</code> to
     *  perform validation only after the text has been typed in
     * @param parent the parent of the field editor's control
     * @since 2.0
     */
    public StringFieldEditor(String name, String labelText, int width,
            int strategy, Composite parent) {
        init(name, labelText);