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