1 /*************************************************************************
2 * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
4 * Plugin for PHP unit Testing.
7 *************************************************************************/
9 package net.sourceforge.phpeclipse.phpunit.preferences;
11 import net.sourceforge.phpeclipse.phpunit.PHPUnitPlugin;
13 import org.eclipse.jface.preference.DirectoryFieldEditor;
14 import org.eclipse.jface.preference.FieldEditorPreferencePage;
15 import org.eclipse.jface.preference.IPreferenceStore;
16 import org.eclipse.ui.IWorkbench;
17 import org.eclipse.ui.IWorkbenchPreferencePage;
20 * This class represents a preference page that is contributed to the
21 * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>,
22 * we can use the field support built into JFace that allows us to create a page
23 * that is small and knows how to save, restore and apply itself.
25 * This page is used to modify preferences only. They are stored in the
26 * preference store that belongs to the main plug-in class. That way,
27 * preferences can be accessed directly via the preference store.
30 public class PHPUnitPreferencePage extends FieldEditorPreferencePage implements
31 IWorkbenchPreferencePage {
33 public static final String PHPUNIT_PATH = "PHPUnitPathPreference";
35 public PHPUnitPreferencePage() {
37 setPreferenceStore(PHPUnitPlugin.getDefault().getPreferenceStore());
38 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. ");
43 * Sets the default values of the preferences.
45 private void initializeDefaults() {
46 IPreferenceStore store = getPreferenceStore();
51 * Creates the field editors. Field editors are abstractions of the common
52 * GUI blocks needed to manipulate various types of preferences. Each field
53 * editor knows how to save and restore itself.
56 public void createFieldEditors() {
58 addField(new DirectoryFieldEditor(PHPUNIT_PATH, "&PHPUnit Path:",
59 getFieldEditorParent()));
63 public void init(IWorkbench workbench) {