</action>
</objectContribution>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ name="PHPUnit Preference"
+ category="PHPUnit"
+ class="net.sourceforge.phpeclipse.phpunit.preferences.PHPUnitPreferencePage"
+ id="net.sourceforge.phpeclipse.phpunit.preferences.PHPUnitPreferencePage">
+ </page>
+ </extension>
</plugin>
* Available cached Images in the Java plugin image registry.
*/
- public static final String IMG_SELECT_TEST_SUITE =
- NAME_PREFIX + "tsuite.gif";
+ public static final String IMG_SELECT_TEST_SUITE = NAME_PREFIX + "tsuite.gif";
public static final String IMG_RUN_TEST_SUITE = NAME_PREFIX + "start.gif";
public static final String IMG_TEST_ERROR = NAME_PREFIX + "testerr.gif";
public static final String IMG_TEST_FAILURE = NAME_PREFIX + "testfail.gif";
public static final String IMG_TEST_SUITE_PASS = NAME_PREFIX + "tsuiteok.gif";
public static final String IMG_TEST_SUITE_FAILURE = NAME_PREFIX + "tsuitefail.gif";
+ public static final String IMG_ERROR = NAME_PREFIX + "error.gif";
+ public static final String IMG_FAILURE = NAME_PREFIX + "failure.gif";
public static final ImageDescriptor DESC_TEST_SUITE_PASS = createManaged(IMG_TEST_SUITE_PASS);
public static final ImageDescriptor DESC_TEST_SUITE_FAILURE = createManaged(IMG_TEST_SUITE_FAILURE);
+ public static final ImageDescriptor DESC_ERROR = createManaged(IMG_ERROR);
+ public static final ImageDescriptor DESC_FAILURE = createManaged(IMG_FAILURE);
/**
* Returns the image managed under the given key in this registry.
*
import java.io.FileWriter;
import java.io.IOException;
+import net.sourceforge.phpeclipse.phpunit.preferences.PHPUnitPreferencePage;
import net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
import net.sourceforge.phpeclipse.phpunit.testpool.TestPool;
import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
out.write("<?php" + "\n");
out.write("ob_start();" + "\n");
+
+ String path = PHPUnitPlugin.getDefault().getPreferenceStore().getString(PHPUnitPreferencePage.PHPUNIT_PATH);
+
- //TODO: use install dir for path to phpunit. include it with plugin.
- out.write("$path = \"C:/Documents and Settings/Ali Echihabi/My Documents/workspace.eclipse2.1/PHPUnit/phpunit\";" + "\n");
+ out.write("$path = \"" + path + "\";" + "\n");
out.write("include_once($path . \"/phpunit_test.php\");" + "\n");
out.write("include_once $path . \"/socketTestResult.php\";" + "\n");
import net.sourceforge.phpeclipse.phpunit.testpool.TestPool;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
private Label labelRuns, labelRunsVal; // Runs: 12
- private Label labelErrors, labelErrorsVal;
- private Label labelFailures, labelFailuresVal;
+ private Label labelErrors, labelErrorsImage, labelErrorsVal;
+ private Label labelFailures, labelFailuresImage, labelFailuresVal;
+
private ProgressBar progressBar;
/**
Composite labelsComposite =
new Composite(this, SWT.NONE);
+
labelsComposite.setLayoutData(
new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
labelRunsVal = new Label(labelsComposite, SWT.NONE);
labelRunsVal.setText("0 / 0");
+ labelFailuresImage = new Label(labelsComposite, SWT.NONE);
+ labelFailuresImage.setImage(PHPUnitImages.DESC_FAILURE.createImage());
labelFailures = new Label(labelsComposite, SWT.NONE);
labelFailures.setText("Failures: ");
labelFailuresVal = new Label(labelsComposite, SWT.NONE);
labelFailuresVal.setText("0");
+
+ labelErrorsImage = new Label(labelsComposite, SWT.NONE);
+ labelErrorsImage.setImage(PHPUnitImages.DESC_ERROR.createImage());
labelErrors = new Label(labelsComposite, SWT.NONE);
labelErrors.setText("Errors: ");
labelErrorsVal = new Label(labelsComposite, SWT.NONE);
public void run(IAction action) {
try {
- PHPUnitView.getDefault().startTests();
+ PHPUnitView.getDefault().startTests("");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
--- /dev/null
+package net.sourceforge.phpeclipse.phpunit.preferences;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import net.sourceforge.phpeclipse.phpunit.PHPUnitPlugin;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * 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) {
+
+ }
+}
\ No newline at end of file