aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-07-19 08:52:49 -0400
committerAlexander Kurtakov2018-07-19 08:52:49 -0400
commit233a9f42db3dcb0a0eaebbe55a3c2574802b9805 (patch)
tree0787422f4289580540142302596cd67234e7e0d0
parent8c924456a516ce49087a542b155ee70c8d76ae38 (diff)
downloadeclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.tar.gz
eclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.tar.xz
eclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.zip
Bug 521038 - [refactoring] Replace anonymous Runnable classes by lambda
expression Changed some formatters to Eclipse so there is some formatting happening as the debug one is not clear where to get from and it's unrealistic to expect random contributors to do it. Change-Id: I731410854f9a4ac0c9fc18bcf3ad3dcf7d941c9a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java7
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java21
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java9
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java42
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java34
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java76
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java7
-rw-r--r--org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs81
-rw-r--r--org.eclipse.debug.ui/.settings/org.eclipse.jdt.ui.prefs4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java115
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/WorkingDirectoryStatusHandler.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupCycleHandler.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/UnsupportedModeHandler.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java138
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java73
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java181
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/Prompter.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java182
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java124
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java566
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java43
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java346
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java199
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPrefAction.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleLogicalStructureAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleShowColumnsAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java75
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java49
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java409
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java20
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs81
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs4
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java7
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java95
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java21
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java62
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java7
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java13
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java21
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java65
79 files changed, 1784 insertions, 2346 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
index 65c9d61dc..13396a8e8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
@@ -94,12 +94,7 @@ public class InputStreamMonitor {
*/
public void startMonitoring() {
if (fThread == null) {
- fThread= new Thread(new Runnable() {
- @Override
- public void run() {
- write();
- }
- }, DebugCoreMessages.InputStreamMonitor_label);
+ fThread = new Thread((Runnable) () -> write(), DebugCoreMessages.InputStreamMonitor_label);
fThread.setDaemon(true);
fThread.start();
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java
index 4e4ae7064..29fdc0e5e 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java
@@ -65,18 +65,15 @@ public class NullStreamsProxy implements IStreamsProxy2 {
}
private void startReaderThread() {
- Thread thread = new Thread(new Runnable() {
- @Override
- public void run() {
- byte[] bytes = new byte[1024];
- try {
- while(fStream.read(bytes) >= 0) {
- //do nothing
- }
- } catch (IOException e) {
- }
- }
- }, DebugCoreMessages.NullStreamsProxy_0);
+ Thread thread = new Thread((Runnable) () -> {
+ byte[] bytes = new byte[1024];
+ try {
+ while (fStream.read(bytes) >= 0) {
+ // do nothing
+ }
+ } catch (IOException e) {
+ }
+ }, DebugCoreMessages.NullStreamsProxy_0);
thread.setDaemon(true);
thread.start();
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
index e344e229b..4b9e432b1 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -206,12 +206,7 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
*/
protected void startMonitoring() {
if (fThread == null) {
- fThread= new Thread(new Runnable() {
- @Override
- public void run() {
- read();
- }
- }, DebugCoreMessages.OutputStreamMonitor_label);
+ fThread = new Thread((Runnable) () -> read(), DebugCoreMessages.OutputStreamMonitor_label);
fThread.setDaemon(true);
fThread.setPriority(Thread.MIN_PRIORITY);
fThread.start();
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
index 5ae877f15..fd1d2402d 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
@@ -23,8 +23,6 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
@@ -145,21 +143,18 @@ public class ConsoleManagerTests extends AbstractDebugTest {
}
private void showConsole(final ConsoleMock console) {
- executorService.execute(new Runnable() {
- @Override
- public void run() {
- // last one arriving here triggers execution for all at same
- // time
- latch.countDown();
- try {
- latch.await(1, TimeUnit.MINUTES);
- System.out.println("Requesting to show: " + console); //$NON-NLS-1$
- manager.showConsoleView(console);
- TestUtil.waitForJobs(getName(), 200, 5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- Thread.interrupted();
- }
+ executorService.execute(() -> {
+ // last one arriving here triggers execution for all at same
+ // time
+ latch.countDown();
+ try {
+ latch.await(1, TimeUnit.MINUTES);
+ System.out.println("Requesting to show: " + console); //$NON-NLS-1$
+ manager.showConsoleView(console);
+ TestUtil.waitForJobs(getName(), 200, 5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ Thread.interrupted();
}
});
}
@@ -213,14 +208,11 @@ public class ConsoleManagerTests extends AbstractDebugTest {
super.createControl(parent);
// This listener is get called if the page is really shown
// in the console view
- getControl().addListener(SWT.Show, new Listener() {
- @Override
- public void handleEvent(Event event) {
- int count = showCalled.incrementAndGet();
- if (count == 1) {
- count = allShownConsoles.incrementAndGet();
- System.out.println("Shown: " + ConsoleMock.this + ", overall: " + count); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ getControl().addListener(SWT.Show, event -> {
+ int count = showCalled.incrementAndGet();
+ if (count == 1) {
+ count = allShownConsoles.incrementAndGet();
+ System.out.println("Shown: " + ConsoleMock.this + ", overall: " + count); //$NON-NLS-1$ //$NON-NLS-2$
}
});
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
index 049055549..caa5a3972 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
@@ -514,29 +514,23 @@ public class ExpressionManagerTests extends AbstractDebugTest {
public void testConcurrentAccess() throws InterruptedException {
final boolean[] done = new boolean[]{false};
final Exception[] ex = new Exception[]{null};
- Runnable add = new Runnable() {
- @Override
- public void run() {
- try {
- for (int i = 0; i < 1000; i++) {
- getManager().addExpression(getManager().newWatchExpression(Integer.toHexString(i)));
- }
- done[0] = true;
- } catch (Exception e) {
- ex[0] = e;
+ Runnable add = () -> {
+ try {
+ for (int i = 0; i < 1000; i++) {
+ getManager().addExpression(getManager().newWatchExpression(Integer.toHexString(i)));
}
+ done[0] = true;
+ } catch (Exception e) {
+ ex[0] = e;
}
};
- Runnable remove = new Runnable() {
- @Override
- public void run() {
- try {
- do {
- getManager().removeExpressions(getManager().getExpressions());
- } while (!done[0] || getManager().getExpressions().length > 0);
- } catch (Exception e) {
- ex[0] = e;
- }
+ Runnable remove = () -> {
+ try {
+ do {
+ getManager().removeExpressions(getManager().getExpressions());
+ } while (!done[0] || getManager().getExpressions().length > 0);
+ } catch (Exception e) {
+ ex[0] = e;
}
};
Thread t1 = new Thread(add);
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java
index 2e50be204..f9727fda8 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 Andrey Loskutov.
+ * Copyright (c) 2016, 2018 Andrey Loskutov.
* 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
@@ -11,7 +11,6 @@
package org.eclipse.debug.tests.launching;
import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ConcurrentModificationException;
import java.util.concurrent.Semaphore;
@@ -53,61 +52,42 @@ public class LaunchTests extends AbstractLaunchTest {
super.setUp();
final Launch launch = new Launch(null, ILaunchManager.RUN_MODE, null);
- handler = new InvocationHandler() {
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- String name = method.getName();
- if (name.equals("equals")) { //$NON-NLS-1$
- return args.length == 1 && proxy == args[0];
- }
- return Boolean.TRUE;
+ handler = (proxy, method, args) -> {
+ String name = method.getName();
+ if (name.equals("equals")) { //$NON-NLS-1$
+ return args.length == 1 && proxy == args[0];
}
+ return Boolean.TRUE;
};
- readIsTerminatedTask = new Runnable() {
- @Override
- public void run() {
- launch.isTerminated();
- }
- };
+ readIsTerminatedTask = () -> launch.isTerminated();
- readIsDisconnectedTask = new Runnable() {
- @Override
- public void run() {
- launch.isDisconnected();
- }
- };
+ readIsDisconnectedTask = () -> launch.isDisconnected();
- writeProcessesTask = new Runnable() {
- @Override
- public void run() {
- IProcess process = createProcessProxy();
- launch.addProcess(process);
- launch.removeProcess(process);
- try {
- Thread.sleep(0, 1);
- } catch (InterruptedException e) {
- //
- }
- launch.addProcess(process);
- launch.removeProcess(process);
+ writeProcessesTask = () -> {
+ IProcess process = createProcessProxy();
+ launch.addProcess(process);
+ launch.removeProcess(process);
+ try {
+ Thread.sleep(0, 1);
+ } catch (InterruptedException e) {
+ //
}
+ launch.addProcess(process);
+ launch.removeProcess(process);
};
- writeDebugTargetsTask = new Runnable() {
- @Override
- public void run() {
- IDebugTarget target2 = createDebugTargetProxy();
- launch.addDebugTarget(target2);
- launch.removeDebugTarget(target2);
- try {
- Thread.sleep(0, 1);
- } catch (InterruptedException e) {
- //
- }
- launch.addDebugTarget(target2);
- launch.removeDebugTarget(target2);
+ writeDebugTargetsTask = () -> {
+ IDebugTarget target2 = createDebugTargetProxy();
+ launch.addDebugTarget(target2);
+ launch.removeDebugTarget(target2);
+ try {
+ Thread.sleep(0, 1);
+ } catch (InterruptedException e) {
+ //
}
+ launch.addDebugTarget(target2);
+ launch.removeDebugTarget(target2);
};
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java
index fedfbc9fe..feb73bbb6 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java
@@ -274,12 +274,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
if (fQueueingUpdates) {
fQueuedUpdates.addAll(Arrays.asList(updates));
} else if (fDelayUpdates) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- processUpdates(updates);
- }
- });
+ Display.getDefault().asyncExec(() -> processUpdates(updates));
} else {
processUpdates(updates);
}
diff --git a/org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs
index ab2cbd1a8..05d8e79da 100644
--- a/org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs
@@ -135,31 +135,37 @@ org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=0
+org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@@ -179,19 +185,23 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
+org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=80
@@ -204,7 +214,7 @@ org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -214,8 +224,9 @@ org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@@ -224,6 +235,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@@ -242,7 +254,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
@@ -271,6 +283,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -348,6 +361,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -402,18 +416,31 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.lineSplit=120
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/org.eclipse.debug.ui/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.debug.ui/.settings/org.eclipse.jdt.ui.prefs
index c0ff1c129..0688ba196 100644
--- a/org.eclipse.debug.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.debug.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -53,8 +53,8 @@ cleanup_profile=_Platform Debug Cleanups
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Platform Debug Formatting
-formatter_settings_version=12
+formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
+formatter_settings_version=14
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 62affedc8..208ab5987 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -89,7 +89,6 @@ import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -398,14 +397,11 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
final Object [] ret = new Object[1];
final CoreException [] exc = new CoreException[1];
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- try {
- ret[0] = element.createExecutableExtension(classAttribute);
- } catch (CoreException e) {
- exc[0] = e;
- }
+ BusyIndicator.showWhile(null, () -> {
+ try {
+ ret[0] = element.createExecutableExtension(classAttribute);
+ } catch (CoreException e) {
+ exc[0] = e;
}
});
if (exc[0] != null) {
@@ -570,13 +566,9 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
getLaunchConfigurationManager().startup();
if (PlatformUI.isWorkbenchRunning()) {
- fThemeListener= new IPropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty())) {
- DebugUIPreferenceInitializer.setThemeBasedPreferences(getPreferenceStore(), true);
- }
+ fThemeListener = event -> {
+ if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty())) {
+ DebugUIPreferenceInitializer.setThemeBasedPreferences(getPreferenceStore(), true);
}
};
PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener);
@@ -584,14 +576,12 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
// do the asynchronous exec last - see bug 209920
getStandardDisplay().asyncExec(
- new Runnable() {
- @Override
- public void run() {
- //initialize the selected resource `
- SelectedResourceManager.getDefault();
- // forces launch shortcuts to be initialized so their key-bindings work
- getLaunchConfigurationManager().getLaunchShortcuts();
- }
+ () -> {
+ // initialize the selected resource `
+ SelectedResourceManager.getDefault();
+ // forces launch shortcuts to be initialized so their
+ // key-bindings work
+ getLaunchConfigurationManager().getLaunchShortcuts();
});
}
@@ -836,14 +826,11 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
private static boolean doBuild() {
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InterruptedException e) {
@@ -1088,26 +1075,25 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
if (wait) {
IWorkbench workbench = DebugUIPlugin.getDefault().getWorkbench();
IProgressService progressService = workbench.getProgressService();
- final IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- /* Setup progress monitor
- * - Waiting for jobs to finish (2)
- * - Build & launch (98) */
- monitor.beginTask(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()}), 100);
+ final IRunnableWithProgress runnable = monitor -> {
+ /*
+ * Setup progress monitor - Waiting for jobs to finish (2) -
+ * Build & launch (98)
+ */
+ monitor.beginTask(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {
+ configuration.getName() }), 100);
+ try {
+ jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, new SubProgressMonitor(monitor, 1));
+ jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, new SubProgressMonitor(monitor, 1));
+ } catch (InterruptedException e1) {
+ /* continue */}
+ if (!monitor.isCanceled()) {
try {
- jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, new SubProgressMonitor(monitor, 1));
- jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, new SubProgressMonitor(monitor, 1));
+ buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 98));
}
- catch (InterruptedException e) {/* continue*/}
- if (!monitor.isCanceled()) {
- try {
- buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 98));
- }
- catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ catch (CoreException e2) {
+ throw new InvocationTargetException(e2);
}
}
};
@@ -1119,18 +1105,16 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
handleInvocationTargetException(e2, configuration, mode);
}
} else {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- /* Setup progress monitor
- * - Build & launch (1) */
- monitor.beginTask(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()}), 1);
- try {
- buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 1));
- }
- catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ IRunnableWithProgress runnable = monitor -> {
+ /*
+ * Setup progress monitor - Build & launch (1)
+ */
+ monitor.beginTask(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {
+ configuration.getName() }), 1);
+ try {
+ buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
};
try {
@@ -1265,12 +1249,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
if (group == null) {
return status;
}
- Runnable r = new Runnable() {
- @Override
- public void run() {
- DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(configuration), group.getIdentifier(), status);
- }
- };
+ Runnable r = () -> DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(configuration), group.getIdentifier(), status);
DebugUIPlugin.getStandardDisplay().asyncExec(r);
}
finally {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
index f0abb3999..0307a0c41 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
@@ -211,26 +211,15 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer
public static void setThemeBasedPreferences(final IPreferenceStore store, final boolean fireEvent) {
Display display= PlatformUI.getWorkbench().getDisplay();
- Runnable runnable= new Runnable() {
- @Override
- public void run() {
- ColorRegistry registry= null;
- if (PlatformUI.isWorkbenchRunning()) {
- registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
- }
- setDefault(store,
- IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR,
- findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_BACKGROUND, new RGB(255, 255, 255)), fireEvent);
- setDefault(store,
- IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR,
- findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_OUT, new RGB(0, 0, 0)), fireEvent);
- setDefault(store,
- IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR,
- findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_IN, new RGB(0, 200, 125)), fireEvent);
- setDefault(store,
- IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR,
- findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_ERR, new RGB(255, 0, 0)), fireEvent);
+ Runnable runnable = () -> {
+ ColorRegistry registry = null;
+ if (PlatformUI.isWorkbenchRunning()) {
+ registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
}
+ setDefault(store, IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR, findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_BACKGROUND, new RGB(255, 255, 255)), fireEvent);
+ setDefault(store, IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR, findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_OUT, new RGB(0, 0, 0)), fireEvent);
+ setDefault(store, IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR, findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_IN, new RGB(0, 200, 125)), fireEvent);
+ setDefault(store, IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR, findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_ERR, new RGB(255, 0, 0)), fireEvent);
};
if (display.getThread() == Thread.currentThread()) {
runnable.run();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
index 25c71b47a..858788b61 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -85,18 +85,7 @@ public class ImageDescriptorRegistry {
}
private void hookDisplay() {
- fDisplay.asyncExec(new Runnable() {
- @Override
- public void run() {
- fDisplay.disposeExec(new Runnable() {
-
- @Override
- public void run() {
- dispose();
- }
- });
- }
- });
+ fDisplay.asyncExec(() -> fDisplay.disposeExec(() -> dispose()));
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/WorkingDirectoryStatusHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/WorkingDirectoryStatusHandler.java
index d0bb87c70..bc75e397a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/WorkingDirectoryStatusHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/WorkingDirectoryStatusHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -27,13 +27,10 @@ public class WorkingDirectoryStatusHandler implements IStatusHandler {
@Override
public Object handleStatus(IStatus status, Object source) {
final boolean[] result = new boolean[1];
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- String title= DebugUIMessages.WorkingDirectoryStatusHandler_Eclipse_Runtime_1;
- String message= DebugUIMessages.WorkingDirectoryStatusHandler_0;
- result[0]= (MessageDialog.openQuestion(DebugUIPlugin.getShell(), title, message));
- }
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> {
+ String title = DebugUIMessages.WorkingDirectoryStatusHandler_Eclipse_Runtime_1;
+ String message = DebugUIMessages.WorkingDirectoryStatusHandler_0;
+ result[0] = (MessageDialog.openQuestion(DebugUIPlugin.getShell(), title, message));
});
return Boolean.valueOf(result[0]);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
index a5d928e23..233e89b26 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -101,22 +101,19 @@ public abstract class AbstractDebugActionDelegate implements IViewActionDelegate
fIsShift = isShift;
final MultiStatus status=
new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, getStatusMessage(), null);
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- @Override
- public void run() {
- Iterator<?> selectionIter = selection.iterator();
- while (selectionIter.hasNext()) {
- Object element= selectionIter.next();
- try {
- // Action's enablement could have been changed since
- // it was last enabled. Check that the action is still
- // enabled before running the action.
- if (isEnabledFor(element)) {
- doAction(element);
- }
- } catch (DebugException e) {
- status.merge(e.getStatus());
+ BusyIndicator.showWhile(Display.getCurrent(), () -> {
+ Iterator<?> selectionIter = selection.iterator();
+ while (selectionIter.hasNext()) {
+ Object element = selectionIter.next();
+ try {
+ // Action's enablement could have been changed since
+ // it was last enabled. Check that the action is still
+ // enabled before running the action.
+ if (isEnabledFor(element)) {
+ doAction(element);
}
+ } catch (DebugException e) {
+ status.merge(e.getStatus());
}
}
});
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java
index 94dc038dd..1cfe90046 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -169,22 +169,19 @@ public class AddToFavoritesAction extends SelectionListenerAction {
@Override
public void run() {
final CoreException[] ex = new CoreException[1];
- BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- try {
- List<String> list = getLaunchConfiguration().getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, (List<String>) null);
- if (list == null) {
- list = new ArrayList<>();
- }
- list.add(getGroup().getIdentifier());
- ILaunchConfigurationWorkingCopy copy = getLaunchConfiguration().getWorkingCopy();
- copy.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, list);
- copy.doSave();
- setEnabled(false);
- } catch (CoreException e) {
- ex[0] = e;
+ BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), () -> {
+ try {
+ List<String> list = getLaunchConfiguration().getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, (List<String>) null);
+ if (list == null) {
+ list = new ArrayList<>();
}
+ list.add(getGroup().getIdentifier());
+ ILaunchConfigurationWorkingCopy copy = getLaunchConfiguration().getWorkingCopy();
+ copy.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, list);
+ copy.doSave();
+ setEnabled(false);
+ } catch (CoreException e) {
+ ex[0] = e;
}
});
if (ex[0] != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java
index 7ac218073..50a3c86c2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -44,27 +44,24 @@ public abstract class ToggleFilterAction extends Action {
if (getViewer().getControl().isDisposed()) {
return;
}
- BusyIndicator.showWhile(getViewer().getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- if (on) {
- ViewerFilter filter= getViewerFilter();
- ViewerFilter[] filters= getViewer().getFilters();
- boolean alreadyAdded= false;
- for (int i= 0; i < filters.length; i++) {
- ViewerFilter addedFilter= filters[i];
- if (addedFilter.equals(filter)) {
- alreadyAdded= true;
- break;
- }
+ BusyIndicator.showWhile(getViewer().getControl().getDisplay(), () -> {
+ if (on) {
+ ViewerFilter filter = getViewerFilter();
+ ViewerFilter[] filters = getViewer().getFilters();
+ boolean alreadyAdded = false;
+ for (int i = 0; i < filters.length; i++) {
+ ViewerFilter addedFilter = filters[i];
+ if (addedFilter.equals(filter)) {
+ alreadyAdded = true;
+ break;
}
- if (!alreadyAdded) {
- getViewer().addFilter(filter);
- }
-
- } else {
- getViewer().removeFilter(getViewerFilter());
}
+ if (!alreadyAdded) {
+ getViewer().addFilter(filter);
+ }
+
+ } else {
+ getViewer().removeFilter(getViewerFilter());
}
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
index 1fdb32f8c..87f3696e6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -245,19 +245,16 @@ public class EnableBreakpointsAction implements IViewActionDelegate, IPartListen
if (shell == null || shell.isDisposed()) {
return;
}
- Runnable r= new Runnable() {
- @Override
- public void run() {
- IWorkbenchWindow ww= getView().getViewSite().getPage().getWorkbenchWindow();
- if (ww == null) {
- return;
- }
- Shell s= ww.getShell();
- if (s == null || s.isDisposed()) {
- return;
- }
- update();
+ Runnable r = () -> {
+ IWorkbenchWindow ww = getView().getViewSite().getPage().getWorkbenchWindow();
+ if (ww == null) {
+ return;
+ }
+ Shell s = ww.getShell();
+ if (s == null || s.isDisposed()) {
+ return;
}
+ update();
};
shell.getDisplay().asyncExec(r);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java
index a30973340..1c7803eb3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -70,12 +70,7 @@ public class ShowTypesAction extends Action {
TreeModelViewer treeViewer = (TreeModelViewer) viewer;
treeViewer.getPresentationContext().setProperty(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES, typesStatus);
}
- BusyIndicator.showWhile(viewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- viewer.refresh();
- }
- });
+ BusyIndicator.showWhile(viewer.getControl().getDisplay(), () -> viewer.refresh());
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java
index 851b2d4a7..6c82a7b82 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -40,28 +40,13 @@ public class ExecuteActionRequest extends DebugCommandRequest {
if (status != null) {
switch (status.getSeverity()) {
case IStatus.ERROR:
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
- }
- });
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openError(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
break;
case IStatus.WARNING:
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openWarning(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
- }
- });
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openWarning(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
break;
case IStatus.INFO:
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openInformation(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
- }
- });
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openInformation(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
break;
default:
break;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
index 488c31653..347d1e0f7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2013 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation 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
@@ -39,19 +39,16 @@ public class TerminateAndRelaunchAction extends DebugCommandAction {
@Override
public void postExecute(IRequest request, final Object[] targets) {
if (request.getStatus() == null || request.getStatus().isOK()) {
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- // Must be run in the UI thread since the launch can require
- // prompting to proceed
- for (int i = 0; i < targets.length; i++) {
- ILaunch launch = DebugUIPlugin.getLaunch(targets[i]);
- if (launch != null) {
- RelaunchActionDelegate.relaunch(launch.getLaunchConfiguration(), launch.getLaunchMode());
- }
- }
- }
- });
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> {
+ // Must be run in the UI thread since the launch can require
+ // prompting to proceed
+ for (int i = 0; i < targets.length; i++) {
+ ILaunch launch = DebugUIPlugin.getLaunch(targets[i]);
+ if (launch != null) {
+ RelaunchActionDelegate.relaunch(launch.getLaunchConfiguration(), launch.getLaunchMode());
+ }
+ }
+ });
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
index 0758f9b28..23bd1d90d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation 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
@@ -579,12 +579,7 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo
final ToolBar bar = entry.getValue();
if(bar != null && !bar.isDisposed()) {
final MouseTrackAdapter listener = fMouseListener;
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- bar.removeMouseTrackListener(listener);
- }
- });
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> bar.removeMouseTrackListener(listener));
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
index 0b990b4f3..82a00d823 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 Wind River Systems and others.
+ * Copyright (c) 2006, 2018 Wind River 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
@@ -59,12 +59,7 @@ public class DebugContextSourceProvider extends AbstractSourceProvider implement
values.put(IDebugUIConstants.DEBUG_CONTEXT_SOURCE_NAME, event.getContext());
// make sure fireSourceChanged is called on the UI thread
if (Display.getCurrent() == null) {
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, values);
- }
- });
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, values));
} else {
fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, values);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
index 501e59c3b..69661afac 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation 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
@@ -59,12 +59,9 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
fWindow.getPartService().addPartListener(this);
// need to register source provider on the UI thread (bug 438396)
- window.getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fWindow != null) {
- fSourceProvider = new DebugContextSourceProvider(DebugWindowContextService.this, evaluationService);
- }
+ window.getShell().getDisplay().asyncExec(() -> {
+ if (fWindow != null) {
+ fSourceProvider = new DebugContextSourceProvider(DebugWindowContextService.this, evaluationService);
}
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupCycleHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupCycleHandler.java
index 746cc7581..11a911b62 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupCycleHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupCycleHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 SSI Schaefer and others.
+ * Copyright (c) 2016, 2018 SSI Schaefer 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
@@ -27,12 +27,7 @@ public class GroupCycleHandler implements IStatusHandler {
@Override
public Object handleStatus(IStatus status, final Object source) throws CoreException {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DebugUIMessages.GroupLaunch_Error, NLS.bind(DebugUIMessages.GroupLaunch_Cycle, source.toString()));
- }
- });
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DebugUIMessages.GroupLaunch_Error, NLS.bind(DebugUIMessages.GroupLaunch_Cycle, source.toString())));
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/UnsupportedModeHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/UnsupportedModeHandler.java
index de4a090bd..ccb56144d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/UnsupportedModeHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/UnsupportedModeHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 SSI Schaefer and others.
+ * Copyright (c) 2016, 2018 SSI Schaefer 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
@@ -30,12 +30,11 @@ public class UnsupportedModeHandler implements IStatusHandler {
public Object handleStatus(IStatus status, Object source) throws CoreException {
if (source instanceof String[]) {
final String[] data = (String[]) source;
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DebugUIMessages.GroupLaunch_Error, NLS.bind(DebugUIMessages.GroupLaunch_Cannot_launch, data[0], data[1]));
- }
- });
+ PlatformUI.getWorkbench().getDisplay()
+ .asyncExec(() -> MessageDialog.openError(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ DebugUIMessages.GroupLaunch_Error,
+ NLS.bind(DebugUIMessages.GroupLaunch_Cannot_launch, data[0], data[1])));
}
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
index fd12f1a53..5651dcac5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation 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
@@ -308,20 +308,17 @@ public class ImportLaunchConfigurationsWizardPage extends WizardResourceImportPa
* @param path the path from the text widget
*/
protected void resetSelection(final IPath path) {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- @Override
- public void run() {
- File file = new File(path.toOSString());
- DebugFileSystemElement dummyparent = new DebugFileSystemElement(IInternalDebugCoreConstants.EMPTY_STRING, null, true);
- dummyparent.setPopulated();
- DebugFileSystemElement element = new DebugFileSystemElement(FileSystemStructureProvider.INSTANCE.getLabel(file),
- dummyparent,
- file.isDirectory());
- element.setFileSystemObject(file);
- element.getFiles();
- selectionGroup.setRoot(dummyparent);
- }
- });
+ BusyIndicator.showWhile(getShell().getDisplay(), () -> {
+ File file = new File(path.toOSString());
+ DebugFileSystemElement dummyparent = new DebugFileSystemElement(IInternalDebugCoreConstants.EMPTY_STRING,
+ null, true);
+ dummyparent.setPopulated();
+ DebugFileSystemElement element = new DebugFileSystemElement(
+ FileSystemStructureProvider.INSTANCE.getLabel(file), dummyparent, file.isDirectory());
+ element.setFileSystemObject(file);
+ element.getFiles();
+ selectionGroup.setRoot(dummyparent);
+ });
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java
index f6824a05b..88c331dde 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -98,15 +98,7 @@ public abstract class AbstractLaunchConfigurationAction extends SelectionListene
return;
}
}
- Runnable r = new Runnable() {
- /**
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- performAction();
- }
- };
+ Runnable r = () -> performAction();
BusyIndicator.showWhile(getShell().getDisplay(), r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
index 2a02359e6..d7884c06e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -58,8 +58,6 @@ import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.custom.ViewForm;
-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.graphics.Color;
@@ -250,14 +248,11 @@ public class LaunchConfigurationTabGroupViewer {
fNameWidget = new Text(fGroupComposite, SWT.SINGLE | SWT.BORDER);
fNameWidget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fNameWidget.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if(!fInitializingTabs) {
- handleNameModified();
- }
- }
- }
+ fNameWidget.addModifyListener(e -> {
+ if (!fInitializingTabs) {
+ handleNameModified();
+ }
+ }
);
createTabFolder(fGroupComposite);
@@ -649,12 +644,7 @@ public class LaunchConfigurationTabGroupViewer {
setInput0(input);
}
else {
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- setInput0(input);
- }
- });
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> setInput0(input));
}
}
@@ -683,12 +673,7 @@ public class LaunchConfigurationTabGroupViewer {
if (DebugUIPlugin.getStandardDisplay().getThread().equals(Thread.currentThread())) {
refreshTabs0(refresh);
} else {
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- refreshTabs0(refresh);
- }
- });
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> refreshTabs0(refresh));
}
}
@@ -699,15 +684,12 @@ public class LaunchConfigurationTabGroupViewer {
*/
protected void refreshTabs0(boolean refreshTabs) {
final boolean refresh = refreshTabs;
- Runnable r = new Runnable() {
- @Override
- public void run() {
- fViewform.setRedraw(false);
- fRefreshTabs = !refresh;
- displayInstanceTabs(refresh);
- refreshStatus();
- fViewform.setRedraw(true);
- }
+ Runnable r = () -> {
+ fViewform.setRedraw(false);
+ fRefreshTabs = !refresh;
+ displayInstanceTabs(refresh);
+ refreshStatus();
+ fViewform.setRedraw(true);
};
BusyIndicator.showWhile(getShell().getDisplay(), r);
}
@@ -719,35 +701,32 @@ public class LaunchConfigurationTabGroupViewer {
*/
protected void inputChanged(Object input) {
final Object finput = input;
- Runnable r = new Runnable() {
- @Override
- public void run() {
- try {
- fViewform.setRedraw(false);
- if (finput instanceof ILaunchConfiguration) {
- ILaunchConfiguration configuration = (ILaunchConfiguration)finput;
- boolean refreshTabs = true;
- if (fWorkingCopy != null && fWorkingCopy.getOriginal().equals(configuration.getWorkingCopy().getOriginal())) {
- refreshTabs = false;
- }
- fOriginal = configuration;
- fWorkingCopy = configuration.getWorkingCopy();
- // Need to refresh all the time as tabs might have changed
- displayInstanceTabs(refreshTabs);
- } else if (finput instanceof ILaunchConfigurationType) {
- fDescription = getDescription((ILaunchConfigurationType)finput);
- setNoInput();
- } else {
- setNoInput();
+ Runnable r = () -> {
+ try {
+ fViewform.setRedraw(false);
+ if (finput instanceof ILaunchConfiguration) {
+ ILaunchConfiguration configuration = (ILaunchConfiguration) finput;
+ boolean refreshTabs = true;
+ if (fWorkingCopy != null
+ && fWorkingCopy.getOriginal().equals(configuration.getWorkingCopy().getOriginal())) {
+ refreshTabs = false;
}
- } catch (CoreException ce) {
- errorDialog(ce);
+ fOriginal = configuration;
+ fWorkingCopy = configuration.getWorkingCopy();
+ // Need to refresh all the time as tabs might have changed
+ displayInstanceTabs(refreshTabs);
+ } else if (finput instanceof ILaunchConfigurationType) {
+ fDescription = getDescription((ILaunchConfigurationType) finput);
+ setNoInput();
+ } else {
setNoInput();
}
- finally {
- refreshStatus();
- fViewform.setRedraw(true);
- }
+ } catch (CoreException ce) {
+ errorDialog(ce);
+ setNoInput();
+ } finally {
+ refreshStatus();
+ fViewform.setRedraw(true);
}
};
BusyIndicator.showWhile(getShell().getDisplay(), r);
@@ -967,22 +946,20 @@ public class LaunchConfigurationTabGroupViewer {
// Use a final Object array to store the tab group and any exception that
// results from the Runnable
final Object[] finalArray = new Object[2];
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- ILaunchConfigurationTabGroup tabGroup = null;
- try {
- tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(getWorkingCopy(), getLaunchConfigurationDialog().getMode());
- finalArray[0] = tabGroup;
- } catch (CoreException ce) {
- finalArray[1] = ce;
- return;
- }
- tabGroup.createTabs(getLaunchConfigurationDialog(), getLaunchConfigurationDialog().getMode());
- ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].setLaunchConfigurationDialog(getLaunchConfigurationDialog());
- }
+ Runnable runnable = () -> {
+ ILaunchConfigurationTabGroup tabGroup = null;
+ try {
+ tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(getWorkingCopy(),
+ getLaunchConfigurationDialog().getMode());
+ finalArray[0] = tabGroup;
+ } catch (CoreException ce) {
+ finalArray[1] = ce;
+ return;
+ }
+ tabGroup.createTabs(getLaunchConfigurationDialog(), getLaunchConfigurationDialog().getMode());
+ ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
+ for (int i = 0; i < tabs.length; i++) {
+ tabs[i].setLaunchConfigurationDialog(getLaunchConfigurationDialog());
}
};
@@ -1504,13 +1481,12 @@ public class LaunchConfigurationTabGroupViewer {
getTabGroup().performApply(fWorkingCopy);
if (isDirty()) {
if(!fWorkingCopy.isLocal()) {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- saved[0] = ((LaunchConfigurationWorkingCopy)fWorkingCopy).doSave(monitor);
- }
- catch (CoreException e) {DebugUIPlugin.log(e);}
+ IRunnableWithProgress runnable = monitor -> {
+ try {
+ saved[0] = ((LaunchConfigurationWorkingCopy) fWorkingCopy).doSave(monitor);
+ }
+ catch (CoreException e) {
+ DebugUIPlugin.log(e);
}
};
getLaunchConfigurationDialog().run(true, false, runnable);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
index ab40eec23..dcfe2f619 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -299,14 +299,11 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
final ILaunchConfiguration from = getLaunchManager().getMovedFrom(configuration);
// handle asynchronously: @see bug 198428 - Deadlock deleting launch configuration
Display display = DebugUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if(!fTree.isDisposed()) {
- handleConfigurationAdded(configuration, from);
- }
- }
- });
+ display.asyncExec(() -> {
+ if (!fTree.isDisposed()) {
+ handleConfigurationAdded(configuration, from);
+ }
+ });
}
}
@@ -400,13 +397,10 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
}
// handle asynchronously: @see bug 198428 - Deadlock deleting launch configuration
Display display = DebugUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if(!fTree.isDisposed()) {
- handleConfigurationRemoved(configuration);
- }
- }
+ display.asyncExec(() -> {
+ if (!fTree.isDisposed()) {
+ handleConfigurationRemoved(configuration);
+ }
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java
index a8dc148c1..4c7cd3551 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -39,13 +39,10 @@ public class LaunchDelegateNotAvailableHandler implements IStatusHandler {
final ILaunchConfiguration config = (ILaunchConfiguration) infos[0];
final String mode = (String) infos[1];
final Shell shell = DebugUIPlugin.getShell();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- ILaunchGroup group = DebugUITools.getLaunchGroup(config, mode);
- if (group != null) {
- DebugUITools.openLaunchConfigurationDialog(shell, config, group.getIdentifier(), null);
- }
+ Runnable runnable = () -> {
+ ILaunchGroup group = DebugUITools.getLaunchGroup(config, mode);
+ if (group != null) {
+ DebugUITools.openLaunchConfigurationDialog(shell, config, group.getIdentifier(), null);
}
};
DebugUIPlugin.getStandardDisplay().asyncExec(runnable);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
index 2ff5205c2..965cbd550 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -219,31 +219,26 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
if (asyncDisplay == null || asyncDisplay.isDisposed()) {
return Status.CANCEL_STATUS;
}
- asyncDisplay.asyncExec(new Runnable() {
- @Override
- public void run() {
- IStatus result = null;
- Throwable throwable = null;
- try {
- if (monitor.isCanceled()) {
- result = Status.CANCEL_STATUS;
- } else {
- result = runInUIThread(monitor);
- }
-
- } catch(Throwable t){
- throwable = t;
- } finally {
- if (result == null) {
- result = new Status(IStatus.ERROR,
- PlatformUI.PLUGIN_ID, IStatus.ERROR,
- LaunchConfigurationsMessages.PerspectiveManager_Error_1,
- throwable);
- }
- done(result);
- }
- }
- });
+ asyncDisplay.asyncExec(() -> {
+ IStatus result = null;
+ Throwable throwable = null;
+ try {
+ if (monitor.isCanceled()) {
+ result = Status.CANCEL_STATUS;
+ } else {
+ result = runInUIThread(monitor);
+ }
+
+ } catch (Throwable t) {
+ throwable = t;
+ } finally {
+ if (result == null) {
+ result = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
+ LaunchConfigurationsMessages.PerspectiveManager_Error_1, throwable);
+ }
+ done(result);
+ }
+ });
return Job.ASYNC_FINISH;
}
@@ -310,16 +305,13 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
if (trigger != null) {
trigger.removeSuspendTriggerListener(this);
}
- Runnable r= new Runnable() {
- @Override
- public void run() {
- IContextActivation[] activations = fLaunchToContextActivations.remove(launch);
- if (activations != null) {
- for (int i = 0; i < activations.length; i++) {
- IContextActivation activation = activations[i];
- activation.getContextService().deactivateContext(activation);
- }
- }
+ Runnable r = () -> {
+ IContextActivation[] activations = fLaunchToContextActivations.remove(launch);
+ if (activations != null) {
+ for (int i = 0; i < activations.length; i++) {
+ IContextActivation activation = activations[i];
+ activation.getContextService().deactivateContext(activation);
+ }
}
};
async(r);
@@ -429,13 +421,10 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
* failure is associated with
*/
protected void switchFailed(final Throwable t, final String launchName) {
- sync(new Runnable() {
- @Override
- public void run() {
- DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), LaunchConfigurationsMessages.PerspectiveManager_Error_1,
+ sync(() -> DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(),
+ LaunchConfigurationsMessages.PerspectiveManager_Error_1,
MessageFormat.format(LaunchConfigurationsMessages.PerspectiveManager_Unable_to_switch_perpsectives_as_specified_by_launch___0__4, new Object[] { launchName }),
- t);
- }});
+ t));
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
index 7451758d6..08853aa84 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -22,14 +22,12 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
-
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
@@ -41,9 +39,6 @@ import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.memory.IPersistableDebugElement;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IStatusMonitor;
import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil;
import org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering;
import org.eclipse.debug.internal.ui.views.memory.renderings.AbstractVirtualContentTableModel;
@@ -65,7 +60,6 @@ import org.eclipse.debug.internal.ui.views.memory.renderings.ReformatAction;
import org.eclipse.debug.internal.ui.views.memory.renderings.ResetToBaseAddressAction;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingContentDescriptor;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLine;
-
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractTableRendering;
@@ -77,7 +71,6 @@ import org.eclipse.debug.ui.memory.IMemoryRenderingSynchronizationService;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
import org.eclipse.debug.ui.memory.IResettableMemoryRendering;
import org.eclipse.debug.ui.memory.MemoryRenderingElement;
-
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -87,10 +80,8 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
-
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextViewer;
-
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor;
@@ -101,10 +92,8 @@ import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TextCellEditor;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StyledText;
@@ -127,16 +116,13 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
@@ -464,12 +450,9 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
*/
public static final String EMPTY_PROPERTY_GROUP = "propertyGroup"; //$NON-NLS-1$
- private ISelectionChangedListener fViewerSelectionChangedListener = new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateSyncTopAddress(getTopVisibleAddress());
- updateSyncSelectedAddress(getSelectedAddress());
- }
+ private ISelectionChangedListener fViewerSelectionChangedListener = event -> {
+ updateSyncTopAddress(getTopVisibleAddress());
+ updateSyncSelectedAddress(getSelectedAddress());
};
private SelectionAdapter fScrollBarSelectionListener = new SelectionAdapter() {
@@ -479,13 +462,10 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
};
- private IModelChangedListener fModelChangedListener = new IModelChangedListener() {
- @Override
- public void modelChanged(IModelDelta delta, IModelProxy proxy) {
- if (delta.getElement() == getMemoryBlock()) {
- showTable();
- updateRenderingLabel(isVisible());
- }
+ private IModelChangedListener fModelChangedListener = (delta, proxy) -> {
+ if (delta.getElement() == getMemoryBlock()) {
+ showTable();
+ updateRenderingLabel(isVisible());
}
};
@@ -543,12 +523,8 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
};
- private IPresentationErrorListener fPresentationErrorListener = new IPresentationErrorListener() {
- @Override
- public void handlePresentationFailure(IStatusMonitor monitor, IStatus status) {
- showMessage(status.getMessage());
- }
- };
+ private IPresentationErrorListener fPresentationErrorListener = (monitor,
+ status) -> showMessage(status.getMessage());
/**
* Constructs a new table rendering of the specified type.
@@ -744,12 +720,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
// create context menu
// create pop up menu for the rendering
createActions();
- IMenuListener menuListener = new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- };
+ IMenuListener menuListener = mgr -> fillContextMenu(mgr);
createPopupMenu(fTableViewer.getControl(), menuListener);
createPopupMenu(fTableViewer.getCursor(), menuListener);
@@ -761,12 +732,9 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
// so that the viewer get refreshed with the correct
// number of lines on the
// next refresh request
- fTableViewer.getTable().addListener(SWT.Resize, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (!fTableViewer.getTable().isDisposed()) {
- fContentDescriptor.setNumLines(getNumLinesToLoad());
- }
+ fTableViewer.getTable().addListener(SWT.Resize, event -> {
+ if (!fTableViewer.getTable().isDisposed()) {
+ fContentDescriptor.setNumLines(getNumLinesToLoad());
}
});
@@ -1151,15 +1119,12 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
private void topVisibleAddressChanged(final BigInteger address) {
- final Runnable runnable = new Runnable() {
- @Override
- public void run() {
- if (fTableViewer.getTable().isDisposed()) {
- return;
- }
-
- doTopVisibleAddressChanged(address);
+ final Runnable runnable = () -> {
+ if (fTableViewer.getTable().isDisposed()) {
+ return;
}
+
+ doTopVisibleAddressChanged(address);
};
runOnUIThread(runnable);
}
@@ -1230,27 +1195,23 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
private void selectedAddressChanged(final BigInteger address) {
- Runnable runnable = new Runnable() {
+ Runnable runnable = () -> {
- @Override
- public void run() {
-
- if (fTableViewer.getTable().isDisposed()) {
- return;
- }
+ if (fTableViewer.getTable().isDisposed()) {
+ return;
+ }
- // call this to make the table viewer to reload when needed
- int i = fTableViewer.indexOf(address);
- if (i < 0) {
- // the model may not have been populated yet,
- // try to predict if the address will be in the buffer
- boolean contained = isAddressBufferred(address);
- if (!contained) {
- topVisibleAddressChanged(address);
- }
+ // call this to make the table viewer to reload when needed
+ int i = fTableViewer.indexOf(address);
+ if (i < 0) {
+ // the model may not have been populated yet,
+ // try to predict if the address will be in the buffer
+ boolean contained = isAddressBufferred(address);
+ if (!contained) {
+ topVisibleAddressChanged(address);
}
- fTableViewer.setSelection(address);
}
+ fTableViewer.setSelection(address);
};
runOnUIThread(runnable);
@@ -2150,26 +2111,23 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
}
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- showTable();
- if (keyIndex >= 0) {
- // address is within range, set cursor and reveal
- fTableViewer.setSelection(address);
- updateSyncTopAddress(getTopVisibleAddress());
- updateSyncSelectedAddress(address);
- } else {
- // load at the address
- fTableViewer.setSelection(address);
- reloadTable(address);
+ Runnable runnable = () -> {
+ showTable();
+ if (keyIndex >= 0) {
+ // address is within range, set cursor and reveal
+ fTableViewer.setSelection(address);
+ updateSyncTopAddress(getTopVisibleAddress());
+ updateSyncSelectedAddress(address);
+ } else {
+ // load at the address
+ fTableViewer.setSelection(address);
+ reloadTable(address);
- updateSyncSelectedAddress(address);
- if (!isDynamicLoad()) {
- updateSyncPageStartAddress(address);
- }
- updateSyncTopAddress(address);
+ updateSyncSelectedAddress(address);
+ if (!isDynamicLoad()) {
+ updateSyncPageStartAddress(address);
}
+ updateSyncTopAddress(address);
}
};
runOnUIThread(runnable);
@@ -2402,16 +2360,13 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
fContentDescriptor.setLoadAddress(address);
final BigInteger finaladdress = address;
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- if (fTableViewer.getTable().isDisposed()) {
- return;
- }
-
- fTableViewer.setTopIndex(finaladdress);
- refresh();
+ Runnable runnable = () -> {
+ if (fTableViewer.getTable().isDisposed()) {
+ return;
}
+
+ fTableViewer.setTopIndex(finaladdress);
+ refresh();
};
runOnUIThread(runnable);
@@ -2566,16 +2521,13 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
return;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- int rowSize = getBytesPerLine();
- if (rowSize < newColumnSize) {
- rowSize = newColumnSize;
- }
-
- format(rowSize, newColumnSize);
+ Display.getDefault().asyncExec(() -> {
+ int rowSize = getBytesPerLine();
+ if (rowSize < newColumnSize) {
+ rowSize = newColumnSize;
}
+
+ format(rowSize, newColumnSize);
});
}
@@ -2588,16 +2540,13 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
return;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- int colSize = getBytesPerColumn();
- if (newRowSize < colSize) {
- colSize = newRowSize;
- }
-
- format(newRowSize, colSize);
+ Display.getDefault().asyncExec(() -> {
+ int colSize = getBytesPerColumn();
+ if (newRowSize < colSize) {
+ colSize = newRowSize;
}
+
+ format(newRowSize, colSize);
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/Prompter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/Prompter.java
index c2aad191b..ad1f0c516 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/Prompter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/Prompter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -65,17 +65,14 @@ public class Prompter implements IStatusHandler {
final Object[] result = new Object[1];
final CoreException[] exception = new CoreException[1];
final Object lock = this;
- Runnable r = new Runnable() {
- @Override
- public void run() {
- try {
- result[0] = handler.handleStatus(status, source);
- } catch (CoreException e) {
- exception[0] = e;
- }
- synchronized (lock) {
- lock.notifyAll();
- }
+ Runnable r = () -> {
+ try {
+ result[0] = handler.handleStatus(status, source);
+ } catch (CoreException e) {
+ exception[0] = e;
+ }
+ synchronized (lock) {
+ lock.notifyAll();
}
};
DebugUIPlugin.getStandardDisplay().syncExec(r);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
index 8d4a715cb..2dedb9d32 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -552,18 +552,13 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
*/
private IEditorPart openEditor(final IWorkbenchPage page, final IEditorInput input, final String id) {
final IEditorPart[] editor = new IEditorPart[] {null};
- Runnable r = new Runnable() {
- @Override
- public void run() {
- if (!isClosing(page)) {
- try {
- editor[0] = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID|IWorkbenchPage.MATCH_INPUT);
- } catch (PartInitException e) {
- DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(),
- DebugUIViewsMessages.LaunchView_Error_1,
- DebugUIViewsMessages.LaunchView_Exception_occurred_opening_editor_for_debugger__2,
- e);
- }
+ Runnable r = () -> {
+ if (!isClosing(page)) {
+ try {
+ editor[0] = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
+ } catch (PartInitException e) {
+ DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), DebugUIViewsMessages.LaunchView_Error_1,
+ DebugUIViewsMessages.LaunchView_Exception_occurred_opening_editor_for_debugger__2, e);
}
}
};
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java
index 2fd6976f7..7abff70ea 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -63,12 +63,9 @@ public class ArchiveFilter extends ViewerFilter {
* Search for all archives in the workspace.
*/
private void init() {
- BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- fArchives = new HashSet<>();
- traverse(ResourcesPlugin.getWorkspace().getRoot(), fArchives);
- }
+ BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), () -> {
+ fArchives = new HashSet<>();
+ traverse(ResourcesPlugin.getWorkspace().getRoot(), fArchives);
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
index 67c97cca6..a34d79ea2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 Matt Conway and others.
+ * Copyright (c) 2000, 2018 Matt Conway 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
@@ -94,12 +94,7 @@ abstract class PromptingResolver implements IDynamicVariableResolver {
String value = null;
setupDialog(argument);
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- prompt();
- }
- });
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> prompt());
if (dialogResultString != null) {
value = dialogResultString;
lastValue = dialogResultString;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
index e5a4c2449..62cc829c8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -71,12 +71,7 @@ public class SelectedResourceManager {
}
else {
final IStructuredSelection[] selection = new IStructuredSelection[1];
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- selection[0] = getCurrentSelection0();
- }
- });
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> selection[0] = getCurrentSelection0());
return selection[0];
}
}
@@ -126,12 +121,7 @@ public class SelectedResourceManager {
}
else {
final IResource[] resource = new IResource[1];
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- resource[0] = getSelectedResource0();
- }
- });
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> resource[0] = getSelectedResource0());
return resource[0];
}
}
@@ -189,12 +179,7 @@ public class SelectedResourceManager {
}
else {
final String[] text = new String[1];
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- text[0] = getSelectedText0();
- }
- });
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> text[0] = getSelectedText0());
return text[0];
}
}
@@ -241,12 +226,7 @@ public class SelectedResourceManager {
}
else {
final IWorkbenchWindow[] window = new IWorkbenchWindow[1];
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- window[0] = DebugUIPlugin.getActiveWorkbenchWindow();
- }
- });
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> window[0] = DebugUIPlugin.getActiveWorkbenchWindow());
return window[0];
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
index 487a90747..3cdba4e9a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -608,17 +608,14 @@ public abstract class AsynchronousModel {
//update viewer outside the lock
final ModelNode[] finalUnmap = unmap;
- preservingSelection(new Runnable() {
- @Override
- public void run() {
- if (finalUnmap != null) {
- for (int i = 0; i < finalUnmap.length; i++) {
- viewer.unmapNode(finalUnmap[i]);
- }
- }
- viewer.nodeChildrenChanged(parentNode);
- }
- });
+ preservingSelection(() -> {
+ if (finalUnmap != null) {
+ for (int i = 0; i < finalUnmap.length; i++) {
+ viewer.unmapNode(finalUnmap[i]);
+ }
+ }
+ viewer.nodeChildrenChanged(parentNode);
+ });
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java
index fa503d9c1..7fa402f14 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation 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
@@ -33,8 +33,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.MenuDetectEvent;
import org.eclipse.swt.events.MenuDetectListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
@@ -44,8 +42,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
@@ -99,30 +95,22 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
fContainer= new Composite(parent, SWT.NONE);
GridData layoutData= new GridData(SWT.FILL, SWT.TOP, true, false);
fContainer.setLayoutData(layoutData);
- fContainer.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- e.doit= true;
- }
- });
+ fContainer.addTraverseListener(e -> e.doit = true);
fContainer.setBackgroundMode(SWT.INHERIT_DEFAULT);
- fContainer.addListener(SWT.Resize, new Listener() {
- @Override
- public void handleEvent(Event event) {
- int height= fContainer.getClientArea().height;
+ fContainer.addListener(SWT.Resize, event -> {
+ int height = fContainer.getClientArea().height;
- if (fGradientBackground == null || fGradientBackground.getBounds().height != height) {
- Image image= height == 0 ? null : createGradientImage(height, event.display);
- fContainer.setBackgroundImage(image);
+ if (fGradientBackground == null || fGradientBackground.getBounds().height != height) {
+ Image image = height == 0 ? null : createGradientImage(height, event.display);
+ fContainer.setBackgroundImage(image);
- if (fGradientBackground != null) {
- fGradientBackground.dispose();
- }
- fGradientBackground= image;
- }
- }
- });
+ if (fGradientBackground != null) {
+ fGradientBackground.dispose();
+ }
+ fGradientBackground = image;
+ }
+ });
hookControl(fContainer);
@@ -138,12 +126,9 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
gridLayout.horizontalSpacing= 0;
fContainer.setLayout(gridLayout);
- fContainer.addListener(SWT.Resize, new Listener() {
- @Override
- public void handleEvent(Event event) {
- updateSize();
- fContainer.layout(true, true);
- }
+ fContainer.addListener(SWT.Resize, event -> {
+ updateSize();
+ fContainer.layout(true, true);
});
}
@@ -266,12 +251,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
disableRedraw();
try {
- preservingSelection(new Runnable() {
- @Override
- public void run() {
- buildItemChain(input);
- }
- });
+ preservingSelection(() -> buildItemChain(input));
} finally {
enableRedraw();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
index 86f697ee6..6ee5b3242 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -102,22 +102,14 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
@Override
protected void scheduleViewerUpdate() {
- execInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!getContentProvider().isDisposed() && !isCanceled()) {
- performUpdate();
- }
- }
- });
+ execInDisplayThread(() -> {
+ if (!getContentProvider().isDisposed() && !isCanceled()) {
+ performUpdate();
+ }
+ });
}
};
- execInDisplayThread(new Runnable() {
- @Override
- public void run() {
- fChildrenUpdate.startRequest();
- }
- });
+ execInDisplayThread(() -> fChildrenUpdate.startRequest());
return;
}
} else {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java
index 433b8d38f..b9a1d88e4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -71,17 +71,19 @@ public class ElementCompareRequest extends MementoUpdate implements IElementComp
@Override
public void done() {
ITreeModelViewer viewer = getContentProvider().getViewer();
- if (viewer == null) return; // disposed
+ if (viewer == null)
+ {
+ return; // disposed
+ }
if (viewer.getDisplay().getThread() == Thread.currentThread()) {
fProvider.getStateTracker().compareFinished(ElementCompareRequest.this, fDelta);
} else {
- viewer.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (getContentProvider().isDisposed()) return;
- fProvider.getStateTracker().compareFinished(ElementCompareRequest.this, fDelta);
- }
- });
+ viewer.getDisplay().asyncExec(() -> {
+ if (getContentProvider().isDisposed()) {
+ return;
+ }
+ fProvider.getStateTracker().compareFinished(ElementCompareRequest.this, fDelta);
+ });
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java
index 6e53cf171..c9afa0360 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -49,22 +49,22 @@ class ElementMementoRequest extends MementoUpdate implements IElementMementoRequ
public void done() {
ITreeModelViewer viewer = getContentProvider().getViewer();
- if (viewer == null) return; // disposed
+ if (viewer == null)
+ {
+ return; // disposed
+ }
if (viewer.getDisplay().getThread() == Thread.currentThread()) {
doComplete();
} else {
- viewer.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- doComplete();
- }
- });
+ viewer.getDisplay().asyncExec(() -> doComplete());
}
}
private void doComplete() {
- if (getContentProvider().isDisposed()) return;
+ if (getContentProvider().isDisposed()) {
+ return;
+ }
if (!isCanceled() && (getStatus() == null || getStatus().isOK())) {
// replace the element with a memento
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
index ddf1c1f42..48df48089 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Wind River Systems and others.
+ * Copyright (c) 2009, 2018 Wind River 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
@@ -306,53 +306,48 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void remove(final Object parentOrTreePath, final int index) {
final List<TreePath> oldSelection = new LinkedList<>(Arrays.asList(((TreeSelection) getSelection()).getPaths()));
- preservingSelection(new Runnable() {
- @Override
- public void run() {
- TreePath removedPath = null;
- VirtualItem[] parentItems = findItems(parentOrTreePath);
- for (int i = 0; i < parentItems.length; i++) {
- VirtualItem parentItem = parentItems[i];
- if (parentItem.isDisposed()) {
- continue;
+ preservingSelection(() -> {
+ TreePath removedPath = null;
+ VirtualItem[] parentItems = findItems(parentOrTreePath);
+ for (int i = 0; i < parentItems.length; i++) {
+ VirtualItem parentItem = parentItems[i];
+ if (parentItem.isDisposed()) {
+ continue;
+ }
+
+ // Parent item is not expanded so just update its contents so that
+ // the plus sign gets refreshed.
+ if (!parentItem.getExpanded()) {
+ parentItem.setNeedsCountUpdate();
+ parentItem.setItemCount(-1);
+ virtualLazyUpdateHasChildren(parentItem);
+ }
+
+ if (index < parentItem.getItemCount()) {
+ VirtualItem item = parentItem.getItem(new VirtualItem.Index(index));
+
+ if (item.getData() != null) {
+ removedPath = getTreePathFromItem(item);
+ disassociate(item);
}
-
- // Parent item is not expanded so just update its contents so that
- // the plus sign gets refreshed.
- if (!parentItem.getExpanded()) {
- parentItem.setNeedsCountUpdate();
- parentItem.setItemCount(-1);
- virtualLazyUpdateHasChildren(parentItem);
- }
-
- if (index < parentItem.getItemCount()) {
- VirtualItem item =parentItem.getItem(new VirtualItem.Index(index));
-
- if (item.getData() != null) {
- removedPath = getTreePathFromItem(item);
- disassociate(item);
- }
- parentItem.remove(item.getIndex());
- }
- }
-
- if (removedPath != null) {
- boolean removed = false;
- for (Iterator<TreePath> it = oldSelection.iterator(); it.hasNext();) {
- TreePath path = it.next();
- if (path.startsWith(removedPath, null)) {
- it.remove();
- removed = true;
- }
- }
- if (removed) {
- setSelection(
- new TreeSelection(oldSelection.toArray(new TreePath[oldSelection.size()])),
- false);
- }
- }
- }
- });
+ parentItem.remove(item.getIndex());
+ }
+ }
+
+ if (removedPath != null) {
+ boolean removed = false;
+ for (Iterator<TreePath> it = oldSelection.iterator(); it.hasNext();) {
+ TreePath path = it.next();
+ if (path.startsWith(removedPath, null)) {
+ it.remove();
+ removed = true;
+ }
+ }
+ if (removed) {
+ setSelection(new TreeSelection(oldSelection.toArray(new TreePath[oldSelection.size()])), false);
+ }
+ }
+ });
}
@Override
@@ -551,15 +546,12 @@ public class InternalVirtualTreeModelViewer extends Viewer
private void validate() {
if (fValidateRunnable == null) {
- fValidateRunnable = new Runnable() {
- @Override
- public void run() {
- if (!fTree.isDisposed()) {
- fValidateRunnable = null;
- fTree.validate();
- }
- }
- };
+ fValidateRunnable = () -> {
+ if (!fTree.isDisposed()) {
+ fValidateRunnable = null;
+ fTree.validate();
+ }
+ };
getDisplay().asyncExec(fValidateRunnable);
}
}
@@ -630,54 +622,48 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void setChildCount(final Object elementOrTreePath, final int count) {
- preservingSelection(new Runnable() {
- @Override
- public void run() {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- VirtualItem[] children = items[i].getItems();
- for (int j = 0; j < children.length; j++) {
- if (children[j].getData() != null && children[j].getIndex().intValue() >= count) {
- disassociate(children[j]);
- }
- }
+ preservingSelection(() -> {
+ VirtualItem[] items = findItems(elementOrTreePath);
+ for (int i = 0; i < items.length; i++) {
+ VirtualItem[] children = items[i].getItems();
+ for (int j = 0; j < children.length; j++) {
+ if (children[j].getData() != null && children[j].getIndex().intValue() >= count) {
+ disassociate(children[j]);
+ }
+ }
- items[i].setItemCount(count);
- }
- }
- });
+ items[i].setItemCount(count);
+ }
+ });
validate();
}
@Override
public void setHasChildren(final Object elementOrTreePath, final boolean hasChildren) {
- preservingSelection(new Runnable() {
- @Override
- public void run() {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- VirtualItem item = items[i];
-
- if (!hasChildren) {
- VirtualItem[] children = item.getItems();
- for (int j = 0; j < children.length; j++) {
- if (children[j].getData() != null) {
- disassociate(children[j]);
- }
- }
- }
-
- item.setHasItems(hasChildren);
- if (hasChildren) {
- if (!item.getExpanded()) {
- item.setItemCount(-1);
- } else {
- virtualLazyUpdateChildCount(item);
- }
- }
- }
- }
- });
+ preservingSelection(() -> {
+ VirtualItem[] items = findItems(elementOrTreePath);
+ for (int i = 0; i < items.length; i++) {
+ VirtualItem item = items[i];
+
+ if (!hasChildren) {
+ VirtualItem[] children = item.getItems();
+ for (int j = 0; j < children.length; j++) {
+ if (children[j].getData() != null) {
+ disassociate(children[j]);
+ }
+ }
+ }
+
+ item.setHasItems(hasChildren);
+ if (hasChildren) {
+ if (!item.getExpanded()) {
+ item.setItemCount(-1);
+ } else {
+ virtualLazyUpdateChildCount(item);
+ }
+ }
+ }
+ });
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java
index 128101422..64e77ee96 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2018 IBM Corporation 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
@@ -207,18 +207,15 @@ public class TimeTriggeredProgressMonitorDialog extends ProgressMonitorDialog {
InterruptedException {
final InvocationTargetException[] invokes = new InvocationTargetException[1];
final InterruptedException[] interrupt = new InterruptedException[1];
- Runnable dialogWaitRunnable = new Runnable() {
- @Override
- public void run() {
- try {
- TimeTriggeredProgressMonitorDialog.super.run(fork, cancelable, runnable);
- } catch (InvocationTargetException e) {
- invokes[0] = e;
- } catch (InterruptedException e) {
- interrupt[0]= e;
- }
- }
- };
+ Runnable dialogWaitRunnable = () -> {
+ try {
+ TimeTriggeredProgressMonitorDialog.super.run(fork, cancelable, runnable);
+ } catch (InvocationTargetException e1) {
+ invokes[0] = e1;
+ } catch (InterruptedException e2) {
+ interrupt[0] = e2;
+ }
+ };
final Display display = PlatformUI.getWorkbench().getDisplay();
if (display == null) {
return;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
index f37bfefbe..48ba3468d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2016 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -759,56 +759,54 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
// Wait a single cycle to allow viewer to queue requests triggered by completed updates.
- getViewer().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isDisposed()) {
- return;
+ getViewer().getDisplay().asyncExec(() -> {
+ if (isDisposed()) {
+ return;
+ }
+
+ for (int i = 0; i < updates.size(); i++) {
+ ViewerUpdateMonitor update = updates.get(i);
+
+ // Search for update in list using identity test. Otherwise a completed canceled
+ // update may trigger removal of up-to-date running update on the same element.
+ List<ViewerUpdateMonitor> requests = fRequestsInProgress.get(update.getSchedulingPath());
+ boolean found = false;
+ if (requests != null) {
+ for (int j = 0; j < requests.size(); j++) {
+ if (requests.get(j) == update) {
+ found = true;
+ requests.remove(j);
+ break;
+ }
+ }
}
- for (int i = 0; i < updates.size(); i++) {
- ViewerUpdateMonitor update = updates.get(i);
-
- // Search for update in list using identity test. Otherwise a completed canceled
- // update may trigger removal of up-to-date running update on the same element.
- List<ViewerUpdateMonitor> requests = fRequestsInProgress.get(update.getSchedulingPath());
- boolean found = false;
- if (requests != null) {
- for (int j = 0; j < requests.size(); j++) {
- if (requests.get(j) == update) {
- found = true;
- requests.remove(j);
- break;
- }
- }
- }
-
- if (found) {
- // Trigger may initiate new updates, so wait to remove requests array from
- // fRequestsInProgress map. This way updateStarted() will not send a
- // redundant "UPDATE SEQUENCE STARTED" notification.
- trigger(update.getSchedulingPath());
- } else {
- // Update may be removed from in progress list if it was canceled by schedule().
- Assert.isTrue( update.isCanceled() );
- }
- if (requests != null && requests.isEmpty()) {
- fRequestsInProgress.remove(update.getSchedulingPath());
- }
- }
- if (fRequestsInProgress.isEmpty() && fWaitingRequests.isEmpty() && fModelSequenceRunning) {
- fModelSequenceRunning = false;
- if (fRevealPath != null) {
- getViewer().reveal(fRevealPath, fRevealIndex);
- fRevealPath = null;
- }
- if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("MODEL SEQUENCE ENDS"); //$NON-NLS-1$
- }
- notifyUpdate(UPDATE_SEQUENCE_COMPLETE, null);
- }
- }
- });
+ if (found) {
+ // Trigger may initiate new updates, so wait to remove requests array from
+ // fRequestsInProgress map. This way updateStarted() will not send a
+ // redundant "UPDATE SEQUENCE STARTED" notification.
+ trigger(update.getSchedulingPath());
+ } else {
+ // Update may be removed from in progress list if it was canceled by schedule().
+ Assert.isTrue(update.isCanceled());
+ }
+ if (requests != null && requests.isEmpty()) {
+ fRequestsInProgress.remove(update.getSchedulingPath());
+ }
+ }
+ if (fRequestsInProgress.isEmpty() && fWaitingRequests.isEmpty() && fModelSequenceRunning) {
+ fModelSequenceRunning = false;
+ if (fRevealPath != null) {
+ getViewer().reveal(fRevealPath, fRevealIndex);
+ fRevealPath = null;
+ }
+ if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE
+ && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("MODEL SEQUENCE ENDS"); //$NON-NLS-1$
+ }
+ notifyUpdate(UPDATE_SEQUENCE_COMPLETE, null);
+ }
+ });
}
@@ -931,15 +929,12 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
}
if (inProgressList == null || inProgressList.isEmpty()) {
- getViewer().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isDisposed()) {
- return;
- }
- trigger(update.getSchedulingPath());
- }
- });
+ getViewer().getDisplay().asyncExec(() -> {
+ if (isDisposed()) {
+ return;
+ }
+ trigger(update.getSchedulingPath());
+ });
}
} else {
// there are waiting requests: coalesce with existing request and add to list
@@ -1776,14 +1771,11 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
display = getViewer().getDisplay();
fCompletedUpdates.add(update);
if (fCompletedUpdatesRunnable == null) {
- fCompletedUpdatesRunnable = new Runnable() {
- @Override
- public void run() {
- if (!isDisposed()) {
- performUpdates();
- }
- }
- };
+ fCompletedUpdatesRunnable = () -> {
+ if (!isDisposed()) {
+ performUpdates();
+ }
+ };
updateJob = fCompletedUpdatesRunnable;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
index 19d2b3eb2..8d4f747fd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2016 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -399,24 +399,21 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
if (fComplete == null) {
fComplete = new LinkedList<>();
- fViewer.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isDisposed()) {
- return;
+ fViewer.getDisplay().asyncExec(() -> {
+ if (isDisposed()) {
+ return;
+ }
+ List<ILabelUpdate> updates = null;
+ synchronized (TreeModelLabelProvider.this) {
+ updates = fComplete;
+ fComplete = null;
+ }
+ for (ILabelUpdate itrUpdate : updates) {
+ if (itrUpdate.isCanceled()) {
+ updateComplete(itrUpdate);
+ } else {
+ ((LabelUpdate) itrUpdate).performUpdate();
}
- List<ILabelUpdate> updates = null;
- synchronized (TreeModelLabelProvider.this) {
- updates = fComplete;
- fComplete = null;
- }
- for (ILabelUpdate itrUpdate : updates) {
- if (itrUpdate.isCanceled()) {
- updateComplete(itrUpdate);
- } else {
- ((LabelUpdate) itrUpdate).performUpdate();
- }
- }
}
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
index 1423e60b3..6a2b8db9b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2016 Wind River Systems and others.
+ * Copyright (c) 2011, 2018 Wind River 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
@@ -285,28 +285,30 @@ class ViewerStateTracker {
// Process start of restore in an async cycle because we may still be inside inputChanged()
// call. I.e. the "input.equals(fContentProvider.getViewer().getInput())" test may fail.
- fContentProvider.getViewer().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!fContentProvider.isDisposed() && input.equals(fContentProvider.getViewer().getInput())) {
- ModelDelta stateDelta2 = fViewerStates.remove(keyMementoString);
- if (stateDelta2 != null) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE RESTORE BEGINS"); //$NON-NLS-1$
- DebugUIPlugin.trace("\tRESTORE: " + stateDelta2.toString()); //$NON-NLS-1$
- notifyStateUpdate(input, STATE_RESTORE_SEQUENCE_BEGINS, null);
- }
- stateDelta2.setElement(input);
- fPendingState = stateDelta2;
- doInitialRestore(fPendingState);
- }
- } else {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE RESTORE CANCELED."); //$NON-NLS-1$
- }
- }
- }
- });
+ fContentProvider.getViewer().getDisplay().asyncExec(() -> {
+ if (!fContentProvider.isDisposed()
+ && input.equals(fContentProvider.getViewer().getInput())) {
+ ModelDelta stateDelta2 = fViewerStates.remove(keyMementoString);
+ if (stateDelta2 != null) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE
+ && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(
+ fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE RESTORE BEGINS"); //$NON-NLS-1$
+ DebugUIPlugin.trace("\tRESTORE: " + stateDelta2.toString()); //$NON-NLS-1$
+ notifyStateUpdate(input, STATE_RESTORE_SEQUENCE_BEGINS, null);
+ }
+ stateDelta2.setElement(input);
+ fPendingState = stateDelta2;
+ doInitialRestore(fPendingState);
+ }
+ } else {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE
+ && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(
+ fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE RESTORE CANCELED."); //$NON-NLS-1$
+ }
+ }
+ });
} else {
if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
DebugUIPlugin.trace("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - NO MATCHING STATE"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -402,15 +404,12 @@ class ViewerStateTracker {
// EXPAND node. These
// markers are used by the restore logic to know when a delta node can
// be removed.
- delta.accept(new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta d, int depth) {
- if ((d.getFlags() & IModelDelta.EXPAND) != 0) {
- ((ModelDelta) d).setFlags(d.getFlags() | IModelDelta.CONTENT);
- }
- return true;
- }
- });
+ delta.accept((d, depth) -> {
+ if ((d.getFlags() & IModelDelta.EXPAND) != 0) {
+ ((ModelDelta) d).setFlags(d.getFlags() | IModelDelta.CONTENT);
+ }
+ return true;
+ });
if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
DebugUIPlugin.trace("\tAPPEND DELTA: " + appendDeltaRoot); //$NON-NLS-1$
@@ -427,66 +426,57 @@ class ViewerStateTracker {
// If the append delta is generated for a sub-tree, copy the pending delta
// attributes into the pending delta.
if (path.getSegmentCount() > 0) {
- fPendingState.accept( new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta pendingDeltaNode, int depth) {
- TreePath pendingDeltaPath = fContentProvider.getViewerTreePath(pendingDeltaNode);
- if (path.startsWith(pendingDeltaPath, null))
- {
- ModelDelta appendDelta = findDeltaForPath(appendDeltaRoot, pendingDeltaPath);
- appendDelta.setFlags(pendingDeltaNode.getFlags());
- appendDelta.setChildCount(pendingDeltaNode.getChildCount());
- appendDelta.setIndex(pendingDeltaNode.getIndex());
- return true;
- }
- return false;
- }
- });
+ fPendingState.accept((pendingDeltaNode, depth) -> {
+ TreePath pendingDeltaPath = fContentProvider.getViewerTreePath(pendingDeltaNode);
+ if (path.startsWith(pendingDeltaPath, null)) {
+ ModelDelta appendDelta = findDeltaForPath(appendDeltaRoot, pendingDeltaPath);
+ appendDelta.setFlags(pendingDeltaNode.getFlags());
+ appendDelta.setChildCount(pendingDeltaNode.getChildCount());
+ appendDelta.setIndex(pendingDeltaNode.getIndex());
+ return true;
+ }
+ return false;
+ });
}
// Copy the pending state into the new appended state.
- fPendingState.accept( new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta pendingDeltaNode, int depth) {
- // Skip the top element
- if (pendingDeltaNode.getParentDelta() == null) {
- return true;
- }
-
- // Find the node in the save delta which is the parent
- // of to the current pending delta node.
- // If the parent node cannot be found, it means that
- // most likely the user collapsed the parent node before
- // the children were ever expanded.
- // If the pending state node already exists in the parent
- // node, it is already processed and we can skip it.
- // If the pending state node does not contain any flags,
- // we can also skip it.
- ModelDelta saveDeltaNode = findSubDeltaParent(appendDeltaRoot, pendingDeltaNode);
- if (saveDeltaNode != null &&
- !isDeltaInParent(pendingDeltaNode, saveDeltaNode) &&
- pendingDeltaNode.getFlags() != IModelDelta.NO_CHANGE)
- {
- saveDeltaNode.setChildCount(pendingDeltaNode.getParentDelta().getChildCount());
- copyIntoDelta(pendingDeltaNode, saveDeltaNode);
- } else {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tSKIPPED: " + pendingDeltaNode.getElement()); //$NON-NLS-1$
- }
- }
-
- // If the pending delta node has a memento element, its
- // children should also be mementos therefore the copy
- // delta operation should have added all the children
- // of this pending delta node into the save delta.
- if (pendingDeltaNode.getElement() instanceof IMemento) {
- return false;
- } else {
- return pendingDeltaNode.getChildCount() > 0;
- }
- }
-
- });
+ fPendingState.accept((pendingDeltaNode, depth) -> {
+ // Skip the top element
+ if (pendingDeltaNode.getParentDelta() == null) {
+ return true;
+ }
+
+ // Find the node in the save delta which is the parent
+ // of to the current pending delta node.
+ // If the parent node cannot be found, it means that
+ // most likely the user collapsed the parent node before
+ // the children were ever expanded.
+ // If the pending state node already exists in the parent
+ // node, it is already processed and we can skip it.
+ // If the pending state node does not contain any flags,
+ // we can also skip it.
+ ModelDelta saveDeltaNode = findSubDeltaParent(appendDeltaRoot, pendingDeltaNode);
+ if (saveDeltaNode != null && !isDeltaInParent(pendingDeltaNode, saveDeltaNode)
+ && pendingDeltaNode.getFlags() != IModelDelta.NO_CHANGE) {
+ saveDeltaNode.setChildCount(pendingDeltaNode.getParentDelta().getChildCount());
+ copyIntoDelta(pendingDeltaNode, saveDeltaNode);
+ } else {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE
+ && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tSKIPPED: " + pendingDeltaNode.getElement()); //$NON-NLS-1$
+ }
+ }
+
+ // If the pending delta node has a memento element, its
+ // children should also be mementos therefore the copy
+ // delta operation should have added all the children
+ // of this pending delta node into the save delta.
+ if (pendingDeltaNode.getElement() instanceof IMemento) {
+ return false;
+ } else {
+ return pendingDeltaNode.getChildCount() > 0;
+ }
+ });
}
if (appendDeltaRoot.getChildDeltas().length > 0) {
@@ -562,55 +552,53 @@ class ViewerStateTracker {
DebugUIPlugin.trace("\tSAVE OUTSTANDING RESTORE: " + fPendingState); //$NON-NLS-1$
}
- IModelDeltaVisitor pendingStateVisitor = new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta pendingDeltaNode, int depth) {
- // Ignore the top element.
- if (pendingDeltaNode.getParentDelta() == null) {
- return true;
- }
+ IModelDeltaVisitor pendingStateVisitor = (pendingDeltaNode, depth) -> {
+ // Ignore the top element.
+ if (pendingDeltaNode.getParentDelta() == null) {
+ return true;
+ }
- // Find the node in the save delta which is the parent
- // of to the current pending delta node.
- // If the parent node cannot be found, it means that
- // most likely the user collapsed the parent node before
- // the children were ever expanded.
- // If the pending state node already exists in the
- // parent
- // node, it is already processed and we can skip it.
- // If the pending state node does not contain any flags,
- // we can also skip it.
- ModelDelta saveDeltaNode = findSubDeltaParent(saveDeltaRoot, pendingDeltaNode);
- if (saveDeltaNode != null && !isDeltaInParent(pendingDeltaNode, saveDeltaNode)
- && pendingDeltaNode.getFlags() != IModelDelta.NO_CHANGE) {
- // There should be only one delta element with
- // the REVEAL flag in the entire save delta. The
- // reveal flag in the pending delta trumps the one
- // in the save delta because most likely the restore
- // operation did not yet complete the reveal
- // operation.
- if ((pendingDeltaNode.getFlags() & IModelDelta.REVEAL) != 0) {
- clearRevealFlag(saveDeltaRoot);
- }
- saveDeltaNode.setChildCount(pendingDeltaNode.getParentDelta().getChildCount());
- copyIntoDelta(pendingDeltaNode, saveDeltaNode);
- } else {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tSKIPPED: " + pendingDeltaNode.getElement()); //$NON-NLS-1$
- }
- }
+ // Find the node in the save delta which is the parent
+ // of to the current pending delta node.
+ // If the parent node cannot be found, it means that
+ // most likely the user collapsed the parent node before
+ // the children were ever expanded.
+ // If the pending state node already exists in the
+ // parent
+ // node, it is already processed and we can skip it.
+ // If the pending state node does not contain any flags,
+ // we can also skip it.
+ ModelDelta saveDeltaNode = findSubDeltaParent(saveDeltaRoot, pendingDeltaNode);
+ if (saveDeltaNode != null && !isDeltaInParent(pendingDeltaNode, saveDeltaNode)
+ && pendingDeltaNode.getFlags() != IModelDelta.NO_CHANGE) {
+ // There should be only one delta element with
+ // the REVEAL flag in the entire save delta. The
+ // reveal flag in the pending delta trumps the one
+ // in the save delta because most likely the restore
+ // operation did not yet complete the reveal
+ // operation.
+ if ((pendingDeltaNode.getFlags() & IModelDelta.REVEAL) != 0) {
+ clearRevealFlag(saveDeltaRoot);
+ }
+ saveDeltaNode.setChildCount(pendingDeltaNode.getParentDelta().getChildCount());
+ copyIntoDelta(pendingDeltaNode, saveDeltaNode);
+ } else {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin
+ .DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tSKIPPED: " + pendingDeltaNode.getElement()); //$NON-NLS-1$
+ }
+ }
- // If the pending delta node has a memento element, its
- // children should also be mementos therefore the copy
- // delta operation should have added all the children
- // of this pending delta node into the save delta.
- if (pendingDeltaNode.getElement() instanceof IMemento) {
- return false;
- } else {
- return pendingDeltaNode.getChildCount() > 0;
- }
- }
- };
+ // If the pending delta node has a memento element, its
+ // children should also be mementos therefore the copy
+ // delta operation should have added all the children
+ // of this pending delta node into the save delta.
+ if (pendingDeltaNode.getElement() instanceof IMemento) {
+ return false;
+ } else {
+ return pendingDeltaNode.getChildCount() > 0;
+ }
+ };
fPendingState.accept(pendingStateVisitor);
}
@@ -627,15 +615,12 @@ class ViewerStateTracker {
}
private void clearRevealFlag(ModelDelta saveRootDelta) {
- IModelDeltaVisitor clearDeltaVisitor = new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta delta, int depth) {
- if ((delta.getFlags() & IModelDelta.REVEAL) != 0) {
- ((ModelDelta) delta).setFlags(delta.getFlags() & ~IModelDelta.REVEAL);
- }
- return true;
- }
- };
+ IModelDeltaVisitor clearDeltaVisitor = (delta, depth) -> {
+ if ((delta.getFlags() & IModelDelta.REVEAL) != 0) {
+ ((ModelDelta) delta).setFlags(delta.getFlags() & ~IModelDelta.REVEAL);
+ }
+ return true;
+ };
saveRootDelta.accept(clearDeltaVisitor);
}
@@ -817,33 +802,29 @@ class ViewerStateTracker {
}
};
- IModelDeltaVisitor visitor = new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta delta, int depth) {
- // Add the CONTENT flag to all nodes with an EXPAND flag.
- // During restoring, this flag is used as a marker indicating
- // whether all the content of a given element has been
- // retrieved.
- if ((delta.getFlags() | IModelDelta.EXPAND) != 0) {
- ((ModelDelta)delta).setFlags(delta.getFlags() | IModelDelta.CONTENT);
- }
+ IModelDeltaVisitor visitor = (delta, depth) -> {
+ // Add the CONTENT flag to all nodes with an EXPAND flag.
+ // During restoring, this flag is used as a marker indicating
+ // whether all the content of a given element has been
+ // retrieved.
+ if ((delta.getFlags() | IModelDelta.EXPAND) != 0) {
+ ((ModelDelta) delta).setFlags(delta.getFlags() | IModelDelta.CONTENT);
+ }
- // This is the root element, save the root element memento in 'inputMemento'.
- if (delta.getParentDelta() == null) {
- manager.addRequest(new ElementMementoRequest(fContentProvider, input, manager,
- delta.getElement(), fContentProvider.getViewerTreePath(delta), inputMemento,
- (ModelDelta) delta));
- } else {
- // If this is another node element, save the memento to a children memento.
- if (!(delta.getElement() instanceof XMLMemento)) {
- manager.addRequest(new ElementMementoRequest(fContentProvider, input, manager,
- delta.getElement(), fContentProvider.getViewerTreePath(delta), childrenMemento
- .createChild("CHILD_ELEMENT"), (ModelDelta) delta)); //$NON-NLS-1$
- }
- }
- return true;
- }
- };
+ // This is the root element, save the root element memento in 'inputMemento'.
+ if (delta.getParentDelta() == null) {
+ manager.addRequest(new ElementMementoRequest(fContentProvider, input, manager, delta.getElement(),
+ fContentProvider.getViewerTreePath(delta), inputMemento, (ModelDelta) delta));
+ } else {
+ // If this is another node element, save the memento to a children memento.
+ if (!(delta.getElement() instanceof XMLMemento)) {
+ manager.addRequest(new ElementMementoRequest(fContentProvider, input, manager, delta.getElement(),
+ fContentProvider.getViewerTreePath(delta), childrenMemento.createChild("CHILD_ELEMENT"), //$NON-NLS-1$
+ (ModelDelta) delta));
+ }
+ }
+ return true;
+ };
rootDelta.accept(visitor);
stateSaveStarted(input, manager);
manager.processReqeusts();
@@ -932,67 +913,66 @@ class ViewerStateTracker {
// If we're canceling select or reveal, cancel it for all of pending deltas
final int mask = flags & (IModelDelta.SELECT | IModelDelta.REVEAL);
- fPendingState.accept(new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta delta, int depth) {
- int deltaFlags = delta.getFlags();
- int newFlags = deltaFlags & ~mask;
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- if (deltaFlags != newFlags) {
- DebugUIPlugin.trace("\tCANCEL: " + delta.getElement() + "(" + Integer.toHexString(deltaFlags & mask) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- ((ModelDelta)delta).setFlags(newFlags);
- return true;
- }
- });
+ fPendingState.accept((delta, depth) -> {
+ int deltaFlags = delta.getFlags();
+ int newFlags = deltaFlags & ~mask;
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE
+ && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ if (deltaFlags != newFlags) {
+ DebugUIPlugin.trace(
+ "\tCANCEL: " + delta.getElement() + "(" + Integer.toHexString(deltaFlags & mask) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ ((ModelDelta) delta).setFlags(newFlags);
+ return true;
+ });
}
if ((flags & ~(IModelDelta.SELECT | IModelDelta.REVEAL)) != 0) {
final int mask = flags & ~(IModelDelta.SELECT | IModelDelta.REVEAL);
// For other flags (EXPAND/COLLAPSE), cancel only from the matching path.
- fPendingState.accept(new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta delta, int depth) {
- if (depth < path.getSegmentCount()) {
- // Descend until we reach a matching depth.
- TreePath deltaPath = fContentProvider.getViewerTreePath(delta);
- if (path.startsWith(deltaPath, null)) {
- return true;
- } else {
- return false;
- }
- }
- else if (depth == path.getSegmentCount()) {
- TreePath deltaPath = fContentProvider.getViewerTreePath(delta);
- if (deltaPath.equals(path)) {
- int deltaFlags = delta.getFlags();
- int newFlags = deltaFlags & ~mask;
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- if (deltaFlags != newFlags) {
- DebugUIPlugin.trace("\tCANCEL: " + delta.getElement() + "(" + Integer.toHexString(deltaFlags & mask) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- ((ModelDelta)delta).setFlags(newFlags);
- if ((flags & IModelDelta.EXPAND) != 0) {
- // Descend delta to clear the EXPAND flags of a canceled expand
- return true;
- }
- }
- return false;
- } else {
- // We're clearing out flags of a matching sub-tree
- // assert (flags & IModelDelta.EXPAND) != 0;
-
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- if (delta.getFlags() != IModelDelta.NO_CHANGE) {
- DebugUIPlugin.trace("\tCANCEL: " + delta.getElement() + "(" + Integer.toHexString(delta.getFlags()) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- ((ModelDelta)delta).setFlags(IModelDelta.NO_CHANGE);
- return true;
- }
- }
- });
+ fPendingState.accept((delta, depth) -> {
+ if (depth < path.getSegmentCount()) {
+ // Descend until we reach a matching depth.
+ TreePath deltaPath1 = fContentProvider.getViewerTreePath(delta);
+ if (path.startsWith(deltaPath1, null)) {
+ return true;
+ } else {
+ return false;
+ }
+ } else if (depth == path.getSegmentCount()) {
+ TreePath deltaPath2 = fContentProvider.getViewerTreePath(delta);
+ if (deltaPath2.equals(path)) {
+ int deltaFlags = delta.getFlags();
+ int newFlags = deltaFlags & ~mask;
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin
+ .DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ if (deltaFlags != newFlags) {
+ DebugUIPlugin.trace("\tCANCEL: " + delta.getElement() + "(" //$NON-NLS-1$ //$NON-NLS-2$
+ + Integer.toHexString(deltaFlags & mask) + ")"); //$NON-NLS-1$
+ }
+ }
+ ((ModelDelta) delta).setFlags(newFlags);
+ if ((flags & IModelDelta.EXPAND) != 0) {
+ // Descend delta to clear the EXPAND flags of a canceled expand
+ return true;
+ }
+ }
+ return false;
+ } else {
+ // We're clearing out flags of a matching sub-tree
+ // assert (flags & IModelDelta.EXPAND) != 0;
+
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE
+ && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ if (delta.getFlags() != IModelDelta.NO_CHANGE) {
+ DebugUIPlugin.trace("\tCANCEL: " + delta.getElement() + "(" //$NON-NLS-1$ //$NON-NLS-2$
+ + Integer.toHexString(delta.getFlags()) + ")"); //$NON-NLS-1$
+ }
+ }
+ ((ModelDelta) delta).setFlags(IModelDelta.NO_CHANGE);
+ return true;
+ }
+ });
}
}
@@ -1018,56 +998,54 @@ class ViewerStateTracker {
return;
}
- IModelDeltaVisitor visitor = new IModelDeltaVisitor() {
- @Override
- public boolean visit(final IModelDelta delta, int depth) {
-
- Object element = delta.getElement();
- Object potentialMatch = depth != 0 ? path.getSegment(depth - 1) : fContentProvider.getViewer().getInput();
- // Only process if the depth in the delta matches the tree path.
- if (depth == path.getSegmentCount()) {
- if (element instanceof IMemento) {
- IElementMementoProvider provider = ViewerAdapterService.getMementoProvider(potentialMatch);
- if (provider == null) {
- provider = ViewerAdapterService.getMementoProvider(fContentProvider.getViewer().getInput());
- }
- if (provider != null) {
- CompareRequestKey key = new CompareRequestKey(path, delta);
- ElementCompareRequest existingRequest = fCompareRequestsInProgress
- .get(key);
- if (existingRequest != null) {
- // Check all the running compare updates for a
- // matching tree path.
- // If found, just update the flags.
- existingRequest.setKnowsHasChildren(knowsHasChildren);
- existingRequest.setKnowsChildCount(knowsChildCount);
- existingRequest.setCheckChildrenRealized(checkChildrenRealized);
- } else {
- // Start a new compare request
- ElementCompareRequest compareRequest = new ElementCompareRequest(
- fContentProvider, fContentProvider.getViewer().getInput(), potentialMatch, path,
- (IMemento) element, (ModelDelta) delta, modelIndex, knowsHasChildren,
- knowsChildCount, checkChildrenRealized);
- fCompareRequestsInProgress.put(key, compareRequest);
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tSTATE BEGIN: " + compareRequest); //$NON-NLS-1$
- }
- notifyStateUpdate(element, TreeModelContentProvider.UPDATE_BEGINS, compareRequest);
- provider.compareElements(new IElementCompareRequest[] { compareRequest });
- }
- }
- } else if (element.equals(potentialMatch)) {
- // Element comparison already succeeded, and it matches
- // our element.
- // Call restore with delta to process the delta flags.
- restorePendingStateNode((ModelDelta) delta, knowsHasChildren, knowsChildCount, checkChildrenRealized);
- }
- return false;
- }
- // Only follow the paths that match the delta.
- return element.equals(potentialMatch);
- }
- };
+ IModelDeltaVisitor visitor = (delta, depth) -> {
+
+ Object element = delta.getElement();
+ Object potentialMatch = depth != 0 ? path.getSegment(depth - 1) : fContentProvider.getViewer().getInput();
+ // Only process if the depth in the delta matches the tree path.
+ if (depth == path.getSegmentCount()) {
+ if (element instanceof IMemento) {
+ IElementMementoProvider provider = ViewerAdapterService.getMementoProvider(potentialMatch);
+ if (provider == null) {
+ provider = ViewerAdapterService.getMementoProvider(fContentProvider.getViewer().getInput());
+ }
+ if (provider != null) {
+ CompareRequestKey key = new CompareRequestKey(path, delta);
+ ElementCompareRequest existingRequest = fCompareRequestsInProgress.get(key);
+ if (existingRequest != null) {
+ // Check all the running compare updates for a
+ // matching tree path.
+ // If found, just update the flags.
+ existingRequest.setKnowsHasChildren(knowsHasChildren);
+ existingRequest.setKnowsChildCount(knowsChildCount);
+ existingRequest.setCheckChildrenRealized(checkChildrenRealized);
+ } else {
+ // Start a new compare request
+ ElementCompareRequest compareRequest = new ElementCompareRequest(fContentProvider,
+ fContentProvider.getViewer().getInput(), potentialMatch, path, (IMemento) element,
+ (ModelDelta) delta, modelIndex, knowsHasChildren, knowsChildCount,
+ checkChildrenRealized);
+ fCompareRequestsInProgress.put(key, compareRequest);
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin
+ .DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tSTATE BEGIN: " + compareRequest); //$NON-NLS-1$
+ }
+ notifyStateUpdate(element, TreeModelContentProvider.UPDATE_BEGINS, compareRequest);
+ provider.compareElements(new IElementCompareRequest[] { compareRequest });
+ }
+ }
+ } else if (element.equals(potentialMatch)) {
+ // Element comparison already succeeded, and it matches
+ // our element.
+ // Call restore with delta to process the delta flags.
+ restorePendingStateNode((ModelDelta) delta, knowsHasChildren, knowsChildCount,
+ checkChildrenRealized);
+ }
+ return false;
+ }
+ // Only follow the paths that match the delta.
+ return element.equals(potentialMatch);
+ };
try {
fInStateRestore = true;
@@ -1153,15 +1131,12 @@ class ViewerStateTracker {
DebugUIPlugin.trace("\tRESTORE REMOVED: " + delta.getElement()); //$NON-NLS-1$
}
- delta.accept(new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta _visitorDelta, int depth) {
- ModelDelta visitorDelta = (ModelDelta) _visitorDelta;
- visitorDelta.setElement(ELEMENT_REMOVED);
- visitorDelta.setFlags(IModelDelta.NO_CHANGE);
- return true;
- }
- });
+ delta.accept((_visitorDelta, depth) -> {
+ ModelDelta visitorDelta = (ModelDelta) _visitorDelta;
+ visitorDelta.setElement(ELEMENT_REMOVED);
+ visitorDelta.setFlags(IModelDelta.NO_CHANGE);
+ return true;
+ });
}
}
@@ -1442,16 +1417,13 @@ class ViewerStateTracker {
*/
private ModelDelta markRevealDelta(ModelDelta rootDelta) {
final ModelDelta[] revealDelta = new ModelDelta[1];
- IModelDeltaVisitor visitor = new IModelDeltaVisitor() {
- @Override
- public boolean visit(IModelDelta delta, int depth) {
- if ( (delta.getFlags() & IModelDelta.REVEAL) != 0) {
- revealDelta[0] = (ModelDelta)delta;
- }
- // Keep recursing only if we haven't found our delta yet.
- return revealDelta[0] == null;
- }
- };
+ IModelDeltaVisitor visitor = (delta, depth) -> {
+ if ((delta.getFlags() & IModelDelta.REVEAL) != 0) {
+ revealDelta[0] = (ModelDelta) delta;
+ }
+ // Keep recursing only if we haven't found our delta yet.
+ return revealDelta[0] == null;
+ };
rootDelta.accept(visitor);
if (revealDelta[0] != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
index a1568c38b..acfc2bb1c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
@@ -1,5 +1,5 @@
/*****************************************************************
- * Copyright (c) 2009, 2013 Texas Instruments and others
+ * Copyright (c) 2009, 2018 Texas Instruments 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
@@ -526,13 +526,10 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
*/
@Override
public void breakpointManagerEnablementChanged(boolean enabled) {
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- IAction action = getAction(ACTION_SKIP_BREAKPOINTS);
- if (action != null) {
- ((SkipAllBreakpointsAction) action).updateActionCheckedState();
- }
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> {
+ IAction action = getAction(ACTION_SKIP_BREAKPOINTS);
+ if (action != null) {
+ ((SkipAllBreakpointsAction) action).updateActionCheckedState();
}
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
index c341c6fa3..7088bd43d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
@@ -456,13 +456,10 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
setWaterMarks(lowWater, highWater);
}
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
- setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
- }
- });
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> {
+ setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
+ setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
+ });
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
index 9f85f919a..dc6a80ffd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -14,7 +14,6 @@ import java.io.IOException;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
-
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
@@ -25,17 +24,14 @@ import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamsProxy;
import org.eclipse.debug.core.model.IStreamsProxy2;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
-
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
-
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
-
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
@@ -226,14 +222,11 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
for (int i = 0; i < events.length; i++) {
DebugEvent event = events[i];
if (event.getSource().equals(getProcess())) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- if (fTerminate != null) {
- fTerminate.update();
- }
- }
- };
+ Runnable r = () -> {
+ if (fTerminate != null) {
+ fTerminate.update();
+ }
+ };
DebugUIPlugin.getStandardDisplay().asyncExec(r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
index e8436da2a..f09645ede 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2013 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation 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
@@ -269,22 +269,19 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS
// tab folders should be removed from our map.
final IMemoryBlockRetrieval ret = (IMemoryBlockRetrieval) source;
if (ret != null) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isDisposed()) {
- return;
- }
-
- Integer key = MemoryViewUtil.getHashCode(ret);
- Object folder = fTabFolderForDebugView.get(key);
-
- if (folder != null && folder != fEmptyTabFolder) {
- // remove the tab folder , and all contained tab
- // items
- disposeOfFolder((CTabFolder) folder);
- fTabFolderForDebugView.remove(key);
- }
+ Display.getDefault().asyncExec(() -> {
+ if (isDisposed()) {
+ return;
+ }
+
+ Integer key = MemoryViewUtil.getHashCode(ret);
+ Object folder = fTabFolderForDebugView.get(key);
+
+ if (folder != null && folder != fEmptyTabFolder) {
+ // remove the tab folder , and all contained tab
+ // items
+ disposeOfFolder((CTabFolder) folder);
+ fTabFolderForDebugView.remove(key);
}
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java
index 88e58f65f..bb95e8553 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -48,12 +48,9 @@ public class MemoryViewPrefAction implements IViewActionDelegate {
final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), prefManager);
- BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- dialog.create();
- dialog.open();
- }
+ BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), () -> {
+ dialog.create();
+ dialog.open();
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java
index 46ec5d2df..343f16ca4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation 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
@@ -229,33 +229,30 @@ public class MemoryViewSynchronizationService implements IMemoryRenderingSynchro
// Make sure the synchronizer does not swallow any events
// Values of the properties are updated in the syncrhonizer immediately.
// Change events are queued up on the UI Thread.
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- if (fSynchronizeInfo == null) {
- return;
- }
+ Display.getDefault().syncExec(() -> {
+ if (fSynchronizeInfo == null) {
+ return;
+ }
- IMemoryRendering rendering = (IMemoryRendering) evt.getSource();
- String propertyId = evt.getProperty();
+ IMemoryRendering rendering = (IMemoryRendering) evt.getSource();
+ String propertyId = evt.getProperty();
- SynchronizeInfo info = fSynchronizeInfo.get(rendering.getMemoryBlock());
- if (info != null) {
- Object value = info.getProperty(propertyId);
- if (value != null) {
- Enumeration<PropertyListener> enumeration = fPropertyListeners.elements();
+ SynchronizeInfo info = fSynchronizeInfo.get(rendering.getMemoryBlock());
+ if (info != null) {
+ Object value = info.getProperty(propertyId);
+ if (value != null) {
+ Enumeration<PropertyListener> enumeration = fPropertyListeners.elements();
- while (enumeration.hasMoreElements()) {
- PropertyListener listener = enumeration.nextElement();
+ while (enumeration.hasMoreElements()) {
+ PropertyListener listener = enumeration.nextElement();
- IPropertyChangeListener origListener = listener.getListener();
+ IPropertyChangeListener origListener = listener.getListener();
- // if it's a valid property - valid means that it's
- // listed in the property filters
- if (listener.isValidProperty(propertyId)) {
- PropertyChangeNotifier notifier = new PropertyChangeNotifier(origListener, evt);
- SafeRunner.run(notifier);
- }
+ // if it's a valid property - valid means that it's
+ // listed in the property filters
+ if (listener.isValidProperty(propertyId)) {
+ PropertyChangeNotifier notifier = new PropertyChangeNotifier(origListener, evt);
+ SafeRunner.run(notifier);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
index a7f04e4fd..1461532f5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2013 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation 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
@@ -120,28 +120,25 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
*/
@Override
public void memoryBlocksAdded(final IMemoryBlock[] memoryBlocks) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
+ Display.getDefault().asyncExec(() -> {
- if (isDisposed()) {
- return;
- }
+ if (isDisposed()) {
+ return;
+ }
- // check condition before doing anything
- if (memoryBlocks == null || memoryBlocks.length <= 0) {
- return;
- }
+ // check condition before doing anything
+ if (memoryBlocks == null || memoryBlocks.length <= 0) {
+ return;
+ }
- for (int i = 0; i < memoryBlocks.length; i++) {
- IMemoryBlock memory = memoryBlocks[i];
+ for (int i = 0; i < memoryBlocks.length; i++) {
+ IMemoryBlock memory = memoryBlocks[i];
- if (!fTabFolderForMemoryBlock.containsKey(memory)) {
- createFolderForMemoryBlock(memory);
- }
- fAddedMemoryBlocks.add(memory);
- updateToolBarActionsEnablement();
+ if (!fTabFolderForMemoryBlock.containsKey(memory)) {
+ createFolderForMemoryBlock(memory);
}
+ fAddedMemoryBlocks.add(memory);
+ updateToolBarActionsEnablement();
}
});
}
@@ -153,91 +150,89 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
*/
@Override
public void memoryBlocksRemoved(final IMemoryBlock[] memoryBlocks) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (int j = 0; j < memoryBlocks.length; j++) {
- IMemoryBlock mbRemoved = memoryBlocks[j];
- if (fTabFolderForMemoryBlock == null) {
- return;
- }
+ Display.getDefault().asyncExec(() -> {
+ for (int j = 0; j < memoryBlocks.length; j++) {
+ IMemoryBlock mbRemoved = memoryBlocks[j];
+ if (fTabFolderForMemoryBlock == null) {
+ return;
+ }
- // get all renderings from this memory block and remove them
- // from the view
- IMemoryRendering[] renderings = fRenderingMgr.getRenderingsFromMemoryBlock(mbRemoved);
+ // get all renderings from this memory block and remove them
+ // from the view
+ IMemoryRendering[] renderings = fRenderingMgr.getRenderingsFromMemoryBlock(mbRemoved);
- for (int k = 0; k < renderings.length; k++) {
- removeMemoryRendering(renderings[k]);
- }
+ for (int k = 0; k < renderings.length; k++) {
+ removeMemoryRendering(renderings[k]);
+ }
- // remove a the tab folder if the memory block is removed
- CTabFolder tabFolder = fTabFolderForMemoryBlock.get(mbRemoved);
+ // remove a the tab folder if the memory block is removed
+ CTabFolder tabFolder = fTabFolderForMemoryBlock.get(mbRemoved);
- if (tabFolder == null) {
- continue;
+ if (tabFolder == null) {
+ continue;
+ }
+
+ fTabFolderForMemoryBlock.remove(mbRemoved);
+ fMemoryBlockFromTabFolder.remove(tabFolder);
+ IMemoryBlockRetrieval retrieve = MemoryViewUtil.getMemoryBlockRetrieval(mbRemoved);
+ if (retrieve != null) {
+ if (fTabFolderForDebugView.contains(tabFolder)) {
+ fTabFolderForDebugView.remove(MemoryViewUtil.getHashCode(retrieve));
}
+ }
- fTabFolderForMemoryBlock.remove(mbRemoved);
- fMemoryBlockFromTabFolder.remove(tabFolder);
- IMemoryBlockRetrieval retrieve = MemoryViewUtil.getMemoryBlockRetrieval(mbRemoved);
- if (retrieve != null) {
- if (fTabFolderForDebugView.contains(tabFolder)) {
- fTabFolderForDebugView.remove(MemoryViewUtil.getHashCode(retrieve));
- }
+ if (!tabFolder.isDisposed()) {
+ // dispose all view tabs belonging to the tab folder
+ CTabItem[] items = tabFolder.getItems();
+
+ for (int i = 0; i < items.length; i++) {
+ disposeTab(items[i]);
}
- if (!tabFolder.isDisposed()) {
- // dispose all view tabs belonging to the tab folder
- CTabItem[] items = tabFolder.getItems();
+ // dispose the tab folder
+ tabFolder.dispose();
- for (int i = 0; i < items.length; i++) {
- disposeTab(items[i]);
- }
+ // if this is the top control
+ if (tabFolder == fStackLayout.topControl) {
- // dispose the tab folder
- tabFolder.dispose();
-
- // if this is the top control
- if (tabFolder == fStackLayout.topControl) {
-
- // if memory view is visible and have a selection
- // follow memory view's selection
-
- ISelection selection = DebugUIPlugin.getActiveWorkbenchWindow().getSelectionService().getSelection(IDebugUIConstants.ID_MEMORY_VIEW);
- IMemoryBlock mbToSelect = getMemoryBlock(selection);
-
- if (mbToSelect != null) {
- // memory view may not have got the event and is
- // still displaying
- // the deleted memory block
- if (mbToSelect != mbRemoved) {
- handleMemoryBlockSelection(null, mbToSelect);
- } else if ((MemoryViewUtil.getMemoryBlockManager().getMemoryBlocks(retrieve).length > 0)) {
- mbToSelect = MemoryViewUtil.getMemoryBlockManager().getMemoryBlocks(retrieve)[0];
- handleMemoryBlockSelection(null, mbToSelect);
- } else {
- emptyFolder();
- }
- } else if (MemoryViewUtil.getMemoryBlockManager().getMemoryBlocks(retrieve).length > 0) { // get
- // to
- // the
- // next
- // folder
+ // if memory view is visible and have a selection
+ // follow memory view's selection
+
+ ISelection selection = DebugUIPlugin.getActiveWorkbenchWindow().getSelectionService()
+ .getSelection(IDebugUIConstants.ID_MEMORY_VIEW);
+ IMemoryBlock mbToSelect = getMemoryBlock(selection);
+
+ if (mbToSelect != null) {
+ // memory view may not have got the event and is
+ // still displaying
+ // the deleted memory block
+ if (mbToSelect != mbRemoved) {
+ handleMemoryBlockSelection(null, mbToSelect);
+ } else if ((MemoryViewUtil.getMemoryBlockManager().getMemoryBlocks(retrieve).length > 0)) {
mbToSelect = MemoryViewUtil.getMemoryBlockManager().getMemoryBlocks(retrieve)[0];
handleMemoryBlockSelection(null, mbToSelect);
} else {
emptyFolder();
-
}
- }
+ } else if (MemoryViewUtil.getMemoryBlockManager().getMemoryBlocks(retrieve).length > 0) { // get
+ // to
+ // the
+ // next
+ // folder
+ mbToSelect = MemoryViewUtil.getMemoryBlockManager().getMemoryBlocks(retrieve)[0];
+ handleMemoryBlockSelection(null, mbToSelect);
+ } else {
+ emptyFolder();
- // if not the top control
- // no need to do anything
+ }
}
- fAddedMemoryBlocks.remove(mbRemoved);
- updateToolBarActionsEnablement();
+ // if not the top control
+ // no need to do anything
}
+
+ fAddedMemoryBlocks.remove(mbRemoved);
+ updateToolBarActionsEnablement();
}
});
@@ -447,59 +442,56 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
public void memoryBlockRenderingAdded(final IMemoryRendering rendering) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
+ Display.getDefault().asyncExec(() -> {
- if (isDisposed()) {
- return;
- }
+ if (isDisposed()) {
+ return;
+ }
- if (fAddedRenderings.contains(rendering)) {
- return;
- }
+ if (fAddedRenderings.contains(rendering)) {
+ return;
+ }
- IMemoryBlock memoryblk = rendering.getMemoryBlock();
+ IMemoryBlock memoryblk = rendering.getMemoryBlock();
- CTabFolder tabFolder = fTabFolderForMemoryBlock.get(memoryblk);
+ CTabFolder tabFolder = fTabFolderForMemoryBlock.get(memoryblk);
- if (tabFolder == null) {
- tabFolder = createFolderForMemoryBlock(memoryblk);
- }
+ if (tabFolder == null) {
+ tabFolder = createFolderForMemoryBlock(memoryblk);
+ }
- if (tabFolder == fStackLayout.topControl) {
- // disable current view tab
- if (getTopMemoryTab() != null) {
- deactivateRendering(getTopMemoryTab());
- getTopMemoryTab().setEnabled(false);
- }
+ if (tabFolder == fStackLayout.topControl) {
+ // disable current view tab
+ if (getTopMemoryTab() != null) {
+ deactivateRendering(getTopMemoryTab());
+ getTopMemoryTab().setEnabled(false);
}
- fAddedRenderings.add(rendering);
+ }
+ fAddedRenderings.add(rendering);
- int index = getIndexOfCreateRenderingTab(tabFolder);
- if (index < 0) {
- index = 0;
- }
- CTabItem tab = createTab(tabFolder, index);
+ int index = getIndexOfCreateRenderingTab(tabFolder);
+ if (index < 0) {
+ index = 0;
+ }
+ CTabItem tab = createTab(tabFolder, index);
- MemoryViewTab viewTab = new MemoryViewTab(tab, rendering, getInstance());
- tabFolder.setSelection(tabFolder.indexOf(tab));
+ MemoryViewTab viewTab = new MemoryViewTab(tab, rendering, getInstance());
+ tabFolder.setSelection(tabFolder.indexOf(tab));
- if (tabFolder == fStackLayout.topControl) {
- setRenderingSelection(viewTab.getRendering());
+ if (tabFolder == fStackLayout.topControl) {
+ setRenderingSelection(viewTab.getRendering());
- // disable top view tab if the view pane is not visible
- IMemoryViewTab top = getTopMemoryTab();
- if (top != null) {
- top.setEnabled(fVisible);
- }
- } else {
- deactivateRendering(viewTab);
- viewTab.setEnabled(false);
+ // disable top view tab if the view pane is not visible
+ IMemoryViewTab top = getTopMemoryTab();
+ if (top != null) {
+ top.setEnabled(fVisible);
}
-
- updateToolBarActionsEnablement();
+ } else {
+ deactivateRendering(viewTab);
+ viewTab.setEnabled(false);
}
+
+ updateToolBarActionsEnablement();
});
}
@@ -514,70 +506,67 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
// need to run the following code on the UI Thread to avoid invalid
// thread access exception
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!fAddedRenderings.contains(rendering)) {
- return;
- }
+ Display.getDefault().asyncExec(() -> {
+ if (!fAddedRenderings.contains(rendering)) {
+ return;
+ }
- fAddedRenderings.remove(rendering);
+ fAddedRenderings.remove(rendering);
- CTabFolder tabFolder = (CTabFolder) fStackLayout.topControl;
+ CTabFolder tabFolder = (CTabFolder) fStackLayout.topControl;
- if (tabFolder.isDisposed()) {
- return;
- }
-
- CTabItem[] tabs = tabFolder.getItems();
- boolean foundTab = false;
- for (int i = 0; i < tabs.length; i++) {
- IMemoryViewTab viewTab = (IMemoryViewTab) tabs[i].getData();
+ if (tabFolder.isDisposed()) {
+ return;
+ }
- if (tabs[i].isDisposed()) {
- continue;
- }
+ CTabItem[] tabs = tabFolder.getItems();
+ boolean foundTab = false;
+ for (int i1 = 0; i1 < tabs.length; i1++) {
+ IMemoryViewTab viewTab1 = (IMemoryViewTab) tabs[i1].getData();
- if (viewTab.getRendering().getMemoryBlock() == memory) {
- if (viewTab.getRendering() == rendering) {
- foundTab = true;
- disposeTab(tabs[i]);
- break;
- }
+ if (tabs[i1].isDisposed()) {
+ continue;
+ }
+ if (viewTab1.getRendering().getMemoryBlock() == memory) {
+ if (viewTab1.getRendering() == rendering) {
+ foundTab = true;
+ disposeTab(tabs[i1]);
+ break;
}
+
}
+ }
- // if a tab is not found in the current top control
- // this deletion is a result of a debug target termination
- // find memory from other folder and dispose the view tab
- if (!foundTab) {
- Enumeration<CTabFolder> enumeration = fTabFolderForMemoryBlock.elements();
- while (enumeration.hasMoreElements()) {
- CTabFolder otherTabFolder = enumeration.nextElement();
- tabs = otherTabFolder.getItems();
- IMemoryViewTab viewTab = null;
- for (int i = 0; i < tabs.length; i++) {
- viewTab = (IMemoryViewTab) tabs[i].getData();
- if (viewTab.getRendering().getMemoryBlock() == memory) {
- if (viewTab.getRendering() == rendering) {
- foundTab = true;
- disposeTab(tabs[i]);
- break;
- }
+ // if a tab is not found in the current top control
+ // this deletion is a result of a debug target termination
+ // find memory from other folder and dispose the view tab
+ if (!foundTab) {
+ Enumeration<CTabFolder> enumeration = fTabFolderForMemoryBlock.elements();
+ while (enumeration.hasMoreElements()) {
+ CTabFolder otherTabFolder = enumeration.nextElement();
+ tabs = otherTabFolder.getItems();
+ IMemoryViewTab viewTab2 = null;
+ for (int i2 = 0; i2 < tabs.length; i2++) {
+ viewTab2 = (IMemoryViewTab) tabs[i2].getData();
+ if (viewTab2.getRendering().getMemoryBlock() == memory) {
+ if (viewTab2.getRendering() == rendering) {
+ foundTab = true;
+ disposeTab(tabs[i2]);
+ break;
}
}
}
}
- IMemoryViewTab top = getTopMemoryTab();
-
- // update selection
- if (top != null) {
- setRenderingSelection(top.getRendering());
- }
+ }
+ IMemoryViewTab top = getTopMemoryTab();
- updateToolBarActionsEnablement();
+ // update selection
+ if (top != null) {
+ setRenderingSelection(top.getRendering());
}
+
+ updateToolBarActionsEnablement();
});
}
@@ -1194,13 +1183,10 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
final CTabFolder tabFolder = fTabFolderForMemoryBlock.get(memoryblk);
if (tabFolder != null) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- int index = getIndexOfCreateRenderingTab(tabFolder);
- if (index >= 0) {
- tabFolder.setSelection(index);
- }
+ Display.getDefault().asyncExec(() -> {
+ int index = getIndexOfCreateRenderingTab(tabFolder);
+ if (index >= 0) {
+ tabFolder.setSelection(index);
}
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
index 8069d259b..11c75b43a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -38,8 +38,6 @@ import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TableCursor;
import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.MouseAdapter;
@@ -166,11 +164,7 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
fTableCursor.addKeyListener(fCursorKeyAdapter);
- fCursorTraverseListener = new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- handleCursorTraverseEvt(e);
- }};
+ fCursorTraverseListener = e -> handleCursorTraverseEvt(e);
fTableCursor.addTraverseListener(fCursorTraverseListener);
@@ -183,16 +177,15 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
// cursor may be disposed before disposed is called
// remove listeners whenever the cursor is disposed
- fTableCursor.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (fTableCursor == null)
- return;
- fTableCursor.removeTraverseListener(fCursorTraverseListener);
- fTableCursor.removeKeyListener(fCursorKeyAdapter);
- fTableCursor.removeMouseListener(fCursorMouseListener);
- fTableCursor.removeSelectionListener(fCursorSelectionListener);
- }});
+ fTableCursor.addDisposeListener(e -> {
+ if (fTableCursor == null) {
+ return;
+ }
+ fTableCursor.removeTraverseListener(fCursorTraverseListener);
+ fTableCursor.removeKeyListener(fCursorKeyAdapter);
+ fTableCursor.removeMouseListener(fCursorMouseListener);
+ fTableCursor.removeSelectionListener(fCursorSelectionListener);
+ });
fCursorSelectionListener = new SelectionAdapter() {
@Override
@@ -231,14 +224,16 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
if (e.button == 1)
{
int col = fTableCursor.getColumn();
- if (col > 0 && col <= (getNumCol()))
+ if (col > 0 && col <= (getNumCol())) {
activateCellEditor(null);
+ }
}
}
private void handleCursorTraverseEvt(TraverseEvent e){
- if (fTableCursor.getRow() == null)
+ if (fTableCursor.getRow() == null) {
return;
+ }
Table table = (Table)fTableCursor.getParent();
int row = table.indexOf(fTableCursor.getRow());
@@ -319,8 +314,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
synchronized private Object doAttemptSetKeySelection(final Object key)
{
- if (getBufferTopKey() == null || getBufferEndKey() == null)
+ if (getBufferTopKey() == null || getBufferEndKey() == null) {
return key;
+ }
// calculate selected row address
int[] location = getCoordinatesFromKey(key);
@@ -337,11 +333,13 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
if (DebugUIPlugin.DEBUG_DYNAMIC_LOADING) {
DebugUIPlugin.trace(getRendering() + " set cursor selection " + ((BigInteger)key).toString(16)); //$NON-NLS-1$
}
- if (fPendingSelection != null && fPendingSelection != key)
+ if (fPendingSelection != null && fPendingSelection != key) {
return Status.OK_STATUS;
+ }
- if (fTableCursor.isDisposed())
+ if (fTableCursor.isDisposed()) {
return Status.OK_STATUS;
+ }
// by the time this is called, the location may not be valid anymore
int[] newLocation = getCoordinatesFromKey(key);
@@ -431,8 +429,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
{
AbstractVirtualContentTableModel model = getVirtualContentModel();
- if (model != null)
+ if (model != null) {
return getKey(model.getElements().length-1);
+ }
return null;
}
@@ -440,8 +439,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
{
int idx = -1;
AbstractVirtualContentTableModel model = getVirtualContentModel();
- if (model != null)
+ if (model != null) {
idx = model.indexOfKey(key);
+ }
return idx;
}
@@ -470,8 +470,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
public Object getKey(int row, int col)
{
AbstractVirtualContentTableModel model = getVirtualContentModel();
- if (model != null)
+ if (model != null) {
return model.getKey(row, col);
+ }
return null;
}
@@ -500,10 +501,11 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
}
}
- if (fPendingSelection != null)
+ if (fPendingSelection != null) {
oldSelectionKey = fPendingSelection;
- else
+ } else {
oldSelectionKey = getSelectionKey();
+ }
if (DebugUIPlugin.DEBUG_DYNAMIC_LOADING)
{
@@ -576,8 +578,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
{
if (!fTableCursor.isDisposed())
{
- if (fTableCursor.isVisible() != show)
+ if (fTableCursor.isVisible() != show) {
fTableCursor.setVisible(show);
+ }
}
}
else
@@ -588,8 +591,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
public IStatus runInUIThread(IProgressMonitor monitor) {
if (!fTableCursor.isDisposed())
{
- if (fTableCursor.isVisible() != show)
+ if (fTableCursor.isVisible() != show) {
fTableCursor.setVisible(show);
+ }
}
return Status.OK_STATUS;
}};
@@ -622,13 +626,15 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
}
}
}
- if (colNum >= 0)
+ if (colNum >= 0) {
break;
+ }
}
// if column position cannot be determined, return
- if (colNum < 1)
+ if (colNum < 1) {
return;
+ }
// handle user mouse click onto table
// move cursor to new position
@@ -656,8 +662,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
final int col = fTableCursor.getColumn();
final int row = indexOf(fSelectionKey);
- if (row < 0)
+ if (row < 0) {
return;
+ }
// do not allow user to edit address column
if (col == 0 || col > getNumCol()) {
@@ -678,8 +685,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
boolean canEdit = cellModifier
.canModify(element, (String) property);
- if (!canEdit)
+ if (!canEdit) {
return;
+ }
CellEditor editor = getCellEditors()[col];
if (editor != null) {
@@ -754,43 +762,36 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
private void handleKeyEventInEditor(KeyEvent event) {
final KeyEvent e = event;
- Display.getDefault().asyncExec(new Runnable()
- {
- @Override
- public void run()
+ Display.getDefault().asyncExec(() -> {
+ Object obj = e.getSource();
+ if (obj instanceof Control)
{
- Object obj = e.getSource();
- if (obj instanceof Control)
- {
- Control control = (Control)obj;
- int row = fCellEditorListener.getRow();
- int col = fCellEditorListener.getCol();
+ Control control = (Control) obj;
+ int row = fCellEditorListener.getRow();
+ int col = fCellEditorListener.getCol();
- try
+ try
+ {
+ switch (e.keyCode)
{
- switch (e.keyCode)
- {
- case 0:
- doHandleKeyEvent(row, col);
- break;
- case SWT.ESC:
- cancelEditing(row, col);
- break;
- default :
- doHandleKeyEvent(row, col);
+ case 0:
+ doHandleKeyEvent(row, col);
+ break;
+ case SWT.ESC:
+ cancelEditing(row, col);
break;
- }
+ default:
+ doHandleKeyEvent(row, col);
+ break;
}
- catch (NumberFormatException e1)
- {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
+ } catch (NumberFormatException e1) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null);
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
- removeListeners(control);
- }
+ removeListeners(control);
}
}
});
@@ -940,12 +941,13 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
public void formatViewer()
{
- if (getModel() == null || !hasPendingUpdates())
+ if (getModel() == null || !hasPendingUpdates()) {
doFormatViewer();
- else
+ } else {
// do not format in the middle of an update
// set pending update and will format when update is completed
fPendingFormatViewer = true;
+ }
}
/**
@@ -953,18 +955,14 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
*/
private void doFormatViewer() {
fPendingFormatViewer = false;
- preservingSelection(new Runnable() {
-
- @Override
- public void run() {
- // causes the content of the table viewer to be replaced
- // without asking content adapter for content
- AbstractVirtualContentTableModel model = getVirtualContentModel();
- if (model != null)
- {
- model.handleViewerChanged();
- }
- }});
+ preservingSelection(() -> {
+ // causes the content of the table viewer to be replaced
+ // without asking content adapter for content
+ AbstractVirtualContentTableModel model = getVirtualContentModel();
+ if (model != null) {
+ model.handleViewerChanged();
+ }
+ });
}
private void fireSelectionChanged(Object selectionKey)
@@ -984,22 +982,18 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
@Override
public void refresh(boolean getContent)
{
- if (getContent)
+ if (getContent) {
refresh();
- else
+ } else
{
- preservingSelection(new Runnable() {
-
- @Override
- public void run() {
- AbstractVirtualContentTableModel model = getVirtualContentModel();
- if (model != null)
- {
- Object[] elements = model.getElements();
- model.remove(elements);
- model.add(elements);
- }
- }});
+ preservingSelection(() -> {
+ AbstractVirtualContentTableModel model = getVirtualContentModel();
+ if (model != null) {
+ Object[] elements = model.getElements();
+ model.remove(elements);
+ model.add(elements);
+ }
+ });
}
}
@@ -1011,10 +1005,11 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
// TODO: work around swt bug, must force a table cursor redraw after top index is changed
// BUG 130130
int[] coordinates = getCoordinatesFromKey(getSelectionKey());
- if (coordinates.length > 0)
+ if (coordinates.length > 0) {
fTableCursor.setVisible(true);
- else
+ } else {
fTableCursor.setVisible(false);
+ }
}
}
@@ -1045,17 +1040,15 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
// and the cursor should not be redrawn yet.
if (!hasPendingSetTopIndex())
{
- preservingSelection(new Runnable() {
+ preservingSelection(() -> {
- @Override
- public void run() {
-
- int[] coordinates = getCoordinatesFromKey(getSelectionKey());
- if (coordinates.length > 0)
- fTableCursor.setVisible(true);
- else
- fTableCursor.setVisible(false);
- }});
+ int[] coordinates = getCoordinatesFromKey(getSelectionKey());
+ if (coordinates.length > 0) {
+ fTableCursor.setVisible(true);
+ } else {
+ fTableCursor.setVisible(false);
+ }
+ });
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java
index 18b1aa5dd..c13842c65 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation 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
@@ -101,12 +101,9 @@ public abstract class BasicDebugViewContentProvider implements IStructuredConten
if (element == null) {
return;
}
- Runnable r= new Runnable() {
- @Override
- public void run() {
- if (!isDisposed()) {
- doHandleDebugEvent(event);
- }
+ Runnable r = () -> {
+ if (!isDisposed()) {
+ doHandleDebugEvent(event);
}
};
@@ -118,8 +115,9 @@ public abstract class BasicDebugViewContentProvider implements IStructuredConten
*/
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i=0; i < events.length; i++)
+ for (int i=0; i < events.length; i++) {
handleDebugEvent(events[i]);
+ }
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPrefAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPrefAction.java
index 6a3000bef..dc2089855 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPrefAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPrefAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation 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
@@ -50,13 +50,10 @@ public class TableRenderingPrefAction extends ActionDelegate implements IViewAct
manager.addToRoot(targetNode);
final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), manager);
final boolean [] result = new boolean[] { false };
- BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- dialog.create();
- dialog.setMessage(targetNode.getLabelText());
- result[0]= (dialog.open() == Window.OK);
- }
+ BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), () -> {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ result[0] = (dialog.open() == Window.OK);
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java
index 6870e23a4..27242bb7e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -54,21 +54,18 @@ public class SelectLogicalStructureAction extends Action {
if (!getView().isAvailable()) {
return;
}
- BusyIndicator.showWhile(getView().getViewer().getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- // Checking this action sets the type to fType, unchecking it sets the type
- // to null ("none selected")
- ILogicalStructureType type= null;
- IAction action = getView().getAction("ToggleContentProviders"); //$NON-NLS-1$
- if (isChecked()) {
- type= fType;
- action.setChecked(true);
- }
- action.run();
- DebugPlugin.setDefaultStructureType(fAvailableTypes, type);
- getView().getViewer().refresh();
+ BusyIndicator.showWhile(getView().getViewer().getControl().getDisplay(), () -> {
+ // Checking this action sets the type to fType, unchecking it sets the type
+ // to null ("none selected")
+ ILogicalStructureType type = null;
+ IAction action = getView().getAction("ToggleContentProviders"); //$NON-NLS-1$
+ if (isChecked()) {
+ type = fType;
+ action.setChecked(true);
}
+ action.run();
+ DebugPlugin.setDefaultStructureType(fAvailableTypes, type);
+ getView().getViewer().refresh();
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleLogicalStructureAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleLogicalStructureAction.java
index 504a1fd53..76caf9e90 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleLogicalStructureAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleLogicalStructureAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -51,12 +51,7 @@ public class ToggleLogicalStructureAction extends Action {
return;
}
getView().setShowLogicalStructure(isChecked());
- BusyIndicator.showWhile(getView().getViewer().getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- getView().getViewer().refresh();
- }
- });
+ BusyIndicator.showWhile(getView().getViewer().getControl().getDisplay(), () -> getView().getViewer().refresh());
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleShowColumnsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleShowColumnsAction.java
index 7294468b0..ab9d34646 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleShowColumnsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleShowColumnsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -48,12 +48,7 @@ public class ToggleShowColumnsAction extends Action implements IUpdate {
if (fViewer.getControl().isDisposed()) {
return;
}
- BusyIndicator.showWhile(fViewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- fViewer.setShowColumns(isChecked());
- }
- });
+ BusyIndicator.showWhile(fViewer.getControl().getDisplay(), () -> fViewer.setShowColumns(isChecked()));
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
index 7f051ad69..d9b95065e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -26,7 +26,6 @@ import org.eclipse.debug.internal.ui.actions.breakpoints.SkipAllBreakpointsActio
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
@@ -555,12 +554,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
protected void createContextMenu(Control menuControl) {
MenuManager menuMgr= new MenuManager("#PopUp"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- });
+ menuMgr.addMenuListener(mgr -> fillContextMenu(mgr));
Menu menu= menuMgr.createContextMenu(menuControl);
menuControl.setMenu(menu);
@@ -623,30 +617,28 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
// This is done in a runnable to be run after this view's pane
// is created
- Runnable r = new Runnable() {
- @Override
- public void run() {
- if (!isAvailable()) {
- return;
- }
- IContributionItem[] items = tbm.getItems();
- if (items != null) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem)items[i]).getAction();
- if (!SkipAllBreakpointsAction.ACTION_ID.equals(action.getId())) {
- if (action.getStyle() == IAction.AS_CHECK_BOX) {
- initActionState(action);
- if (action.isChecked()) {
- action.run();
- }
+ Runnable r = () -> {
+ if (!isAvailable()) {
+ return;
+ }
+ IContributionItem[] items = tbm.getItems();
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ if (items[i] instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem) items[i]).getAction();
+ if (!SkipAllBreakpointsAction.ACTION_ID.equals(action.getId())) {
+ if (action.getStyle() == IAction.AS_CHECK_BOX) {
+ initActionState(action);
+ if (action.isChecked()) {
+ action.run();
}
- }}
+ }
+ }
}
- setMemento(null);
}
- updateObjects();
+ setMemento(null);
}
+ updateObjects();
};
asyncExec(r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
index 478bb34b5..1c54d48cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -606,32 +606,27 @@ public class DebugUITools {
*/
public static int openLaunchConfigurationDialogOnGroup(final Shell shell, final IStructuredSelection selection, final String groupIdentifier, final IStatus status) {
final int[] result = new int[1];
- Runnable r = new Runnable() {
- /**
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog) LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
- if (dialog != null) {
+ Runnable r = () -> {
+ LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog) LaunchConfigurationsDialog
+ .getCurrentlyVisibleLaunchConfigurationDialog();
+ if (dialog != null) {
+ dialog.setInitialSelection(selection);
+ dialog.doInitialTreeSelection();
+ if (status != null) {
+ dialog.handleStatus(status);
+ }
+ result[0] = Window.OK;
+ } else {
+ LaunchGroupExtension ext = DebugUIPlugin.getDefault().getLaunchConfigurationManager()
+ .getLaunchGroup(groupIdentifier);
+ if (ext != null) {
+ dialog = new LaunchConfigurationsDialog(shell, ext);
+ dialog.setOpenMode(LaunchConfigurationsDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_SELECTION);
dialog.setInitialSelection(selection);
- dialog.doInitialTreeSelection();
- if (status != null) {
- dialog.handleStatus(status);
- }
- result[0] = Window.OK;
+ dialog.setInitialStatus(status);
+ result[0] = dialog.open();
} else {
- LaunchGroupExtension ext = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
- if(ext != null) {
- dialog = new LaunchConfigurationsDialog(shell, ext);
- dialog.setOpenMode(LaunchConfigurationsDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_SELECTION);
- dialog.setInitialSelection(selection);
- dialog.setInitialStatus(status);
- result[0] = dialog.open();
- }
- else {
- result[0] = Window.CANCEL;
- }
+ result[0] = Window.CANCEL;
}
}
};
@@ -982,24 +977,22 @@ public class DebugUITools {
private static Set<ILaunch> fgLaunchList = new LinkedHashSet<>();
- private static Runnable fgLaunchTerminate = new Runnable() {
- @Override
- public void run() {
- String launchConfigName = null;
- Set<ILaunch> launchList;
- try {
- synchronized (fgLaunchList) {
- launchList = new LinkedHashSet<>(fgLaunchList);
- fgLaunchList.clear();
- }
- for (ILaunch iLaunch : launchList) {
- launchConfigName = iLaunch.getLaunchConfiguration().getName();
- iLaunch.terminate();
- }
-
- } catch (DebugException e) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), NLS.bind(ActionMessages.TerminateAndLaunchFailure, launchConfigName), e));
+ private static Runnable fgLaunchTerminate = () -> {
+ String launchConfigName = null;
+ Set<ILaunch> launchList;
+ try {
+ synchronized (fgLaunchList) {
+ launchList = new LinkedHashSet<>(fgLaunchList);
+ fgLaunchList.clear();
}
+ for (ILaunch iLaunch : launchList) {
+ launchConfigName = iLaunch.getLaunchConfiguration().getName();
+ iLaunch.terminate();
+ }
+
+ } catch (DebugException e) {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(),
+ NLS.bind(ActionMessages.TerminateAndLaunchFailure, launchConfigName), e));
}
};
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java
index 9d26b679a..a2a49338e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java
@@ -444,15 +444,12 @@ public class PrototypeTab extends AbstractLaunchConfigurationTab {
* Set columns tree widths dynamically
*/
private void updateColumnsWidth() {
- getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- Tree tree = fAttributesTreeViewer.getTree();
- if (tree != null && !tree.isDisposed()) {
- TreeColumn[] columns = tree.getColumns();
- for (TreeColumn treeColumn : columns) {
- treeColumn.pack();
- }
+ getShell().getDisplay().asyncExec(() -> {
+ Tree tree = fAttributesTreeViewer.getTree();
+ if (tree != null && !tree.isDisposed()) {
+ TreeColumn[] columns = tree.getColumns();
+ for (TreeColumn treeColumn : columns) {
+ treeColumn.pack();
}
}
});
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
index 0df29da21..9e778812b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -159,17 +159,9 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
private void updateElements() {
final Display display = DebugUIPlugin.getStandardDisplay();
- BusyIndicator.showWhile(display, new Runnable() {
- @Override
- public void run() {
- final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- setListElements(elements);
- }
- });
- }
+ BusyIndicator.showWhile(display, () -> {
+ final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables();
+ display.asyncExec(() -> setListElements(elements));
});
}
@@ -306,20 +298,14 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
*/
protected void editVariables() {
final Display display = DebugUIPlugin.getStandardDisplay();
- BusyIndicator.showWhile(display, new Runnable() {
- @Override
- public void run() {
- // show the preference page in a new dialog rather than using the utility method to re-use a
- // preference page, in case this dialog is being opened from a preference page
- if (showVariablesPage()) {
- final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- setListElements(elements);
- }
- });
- }
+ BusyIndicator.showWhile(display, () -> {
+ // show the preference page in a new dialog rather than using the utility method
+ // to re-use a
+ // preference page, in case this dialog is being opened from a preference page
+ if (showVariablesPage()) {
+ final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager()
+ .getVariables();
+ display.asyncExec(() -> setListElements(elements));
}
});
}
@@ -337,13 +323,10 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
manager.addToRoot(targetNode);
final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), manager);
final boolean [] result = new boolean[] { false };
- BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- dialog.create();
- dialog.setMessage(targetNode.getLabelText());
- result[0]= (dialog.open() == Window.OK);
- }
+ BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), () -> {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ result[0] = (dialog.open() == Window.OK);
});
return result[0];
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java
index b8e18b8cf..2b71d373f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017 IBM Corporation and others.
+ * Copyright (c) 2017, 2018 IBM Corporation 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
@@ -170,12 +170,7 @@ public class RunToLineAction extends Action implements IUpdate {
*/
@Override
public void update() {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- setEnabled(isTargetEnabled());
- }
- };
+ Runnable r = () -> setEnabled(isTargetEnabled());
DebugUIPlugin.getStandardDisplay().asyncExec(r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
index 7f687386c..9f848a12e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -122,22 +122,20 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
if (fAction == null) {
return;
}
- Runnable r = new Runnable() {
- @Override
- public void run() {
- boolean enabled = false;
- if (fPartTarget != null && fTargetElement != null) {
- IWorkbenchPartSite site = fActivePart.getSite();
- if (site != null) {
- ISelectionProvider selectionProvider = site.getSelectionProvider();
- if (selectionProvider != null) {
- ISelection selection = selectionProvider.getSelection();
- enabled = fTargetElement.isSuspended() && fPartTarget.canRunToLine(fActivePart, selection, fTargetElement);
- }
+ Runnable r = () -> {
+ boolean enabled = false;
+ if (fPartTarget != null && fTargetElement != null) {
+ IWorkbenchPartSite site = fActivePart.getSite();
+ if (site != null) {
+ ISelectionProvider selectionProvider = site.getSelectionProvider();
+ if (selectionProvider != null) {
+ ISelection selection = selectionProvider.getSelection();
+ enabled = fTargetElement.isSuspended()
+ && fPartTarget.canRunToLine(fActivePart, selection, fTargetElement);
}
}
- fAction.setEnabled(enabled);
}
+ fAction.setEnabled(enabled);
};
DebugUIPlugin.getStandardDisplay().asyncExec(r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
index 938b6ac52..978a1e10b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2016 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation 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
@@ -25,7 +25,6 @@ import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.views.memory.PropertyChangeNotifier;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -118,11 +117,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
// disconnect from memory block when rendering is disposed
if (fMemoryBlock instanceof IMemoryBlockExtension)
{
- Runnable runnable = new Runnable(){
- @Override
- public void run() {
- ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this);
- }};
+ Runnable runnable = () -> ((IMemoryBlockExtension) fMemoryBlock).disconnect(AbstractMemoryRendering.this);
new ConnectionJob(runnable).schedule();
}
@@ -134,8 +129,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
fPopupMenuMgr = null;
}
- if (fPropertyListeners != null)
+ if (fPropertyListeners != null) {
fPropertyListeners = null;
+ }
}
/* (non-Javadoc)
@@ -143,8 +139,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
*/
@Override
public void activated() {
- if (fContainer.getMemoryRenderingSite().getSynchronizationService() != null)
+ if (fContainer.getMemoryRenderingSite().getSynchronizationService() != null) {
fContainer.getMemoryRenderingSite().getSynchronizationService().setSynchronizationProvider(this);
+ }
}
/* (non-Javadoc)
@@ -168,11 +165,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
if (fMemoryBlock instanceof IMemoryBlockExtension)
{
- Runnable runnable = new Runnable(){
- @Override
- public void run() {
- ((IMemoryBlockExtension)fMemoryBlock).connect(AbstractMemoryRendering.this);
- }};
+ Runnable runnable = () -> ((IMemoryBlockExtension) fMemoryBlock).connect(AbstractMemoryRendering.this);
new ConnectionJob(runnable).schedule();
}
}
@@ -185,11 +178,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
fVisible = false;
if (fMemoryBlock instanceof IMemoryBlockExtension)
{
- Runnable runnable = new Runnable(){
- @Override
- public void run() {
- ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this);
- }};
+ Runnable runnable = () -> ((IMemoryBlockExtension) fMemoryBlock).disconnect(AbstractMemoryRendering.this);
new ConnectionJob(runnable).schedule();
}
}
@@ -217,8 +206,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (fPropertyListeners == null)
+ if (fPropertyListeners == null) {
fPropertyListeners = new ListenerList<>();
+ }
fPropertyListeners.add(listener);
}
@@ -229,8 +219,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
@Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (fPropertyListeners == null)
+ if (fPropertyListeners == null) {
return;
+ }
fPropertyListeners.remove(listener);
}
@@ -250,8 +241,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
* @since 3.2
*/
protected Image decorateImage(Image image) {
- if (fLabelDecorator != null)
+ if (fLabelDecorator != null) {
return fLabelDecorator.decorateImage(image, this);
+ }
return image;
}
@@ -261,8 +253,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
@Override
public String getLabel()
{
- if (fMemoryBlock == null)
+ if (fMemoryBlock == null) {
return IInternalDebugCoreConstants.EMPTY_STRING;
+ }
StringBuffer label = new StringBuffer(IInternalDebugCoreConstants.EMPTY_STRING);
@@ -270,13 +263,16 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
{
String expression = ((IMemoryBlockExtension)fMemoryBlock).getExpression();
- if (expression == null)
+ if (expression == null) {
expression = IInternalDebugCoreConstants.EMPTY_STRING;
+ }
label.append(expression);
if (expression.startsWith("&")) //$NON-NLS-1$
+ {
label.insert(0, "&"); //$NON-NLS-1$
+ }
// show full address if the rendering is visible
// hide address if the rendering is invisible
@@ -321,8 +317,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
* @since 3.2
*/
protected String decorateLabel(String label) {
- if (fLabelDecorator != null)
+ if (fLabelDecorator != null) {
return fLabelDecorator.decorateText(label.toString(), this);
+ }
return label.toString();
}
@@ -356,11 +353,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
ISelectionProvider selProvider = site.getSite().getSelectionProvider();
- fMenuListener = new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }};
+ fMenuListener = manager -> manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
fPopupMenuMgr.addMenuListener(fMenuListener);
site.getSite().registerContextMenu(menuId, fPopupMenuMgr, selProvider);
@@ -388,8 +381,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
*/
protected void firePropertyChangedEvent(PropertyChangeEvent event)
{
- if (fPropertyListeners == null)
+ if (fPropertyListeners == null) {
return;
+ }
for (IPropertyChangeListener iPropertyChangeListener : fPropertyListeners) {
PropertyChangeNotifier notifier = new PropertyChangeNotifier(iPropertyChangeListener, event);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
index adcaa5cd5..1b6910821 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation 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
@@ -16,7 +16,6 @@ import java.math.BigInteger;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
@@ -43,10 +42,8 @@ import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingConte
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLabelProvider;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLabelProviderEx;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLine;
-
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
-
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -54,10 +51,8 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
-
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextViewer;
-
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor;
@@ -68,13 +63,10 @@ import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.TableCursor;
import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
@@ -103,7 +95,6 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyDialogAction;
@@ -867,12 +858,10 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
createPopupMenu(fTableViewer.getControl());
createPopupMenu(fTableCursor);
- fMenuListener = new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }};
+ fMenuListener = manager -> {
+ fillContextMenu(manager);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ };
getPopupMenuManager().addMenuListener(fMenuListener);
// now the rendering is successfully created
@@ -1161,11 +1150,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
};
fTableCursor.addKeyListener(fCursorKeyAdapter);
- fCursorTraverseListener = new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- handleCursorTraverseEvt(e);
- }};
+ fCursorTraverseListener = e -> handleCursorTraverseEvt(e);
fTableCursor.addTraverseListener(fCursorTraverseListener);
@@ -1178,17 +1163,15 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
// cursor may be disposed before disposed is called
// remove listeners whenever the cursor is disposed
- fTableCursor.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (fTableCursor == null) {
- return;
- }
- fTableCursor.removeTraverseListener(fCursorTraverseListener);
- fTableCursor.removeKeyListener(fCursorKeyAdapter);
- fTableCursor.removeMouseListener(fCursorMouseListener);
- fTableCursor.removeSelectionListener(fCursorSelectionListener);
- }});
+ fTableCursor.addDisposeListener(e -> {
+ if (fTableCursor == null) {
+ return;
+ }
+ fTableCursor.removeTraverseListener(fCursorTraverseListener);
+ fTableCursor.removeKeyListener(fCursorKeyAdapter);
+ fTableCursor.removeMouseListener(fCursorMouseListener);
+ fTableCursor.removeSelectionListener(fCursorSelectionListener);
+ });
fCursorSelectionListener = new SelectionAdapter() {
@Override
@@ -2830,12 +2813,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
return;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- format(getBytesPerLine(), newColumnSize);
- }
- });
+ Display.getDefault().asyncExec(() -> format(getBytesPerLine(), newColumnSize));
}
/**
@@ -2856,12 +2834,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
final int columnSize = col;
final int rowSize = bytesPerLine;
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- format(rowSize, columnSize);
- }
- });
+ Display.getDefault().asyncExec(() -> format(rowSize, columnSize));
}
private void handleCursorMouseEvent(MouseEvent e){
@@ -3003,36 +2976,29 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
{
final FocusEvent e = event;
- Display.getDefault().syncExec(new Runnable() {
-
- @Override
- public void run()
+ Display.getDefault().syncExec(() -> {
+ try
{
- try
- {
- int row = findAddressIndex(fSelectedAddress);
- int col = fTableCursor.getColumn();
+ int row = findAddressIndex(fSelectedAddress);
+ int col = fTableCursor.getColumn();
- Text text = (Text)e.getSource();
- removeListeners(text);
+ Text text = (Text) e.getSource();
+ removeListeners(text);
- // get new value
- String newValue = text.getText();
+ // get new value
+ String newValue = text.getText();
- // modify memory at fRow and fCol
- modifyValue(row, col, newValue);
+ // modify memory at fRow and fCol
+ modifyValue(row, col, newValue);
- // show cursor after modification is completed
- setCursorAtAddress(fSelectedAddress);
- fTableCursor.moveAbove(text);
- fTableCursor.setVisible(false);
- fTableCursor.setVisible(true);
- }
- catch (NumberFormatException e1)
- {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
+ // show cursor after modification is completed
+ setCursorAtAddress(fSelectedAddress);
+ fTableCursor.moveAbove(text);
+ fTableCursor.setVisible(false);
+ fTableCursor.setVisible(true);
+ } catch (NumberFormatException e1) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null);
- }
}
});
}
@@ -3042,150 +3008,137 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
*/
private void handleKeyEventInEditor(KeyEvent event) {
final KeyEvent e = event;
- Display.getDefault().asyncExec(new Runnable()
- {
- @Override
- public void run()
- {
- Text text = (Text)e.getSource();
- int row = findAddressIndex(fSelectedAddress);
- int col = fTableCursor.getColumn();
+ Display.getDefault().asyncExec(() -> {
+ Text text = (Text) e.getSource();
+ int row = findAddressIndex(fSelectedAddress);
+ int col = fTableCursor.getColumn();
- try
+ try
+ {
+ switch (e.keyCode)
{
- switch (e.keyCode)
- {
- case SWT.ARROW_UP :
+ case SWT.ARROW_UP:
- // move text editor box up one row
- if (row-1 < 0) {
- return;
- }
+ // move text editor box up one row
+ if (row - 1 < 0) {
+ return;
+ }
- // modify value for current cell
- modifyValue(row, col, text.getText());
+ // modify value for current cell
+ modifyValue(row, col, text.getText());
- row--;
+ row--;
- // update cursor location and selection in table
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
+ // update cursor location and selection in table
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
- // remove listeners when focus is lost
- removeListeners(text);
- activateCellEditor(null);
- break;
- case SWT.ARROW_DOWN :
+ // remove listeners when focus is lost
+ removeListeners(text);
+ activateCellEditor(null);
+ break;
+ case SWT.ARROW_DOWN:
- // move text editor box down one row
+ // move text editor box down one row
- if (row+1 >= fTableViewer.getTable().getItemCount()) {
- return;
- }
+ if (row + 1 >= fTableViewer.getTable().getItemCount()) {
+ return;
+ }
+
+ // modify value for current cell
+ modifyValue(row, col, text.getText());
+
+ row++;
+
+ // update cursor location and selection in table
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
+
+ // remove traverse listener when focus is lost
+ removeListeners(text);
+ activateCellEditor(null);
+ break;
+ case 0:
+
+ // if user has entered the max number of characters allowed in a cell, move to
+ // next cell
+ // Extra changes will be used as initial value for the next cell
+ int numCharsPerByte = getNumCharsPerByte();
+ if (numCharsPerByte > 0) {
+ if (text.getText().length() > getBytesPerColumn() * numCharsPerByte)
+ {
+ String newValue1 = text.getText();
+ text.setText(newValue1.substring(0, getBytesPerColumn() * numCharsPerByte));
- // modify value for current cell
modifyValue(row, col, text.getText());
- row++;
+ // if cursor is at the end of a line, move to next line
+ if (col >= getNumCol()) {
+ col = 1;
+ row++;
+ } else {
+ // move to next column
+ row++;
+ }
- // update cursor location and selection in table
+ // update cursor position and selected address
fTableCursor.setSelection(row, col);
handleCursorMoved();
- // remove traverse listener when focus is lost
removeListeners(text);
- activateCellEditor(null);
- break;
- case 0:
-
- // if user has entered the max number of characters allowed in a cell, move to next cell
- // Extra changes will be used as initial value for the next cell
- int numCharsPerByte = getNumCharsPerByte();
- if (numCharsPerByte > 0)
+
+ // activate text editor at next cell
+ activateCellEditor(newValue1.substring(getBytesPerColumn() * numCharsPerByte));
+ }
+ }
+ break;
+ case SWT.ESC:
+
+ // if user has pressed escape, do not commit the changes
+ // that's why "modifyValue" is not called
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
+
+ removeListeners(text);
+
+ // cursor needs to have focus to remove focus from cell editor
+ fTableCursor.setFocus();
+ break;
+ default:
+ numCharsPerByte = getNumCharsPerByte();
+ if (numCharsPerByte > 0) {
+ if (text.getText().length() > getBytesPerColumn() * numCharsPerByte)
{
- if (text.getText().length() > getBytesPerColumn()*numCharsPerByte)
+ String newValue2 = text.getText();
+ text.setText(newValue2.substring(0, getBytesPerColumn() * numCharsPerByte));
+ modifyValue(row, col, text.getText());
+ // if cursor is at the end of a line, move to next line
+ if (col >= getNumCol()) {
+ col = 1;
+ row++;
+ } else
{
- String newValue = text.getText();
- text.setText(newValue.substring(0, getBytesPerColumn()*numCharsPerByte));
-
- modifyValue(row, col, text.getText());
-
- // if cursor is at the end of a line, move to next line
- if (col >= getNumCol())
- {
- col = 1;
- row++;
- }
- else
- {
- // move to next column
- row++;
- }
-
- // update cursor position and selected address
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
-
- removeListeners(text);
-
- // activate text editor at next cell
- activateCellEditor(newValue.substring(getBytesPerColumn()*numCharsPerByte));
- }
+ col++;
}
- break;
- case SWT.ESC:
- // if user has pressed escape, do not commit the changes
- // that's why "modifyValue" is not called
fTableCursor.setSelection(row, col);
handleCursorMoved();
removeListeners(text);
- // cursor needs to have focus to remove focus from cell editor
- fTableCursor.setFocus();
- break;
- default :
- numCharsPerByte = getNumCharsPerByte();
- if (numCharsPerByte > 0)
- {
- if (text.getText().length()> getBytesPerColumn()* numCharsPerByte)
- {
- String newValue = text.getText();
- text.setText(newValue.substring(0,getBytesPerColumn()* numCharsPerByte));
- modifyValue(row, col, text.getText());
- // if cursor is at the end of a line, move to next line
- if (col >= getNumCol())
- {
- col = 1;
- row++;
- }
- else
- {
- col++;
- }
-
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
-
- removeListeners(text);
-
- activateCellEditor(newValue.substring(getBytesPerColumn()*numCharsPerByte));
- }
+ activateCellEditor(newValue2.substring(getBytesPerColumn() * numCharsPerByte));
}
- break;
}
+ break;
}
- catch (NumberFormatException e1)
- {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
+ } catch (NumberFormatException e1) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null);
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
- removeListeners(text);
- }
+ removeListeners(text);
}
});
}
@@ -3484,64 +3437,54 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
if (adapter == IMemoryBlockConnection.class) {
if (fConnection == null) {
- fConnection = new IMemoryBlockConnection() {
- @Override
- public void update() {
- try {
- fContentProvider.takeContentSnapshot();
- if (getMemoryBlock() instanceof IMemoryBlockExtension)
+ fConnection = () -> {
+ try {
+ fContentProvider.takeContentSnapshot();
+ if (getMemoryBlock() instanceof IMemoryBlockExtension) {
+ BigInteger address = ((IMemoryBlockExtension) getMemoryBlock()).getBigBaseAddress();
+ if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0)
{
- BigInteger address = ((IMemoryBlockExtension)getMemoryBlock()).getBigBaseAddress();
- if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0)
- {
- // get to new address
- setSelectedAddress(address);
- updateSyncSelectedAddress();
- fTopRowAddress = address;
- fContentInput.updateContentBaseAddress();
- fContentInput.setLoadAddress(address);
+ // get to new address
+ setSelectedAddress(address);
+ updateSyncSelectedAddress();
+ fTopRowAddress = address;
+ fContentInput.updateContentBaseAddress();
+ fContentInput.setLoadAddress(address);
+ }
+ fContentProvider.loadContentForExtendedMemoryBlock();
+ } else {
+ fContentProvider.loadContentForSimpleMemoryBlock();
+ }
+
+ // update UI asynchronously
+ Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay();
+ display.asyncExec(() -> {
+ updateLabels();
+
+ if (getMemoryBlock() instanceof IMemoryBlockExtension) {
+ int topIdx = findAddressIndex(fTopRowAddress);
+ if (topIdx != -1) {
+ setTopIndex(fTableViewer.getTable(), topIdx);
}
- fContentProvider.loadContentForExtendedMemoryBlock();
+ }
+
+ // cursor needs to be refreshed after reload
+ if (isAddressVisible(fSelectedAddress)) {
+ setCursorAtAddress(fSelectedAddress);
+ fTableCursor.setVisible(true);
+ fTableCursor.redraw();
} else {
- fContentProvider.loadContentForSimpleMemoryBlock();
+ fTableCursor.setVisible(false);
}
- // update UI asynchronously
- Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- updateLabels();
-
- if (getMemoryBlock() instanceof IMemoryBlockExtension) {
- int topIdx = findAddressIndex(fTopRowAddress);
- if (topIdx != -1) {
- setTopIndex(fTableViewer.getTable(),topIdx);
- }
- }
-
- // cursor needs to be refreshed after reload
- if (isAddressVisible(fSelectedAddress))
- {
- setCursorAtAddress(fSelectedAddress);
- fTableCursor.setVisible(true);
- fTableCursor.redraw();
- }
- else
- {
- fTableCursor.setVisible(false);
- }
-
- if (!isDynamicLoad()) {
- updateSyncPageStartAddress();
- }
-
- updateSyncTopAddress();
- }
- });
- } catch (DebugException e) {
- displayError(e);
- }
+ if (!isDynamicLoad()) {
+ updateSyncPageStartAddress();
+ }
+
+ updateSyncTopAddress();
+ });
+ } catch (DebugException e) {
+ displayError(e);
}
};
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
index aac8d0419..3911833e4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2018 IBM Corporation 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
@@ -242,15 +242,12 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE
protected void closeEditor()
{
final IEditorPart editor = this;
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- IWorkbenchWindow activeWorkbenchWindow = DebugUIPlugin.getActiveWorkbenchWindow();
- if (activeWorkbenchWindow != null) {
- IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- if (activePage != null) {
- activePage.closeEditor(editor, false);
- }
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> {
+ IWorkbenchWindow activeWorkbenchWindow = DebugUIPlugin.getActiveWorkbenchWindow();
+ if (activeWorkbenchWindow != null) {
+ IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
+ if (activePage != null) {
+ activePage.closeEditor(editor, false);
}
}
});
@@ -264,8 +261,9 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE
*/
@Override
public void dispose() {
- if (fLaunchesListener != null)
+ if (fLaunchesListener != null) {
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(fLaunchesListener);
+ }
super.dispose();
}
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
index 03a7213cd..568f4d675 100644
--- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
@@ -138,31 +138,37 @@ org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=0
+org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@@ -182,19 +188,23 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
+org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=80
@@ -207,7 +217,7 @@ org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -217,8 +227,9 @@ org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@@ -227,6 +238,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@@ -245,7 +257,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
@@ -274,6 +286,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -351,6 +364,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -405,18 +419,31 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.lineSplit=120
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
index 8e18452e3..aba901028 100644
--- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
@@ -53,8 +53,8 @@ cleanup_profile=_Platform Debug Cleanups
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Platform Debug Formatting
-formatter_settings_version=12
+formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
+formatter_settings_version=14
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
index 8aaa63554..b10c84a1a 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
@@ -231,12 +231,7 @@ public abstract class TextConsole extends AbstractConsole {
if (fTabWidth != newTabWidth) {
final int oldTabWidth = fTabWidth;
fTabWidth = newTabWidth;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- firePropertyChange(TextConsole.this, IConsoleConstants.P_TAB_SIZE, Integer.valueOf(oldTabWidth), Integer.valueOf(fTabWidth));
- }
- });
+ ConsolePlugin.getStandardDisplay().asyncExec(() -> firePropertyChange(TextConsole.this, IConsoleConstants.P_TAB_SIZE, Integer.valueOf(oldTabWidth), Integer.valueOf(fTabWidth)));
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
index ea849d651..d12f6f9e7 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
@@ -47,11 +47,8 @@ import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.MouseWheelListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
@@ -59,7 +56,6 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.internal.console.ConsoleDocumentAdapter;
import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
@@ -107,18 +103,15 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
}
};
// event listener used to send event to hyperlink for IHyperlink2
- private Listener mouseUpListener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (hyperlink != null) {
- String selection = getTextWidget().getSelectionText();
- if (selection.length() <= 0) {
- if (event.button == 1) {
- if (hyperlink instanceof IHyperlink2) {
- ((IHyperlink2) hyperlink).linkActivated(event);
- } else {
- hyperlink.linkActivated();
- }
+ private Listener mouseUpListener = event -> {
+ if (hyperlink != null) {
+ String selection = getTextWidget().getSelectionText();
+ if (selection.length() <= 0) {
+ if (event.button == 1) {
+ if (hyperlink instanceof IHyperlink2) {
+ ((IHyperlink2) hyperlink).linkActivated(event);
+ } else {
+ hyperlink.linkActivated();
}
}
}
@@ -197,25 +190,22 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
return false;
}
- private IPositionUpdater positionUpdater = new IPositionUpdater() {
- @Override
- public void update(DocumentEvent event) {
- try {
- IDocument document = getDocument();
- if (document != null) {
- Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- for (int i = 0; i < positions.length; i++) {
- Position position = positions[i];
- if (position.offset == event.fOffset && position.length<=event.fLength) {
- position.delete();
- }
- if (position.isDeleted) {
- document.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, position);
- }
+ private IPositionUpdater positionUpdater = event -> {
+ try {
+ IDocument document = getDocument();
+ if (document != null) {
+ Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
+ for (int i = 0; i < positions.length; i++) {
+ Position position = positions[i];
+ if (position.offset == event.fOffset && position.length <= event.fLength) {
+ position.delete();
+ }
+ if (position.isDeleted) {
+ document.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, position);
}
}
- } catch (BadPositionCategoryException e) {
}
+ } catch (BadPositionCategoryException e) {
}
};
@@ -308,29 +298,23 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
}
}
});
- styledText.addMouseWheelListener(new MouseWheelListener() {
- @Override
- public void mouseScrolled(MouseEvent e) {
- if (isAutoScrollLockNotApplicable()) {
- return;
- }
- if (e.count < 0) { // Mouse dragged down
- if (checkEndOfDocument()) {
- setScrollLock(false);
- }
- } else if (!userHoldsScrollLock.get()) {
- setScrollLock(true);
+ styledText.addMouseWheelListener(e -> {
+ if (isAutoScrollLockNotApplicable()) {
+ return;
+ }
+ if (e.count < 0) { // Mouse dragged down
+ if (checkEndOfDocument()) {
+ setScrollLock(false);
}
+ } else if (!userHoldsScrollLock.get()) {
+ setScrollLock(true);
}
});
- styledText.addVerifyListener(new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- // unlock the auto lock if user starts typing only if it was not manual lock
- if (scrollLockStateProvider != null && !scrollLockStateProvider.getScrollLock()) {
- setScrollLock(false);
- }
+ styledText.addVerifyListener(e -> {
+ // unlock the auto lock if user starts typing only if it was not manual lock
+ if (scrollLockStateProvider != null && !scrollLockStateProvider.getScrollLock()) {
+ setScrollLock(false);
}
});
@@ -702,12 +686,9 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
public void setConsoleWidth(int width) {
if (consoleWidth != width) {
consoleWidth = width;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (documentAdapter != null) {
- documentAdapter.setWidth(consoleWidth);
- }
+ ConsolePlugin.getStandardDisplay().asyncExec(() -> {
+ if (documentAdapter != null) {
+ documentAdapter.setWidth(consoleWidth);
}
});
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
index f2f568714..2a31cae41 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -79,18 +79,15 @@ public class ClearOutputAction extends Action {
*/
@Override
public void run() {
- BusyIndicator.showWhile(ConsolePlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- if (fIOConsole == null) {
- IDocument document = fViewer.getDocument();
- if (document != null) {
- document.set(""); //$NON-NLS-1$
- }
- fViewer.setSelectedRange(0, 0);
- } else {
- fIOConsole.clearConsole();
+ BusyIndicator.showWhile(ConsolePlugin.getStandardDisplay(), () -> {
+ if (fIOConsole == null) {
+ IDocument document = fViewer.getDocument();
+ if (document != null) {
+ document.set(""); //$NON-NLS-1$
}
+ fViewer.setSelectedRange(0, 0);
+ } else {
+ fIOConsole.clearConsole();
}
});
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
index ab03b3adb..9fc2c526e 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
@@ -394,26 +394,23 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
@Override
public void consolesAdded(final IConsole[] consoles) {
if (isAvailable()) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- if (isAvailable()) {
- IConsole console = consoles[i];
- // ensure it's still registered since this is done asynchronously
- IConsole[] allConsoles = getConsoleManager().getConsoles();
- for (int j = 0; j < allConsoles.length; j++) {
- IConsole registered = allConsoles[j];
- if (registered.equals(console)) {
- ConsoleWorkbenchPart part = new ConsoleWorkbenchPart(console, getSite());
- fConsoleToPart.put(console, part);
- fPartToConsole.put(part, console);
- partActivated(part);
- break;
- }
+ Runnable r = () -> {
+ for (int i = 0; i < consoles.length; i++) {
+ if (isAvailable()) {
+ IConsole console = consoles[i];
+ // ensure it's still registered since this is done asynchronously
+ IConsole[] allConsoles = getConsoleManager().getConsoles();
+ for (int j = 0; j < allConsoles.length; j++) {
+ IConsole registered = allConsoles[j];
+ if (registered.equals(console)) {
+ ConsoleWorkbenchPart part = new ConsoleWorkbenchPart(console, getSite());
+ fConsoleToPart.put(console, part);
+ fPartToConsole.put(part, console);
+ partActivated(part);
+ break;
}
-
}
+
}
}
};
@@ -424,22 +421,19 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
@Override
public void consolesRemoved(final IConsole[] consoles) {
if (isAvailable()) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- if (isAvailable()) {
- IConsole console = consoles[i];
- fStack.remove(console);
- ConsoleWorkbenchPart part = fConsoleToPart.get(console);
- if (part != null) {
- partClosed(part);
- }
- if (getConsole() == null) {
- IConsole[] available = getConsoleManager().getConsoles();
- if (available.length > 0) {
- display(available[available.length - 1]);
- }
+ Runnable r = () -> {
+ for (int i = 0; i < consoles.length; i++) {
+ if (isAvailable()) {
+ IConsole console = consoles[i];
+ fStack.remove(console);
+ ConsoleWorkbenchPart part = fConsoleToPart.get(console);
+ if (part != null) {
+ partClosed(part);
+ }
+ if (getConsole() == null) {
+ IConsole[] available = getConsoleManager().getConsoles();
+ if (available.length > 0) {
+ display(available[available.length - 1]);
}
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
index f71fab026..44fcca5b6 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
@@ -135,12 +135,7 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
public void setWaterMarks(int low, int high) {
lowWaterMark = low;
highWaterMark = high;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- checkBufferSize();
- }
- });
+ ConsolePlugin.getStandardDisplay().asyncExec(() -> checkBufferSize());
}
/**
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
index 432f86a6f..2c6799741 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -139,13 +139,10 @@ public class IOConsoleViewer extends TextConsoleViewer {
* makes the associated text widget uneditable.
*/
public void setReadOnly() {
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- StyledText text = getTextWidget();
- if (text != null && !text.isDisposed()) {
- text.setEditable(false);
- }
+ ConsolePlugin.getStandardDisplay().asyncExec(() -> {
+ StyledText text = getTextWidget();
+ if (text != null && !text.isDisposed()) {
+ text.setEditable(false);
}
});
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
index caecfc274..7abcddaec 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -15,12 +15,10 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-
import org.eclipse.core.runtime.Assert;
-
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
/**
* A registry that maps <code>ImageDescriptors</code> to <code>Image</code>.
@@ -82,18 +80,7 @@ public class ImageDescriptorRegistry {
}
private void hookDisplay() {
- fDisplay.asyncExec(new Runnable() {
- @Override
- public void run() {
- fDisplay.disposeExec(new Runnable() {
-
- @Override
- public void run() {
- dispose();
- }
- });
- }
- });
+ fDisplay.asyncExec(() -> fDisplay.disposeExec(() -> dispose()));
}
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
index 5de79ecd5..f6f0dc02a 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
@@ -68,9 +68,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
@@ -166,19 +164,17 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
newConfigList.add(configuration);
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- TableItem[] items= viewer.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
- Object data= item.getData();
- if (data == oldConfig) {
- // Found the movedFrom config in the tree. Replace it with the new config
- item.setData(configuration);
- viewer.update(configuration, null);
- break;
- }
+ Display.getDefault().asyncExec(() -> {
+ TableItem[] items = viewer.getTable().getItems();
+ for (int i = 0; i < items.length; i++) {
+ TableItem item = items[i];
+ Object data = item.getData();
+ if (data == oldConfig) {
+ // Found the movedFrom config in the tree. Replace it
+ // with the new config
+ item.setData(configuration);
+ viewer.update(configuration, null);
+ break;
}
}
});
@@ -337,14 +333,12 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
}
});
- builderTable.addListener(SWT.MouseDoubleClick, new Listener() {
- @Override
- public void handleEvent(Event event) {
- //we must not allow editing of elements that cannot be edited via the selection changed logic
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=386820
- if(fCanEdit) {
- handleEditButtonPressed();
- }
+ builderTable.addListener(SWT.MouseDoubleClick, event -> {
+ // we must not allow editing of elements that cannot be edited via
+ // the selection changed logic
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=386820
+ if (fCanEdit) {
+ handleEditButtonPressed();
}
});
@@ -780,15 +774,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
} else {
status[0] = new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, 0, ExternalToolsUIMessages.BuilderPropertyPage_statusMessage, e);
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- Shell shell= getShell();
- if (shell != null) {
- ErrorDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_errorTitle,
- ExternalToolsUIMessages.BuilderPropertyPage_errorMessage,
- status[0]);
- }
+ Display.getDefault().asyncExec(() -> {
+ Shell shell = getShell();
+ if (shell != null) {
+ ErrorDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_errorTitle, ExternalToolsUIMessages.BuilderPropertyPage_errorMessage, status[0]);
}
});
}
@@ -945,14 +934,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
for (int i = 0; i < numCommands; i++) {
itemData[i]= builderTable.getItem(i).getData();
}
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- doPerformOk(monitor, itemData);
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- }
+ IRunnableWithProgress runnable = monitor -> {
+ doPerformOk(monitor, itemData);
+ if (monitor.isCanceled()) {
+ throw new InterruptedException();
}
};