Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2020-02-12 09:03:05 -0500
committerLars Vogel2020-03-19 05:24:55 -0400
commit4ded5dee80624ca4c29750bb6ee12a75147068c2 (patch)
treec8e1e8f5c61795a7915053cabb1b24b03996e6d6
parente2efdb6dc7bb47a145300d507b4dcb5bba021478 (diff)
downloadeclipse.platform.debug-4ded5dee80624ca4c29750bb6ee12a75147068c2.tar.gz
eclipse.platform.debug-4ded5dee80624ca4c29750bb6ee12a75147068c2.tar.xz
eclipse.platform.debug-4ded5dee80624ca4c29750bb6ee12a75147068c2.zip
Clean-up use method references in debug external tools
Using the JDT cleanup action -> Use lambda where possible Simplify lambda expression and method reference syntax Change-Id: I24c897659916e472b24d6a5c71c5660f2a00d0d9 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java11
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java20
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java16
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java61
4 files changed, 38 insertions, 70 deletions
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
index be06daad4..8b8a8b438 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
@@ -36,8 +36,6 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -260,12 +258,9 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
group.setFont(parent.getFont());
argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
- argumentField.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent event) {
- if (event.detail == SWT.TRAVERSE_RETURN && (event.stateMask & SWT.MODIFIER_MASK) != 0) {
- event.doit= true;
- }
+ argumentField.addTraverseListener(event -> {
+ if (event.detail == SWT.TRAVERSE_RETURN && (event.stateMask & SWT.MODIFIER_MASK) != 0) {
+ event.doit= true;
}
});
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java
index 0305d1e22..062f07f97 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java
@@ -23,12 +23,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
@@ -205,19 +201,9 @@ public class FileSelectionDialog extends MessageDialog {
*/
private void initializeDialog() {
selectionGroup
- .addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- getButton(IDialogConstants.OK_ID).setEnabled(
- !selectionGroup.getListTableSelection().isEmpty());
- }
- });
- selectionGroup.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- buttonPressed(IDialogConstants.OK_ID);
- }
- });
+ .addSelectionChangedListener(event -> getButton(IDialogConstants.OK_ID).setEnabled(
+ !selectionGroup.getListTableSelection().isEmpty()));
+ selectionGroup.addDoubleClickListener(event -> buttonPressed(IDialogConstants.OK_ID));
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java
index b52e78a0a..6f792797d 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java
@@ -177,18 +177,10 @@ public class TreeAndListGroup implements ISelectionChangedListener {
listViewer.setContentProvider(listContentProvider);
listViewer.setLabelProvider(listLabelProvider);
listViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- notifySelectionListeners(event);
- }
- });
- listViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- if (!event.getSelection().isEmpty()) {
- notifyDoubleClickListeners(event);
- }
+ listViewer.addSelectionChangedListener(event -> notifySelectionListeners(event));
+ listViewer.addDoubleClickListener(event -> {
+ if (!event.getSelection().isEmpty()) {
+ notifyDoubleClickListeners(event);
}
});
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
index b0fc9bd2c..3ee183caa 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
@@ -93,46 +93,41 @@ public class BuildFilesResolver implements IDynamicVariableResolver
final boolean trackFiles = files;
- buildDelta.accept(new IResourceDeltaVisitor()
- {
- @Override
- public boolean visit(IResourceDelta delta) throws CoreException
- {
- IResource resource = delta.getResource();
+ buildDelta.accept((IResourceDeltaVisitor) delta -> {
+ IResource resource = delta.getResource();
- // Only track files with the right kind of delta
- boolean isTracked = (delta.getKind() & trackDeltas) > 0;
- if (isTracked)
- {
- // Only track dirs if desired
- isTracked = trackDirs && resource.getType() != IResource.FILE;
- // Only track files if desired
- isTracked |= trackFiles && resource.getType() == IResource.FILE;
- }
+ // Only track files with the right kind of delta
+ boolean isTracked = (delta.getKind() & trackDeltas) > 0;
+ if (isTracked)
+ {
+ // Only track dirs if desired
+ isTracked = trackDirs && resource.getType() != IResource.FILE;
+ // Only track files if desired
+ isTracked |= trackFiles && resource.getType() == IResource.FILE;
+ }
- // If tracking a change, then add it to the change set for inclusion in the variable's output
- if (isTracked)
+ // If tracking a change, then add it to the change set for inclusion in the variable's output
+ if (isTracked)
+ {
+ String osPath = resource.getLocation().toOSString();
+ if (changedResources.add(osPath))
{
- String osPath = resource.getLocation().toOSString();
- if (changedResources.add(osPath))
+ if (fileList.length() > 0)
{
- if (fileList.length() > 0)
- {
- fileList.append(FILE_LIST_SEPARATOR);
- }
-
- // Since space is our separator, we need to add quotes
- // around each file to handle filenames with embedded
- // spaces. We also need to escape out embedded quotes in
- // the filename so they don't conflict with these
- // special quotes.
- //
- osPath = osPath.replaceAll("\"", "\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
- fileList.append("\"" + osPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+ fileList.append(FILE_LIST_SEPARATOR);
}
+
+ // Since space is our separator, we need to add quotes
+ // around each file to handle filenames with embedded
+ // spaces. We also need to escape out embedded quotes in
+ // the filename so they don't conflict with these
+ // special quotes.
+ //
+ osPath = osPath.replaceAll("\"", "\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
+ fileList.append("\"" + osPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$
}
- return true;
}
+ return true;
}, deltas);
result = fileList.toString();
}

Back to the top