From f0b41feeff3fe2d6a7ea916ec430bf715e486ea1 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Fri, 24 Jan 2020 21:57:24 +0200 Subject: [PATCH] Bug 559514 - Cleanup codebase Lambda conversion. Change-Id: I308f0249f83ad5ea51b7ab9988ad6bc9004b8e71 Signed-off-by: Alexander Kurtakov --- .../proxy/ui/ProxyUIConnectionService.java | 22 ++++++++----------- .../proxy/ui/ProxyUserAuthenticator.java | 13 +++++------ .../internal/ui/SerialPortConnectionsUI.java | 17 +++++--------- .../internal/ui/TelnetConnectionsUI.java | 22 ++++++++----------- 4 files changed, 29 insertions(+), 45 deletions(-) diff --git a/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUIConnectionService.java b/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUIConnectionService.java index 00017491bb4..6d4e63ff28e 100644 --- a/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUIConnectionService.java +++ b/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUIConnectionService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Oak Ridge National Laboratory and others. + * Copyright (c) 2016, 2020 Oak Ridge National Laboratory 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 @@ -9,7 +9,6 @@ package org.eclipse.remote.internal.proxy.ui; import java.lang.reflect.InvocationTargetException; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.ErrorDialog; @@ -61,17 +60,14 @@ public class ProxyUIConnectionService extends AbstractRemoteUIConnectionService @Override public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) { if (!connection.isOpen()) { - IRunnableWithProgress op = new IRunnableWithProgress() { - @Override - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - connection.open(monitor); - } catch (RemoteConnectionException e) { - throw new InvocationTargetException(e); - } - if (monitor.isCanceled()) { - throw new InterruptedException(); - } + IRunnableWithProgress op = monitor -> { + try { + connection.open(monitor); + } catch (RemoteConnectionException e) { + throw new InvocationTargetException(e); + } + if (monitor.isCanceled()) { + throw new InterruptedException(); } }; try { diff --git a/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUserAuthenticator.java b/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUserAuthenticator.java index 6146764546c..36e43157b2f 100644 --- a/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUserAuthenticator.java +++ b/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/ProxyUserAuthenticator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Oak Ridge National Laboratory and others. + * Copyright (c) 2016, 2020 Oak Ridge National Laboratory 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 @@ -84,13 +84,10 @@ public class ProxyUserAuthenticator implements IUserAuthenticatorService { } } - display.syncExec(new Runnable() { - @Override - public void run() { - final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */, message, - promptType, buttons, defaultResponseIndex); - retval[0] = dialog.open(); - } + display.syncExec(() -> { + final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */, message, + promptType, buttons, defaultResponseIndex); + retval[0] = dialog.open(); }); return promptResponses[retval[0]]; } diff --git a/bundles/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/SerialPortConnectionsUI.java b/bundles/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/SerialPortConnectionsUI.java index c8abdd1eb2f..ef938783a3e 100644 --- a/bundles/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/SerialPortConnectionsUI.java +++ b/bundles/org.eclipse.remote.serial.ui/src/org/eclipse/remote/serial/internal/ui/SerialPortConnectionsUI.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 QNX Software Systems, and others. + * Copyright (c) 2015, 2020 QNX Software Systems, 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 @@ -12,9 +12,7 @@ package org.eclipse.remote.serial.internal.ui; import java.lang.reflect.InvocationTargetException; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.remote.core.IRemoteConnection; import org.eclipse.remote.core.IRemoteConnectionType; @@ -59,14 +57,11 @@ public class SerialPortConnectionsUI extends AbstractRemoteUIConnectionService { @Override public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) { try { - context.run(false, true, new IRunnableWithProgress() { - @Override - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - connection.open(monitor); - } catch (RemoteConnectionException e) { - Activator.log(e.getStatus()); - } + context.run(false, true, monitor -> { + try { + connection.open(monitor); + } catch (RemoteConnectionException e) { + Activator.log(e.getStatus()); } }); } catch (InvocationTargetException | InterruptedException e) { diff --git a/bundles/org.eclipse.remote.telnet.ui/src/org/eclipse/remote/telnet/internal/ui/TelnetConnectionsUI.java b/bundles/org.eclipse.remote.telnet.ui/src/org/eclipse/remote/telnet/internal/ui/TelnetConnectionsUI.java index 51b5ed75b00..c2fd1ce85f0 100644 --- a/bundles/org.eclipse.remote.telnet.ui/src/org/eclipse/remote/telnet/internal/ui/TelnetConnectionsUI.java +++ b/bundles/org.eclipse.remote.telnet.ui/src/org/eclipse/remote/telnet/internal/ui/TelnetConnectionsUI.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 QNX Software Systems, and others. + * Copyright (c) 2015, 2020 QNX Software Systems, 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 @@ -13,7 +13,6 @@ package org.eclipse.remote.telnet.internal.ui; import java.lang.reflect.InvocationTargetException; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableWithProgress; @@ -60,17 +59,14 @@ public class TelnetConnectionsUI extends AbstractRemoteUIConnectionService { @Override public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) { try { - IRunnableWithProgress op = new IRunnableWithProgress() { - @Override - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - connection.open(monitor); - } catch (RemoteConnectionException e) { - throw new InvocationTargetException(e); - } - if (monitor.isCanceled()) { - throw new InterruptedException(); - } + IRunnableWithProgress op = monitor -> { + try { + connection.open(monitor); + } catch (RemoteConnectionException e) { + throw new InvocationTargetException(e); + } + if (monitor.isCanceled()) { + throw new InterruptedException(); } }; if (context != null) {