Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-12-19 20:04:17 +0000
committerLars Vogel2020-01-17 06:16:39 +0000
commitff29989bb1381eb910796e0f1bf96239554f964f (patch)
tree298c69e2479803ee1429e59a54cdd054eb986eb7 /org.eclipse.ui.editors.tests/src
parent49bd6fef4f88b2e3c8128998bb428c61e696a710 (diff)
downloadeclipse.platform.text-ff29989bb1381eb910796e0f1bf96239554f964f.tar.gz
eclipse.platform.text-ff29989bb1381eb910796e0f1bf96239554f964f.tar.xz
eclipse.platform.text-ff29989bb1381eb910796e0f1bf96239554f964f.zip
Using the batch cleanup operation via Source -> Cleanup -> "Use lambdas where possible" from standard JDT. Change-Id: I609127e1d7267230c8741a155b81e4b004d7ee15 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'org.eclipse.ui.editors.tests/src')
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java46
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java9
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java27
3 files changed, 27 insertions, 55 deletions
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java
index 91531f44a..8d4505a41 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/FileDocumentProviderTest.java
@@ -157,12 +157,9 @@ public class FileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay so that we can verify the UI events are still
// dispatched after the call to refreshFile() below
- Display.getCurrent().timerExec(500, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(500, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -189,12 +186,9 @@ public class FileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay so that we can verify the UI events are still
// dispatched after the call to refreshFile() below
- Display.getCurrent().timerExec(500, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(500, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -218,12 +212,9 @@ public class FileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay
- Display.getCurrent().timerExec(600, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(600, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -355,18 +346,15 @@ class LockJob extends WorkspaceJob {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- run2();
- } catch (Exception e) {
- // Re-throw as OperationCanceledException, which will be
- // caught and re-thrown as InterruptedException below.
- throw new OperationCanceledException(e.getMessage());
- }
- // CoreException and OperationCanceledException are propagated
+ IWorkspaceRunnable workspaceRunnable = pm -> {
+ try {
+ run2();
+ } catch (Exception e) {
+ // Re-throw as OperationCanceledException, which will be
+ // caught and re-thrown as InterruptedException below.
+ throw new OperationCanceledException(e.getMessage());
}
+ // CoreException and OperationCanceledException are propagated
};
ResourcesPlugin.getWorkspace().run(workspaceRunnable,
resource, IResource.NONE, monitor);
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
index 8832678dd..8277314c2 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
@@ -31,7 +31,6 @@ import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -90,13 +89,7 @@ public class MarkerAnnotationOrderTest {
final ArrayList<IStatus> list= new ArrayList<>(2);
Bundle bundle= Platform.getBundle(EditorsUI.PLUGIN_ID);
ILog log= Platform.getLog(bundle);
- log.addLogListener(new ILogListener() {
-
- @Override
- public void logging(IStatus status, String plugin) {
- list.add(status);
- }
- });
+ log.addLogListener((status, plugin) -> list.add(status));
TestMarkerAnnotationModel t1= new TestMarkerAnnotationModel();
Position position= new Position(0);
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java
index dde68474e..e0e775700 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java
@@ -142,12 +142,9 @@ public class TextFileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay so that we can verify the UI events are still
// dispatched after the call to refreshFile() below
- Display.getCurrent().timerExec(500, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(500, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -176,12 +173,9 @@ public class TextFileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay so that we can verify the UI events are still
// dispatched after the call to refreshFile() below
- Display.getCurrent().timerExec(500, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(500, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire
@@ -206,12 +200,9 @@ public class TextFileDocumentProviderTest {
// Put an UI event in the queue which will stop the workspace lock job
// after a delay
- Display.getCurrent().timerExec(600, new Runnable() {
- @Override
- public void run() {
- stopLockingFlag.set(true);
- System.out.println("UI event dispatched, lock removed");
- }
+ Display.getCurrent().timerExec(600, () -> {
+ stopLockingFlag.set(true);
+ System.out.println("UI event dispatched, lock removed");
});
// Original code will lock UI thread here because it will try to acquire

Back to the top