stack filtering added to the public API
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/EnableStackFilterAction.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/EnableStackFilterAction.java
index a73cfea..8636039 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/EnableStackFilterAction.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/EnableStackFilterAction.java
@@ -36,14 +36,14 @@
 		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDLTKTestingHelpContextIds.ENABLEFILTER_ACTION);
 
 		fView= view;
-//		setChecked(JUnitPreferencePage.getFilterStack());
+		setEnabled(false);
 	}
 
 	/*
 	 * @see Action#actionPerformed
 	 */		
 	public void run() {
-//		JUnitPreferencePage.setFilterStack(isChecked());
+		fView.getTestRunnerUI().setFilterStack(isChecked());
 		fView.refresh();
 	}
 }
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/FailureTrace.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/FailureTrace.java
index 5b74de1..211fa30 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/FailureTrace.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/FailureTrace.java
@@ -44,22 +44,24 @@
 	private final Clipboard fClipboard;
     private TestElement fFailure;
     private CompareResultsAction fCompareAction;
+    private EnableStackFilterAction fStackTraceFilterAction;
 	private final FailureTableDisplay fFailureTableDisplay;
 
 	public FailureTrace(Composite parent, Clipboard clipboard, TestRunnerViewPart testRunner, ToolBar toolBar) {
 		Assert.isNotNull(clipboard);
 		
+		fTestRunner= testRunner;
+		fClipboard= clipboard;
 		// fill the failure trace viewer toolbar
 		ToolBarManager failureToolBarmanager= new ToolBarManager(toolBar);
-		failureToolBarmanager.add(new EnableStackFilterAction(this));			
+		fStackTraceFilterAction = new EnableStackFilterAction(this);
+		failureToolBarmanager.add(fStackTraceFilterAction);			
 		fCompareAction = new CompareResultsAction(this);
 		fCompareAction.setEnabled(false);
         failureToolBarmanager.add(fCompareAction);			
 		failureToolBarmanager.update(true);
 		
 		fTable= new Table(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
-		fTestRunner= testRunner;
-		fClipboard= clipboard;
 		
 		OpenStrategy handler = new OpenStrategy(fTable);
 		handler.addOpenListener(new IOpenEventListener() {
@@ -113,6 +115,10 @@
 		return runnerUI.createOpenEditorAction(traceLine);
 	}
 	
+	ITestRunnerUI getTestRunnerUI() {
+		return fTestRunner.getTestRunnerUI();
+	}
+	
 	/**
 	 * Returns the composite used to present the trace
 	 * @return The composite
@@ -176,6 +182,21 @@
 	}
 
 	/**
+	 * Prepares the trace view for the new test session.
+	 */
+	public void reset() {
+		clear();
+		final ITestRunnerUI runnerUI = fTestRunner.getTestRunnerUI();
+		if (runnerUI.canFilterStack()) {
+			fStackTraceFilterAction.setEnabled(true);
+			fStackTraceFilterAction.setChecked(runnerUI.isFilterStack());
+		} else {
+			fStackTraceFilterAction.setEnabled(false);
+			fStackTraceFilterAction.setChecked(false);
+		}
+	}
+
+	/**
 	 * Clears the non-stack trace info
 	 */
 	public void clear() {
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestRunnerViewPart.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestRunnerViewPart.java
index a2f2baf..17b6110 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestRunnerViewPart.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestRunnerViewPart.java
@@ -1333,7 +1333,7 @@
 			setTitleToolTip(null);
 			resetViewIcon();
 			clearStatus();
-			fFailureTrace.clear();
+			fFailureTrace.reset();
 
 			registerInfoMessage(" "); //$NON-NLS-1$
 			stopUpdateJobs();
@@ -1349,7 +1349,7 @@
 			setTitleToolTip();
 
 			clearStatus();
-			fFailureTrace.clear();
+			fFailureTrace.reset();
 			registerInfoMessage(fTestRunSession.getTestRunName());
 
 			updateRerunFailedFirstAction();
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TextualTrace.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TextualTrace.java
index 4e45a95..bd53b59 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TextualTrace.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TextualTrace.java
@@ -27,11 +27,15 @@
 	public static final int LINE_TYPE_STACKFRAME = 2;
 
 	private final String fTrace;
-	private final ITestRunnerUI engineUI;
+	private final ITestRunnerUI runnerUI;
 
-	public TextualTrace(String trace, ITestRunnerUI engineUI) {
-		this.engineUI = engineUI;
-		this.fTrace = engineUI.filterStackTrace(trace);
+	public TextualTrace(String trace, ITestRunnerUI runnerUI) {
+		this.runnerUI = runnerUI;
+		if (runnerUI.canFilterStack() && runnerUI.isFilterStack()) {
+			this.fTrace = runnerUI.filterStackTrace(trace);
+		} else {
+			this.fTrace = trace;
+		}
 	}
 
 	public void display(ITraceDisplay display, int maxLabelLength) {
@@ -50,7 +54,7 @@
 
 			// the stack frames of the trace
 			while ((line = readLine(bufferedReader)) != null) {
-				int type = engineUI.isStackFrame(line) ? LINE_TYPE_STACKFRAME
+				int type = runnerUI.isStackFrame(line) ? LINE_TYPE_STACKFRAME
 						: LINE_TYPE_NORMAL;
 				displayWrappedLine(display, maxLabelLength, line, type);
 			}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
index 0a023e0..60fc666 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
@@ -14,10 +14,18 @@
 import org.eclipse.dltk.testing.model.ITestCaseElement;
 import org.eclipse.dltk.testing.model.ITestElement;
 import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.osgi.util.NLS;
 
 public abstract class AbstractTestRunnerUI implements ITestRunnerUI {
 
+	/*
+	 * @see org.eclipse.dltk.testing.ITestRunnerUI#canFilterStack()
+	 */
+	public boolean canFilterStack() {
+		return false;
+	}
+
 	public String filterStackTrace(String trace) {
 		return trace;
 	}
@@ -92,4 +100,26 @@
 		return null;
 	}
 
+	public boolean isFilterStack() {
+		final IPreferenceStore store = getPreferenceStore();
+		if (store != null) {
+			return store
+					.getBoolean(DLTKTestingPreferencesConstants.DO_FILTER_STACK);
+		} else {
+			return false;
+		}
+	}
+
+	public void setFilterStack(boolean value) {
+		final IPreferenceStore store = getPreferenceStore();
+		if (store != null) {
+			store.setValue(DLTKTestingPreferencesConstants.DO_FILTER_STACK,
+					value);
+		}
+	}
+
+	protected IPreferenceStore getPreferenceStore() {
+		return DLTKTestingPlugin.getDefault().getPreferenceStore();
+	}
+
 }
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/DLTKTestingPreferencesConstants.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/DLTKTestingPreferencesConstants.java
new file mode 100644
index 0000000..8f490d2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/DLTKTestingPreferencesConstants.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2008 xored software, Inc.
+ *
+ * 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:
+ *     xored software, Inc. - initial API and Implementation (Alex Panchenko)
+ *******************************************************************************/
+package org.eclipse.dltk.testing;
+
+/**
+ * Defines constants which are used to refer to values in the plugin's
+ * preference store.
+ */
+public class DLTKTestingPreferencesConstants {
+
+	/**
+	 * Boolean preference controlling whether the failure stack should be
+	 * filtered.
+	 */
+	public static final String DO_FILTER_STACK = DLTKTestingPlugin.PLUGIN_ID
+			+ ".do_filter_stack"; //$NON-NLS-1$
+
+}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
index 2828b58..41ba119 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
@@ -20,14 +20,6 @@
 public interface ITestRunnerUI extends IAdaptable {
 
 	/**
-	 * Filters the stack trace if filtering is enabled for this engine.
-	 * 
-	 * @param trace
-	 * @return
-	 */
-	String filterStackTrace(String trace);
-
-	/**
 	 * Tests that the specified line looks like a stack frame
 	 * 
 	 * @param line
@@ -67,4 +59,34 @@
 	 */
 	boolean canRerun(ITestElement testElement);
 
+	/**
+	 * Tests that this testing engine can filter the stack.
+	 * 
+	 * @return
+	 */
+	boolean canFilterStack();
+
+	/**
+	 * Filters the stack trace. This method is called only if filtering is
+	 * enabled for this engine.
+	 * 
+	 * @param trace
+	 * @return
+	 */
+	String filterStackTrace(String trace);
+
+	/**
+	 * Tests that stack filtering is enabled for this engine.
+	 * 
+	 * @return
+	 */
+	boolean isFilterStack();
+
+	/**
+	 * Sets the filtering value for this engine.
+	 * 
+	 * @param value
+	 */
+	void setFilterStack(boolean value);
+
 }