/*************************************************************************
 * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
 *
 * Plugin for PHP unit Testing.
 * www.phpeclipse.de
 * 
 *************************************************************************/

package net.sourceforge.phpeclipse.phpunit.preferences;

import net.sourceforge.phpeclipse.phpunit.PHPUnitPlugin;

import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
//import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

/**
 * This class represents a preference page that is contributed to the
 * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>,
 * we can use the field support built into JFace that allows us to create a page
 * that is small and knows how to save, restore and apply itself.
 * <p>
 * This page is used to modify preferences only. They are stored in the
 * preference store that belongs to the main plug-in class. That way,
 * preferences can be accessed directly via the preference store.
 */

public class PHPUnitPreferencePage extends FieldEditorPreferencePage implements
		IWorkbenchPreferencePage {

	public static final String PHPUNIT_PATH = "PHPUnitPathPreference";

	public PHPUnitPreferencePage() {
		super(GRID);
		setPreferenceStore(PHPUnitPlugin.getDefault().getPreferenceStore());
		setDescription("Please browse for the folder containing the PHPUnit files (among them: \"phpunit.php\" and \"socketTestResult.php\"). If you don't have it, please download the latest version from http://sourceforge.net/projects/phpunit/ first. ");
		//initializeDefaults();
	}

	/**
	 * Sets the default values of the preferences.
	 */
//	private void initializeDefaults() {
//		//IPreferenceStore store = getPreferenceStore();
//
//	}

	/**
	 * Creates the field editors. Field editors are abstractions of the common
	 * GUI blocks needed to manipulate various types of preferences. Each field
	 * editor knows how to save and restore itself.
	 */

	public void createFieldEditors() {

		addField(new DirectoryFieldEditor(PHPUNIT_PATH, "&PHPUnit Path:",
				getFieldEditorParent()));

	}

	public void init(IWorkbench workbench) {

	}
}