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
this(name, labelText, UNLIMITED, parent);
    }
    /* (non-Javadoc)
     * Method declared on FieldEditor.
     */
    protected void adjustForNumColumns(int numColumns) {
        GridData gd = (GridData) textField.getLayoutData();
        gd.horizontalSpan = numColumns - 1;
        
        
        
        gd.grabExcessHorizontalSpace = gd.horizontalSpan == 1;
    }
    /**
     * Checks whether the text input field contains a valid value or not.
     *
     * @return <code>true</code> if the field value is valid,
     *   and <code>false</code> if invalid
     */
    protected boolean checkState() {
        boolean result = false;
        if (emptyStringAllowed) {
			result = true;
		}
        if (textField == null) {
			result = false;
		}
        String txt = textField.getText();
        result = (txt.trim().length() > 0) || emptyStringAllowed;