summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Eisenberg2013-07-24 05:05:54 (EDT)
committerNoopur Gupta2013-07-24 05:05:54 (EDT)
commitd0add1708b812c80384d88ef4eb52493b862187d (patch)
tree9a3f6458dfcc327ceacd0d77b14e6d825e25b485
parent01524fcfdc12164ec5864d460a15ce8fd50aa088 (diff)
downloadeclipse.jdt.ui-d0add1708b812c80384d88ef4eb52493b862187d.zip
eclipse.jdt.ui-d0add1708b812c80384d88ef4eb52493b862187d.tar.gz
eclipse.jdt.ui-d0add1708b812c80384d88ef4eb52493b862187d.tar.bz2
Fixed bug 411794: [JUnit] Add a monospace font option for the junit
results view Signed-off-by: Andrew Eisenberg <andrew@eisenberg.as>
-rw-r--r--org.eclipse.jdt.junit/plugin.properties5
-rw-r--r--org.eclipse.jdt.junit/plugin.xml11
-rw-r--r--org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/FailureTrace.java35
-rw-r--r--org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java6
4 files changed, 54 insertions, 3 deletions
diff --git a/org.eclipse.jdt.junit/plugin.properties b/org.eclipse.jdt.junit/plugin.properties
index de44686..cf4f3a5 100644
--- a/org.eclipse.jdt.junit/plugin.properties
+++ b/org.eclipse.jdt.junit/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2000, 2013 IBM Corporation and others.
# 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
@@ -7,6 +7,7 @@
#
# Contributors:
# IBM Corporation - initial API and implementation
+# Andrew Eisenberg <andrew@eisenberg.as> - [JUnit] Add a monospace font option for the junit results view - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411794
###############################################################################
pluginName=Java Development Tools JUnit support
providerName=Eclipse.org
@@ -30,6 +31,8 @@ preferenceKeywords.wizards.java=Java
View.label= JUnit
Launch.label= JUnit
PreferencePage.label= JUnit
+FailureTraceFont.label= JUnit test results font
+FailureTraceFont.description= The JUnit test results font is used by the JUnit view to display the stack trace and message of a failed test run.
TestWizard.description= Create a JUnit Test Case
SuiteWizard.description= Create a JUnit Test Suite
diff --git a/org.eclipse.jdt.junit/plugin.xml b/org.eclipse.jdt.junit/plugin.xml
index 2bdf15a..d4399b8 100644
--- a/org.eclipse.jdt.junit/plugin.xml
+++ b/org.eclipse.jdt.junit/plugin.xml
@@ -448,4 +448,15 @@
class="org.eclipse.jdt.internal.junit.ui.UITestRunListener">
</testRunListener>
</extension>
+ <extension
+ point="org.eclipse.ui.themes">
+ <fontDefinition
+ categoryId="org.eclipse.jdt.ui.presentation"
+ id="org.eclipse.jdt.junit.failurePaneFont"
+ label="%FailureTraceFont.label">
+ <description>
+ %FailureTraceFont.description
+ </description>
+ </fontDefinition>
+ </extension>
</plugin>
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/FailureTrace.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/FailureTrace.java
index 5e57509..cbef720 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/FailureTrace.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/FailureTrace.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* 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
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Sebastian Davids: sdavids@gmx.de bug 37333, 26653
* Johan Walles: walles@mailblocks.com bug 68737
+ * Andrew Eisenberg: andrew@eisenberg.as bug 411794
*******************************************************************************/
package org.eclipse.jdt.internal.junit.ui;
@@ -29,8 +30,11 @@ import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.IOpenEventListener;
+import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.OpenStrategy;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jdt.internal.junit.JUnitPreferencesConstants;
import org.eclipse.jdt.internal.junit.model.TestElement;
@@ -39,7 +43,27 @@ import org.eclipse.jdt.internal.junit.model.TestElement;
* A pane that shows a stack trace of a failed test.
*/
public class FailureTrace implements IMenuListener {
+
+ /**
+ * Internal property change listener for handling workbench font changes.
+ */
+ private class FontPropertyChangeListener implements IPropertyChangeListener {
+ /*
+ * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ if (fTable == null)
+ return;
+
+ String property= event.getProperty();
+
+ if (FAILURE_FONT.equals(property))
+ fTable.setFont(JFaceResources.getFont(FAILURE_FONT));
+ }
+ }
+
private static final int MAX_LABEL_LENGTH = 256;
+ private static final String FAILURE_FONT = "org.eclipse.jdt.junit.failurePaneFont"; //$NON-NLS-1$
static final String FRAME_PREFIX= "at "; //$NON-NLS-1$
private Table fTable;
@@ -49,6 +73,7 @@ public class FailureTrace implements IMenuListener {
private TestElement fFailure;
private CompareResultsAction fCompareAction;
private final FailureTableDisplay fFailureTableDisplay;
+ private IPropertyChangeListener fFontPropertyChangeListener;
public FailureTrace(Composite parent, Clipboard clipboard, TestRunnerViewPart testRunner, ToolBar toolBar) {
Assert.isNotNull(clipboard);
@@ -62,6 +87,7 @@ public class FailureTrace implements IMenuListener {
failureToolBarmanager.update(true);
fTable= new Table(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
+ fTable.setFont(JFaceResources.getFont(FAILURE_FONT));
fTestRunner= testRunner;
fClipboard= clipboard;
@@ -78,6 +104,9 @@ public class FailureTrace implements IMenuListener {
}
}
});
+
+ fFontPropertyChangeListener = new FontPropertyChangeListener();
+ JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener);
initMenu();
@@ -220,4 +249,8 @@ public class FailureTrace implements IMenuListener {
public FailureTableDisplay getFailureTableDisplay() {
return fFailureTableDisplay;
}
+
+ public void dispose() {
+ JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener);
+ }
}
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java
index b22afa0..ccf104e 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java
@@ -14,7 +14,8 @@
* - https://bugs.eclipse.org/bugs/show_bug.cgi?id=102236: [JUnit] display execution time next to each test
* Achim Demelt <a.demelt@exxcellent.de> - [junit] Separate UI from non-UI code - https://bugs.eclipse.org/bugs/show_bug.cgi?id=278844
* Andrew Eisenberg <andrew@eisenberg.as> - [JUnit] Rerun failed first does not work with JUnit4 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=140392
- * Thirumala Reddy Mutchukota <thirumala@google.com> - [JUnit] Avoid rerun test launch on UI thread - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411841
+ * Thirumala Reddy Mutchukota <thirumala@google.com> - [JUnit] Avoid rerun test launch on UI thread - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411841
+ * Andrew Eisenberg <andrew@eisenberg.as> - [JUnit] Add a monospace font option for the junit results view - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411794
*******************************************************************************/
package org.eclipse.jdt.internal.junit.ui;
@@ -1575,6 +1576,9 @@ action enablement
JavaCore.removeElementChangedListener(fDirtyListener);
fDirtyListener= null;
}
+ if (fFailureTrace != null) {
+ fFailureTrace.dispose();
+ }
}
private void disposeImages() {