Bug 157511 [Preferences] FileFieldEditor should have a constructor allowing the validation strategy to be set
When using the org.eclipse.jface.preference.FileFieldEditor, a user can enter an invalid filename and no error is shown unless focus is removed from the preference page and than brought back to it. As soon as the user types again, the error message is removed and the user doesn't know if the file is valid until they remove/reapply focus to the preference page. Using the StringFieldEditor::setValidateStrategy(int value) method after constructing the object does not solve the problem since StringFieldEditor::getTextControl(Composite parent) is called indirectly from the constructor and the listeners will already be setup before there is a chance to set the validation strategy. Therefore a constructor for the FileFieldEditor is needed that will allow a user to supply the validation strategy they need (since the default is currently VALIDATE_ON_FOCUS_LOST).
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FileFieldEditor.java
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.preference;
import java.io.File;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
/**
 * A field editor for a file path type preference. A standard file 
 * dialog appears when the user presses the change button.
 */
public class FileFieldEditor extends StringButtonFieldEditor {
    /**
     * List of legal file extension suffixes, or <code>null</code>
     * for system defaults.
     */
    private String[] extensions = null;
    /**
     * Indicates whether the path must be absolute;
     * <code>false</code> by default.