small API changes
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/model/TestRunSession.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/model/TestRunSession.java
index 7dacd11..27874b8 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/model/TestRunSession.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/model/TestRunSession.java
@@ -884,7 +884,7 @@
testElement.setStatus(status);
}
- public TestElement[] getAllFailedTestElements() {
+ public ITestElement[] getAllFailedTestElements() {
ArrayList failures= new ArrayList();
addFailures(failures, getTestRoot());
return (TestElement[]) failures.toArray(new TestElement[failures.size()]);
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/CopyFailureListAction.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/CopyFailureListAction.java
index cc16308..770936f 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/CopyFailureListAction.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/CopyFailureListAction.java
@@ -10,36 +10,35 @@
*******************************************************************************/
package org.eclipse.dltk.internal.testing.ui;
+import org.eclipse.dltk.internal.testing.model.TestElement;
+import org.eclipse.dltk.testing.DLTKTestingMessages;
+import org.eclipse.dltk.testing.model.ITestCaseElement;
+import org.eclipse.dltk.testing.model.ITestElement;
+import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-
import org.eclipse.ui.PlatformUI;
-import org.eclipse.dltk.internal.testing.model.TestElement;
-import org.eclipse.dltk.testing.DLTKTestingMessages;
-import org.eclipse.dltk.ui.DLTKUIPlugin;
-
-
-
/**
- * Copies the names of the methods that failed and their traces to the clipboard.
+ * Copies the names of the methods that failed and their traces to the
+ * clipboard.
*/
public class CopyFailureListAction extends Action {
-
+
private final Clipboard fClipboard;
private final TestRunnerViewPart fRunner;
-
+
public CopyFailureListAction(TestRunnerViewPart runner, Clipboard clipboard) {
super(DLTKTestingMessages.CopyFailureList_action_label);
- fRunner= runner;
- fClipboard= clipboard;
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDLTKTestingHelpContextIds.COPYFAILURELIST_ACTION);
+ fRunner = runner;
+ fClipboard = clipboard;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+ IDLTKTestingHelpContextIds.COPYFAILURELIST_ACTION);
}
/*
@@ -47,38 +46,41 @@
*/
public void run() {
TextTransfer plainTextTransfer = TextTransfer.getInstance();
-
+
try {
- fClipboard.setContents(
- new String[] { getAllFailureTraces() },
+ fClipboard.setContents(new String[] { getAllFailureTraces() },
new Transfer[] { plainTextTransfer });
- } catch (SWTError e){
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
+ } catch (SWTError e) {
+ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
throw e;
- if (MessageDialog.openQuestion(DLTKUIPlugin.getActiveWorkbenchShell(), DLTKTestingMessages.CopyFailureList_problem, DLTKTestingMessages.CopyFailureList_clipboard_busy))
+ if (MessageDialog.openQuestion(DLTKUIPlugin
+ .getActiveWorkbenchShell(),
+ DLTKTestingMessages.CopyFailureList_problem,
+ DLTKTestingMessages.CopyFailureList_clipboard_busy))
run();
}
}
-
+
public String getAllFailureTraces() {
- StringBuffer buf= new StringBuffer();
- TestElement[] failures= fRunner.getAllFailures();
-
- String lineDelim= System.getProperty("line.separator", "\n"); //$NON-NLS-1$//$NON-NLS-2$
- for (int i= 0; i < failures.length; i++) {
- TestElement failure= failures[i];
+ StringBuffer buf = new StringBuffer();
+ ITestElement[] failures = fRunner.getCurrentSession()
+ .getAllFailedTestElements();
+
+ String lineDelim = System.getProperty("line.separator", "\n"); //$NON-NLS-1$//$NON-NLS-2$
+ for (int i = 0; i < failures.length; i++) {
+ TestElement failure = (TestElement) failures[i];
buf.append(failure.getTestName()).append(lineDelim);
- String failureTrace= failure.getTrace();
+ String failureTrace = failure.getTrace();
if (failureTrace != null) {
- int start= 0;
+ int start = 0;
while (start < failureTrace.length()) {
- int idx= failureTrace.indexOf('\n', start);
+ int idx = failureTrace.indexOf('\n', start);
if (idx != -1) {
- String line= failureTrace.substring(start, idx);
+ String line = failureTrace.substring(start, idx);
buf.append(line).append(lineDelim);
- start= idx + 1;
+ start = idx + 1;
} else {
- start= Integer.MAX_VALUE;
+ start = Integer.MAX_VALUE;
}
}
}
@@ -86,5 +88,4 @@
return buf.toString();
}
-
}
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 5a26201..828bc3b 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
@@ -58,6 +58,7 @@
import org.eclipse.dltk.testing.ITestRunnerUI;
import org.eclipse.dltk.testing.ITestSession;
import org.eclipse.dltk.testing.model.ITestElement;
+import org.eclipse.dltk.testing.model.ITestRunSession;
import org.eclipse.dltk.testing.model.ITestElement.Result;
import org.eclipse.dltk.ui.viewsupport.ViewHistory;
import org.eclipse.jface.action.Action;
@@ -1226,12 +1227,13 @@
try {
File file = File.createTempFile("testFailures", ".txt"); //$NON-NLS-1$ //$NON-NLS-2$
file.deleteOnExit();
- TestElement[] failures = fTestRunSession.getAllFailedTestElements();
+ ITestElement[] failures = fTestRunSession
+ .getAllFailedTestElements();
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(file));
for (int i = 0; i < failures.length; i++) {
- TestElement testElement = failures[i];
+ TestElement testElement = (TestElement) failures[i];
bw.write(testElement.getTestName());
bw.newLine();
}
@@ -1989,7 +1991,7 @@
fTestViewer.setShowFailuresOnly(failuresOnly, layoutMode);
}
- TestElement[] getAllFailures() {
- return fTestRunSession.getAllFailedTestElements();
+ public ITestRunSession getCurrentSession() {
+ return fTestRunSession;
}
}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/model/ITestCaseElement.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/model/ITestCaseElement.java
index ff6a17a..83a6d6c 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/model/ITestCaseElement.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/model/ITestCaseElement.java
@@ -27,4 +27,6 @@
*/
public String getTestName();
+ public String getTrace();
+
}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/model/ITestRunSession.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/model/ITestRunSession.java
index 2c1a09a..a75084c 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/model/ITestRunSession.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/model/ITestRunSession.java
@@ -32,5 +32,7 @@
public ITestingClient getTestRunnerClient();
public void setTotalCount(int id);
-
+
+ public ITestElement[] getAllFailedTestElements();
+
}