Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-06-21 04:59:28 -0400
committerLars Vogel2019-06-21 05:36:29 -0400
commit8b4ed4f66f68932f9c2bd141ea8dfcc3dc1c9cdf (patch)
tree62efeebcc8769aa954e7f01271f2608daa1b4800
parent28eafb0f03d500dd162f2151845d2644cfc5ab5c (diff)
downloadeclipse.platform.debug-8b4ed4f66f68932f9c2bd141ea8dfcc3dc1c9cdf.tar.gz
eclipse.platform.debug-8b4ed4f66f68932f9c2bd141ea8dfcc3dc1c9cdf.tar.xz
eclipse.platform.debug-8b4ed4f66f68932f9c2bd141ea8dfcc3dc1c9cdf.zip
Lamba optimization
Use method references if possible Remove unnecessary brackets Change-Id: I82c219171f7b3e459d4e2f70ae916d44d25fdc11 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java2
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java2
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java2
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java2
15 files changed, 16 insertions, 17 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
index d06a8346f..c6df05c1f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
@@ -97,7 +97,7 @@ public class InputStreamMonitor {
*/
public void startMonitoring() {
if (fThread == null) {
- fThread = new Thread((Runnable) () -> write(), DebugCoreMessages.InputStreamMonitor_label);
+ fThread = new Thread((Runnable) this::write, DebugCoreMessages.InputStreamMonitor_label);
fThread.setDaemon(true);
fThread.start();
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index ecd60220f..58ed8c08b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
@@ -221,7 +221,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
}
if (useRunnable) {
- IWorkspaceRunnable wr = pm -> doSave0(pm);
+ IWorkspaceRunnable wr = this::doSave0;
ResourcesPlugin.getWorkspace().run(wr, null, 0, lmonitor.newChild(1));
} else {
//file is persisted in the metadata not the workspace
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
index ac57dae56..34aa133a8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
@@ -209,7 +209,7 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
protected void startMonitoring() {
if (fThread == null) {
fDone.set(false);
- fThread = new Thread((Runnable) () -> read(), DebugCoreMessages.OutputStreamMonitor_label);
+ fThread = new Thread((Runnable) this::read, DebugCoreMessages.OutputStreamMonitor_label);
fThread.setDaemon(true);
fThread.setPriority(Thread.MIN_PRIORITY);
fThread.start();
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java
index 9a942eb6e..554ca41ff 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java
@@ -71,7 +71,7 @@ public class WatchExpression implements IWatchExpression {
return;
}
- IWatchExpressionListener listener = result -> setResult(result);
+ IWatchExpressionListener listener = this::setResult;
setPending(true);
IWatchExpressionDelegate delegate= DebugPlugin.getDefault().getExpressionManager().newWatchExpressionDelegate(context.getModelIdentifier());
if (delegate != null) {
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java
index 1e510b4de..3ad0c414e 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java
@@ -47,7 +47,7 @@ public class TestUtil {
if (timedOut) {
// We don't expect any extra jobs run during the test: try to cancel them
log(IStatus.INFO, owner, "Trying to cancel running jobs: " + getRunningOrWaitingJobs(null));
- getRunningOrWaitingJobs(null).forEach(job -> job.cancel());
+ getRunningOrWaitingJobs(null).forEach(Job::cancel);
waitForJobs(owner, 5, 1000);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
index 171722530..e62b46e28 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
@@ -88,7 +88,7 @@ public class ImageDescriptorRegistry {
}
private void hookDisplay() {
- fDisplay.asyncExec(() -> fDisplay.disposeExec(() -> dispose()));
+ fDisplay.asyncExec(() -> fDisplay.disposeExec(this::dispose));
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java
index f1073c598..9f0710e08 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java
@@ -19,6 +19,7 @@ package org.eclipse.debug.internal.ui.groups;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -642,9 +643,7 @@ public class GroupLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
}
modes = new LinkedHashMap<>();
modes.put(GroupLaunchElement.MODE_INHERIT, new InheritModeGroup());
- Set<ILaunchGroup> sortedGroups = new TreeSet<>((a, b) -> {
- return a.getLabel().compareTo(b.getLabel());
- });
+ Set<ILaunchGroup> sortedGroups = new TreeSet<>(Comparator.comparing(ILaunchGroup::getLabel));
LaunchConfigurationManager mgr = DebugUIPlugin.getDefault().getLaunchConfigurationManager();
sortedGroups.addAll(Arrays.asList(mgr.getLaunchGroups()));
for (ILaunchGroup launchGroup : sortedGroups) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java
index a613f13b8..0a261d7e9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java
@@ -101,7 +101,7 @@ public abstract class AbstractLaunchConfigurationAction extends SelectionListene
return;
}
}
- Runnable r = () -> performAction();
+ Runnable r = this::performAction;
BusyIndicator.showWhile(getShell().getDisplay(), r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
index 1fbcbb768..48db0e51a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
@@ -699,7 +699,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
// create context menu
// create pop up menu for the rendering
createActions();
- IMenuListener menuListener = mgr -> fillContextMenu(mgr);
+ IMenuListener menuListener = AbstractAsyncTableRendering.this::fillContextMenu;
createPopupMenu(fTableViewer.getControl(), menuListener);
createPopupMenu(fTableViewer.getCursor(), menuListener);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
index ffb60bfc3..59ead6dfe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
@@ -94,7 +94,7 @@ abstract class PromptingResolver implements IDynamicVariableResolver {
String value = null;
setupDialog(argument);
- DebugUIPlugin.getStandardDisplay().syncExec(() -> prompt());
+ DebugUIPlugin.getStandardDisplay().syncExec(this::prompt);
if (dialogResultString != null) {
value = dialogResultString;
lastValue = dialogResultString;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
index cf12bcc2b..44c8a5b53 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
@@ -167,7 +167,7 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
fTableCursor.addKeyListener(fCursorKeyAdapter);
- fCursorTraverseListener = e -> handleCursorTraverseEvt(e);
+ fCursorTraverseListener = this::handleCursorTraverseEvt;
fTableCursor.addTraverseListener(fCursorTraverseListener);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
index 073504821..fe10bfdd5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
@@ -557,7 +557,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
protected void createContextMenu(Control menuControl) {
MenuManager menuMgr= new MenuManager("#PopUp"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(mgr -> fillContextMenu(mgr));
+ menuMgr.addMenuListener(this::fillContextMenu);
Menu menu= menuMgr.createContextMenu(menuControl);
menuControl.setMenu(menu);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
index 75928a8ba..21e0887d0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
@@ -1139,7 +1139,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
};
fTableCursor.addKeyListener(fCursorKeyAdapter);
- fCursorTraverseListener = e -> handleCursorTraverseEvt(e);
+ fCursorTraverseListener = this::handleCursorTraverseEvt;
fTableCursor.addTraverseListener(fCursorTraverseListener);
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
index f2efa092e..f3248ffda 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
@@ -155,7 +155,7 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
public void setWaterMarks(int low, int high) {
lowWaterMark = low;
highWaterMark = high;
- ConsolePlugin.getStandardDisplay().asyncExec(() -> checkBufferSize());
+ ConsolePlugin.getStandardDisplay().asyncExec(this::checkBufferSize);
}
/**
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
index 72885b9eb..0725b3922 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
@@ -83,7 +83,7 @@ public class ImageDescriptorRegistry {
}
private void hookDisplay() {
- fDisplay.asyncExec(() -> fDisplay.disposeExec(() -> dispose()));
+ fDisplay.asyncExec(() -> fDisplay.disposeExec(this::dispose));
}
}

Back to the top