diff --git a/org.eclipse.eclemma.doc/pages/changes.html b/org.eclipse.eclemma.doc/pages/changes.html
index 8c847380..6be97455 100644
--- a/org.eclipse.eclemma.doc/pages/changes.html
+++ b/org.eclipse.eclemma.doc/pages/changes.html
@@ -20,6 +20,7 @@
Trunk Build (not yet released)
4.3 (Eclipse Bug 507907).
Session import and export is now consistently named and has been moved to
category Run/Debug (Eclipse Bug 507696).
+ All dialogs now respect changes of dialog font (Eclipse Bug 507694).
Automated UI tests with SWTBot.
End of support for Eclipse versions older than 3.8.
Upgrade to JaCoCo 0.7.7.
diff --git a/org.eclipse.eclemma.ui.test/META-INF/MANIFEST.MF b/org.eclipse.eclemma.ui.test/META-INF/MANIFEST.MF
index 65785a11..35758ab7 100644
--- a/org.eclipse.eclemma.ui.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.eclemma.ui.test/META-INF/MANIFEST.MF
@@ -6,5 +6,7 @@ Bundle-Version: 3.0.0.qualifier
Bundle-Vendor: Mountainminds GmbH & Co. KG
Fragment-Host: org.eclipse.eclemma.ui;bundle-version="[3.0.0,4.0.0)"
Require-Bundle: org.junit;bundle-version="4.0.0",
- org.eclipse.swtbot.eclipse.finder;bundle-version="2.5.0"
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.5.0",
+ org.apache.log4j,
+ org.eclipse.jdt.debug.ui
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/org.eclipse.eclemma.ui.test/src/org/eclipse/eclemma/ui/FontChangeTest.java b/org.eclipse.eclemma.ui.test/src/org/eclipse/eclemma/ui/FontChangeTest.java
new file mode 100644
index 00000000..2fd4462d
--- /dev/null
+++ b/org.eclipse.eclemma.ui.test/src/org/eclipse/eclemma/ui/FontChangeTest.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2016 Mountainminds GmbH & Co. KG and Contributors
+ * 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:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.eclemma.ui;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.eclemma.core.ICoverageSession;
+import org.eclipse.eclemma.core.launching.ICoverageLaunch;
+import org.eclipse.eclemma.internal.ui.dialogs.MergeSessionsDialog;
+import org.eclipse.eclemma.internal.ui.handlers.DumpExecutionDataHandler;
+import org.eclipse.eclemma.internal.ui.handlers.SelectActiveSessionHandler;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.hamcrest.CoreMatchers;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class FontChangeTest {
+
+ private static final SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+ private FontData expected;
+
+ @BeforeClass
+ public static void closeWelcomeView() {
+ try {
+ bot.viewByTitle("Welcome").close();
+ } catch (WidgetNotFoundException e) {
+ // ignore
+ }
+ }
+
+ @Before
+ public void changeFont() {
+ ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.ui.workbench");
+ expected = new FontData(store.getString(JFaceResources.DIALOG_FONT));
+ expected.setHeight(expected.getHeight() + 1);
+ store.setValue(JFaceResources.DIALOG_FONT, expected.toString());
+ }
+
+ @After
+ public void resetWorkbench() {
+ bot.resetWorkbench();
+ }
+
+ /**
+ * Test for {@link org.eclipse.eclemma.internal.ui.dialogs.CoveragePreferencePage}.
+ */
+ @Test
+ public void preferencePage() {
+ // This does not work on Mac
+ // bot.menu("Window").menu("Preferences").click();
+ // Launch preferences programmatically instead
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ public void run() {
+ ActionFactory.PREFERENCES.create(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run();
+ }
+ });
+
+ bot.shell("Preferences").activate();
+ bot.tree().getTreeItem("Java").expand().getNode("Code Coverage").select();
+
+ assertFont(expected, bot.widget(WidgetMatcherFactory.withId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.coverage_preferences_context")));
+ }
+
+ /**
+ * Test for {@link org.eclipse.eclemma.internal.ui.wizards.SessionImportPage1} and {@link org.eclipse.eclemma.internal.ui.wizards.SessionImportPage2}.
+ */
+ @Test
+ public void importWizard() {
+ bot.menu("File").menu("Import...").click();
+ bot.shell("Import").activate();
+
+ SWTBotTreeItem treeItem = bot.tree().getTreeItem("Run/Debug").expand();
+ treeItem.getNode("Coverage Session").select();
+ bot.button("Next >").click();
+
+ assertFont(expected, bot.widget(WidgetMatcherFactory.withId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.session_import_context")));
+
+ bot.radio("Agent address:").click();
+ bot.button("Next >").click();
+
+ assertFont(expected, bot.widget(WidgetMatcherFactory.withId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.session_import_context")));
+ }
+
+ /**
+ * Test for {@link org.eclipse.eclemma.internal.ui.wizards.SessionExportPage1}.
+ */
+ @Test
+ public void exportWizard() {
+ bot.menu("File").menu("Export...").click();
+ bot.shell("Export").activate();
+
+ SWTBotTreeItem treeItem = bot.tree().getTreeItem("Run/Debug").expand();
+ treeItem.getNode("Coverage Session").select();
+ bot.button("Next >").click();
+
+ assertFont(expected, bot.widget(WidgetMatcherFactory.withId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.session_export_context")));
+ }
+
+ /**
+ * Test for {@link org.eclipse.eclemma.internal.ui.dialogs.CoveragePropertyPage}.
+ */
+ @Test
+ public void propertyPage() throws CoreException {
+ createProject();
+
+ bot.viewByTitle("Project Explorer").bot().tree().select("prj").contextMenu().menu("Properties", false, 0).click();
+ bot.shell("Properties for prj").activate();
+ bot.tree().select("Coverage");
+
+ assertFont(expected, bot.widget(WidgetMatcherFactory.withId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.coverage_properties_context")));
+ }
+
+ /**
+ * Test for {@link org.eclipse.eclemma.ui.launching.CoverageTab}.
+ */
+ @Test
+ public void launchingTab() throws CoreException {
+ createProject();
+
+ bot.viewByTitle("Project Explorer").bot().tree().select("prj").contextMenu("Coverage As").menu("Coverage Configurations...").click();
+ bot.shell("Coverage Configurations").activate();
+ bot.tree().getTreeItem("Java Application").contextMenu("New").click();
+ bot.cTabItem("Coverage").activate();
+
+ assertFont(expected, bot.widget(WidgetMatcherFactory.withId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.coverage_launch_tab_context")));
+ }
+
+ private static void createProject() throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("prj");
+ if (project.exists()) {
+ project.delete(true, null);
+ }
+ project.create(null);
+ project.open(null);
+ IProjectDescription description = project.getDescription();
+ description.setNatureIds(new String[] { JavaCore.NATURE_ID });
+ project.setDescription(description, null);
+ }
+
+ /**
+ * Test for {@link org.eclipse.eclemma.internal.ui.dialogs.MergeSessionsDialog}.
+ */
+ @Test
+ public void mergeSessionsDialog() {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ public void run() {
+ new MergeSessionsDialog(bot.activeShell().widget, new ArrayList(), "").open();
+ }
+ });
+
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ assertFont(expected, bot.shellWithId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.merge_sessions_context").widget.getChildren()[0]);
+ }
+ });
+ }
+
+ /**
+ * Test for {@link org.eclipse.eclemma.internal.ui.handlers.SelectActiveSessionHandler}.
+ */
+ @Test
+ public void selectActiveSessionDialog() throws ExecutionException {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ public void run() {
+ try {
+ new SelectActiveSessionHandler().execute(new ExecutionEvent());
+ } catch (ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+
+ assertFont(expected, bot.shellWithId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.select_active_session_context").widget);
+ }
+
+ /**
+ * Test for {@link org.eclipse.eclemma.internal.ui.handlers.DumpExecutionDataHandler#openDialog(ExecutionEvent, java.util.List)}.
+ */
+ @Test
+ public void selectLaunchDialog() {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ public void run() {
+ DumpExecutionDataHandler.openDialog(new ExecutionEvent(), new ArrayList());
+ }
+ });
+
+ assertFont(expected, bot.shellWithId("org.eclipse.ui.help", "org.eclipse.eclemma.ui.dump_execution_data").widget);
+ }
+
+ private static void assertFont(final FontData expected, final Widget parentWidget) {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ for (Control widget : bot.widgets(CoreMatchers.any(Control.class), parentWidget)) {
+ FontData actual = widget.getFont().getFontData()[0];
+ assertEquals(widget + " font", expected, actual);
+ }
+ }
+ });
+ }
+
+}
diff --git a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/dialogs/CoveragePreferencePage.java b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/dialogs/CoveragePreferencePage.java
index 3c8098c6..2726cb44 100644
--- a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/dialogs/CoveragePreferencePage.java
+++ b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/dialogs/CoveragePreferencePage.java
@@ -15,6 +15,7 @@
import org.eclipse.eclemma.internal.ui.EclEmmaUIPlugin;
import org.eclipse.eclemma.internal.ui.UIMessages;
import org.eclipse.eclemma.internal.ui.UIPreferences;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.BooleanFieldEditor;
@@ -63,6 +64,7 @@ protected Control createContents(final Composite parent) {
createLink(result, UIMessages.CoveragePreferencesAnnotationsLink_label,
ANNOTATIONS_PAGE);
+ Dialog.applyDialogFont(result);
initialize();
checkState();
return result;
diff --git a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/dialogs/CoveragePropertyPage.java b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/dialogs/CoveragePropertyPage.java
index f6404a5e..d366f106 100644
--- a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/dialogs/CoveragePropertyPage.java
+++ b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/dialogs/CoveragePropertyPage.java
@@ -14,6 +14,7 @@
import java.text.DecimalFormat;
import java.text.NumberFormat;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.OwnerDrawLabelProvider;
@@ -77,6 +78,7 @@ protected Control createContents(Composite parent) {
gd.horizontalSpan = 2;
table.setLayoutData(gd);
+ Dialog.applyDialogFont(parent);
return parent;
}
diff --git a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/handlers/DumpExecutionDataHandler.java b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/handlers/DumpExecutionDataHandler.java
index 4dfffdbd..123017a4 100644
--- a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/handlers/DumpExecutionDataHandler.java
+++ b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/handlers/DumpExecutionDataHandler.java
@@ -94,11 +94,12 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
return null;
}
- private ICoverageLaunch openDialog(ExecutionEvent event,
+ public static ICoverageLaunch openDialog(ExecutionEvent event,
List launches) {
final ListDialog dialog = new ListDialog(HandlerUtil.getActiveShell(event)) {
protected void configureShell(Shell shell) {
super.configureShell(shell);
+ Dialog.applyDialogFont(shell);
ContextHelp.setHelp(shell, ContextHelp.DUMP_EXECUTION_DATA);
}
};
diff --git a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/handlers/SelectActiveSessionHandler.java b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/handlers/SelectActiveSessionHandler.java
index 85785870..137c6583 100644
--- a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/handlers/SelectActiveSessionHandler.java
+++ b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/handlers/SelectActiveSessionHandler.java
@@ -47,6 +47,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
final ListDialog dialog = new ListDialog(HandlerUtil.getActiveShell(event)) {
protected void configureShell(Shell shell) {
super.configureShell(shell);
+ Dialog.applyDialogFont(shell);
ContextHelp.setHelp(shell, ContextHelp.SELECT_ACTIVE_SESSION);
}
};
diff --git a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionExportPage1.java b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionExportPage1.java
index 53104f66..ee1aeaf8 100644
--- a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionExportPage1.java
+++ b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionExportPage1.java
@@ -13,6 +13,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
@@ -91,6 +92,7 @@ public void createControl(Composite parent) {
group.setText(UIMessages.ExportSessionPage1DestinationGroup_label);
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
createExportOptionsGroup(group);
+ Dialog.applyDialogFont(parent);
setControl(parent);
ContextHelp.setHelp(parent, ContextHelp.SESSION_EXPORT);
restoreWidgetValues();
diff --git a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionImportPage1.java b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionImportPage1.java
index d5e382c0..a71c2dc9 100644
--- a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionImportPage1.java
+++ b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionImportPage1.java
@@ -32,6 +32,7 @@
import java.net.MalformedURLException;
import java.net.URL;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.layout.GridDataFactory;
@@ -108,6 +109,7 @@ public void createControl(Composite parent) {
ContextHelp.setHelp(parent, ContextHelp.SESSION_IMPORT);
restoreWidgetValues();
updateStatus();
+ Dialog.applyDialogFont(parent);
}
private void createFileBlock(Composite parent) {
diff --git a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionImportPage2.java b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionImportPage2.java
index b8c222b8..fbff6205 100644
--- a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionImportPage2.java
+++ b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/internal/ui/wizards/SessionImportPage2.java
@@ -18,6 +18,7 @@
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -71,6 +72,7 @@ public void createControl(Composite parent) {
createScopeBlock(parent);
createButtonsBlock(parent);
setControl(parent);
+ Dialog.applyDialogFont(parent);
ContextHelp.setHelp(parent, ContextHelp.SESSION_IMPORT);
restoreWidgetValues();
update();
diff --git a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/ui/launching/CoverageTab.java b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/ui/launching/CoverageTab.java
index 823375ad..6b3c13f4 100644
--- a/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/ui/launching/CoverageTab.java
+++ b/org.eclipse.eclemma.ui/src/org/eclipse/eclemma/ui/launching/CoverageTab.java
@@ -17,6 +17,7 @@
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
@@ -54,6 +55,7 @@ public void createControl(Composite parent) {
parent.setLayout(layout);
setControl(parent);
createAnalysisScope(parent);
+ Dialog.applyDialogFont(parent);
}
private void createAnalysisScope(Composite parent) {