Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-04-26 12:41:38 -0400
committerMichael Keppler2019-05-01 06:41:51 -0400
commitf8800d8ed1b5002bcf4cccfa431d24b17f3b480a (patch)
treeb5c13f2b77eb7f5ffa4deaa9a3cc7bfdc8f6d61f /org.eclipse.egit.ui.test/src
parentc14842f57dceb3d7c5e699f31c65c35d0967149a (diff)
downloadegit-f8800d8ed1b5002bcf4cccfa431d24b17f3b480a.tar.gz
egit-f8800d8ed1b5002bcf4cccfa431d24b17f3b480a.tar.xz
egit-f8800d8ed1b5002bcf4cccfa431d24b17f3b480a.zip
Get display instance from workbench
org.eclipse.ui.IWorkbench.getDisplay() recommends to always use that method instead of Display.getDefault(). Change-Id: I0d7512aa9b40ad26e0b71356aa90bebd5b7611f7 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui.test/src')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/GitImportRepoWizard.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/SwitchToMenuTest.java10
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java4
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java7
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/trace/TraceConfigurationDialogTest.java6
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java7
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java6
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewGitChangeSetModelTest.java6
11 files changed, 31 insertions, 29 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/GitImportRepoWizard.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/GitImportRepoWizard.java
index c944814b6..ab565fc8c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/GitImportRepoWizard.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/GitImportRepoWizard.java
@@ -22,6 +22,7 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.ui.PlatformUI;
public class GitImportRepoWizard {
@@ -107,7 +108,7 @@ public class GitImportRepoWizard {
// TODO: move this to some utility class
private void pressAltAndChar(final SWTBotShell shell, final char charToPress) {
- final Display display = Display.getDefault();
+ final Display display = PlatformUI.getWorkbench().getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
index a1b6f4e8f..ccd8e682b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
@@ -85,6 +85,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.ui.history.IHistoryView;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.ui.PlatformUI;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -781,7 +782,7 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
}
protected void pressAltAndChar(SWTBotShell shell, char charToPress) {
- Display display = Display.getDefault();
+ Display display = PlatformUI.getWorkbench().getDisplay();
Event evt = new Event();
// Alt down
evt.type = SWT.KeyDown;
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/SwitchToMenuTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/SwitchToMenuTest.java
index 768dc3892..3c8594784 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/SwitchToMenuTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/SwitchToMenuTest.java
@@ -34,12 +34,12 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.ui.ISources;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.services.IServiceLocator;
import org.junit.Before;
@@ -269,10 +269,10 @@ public class SwitchToMenuTest extends LocalRepositoryTestCase {
private MenuItem[] fillMenu() {
final MenuItem[][] items = new MenuItem[1][];
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
- Menu menu = new Menu(new Shell(Display.getDefault()));
+ Menu menu = new Menu(new Shell(PlatformUI.getWorkbench().getDisplay()));
switchToMenu.fill(menu, 0 /* index */);
items[0] = menu.getItems();
}
@@ -289,7 +289,7 @@ public class SwitchToMenuTest extends LocalRepositoryTestCase {
private static void assertTextEquals(final String expectedText,
final MenuItem item) {
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
assertEquals(expectedText, item.getText());
@@ -299,7 +299,7 @@ public class SwitchToMenuTest extends LocalRepositoryTestCase {
private static void assertStyleEquals(final int expectedStyle,
final MenuItem item) {
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
assertEquals(expectedStyle, item.getStyle());
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
index b6cf090f8..17e62768b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
@@ -803,7 +803,7 @@ public class TestUtil {
}
public static SWTBotView showView(final String viewId) {
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench()
@@ -827,7 +827,7 @@ public class TestUtil {
}
public static void hideView(final String viewId) {
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
index f2a0d12ff..3e95720b0 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
@@ -38,7 +38,6 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
@@ -307,7 +306,7 @@ public class HistoryViewTest extends LocalRepositoryTestCase {
table.getTableItem(0).select();
final RevCommit[] commit = new RevCommit[1];
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
@@ -365,7 +364,7 @@ public class HistoryViewTest extends LocalRepositoryTestCase {
table.getTableItem(0).select();
final RevCommit[] commit = new RevCommit[1];
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
@@ -427,7 +426,7 @@ public class HistoryViewTest extends LocalRepositoryTestCase {
table.getTableItem(line).select();
final RevCommit[] commit = new RevCommit[1];
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
index 65e0d934d..27bae49a9 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
@@ -52,7 +52,6 @@ import org.eclipse.jgit.lib.TagBuilder;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.RawParseUtils;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.utils.TableCollection;
@@ -211,7 +210,7 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
// repo relative path
assertEquals("ToBeDeleted", showUndeleted.bot().tree()
.getAllItems()[0].getItems()[0].getItems()[0].getText());
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
assertSame(folderImage, showUndeleted.bot().tree()
@@ -244,7 +243,7 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
// resource path
assertEquals("ToBeDeleted", showUndeleted.bot().tree()
.getAllItems()[0].getItems()[0].getItems()[0].getText());
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
assertSame(projectImage, showUndeleted.bot().tree()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
index a70b671f0..e45b98ca0 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
@@ -35,6 +35,7 @@ import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.ui.PlatformUI;
import org.junit.Before;
import org.junit.Test;
@@ -236,7 +237,7 @@ public class CreatePatchActionTest extends LocalRepositoryTestCase {
private static void assertClipboard(final String expected) {
final String[] value = { null };
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
Clipboard clp = new Clipboard(Display.getCurrent());
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/trace/TraceConfigurationDialogTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/trace/TraceConfigurationDialogTest.java
index 3ba1d7729..5f7da3baa 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/trace/TraceConfigurationDialogTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/trace/TraceConfigurationDialogTest.java
@@ -20,7 +20,6 @@ import org.eclipse.egit.ui.common.EGitTestCase;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.dialogs.GitTraceConfigurationDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
@@ -28,6 +27,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.PlatformUI;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -154,14 +154,14 @@ public class TraceConfigurationDialogTest {
}
private void getDialog() {
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
if (configurationDialog != null)
configurationDialog.close();
GitTraceConfigurationDialog dlg = new GitTraceConfigurationDialog(
- new Shell(Display.getDefault()));
+ new Shell(PlatformUI.getWorkbench().getDisplay()));
dlg.setBlockOnOpen(false);
dlg.open();
configurationDialog = bot.shell(
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
index 185e8b128..d332f2516 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
@@ -45,6 +45,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.PlatformUI;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -74,7 +75,7 @@ public class GitRepositoriesViewRepoHandlingTest extends
final SWTBotTree tree = getOrOpenView().bot().tree();
tree.getAllItems()[0].select();
waitInUI();
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
@@ -106,13 +107,13 @@ public class GitRepositoriesViewRepoHandlingTest extends
final Exception[] exceptions = new Exception[1];
final SWTBotLabel label = getOrOpenView().bot().label(
UIText.RepositoriesView_messageEmpty);
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
Clipboard clip = null;
try {
- clip = new Clipboard(Display.getDefault());
+ clip = new Clipboard(PlatformUI.getWorkbench().getDisplay());
clip.setContents(new Object[] { repositoryFile.getPath() },
new Transfer[] { TextTransfer.getInstance() });
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java
index 79df4a474..df7e6886a 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java
@@ -26,9 +26,9 @@ import org.eclipse.egit.ui.internal.repository.tree.TagsNode;
import org.eclipse.egit.ui.internal.repository.tree.WorkingDirNode;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.PlatformUI;
public class GitRepositoriesViewTestUtils {
@@ -39,7 +39,7 @@ public class GitRepositoriesViewTestUtils {
*/
public static RepositoryTreeNodeLabelProvider createLabelProvider() {
final AtomicReference<RepositoryTreeNodeLabelProvider> providerRef = new AtomicReference<>();
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
@@ -62,7 +62,7 @@ public class GitRepositoriesViewTestUtils {
}
public void dispose() {
- Display.getDefault().syncExec(() -> labelProvider.dispose());
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> labelProvider.dispose());
}
public SWTBotTreeItem getLocalBranchesItem(SWTBotTree tree, File repo)
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewGitChangeSetModelTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewGitChangeSetModelTest.java
index 990baf611..6afb055d1 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewGitChangeSetModelTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewGitChangeSetModelTest.java
@@ -46,13 +46,13 @@ import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.Status;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.ui.PlatformUI;
import org.hamcrest.Matcher;
import org.junit.Before;
import org.junit.Ignore;
@@ -312,7 +312,7 @@ public class SynchronizeViewGitChangeSetModelTest extends
FILE1, true);
// when
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
CommonUtils.runCommand("org.eclipse.compare.copyLeftToRight",
@@ -343,7 +343,7 @@ public class SynchronizeViewGitChangeSetModelTest extends
FILE1, true);
// when
- Display.getDefault().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
CommonUtils.runCommand("org.eclipse.compare.copyRightToLeft",

Back to the top