diff options
author | Alexander Kurtakov | 2019-08-10 14:36:47 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-08-12 11:11:40 +0000 |
commit | 1e42e5f0e1e6591b5b609db0b864affc746ed5bf (patch) | |
tree | b640c6d31ef982f1428dcb1077d4ea8fba7fbce4 /debug/org.eclipse.cdt.debug.application | |
parent | 51da3eb3a619c85b31c74d0a1bedacfa94f5db58 (diff) | |
download | org.eclipse.cdt-1e42e5f0e1e6591b5b609db0b864affc746ed5bf.tar.gz org.eclipse.cdt-1e42e5f0e1e6591b5b609db0b864affc746ed5bf.tar.xz org.eclipse.cdt-1e42e5f0e1e6591b5b609db0b864affc746ed5bf.zip |
Convert new Runnable to lambda.
Change-Id: I8b827013a29802a3f3ae6400ddce8d8753eb6399
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'debug/org.eclipse.cdt.debug.application')
6 files changed, 64 insertions, 116 deletions
diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Application.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Application.java index 76e2d1a924c..fba5d4da410 100644 --- a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Application.java +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Application.java @@ -109,12 +109,9 @@ public class Application implements IApplication { final IWorkbench workbench = PlatformUI.getWorkbench(); final Display display = workbench.getDisplay(); fInstanceLoc.release(); - display.syncExec(new Runnable() { - @Override - public void run() { - if (!display.isDisposed()) - workbench.close(); - } + display.syncExec(() -> { + if (!display.isDisposed()) + workbench.close(); }); } } diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchWindowAdvisor.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchWindowAdvisor.java index 21a5cead23e..f18fc6d800d 100644 --- a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchWindowAdvisor.java +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchWindowAdvisor.java @@ -265,22 +265,18 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { final String executablePath = executable; final String coreFilePath = corefile; - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - - CoreFileDialog dialog = new CoreFileDialog(getWindowConfigurer().getWindow().getShell(), - 0, executablePath, coreFilePath); - dialog.setBlockOnOpen(true); - if (dialog.open() == IDialogConstants.OK_ID) { - CoreFileInfo info2 = dialog.getCoreFileInfo(); - info.setHostPath(info2.getHostPath()); - info.setCoreFilePath(info2.getCoreFilePath()); - } else { - ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus, - IStatus.ERROR | IStatus.WARNING); - } + Display.getDefault().syncExec(() -> { + + CoreFileDialog dialog = new CoreFileDialog(getWindowConfigurer().getWindow().getShell(), 0, + executablePath, coreFilePath); + dialog.setBlockOnOpen(true); + if (dialog.open() == IDialogConstants.OK_ID) { + CoreFileInfo info2 = dialog.getCoreFileInfo(); + info.setHostPath(info2.getHostPath()); + info.setCoreFilePath(info2.getCoreFilePath()); + } else { + ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus, + IStatus.ERROR | IStatus.WARNING); } }); // Check and see if we failed above and if so, quit @@ -318,22 +314,18 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { final String buildLogPath = buildLog; final boolean attach = attachExecutable; - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - - RemoteExecutableDialog dialog = new RemoteExecutableDialog( - getWindowConfigurer().getWindow().getShell(), executablePath, buildLogPath, - addressStr, portStr, attach); - dialog.setBlockOnOpen(true); - if (dialog.open() == IDialogConstants.OK_ID) { - info[0] = dialog.getExecutableInfo(); - } else { - info[0] = null; - ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus, - IStatus.ERROR | IStatus.WARNING); - } + Display.getDefault().syncExec(() -> { + + RemoteExecutableDialog dialog = new RemoteExecutableDialog( + getWindowConfigurer().getWindow().getShell(), executablePath, buildLogPath, + addressStr, portStr, attach); + dialog.setBlockOnOpen(true); + if (dialog.open() == IDialogConstants.OK_ID) { + info[0] = dialog.getExecutableInfo(); + } else { + info[0] = null; + ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus, + IStatus.ERROR | IStatus.WARNING); } }); // Check and see if we failed above and if so, quit @@ -364,23 +356,19 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { final String executableArgs = arguments; final String buildLogPath = buildLog; - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - - NewExecutableDialog dialog = new NewExecutableDialog( - getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath, - executableArgs); - dialog.setBlockOnOpen(true); - if (dialog.open() == IDialogConstants.OK_ID) { - NewExecutableInfo info2 = dialog.getExecutableInfo(); - info.setHostPath(info2.getHostPath()); - info.setArguments(info2.getArguments()); - } else { - ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus, - IStatus.ERROR | IStatus.WARNING); - } + Display.getDefault().syncExec(() -> { + + NewExecutableDialog dialog = new NewExecutableDialog( + getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath, + executableArgs); + dialog.setBlockOnOpen(true); + if (dialog.open() == IDialogConstants.OK_ID) { + NewExecutableInfo info2 = dialog.getExecutableInfo(); + info.setHostPath(info2.getHostPath()); + info.setArguments(info2.getArguments()); + } else { + ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus, + IStatus.ERROR | IStatus.WARNING); } }); // Check and see if we failed above and if so, quit @@ -429,24 +417,20 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { final String buildLogPath = oldBuildLog; // Bring up New Executable dialog with values from // the last launch. - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - - NewExecutableDialog dialog = new NewExecutableDialog( - getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath, - executableArgs); - dialog.setBlockOnOpen(true); - if (dialog.open() == IDialogConstants.OK_ID) { - NewExecutableInfo info2 = dialog.getExecutableInfo(); - info.setHostPath(info2.getHostPath()); - info.setArguments(info2.getArguments()); - info.setBuildLog(info2.getBuildLog()); - } else { - ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus, - IStatus.ERROR | IStatus.WARNING); - } + Display.getDefault().syncExec(() -> { + + NewExecutableDialog dialog = new NewExecutableDialog( + getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath, + executableArgs); + dialog.setBlockOnOpen(true); + if (dialog.open() == IDialogConstants.OK_ID) { + NewExecutableInfo info2 = dialog.getExecutableInfo(); + info.setHostPath(info2.getHostPath()); + info.setArguments(info2.getArguments()); + info.setBuildLog(info2.getBuildLog()); + } else { + ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus, + IStatus.ERROR | IStatus.WARNING); } }); // Check and see if we failed above and if so, quit @@ -488,13 +472,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { } }); monitor.subTask(Messages.LaunchingConfig); - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); - } - }); + Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE)); if (LaunchJobs.getLaunchJob() != null) { try { LaunchJobs.getLaunchJob().join(); @@ -533,14 +511,11 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { final MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, 1, Messages.ProblemSavingWorkbench, null); try { final ProgressMonitorDialog p = new ProgressMonitorDialog(null); - IRunnableWithProgress runnable = new IRunnableWithProgress() { - @Override - public void run(IProgressMonitor monitor) { - try { - status.merge(ResourcesPlugin.getWorkspace().save(true, monitor)); - } catch (CoreException e) { - status.merge(e.getStatus()); - } + IRunnableWithProgress runnable = monitor -> { + try { + status.merge(ResourcesPlugin.getWorkspace().save(true, monitor)); + } catch (CoreException e) { + status.merge(e.getStatus()); } }; p.run(true, false, runnable); diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutableHandler.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutableHandler.java index 9bc9d5eafa0..b51b6063dfd 100644 --- a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutableHandler.java +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutableHandler.java @@ -34,13 +34,7 @@ public class DebugAttachedExecutableHandler extends AbstractHandler { final ILaunchConfiguration config = DebugAttachedExecutable.createLaunchConfig(new NullProgressMonitor(), null); if (config != null) { - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); - } - }); + Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE)); } } catch (InterruptedException e) { e.printStackTrace(); diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFileHandler.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFileHandler.java index b383d0e8596..440fc6e0612 100644 --- a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFileHandler.java +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFileHandler.java @@ -42,13 +42,7 @@ public class DebugCoreFileHandler extends AbstractHandler { final ILaunchConfiguration config = DebugCoreFile.createLaunchConfig(new NullProgressMonitor(), null, info.getHostPath(), info.getCoreFilePath()); if (config != null) { - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); - } - }); + Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE)); } } catch (InterruptedException e) { e.printStackTrace(); diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugNewExecutableHandler.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugNewExecutableHandler.java index 919989364bc..c05dbdf6d59 100644 --- a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugNewExecutableHandler.java +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugNewExecutableHandler.java @@ -68,13 +68,7 @@ public class DebugNewExecutableHandler extends AbstractHandler { public void done(IJobChangeEvent event) { } }); - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); - } - }); + Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE)); if (LaunchJobs.getLaunchJob() != null) { try { LaunchJobs.getLaunchJob().join(); diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugRemoteExecutableHandler.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugRemoteExecutableHandler.java index 3b403fc4c42..b32a92cc657 100644 --- a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugRemoteExecutableHandler.java +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugRemoteExecutableHandler.java @@ -47,13 +47,7 @@ public class DebugRemoteExecutableHandler extends AbstractHandler { final ILaunchConfiguration config = DebugRemoteExecutable.createLaunchConfig(new NullProgressMonitor(), buildLog, executable, address, port, attach); if (config != null) { - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); - } - }); + Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE)); } } catch (InterruptedException e) { e.printStackTrace(); |