1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Bug 559514 - Cleanup codebase

Lambda conversion.

Change-Id: I308f0249f83ad5ea51b7ab9988ad6bc9004b8e71
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2020-01-24 21:57:24 +02:00
parent 6ce8bf9982
commit f0b41feeff
4 changed files with 29 additions and 45 deletions

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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 java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ErrorDialog;
@ -61,9 +60,7 @@ public class ProxyUIConnectionService extends AbstractRemoteUIConnectionService
@Override @Override
public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) { public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) {
if (!connection.isOpen()) { if (!connection.isOpen()) {
IRunnableWithProgress op = new IRunnableWithProgress() { IRunnableWithProgress op = monitor -> {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try { try {
connection.open(monitor); connection.open(monitor);
} catch (RemoteConnectionException e) { } catch (RemoteConnectionException e) {
@ -72,7 +69,6 @@ public class ProxyUIConnectionService extends AbstractRemoteUIConnectionService
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
throw new InterruptedException(); throw new InterruptedException();
} }
}
}; };
try { try {
if (context != null) { if (context != null) {

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -84,13 +84,10 @@ public class ProxyUserAuthenticator implements IUserAuthenticatorService {
} }
} }
display.syncExec(new Runnable() { display.syncExec(() -> {
@Override
public void run() {
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */, message, final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */, message,
promptType, buttons, defaultResponseIndex); promptType, buttons, defaultResponseIndex);
retval[0] = dialog.open(); retval[0] = dialog.open();
}
}); });
return promptResponses[retval[0]]; return promptResponses[retval[0]];
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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 java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.remote.core.IRemoteConnection; import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionType; import org.eclipse.remote.core.IRemoteConnectionType;
@ -59,15 +57,12 @@ public class SerialPortConnectionsUI extends AbstractRemoteUIConnectionService {
@Override @Override
public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) { public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) {
try { try {
context.run(false, true, new IRunnableWithProgress() { context.run(false, true, monitor -> {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try { try {
connection.open(monitor); connection.open(monitor);
} catch (RemoteConnectionException e) { } catch (RemoteConnectionException e) {
Activator.log(e.getStatus()); Activator.log(e.getStatus());
} }
}
}); });
} catch (InvocationTargetException | InterruptedException e) { } catch (InvocationTargetException | InterruptedException e) {
Activator.log(e); Activator.log(e);

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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 java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.operation.IRunnableWithProgress;
@ -60,9 +59,7 @@ public class TelnetConnectionsUI extends AbstractRemoteUIConnectionService {
@Override @Override
public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) { public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) {
try { try {
IRunnableWithProgress op = new IRunnableWithProgress() { IRunnableWithProgress op = monitor -> {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try { try {
connection.open(monitor); connection.open(monitor);
} catch (RemoteConnectionException e) { } catch (RemoteConnectionException e) {
@ -71,7 +68,6 @@ public class TelnetConnectionsUI extends AbstractRemoteUIConnectionService {
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
throw new InterruptedException(); throw new InterruptedException();
} }
}
}; };
if (context != null) { if (context != null) {
context.run(true, true, op); context.run(true, true, op);