Skip to main content
summaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-08-12 09:50:58 -0400
committerAlexander Kurtakov2019-08-12 10:31:30 -0400
commita3938937f2cd4966dc216c45f8114da4baab02b8 (patch)
treedc7e83c0c18fbe21c22f460dc13a65f7515f013e /launch
parent1e42e5f0e1e6591b5b609db0b864affc746ed5bf (diff)
downloadorg.eclipse.cdt-a3938937f2cd4966dc216c45f8114da4baab02b8.tar.gz
org.eclipse.cdt-a3938937f2cd4966dc216c45f8114da4baab02b8.tar.xz
org.eclipse.cdt-a3938937f2cd4966dc216c45f8114da4baab02b8.zip
Convert new Runnable to lambda.
Take 2. Change-Id: I060b0e41d8c6058db0c2ba88af8454b5517105b8 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java25
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java22
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java35
3 files changed, 30 insertions, 52 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
index 248c15c7fc..e90b1be21c 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
@@ -261,20 +261,17 @@ public class LaunchUtils {
*/
public static void enableActivity(final String activityID, final boolean enableit) {
if (PlatformUI.isWorkbenchRunning()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
- IActivityManager activityManager = workbenchActivitySupport.getActivityManager();
- Set<String> enabledActivityIds = new HashSet<>(activityManager.getEnabledActivityIds());
- boolean changed = false;
- if (enableit)
- changed = enabledActivityIds.add(activityID);
- else
- changed = enabledActivityIds.remove(activityID);
- if (changed)
- workbenchActivitySupport.setEnabledActivityIds(enabledActivityIds);
- }
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
+ IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
+ IActivityManager activityManager = workbenchActivitySupport.getActivityManager();
+ Set<String> enabledActivityIds = new HashSet<>(activityManager.getEnabledActivityIds());
+ boolean changed = false;
+ if (enableit)
+ changed = enabledActivityIds.add(activityID);
+ else
+ changed = enabledActivityIds.remove(activityID);
+ if (changed)
+ workbenchActivitySupport.setEnabledActivityIds(enabledActivityIds);
});
}
}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java
index 689eb1ca29..851ac30e36 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java
@@ -377,15 +377,12 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
localMode = mode;
}
if (!conf.supportsMode(localMode)) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ PlatformUI.getWorkbench().getDisplay()
+ .asyncExec(() -> MessageDialog.openError(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
LaunchMessages.LaunchUIPlugin_Error,
NLS.bind(LaunchMessages.MultiLaunchConfigurationDelegate_Cannot, conf.toString(),
- localMode));
- }
- });
+ localMode)));
continue;
}
@@ -411,14 +408,11 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
postLaunchAction(subLaunch, le.action, le.actionParam, monitor);
} catch (StackOverflowError e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ PlatformUI.getWorkbench().getDisplay()
+ .asyncExec(() -> MessageDialog.openError(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
LaunchMessages.LaunchUIPlugin_Error,
- NLS.bind(LaunchMessages.MultiLaunchConfigurationDelegate_Loop, conf.toString()));
- }
- });
+ NLS.bind(LaunchMessages.MultiLaunchConfigurationDelegate_Loop, conf.toString())));
}
}
if (!launch.hasChildren()) {
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java
index 3ac57ff265..98ae3a3c20 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java
@@ -46,8 +46,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
-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.SelectionListener;
@@ -146,14 +144,11 @@ public abstract class CAbstractMainTab extends CLaunchConfigurationTab {
fProjText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fProjText.setLayoutData(gd);
- fProjText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent evt) {
- // if project changes, invalidate program name cache
- fPreviouslyCheckedProgram = null;
- updateBuildConfigCombo(EMPTY_STRING);
- updateLaunchConfigurationDialog();
- }
+ fProjText.addModifyListener(evt -> {
+ // if project changes, invalidate program name cache
+ fPreviouslyCheckedProgram = null;
+ updateBuildConfigCombo(EMPTY_STRING);
+ updateLaunchConfigurationDialog();
});
fProjButton = createPushButton(projComp, LaunchMessages.Launch_common_Browse_1, null);
fProjButton.addSelectionListener(new SelectionAdapter() {
@@ -457,12 +452,7 @@ public abstract class CAbstractMainTab extends CLaunchConfigurationTab {
fCoreText = new Text(coreComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fCoreText.setLayoutData(gd);
- fCoreText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
+ fCoreText.addModifyListener(evt -> updateLaunchConfigurationDialog());
Button browseForCoreButton;
browseForCoreButton = createPushButton(coreComp, LaunchMessages.Launch_common_Browse_3, null);
browseForCoreButton.addSelectionListener(new SelectionAdapter() {
@@ -515,14 +505,11 @@ public abstract class CAbstractMainTab extends CLaunchConfigurationTab {
display = getShell().getDisplay();
}
final IBinary[][] ret = new IBinary[1][];
- BusyIndicator.showWhile(display, new Runnable() {
- @Override
- public void run() {
- try {
- ret[0] = cproject.getBinaryContainer().getBinaries();
- } catch (CModelException e) {
- LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$
- }
+ BusyIndicator.showWhile(display, () -> {
+ try {
+ ret[0] = cproject.getBinaryContainer().getBinaries();
+ } catch (CModelException e) {
+ LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$
}
});
return ret[0];

Back to the top