Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-01-25 06:51:23 -0500
committerAlexander Kurtakov2016-01-25 07:43:43 -0500
commit8014b15ab193c12c2430996d749dc1b7e94ed375 (patch)
tree002aefda873ddf500d448227b1532b03266382dc /changelog
parentbdffc9ce9f73c38f723f9fe780ff053dff1dd9bd (diff)
downloadorg.eclipse.linuxtools-8014b15ab193c12c2430996d749dc1b7e94ed375.tar.gz
org.eclipse.linuxtools-8014b15ab193c12c2430996d749dc1b7e94ed375.tar.xz
org.eclipse.linuxtools-8014b15ab193c12c2430996d749dc1b7e94ed375.zip
Lambdas convert.
Convert to lambdas where feasible and found. Change-Id: I0521c88a41b7a22012cc8e53bc621cc4bc2e8c88 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com> Reviewed-on: https://git.eclipse.org/r/65092 Tested-by: Hudson CI
Diffstat (limited to 'changelog')
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.tests/src/org/eclipse/linuxtools/changelog/tests/helpers/EditorHelper.java12
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.ui.tests/src/org/eclipse/linuxtools/changelog/ui/tests/utils/ContextMenuHelper.java69
2 files changed, 28 insertions, 53 deletions
diff --git a/changelog/org.eclipse.linuxtools.changelog.tests/src/org/eclipse/linuxtools/changelog/tests/helpers/EditorHelper.java b/changelog/org.eclipse.linuxtools.changelog.tests/src/org/eclipse/linuxtools/changelog/tests/helpers/EditorHelper.java
index e3ffb389fd..41dd2289f6 100644
--- a/changelog/org.eclipse.linuxtools.changelog.tests/src/org/eclipse/linuxtools/changelog/tests/helpers/EditorHelper.java
+++ b/changelog/org.eclipse.linuxtools.changelog.tests/src/org/eclipse/linuxtools/changelog/tests/helpers/EditorHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc. and others.
+ * Copyright (c) 2010, 2016 Red Hat Inc. 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
@@ -44,14 +44,8 @@ public class EditorHelper {
*/
public static void closeEditor(final IEditorPart editor) {
if (editor.getSite().getWorkbenchWindow().getActivePage() != null) {
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- // close editor
- editor.getSite().getWorkbenchWindow().getActivePage()
- .closeEditor(editor, false);
- }
- });
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> editor.getSite().getWorkbenchWindow().getActivePage()
+ .closeEditor(editor, false));
}
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.ui.tests/src/org/eclipse/linuxtools/changelog/ui/tests/utils/ContextMenuHelper.java b/changelog/org.eclipse.linuxtools.changelog.ui.tests/src/org/eclipse/linuxtools/changelog/ui/tests/utils/ContextMenuHelper.java
index c1b4cdf7c7..ee6c85204d 100644
--- a/changelog/org.eclipse.linuxtools.changelog.ui.tests/src/org/eclipse/linuxtools/changelog/ui/tests/utils/ContextMenuHelper.java
+++ b/changelog/org.eclipse.linuxtools.changelog.ui.tests/src/org/eclipse/linuxtools/changelog/ui/tests/utils/ContextMenuHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, SAP AG
+ * Copyright (c) 2010, 2016 SAP AG
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -27,7 +27,6 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
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.results.WidgetResult;
import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
import org.hamcrest.Matcher;
@@ -52,17 +51,13 @@ public class ContextMenuHelper {
// show
final MenuItem menuItem = UIThreadRunnable
- .syncExec(new WidgetResult<MenuItem>() {
- @Override
- public MenuItem run() {
- MenuItem theItem = getMenuItem(bot, texts);
- if (theItem != null && !theItem.isEnabled())
- throw new IllegalStateException(
- "Menu item is diabled");
-
- return theItem;
- }
- });
+ .syncExec((WidgetResult<MenuItem>) () -> {
+ MenuItem theItem = getMenuItem(bot, texts);
+ if (theItem != null && !theItem.isEnabled())
+ throw new IllegalStateException("Menu item is diabled");
+
+ return theItem;
+ });
if (menuItem == null) {
throw new WidgetNotFoundException("Could not find menu: "
+ Arrays.asList(texts));
@@ -72,14 +67,11 @@ public class ContextMenuHelper {
click(menuItem);
// hide
- UIThreadRunnable.syncExec(new VoidResult() {
- @Override
- public void run() {
- if (menuItem.isDisposed())
- return; // menu already gone
- hide(menuItem.getParent());
- }
- });
+ UIThreadRunnable.syncExec(() -> {
+ if (menuItem.isDisposed())
+ return; // menu already gone
+ hide(menuItem.getParent());
+ });
}
private static MenuItem getMenuItem(final AbstractSWTBot<?> bot,
@@ -120,28 +112,22 @@ public class ContextMenuHelper {
final AtomicBoolean enabled = new AtomicBoolean(false);
// show
final MenuItem menuItem = UIThreadRunnable
- .syncExec(new WidgetResult<MenuItem>() {
- @Override
- public MenuItem run() {
- MenuItem theItem = getMenuItem(bot, texts);
- if (theItem != null && theItem.isEnabled())
- enabled.set(true);
- return theItem;
- }
- });
+ .syncExec((WidgetResult<MenuItem>) () -> {
+ MenuItem theItem = getMenuItem(bot, texts);
+ if (theItem != null && theItem.isEnabled())
+ enabled.set(true);
+ return theItem;
+ });
if (menuItem == null) {
throw new WidgetNotFoundException("Could not find menu: "
+ Arrays.asList(texts));
}
// hide
- UIThreadRunnable.syncExec(new VoidResult() {
- @Override
- public void run() {
- if (menuItem.isDisposed())
- return; // menu already gone
- hide(menuItem.getParent());
- }
- });
+ UIThreadRunnable.syncExec(() -> {
+ if (menuItem.isDisposed())
+ return; // menu already gone
+ hide(menuItem.getParent());
+ });
return enabled.get();
}
@@ -166,12 +152,7 @@ public class ContextMenuHelper {
event.display = menuItem.getDisplay();
event.type = SWT.Selection;
- UIThreadRunnable.asyncExec(menuItem.getDisplay(), new VoidResult() {
- @Override
- public void run() {
- menuItem.notifyListeners(SWT.Selection, event);
- }
- });
+ UIThreadRunnable.asyncExec(menuItem.getDisplay(), () -> menuItem.notifyListeners(SWT.Selection, event));
}
private static void hide(final Menu menu) {

Back to the top