Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2017-08-16 16:24:52 -0400
committerAlexander Kurtakov2017-09-06 06:43:46 -0400
commitd8621eaf55a1e95ff894dda0a241af08cc6111fe (patch)
treec25456438000b8f21bfd4173f6910cba71bf138a
parent1ac7a50083b25934db5e4902343c7a186435763b (diff)
downloadeclipse.platform.debug-I20170906-0815.tar.gz
eclipse.platform.debug-I20170906-0815.tar.xz
eclipse.platform.debug-I20170906-0815.zip
Bug 521038 - Replaced anonymous Runnable classes by lambda expressionI20170906-2000I20170906-0815
Change-Id: Ia0d3478be72f514cce6e57cb679fa60668bdb23f Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
-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.java7
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java27
-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.java64
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java34
-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.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/WorkingDirectoryStatusHandler.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java35
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java49
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupCycleHandler.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/UnsupportedModeHandler.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/AbstractLaunchConfigurationAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java78
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java77
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java129
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/Prompter.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java69
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java201
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java63
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java267
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java87
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java11
-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.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java343
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java175
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPrefAction.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleLogicalStructureAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleShowColumnsAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java8
59 files changed, 1062 insertions, 1398 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 3196df3ea..65265e9bb 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 0b35caa54..6cd906330 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
@@ -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..f37fd3638 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
@@ -145,21 +145,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();
}
});
}
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 626466eb6..3ad940fe3 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
@@ -538,29 +538,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..d2661fbad 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
@@ -64,50 +64,34 @@ public class LaunchTests extends AbstractLaunchTest {
}
};
- readIsTerminatedTask = new Runnable() {
- @Override
- public void run() {
- launch.isTerminated();
- }
- };
-
- readIsDisconnectedTask = new Runnable() {
- @Override
- public void run() {
- 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);
+ readIsTerminatedTask = () -> launch.isTerminated();
+
+ readIsDisconnectedTask = () -> launch.isDisconnected();
+
+ 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 7ec70948f..6c2ce830a 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/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index a8ae9ca77..6373542b1 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
@@ -398,14 +398,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) {
@@ -584,14 +581,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();
});
}
@@ -1265,12 +1260,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 f9f0a4303..de9b68bea 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
@@ -214,26 +214,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..d6b6262d7 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
@@ -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..9c0172169 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
@@ -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..820a08469 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
@@ -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 5c896783e..e2dca1c41 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
@@ -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<String>();
- }
- 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<String>();
}
+ 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..3d70cf3eb 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
@@ -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..f7cc45af2 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
@@ -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..ea2803182 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
@@ -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..fefe8cbfd 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
@@ -30,44 +30,29 @@ public class ExecuteActionRequest extends DebugCommandRequest {
super(elements);
}
- @Override
+ @Override
public void done() {
- if (fParticipant != null) {
+ if (fParticipant != null) {
fParticipant.requestDone(this);
fParticipant = null;
}
- final IStatus status = getStatus();
- 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());
- }
- });
- break;
- case IStatus.WARNING:
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- 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());
- }
- });
- break;
+ final IStatus status = getStatus();
+ if (status != null) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openError(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
+ break;
+ case IStatus.WARNING:
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openWarning(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
+ break;
+ case IStatus.INFO:
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openInformation(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
+ break;
default:
break;
- }
- }
- }
+ }
+ }
+ }
public void setCommandParticipant(ICommandParticipant participant) {
fParticipant = participant;
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 b0d0713bf..3495f7a09 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
@@ -36,24 +36,21 @@ import org.eclipse.jface.viewers.StructuredSelection;
*/
public class TerminateAndRelaunchAction extends DebugCommandAction {
- @Override
+ @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());
- }
- }
- }
- });
- }
- }
+ if (request.getStatus() == null || request.getStatus().isOK()) {
+ 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());
+ }
+ }
+ });
+ }
+ }
@Override
protected ISelection getContext() {
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 b56924351..fe449fe12 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
@@ -579,13 +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));
}
}
fWindows.clear();
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 57f07a8e7..d4a7b0752 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
@@ -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 c02a87ede..e661d079d 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
@@ -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..f9cc6e80a 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
@@ -27,12 +27,10 @@ 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..0ec79618f 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
@@ -30,12 +30,10 @@ 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 5e4b35728..75b60eda9 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
@@ -307,20 +307,15 @@ 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 1559bebfa..7e31a9cfb 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
@@ -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 dc91023de..4efa9abb2 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
@@ -590,12 +590,7 @@ public class LaunchConfigurationTabGroupViewer {
setInput0(input);
}
else {
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- setInput0(input);
- }
- });
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> setInput0(input));
}
}
@@ -624,31 +619,27 @@ 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 = !delegatesEqual(fWorkingCopy, configuration);
- fOriginal = configuration;
- fWorkingCopy = configuration.getWorkingCopy();
- displayInstanceTabs(refreshtabs);
- } else if (finput instanceof ILaunchConfigurationType) {
- fDescription = getDescription((ILaunchConfigurationType)finput);
- setNoInput();
- } else {
- setNoInput();
- }
- } catch (CoreException ce) {
- errorDialog(ce);
+ Runnable r = () -> {
+ try {
+ fViewform.setRedraw(false);
+ if (finput instanceof ILaunchConfiguration) {
+ ILaunchConfiguration configuration = (ILaunchConfiguration) finput;
+ boolean refreshtabs = !delegatesEqual(fWorkingCopy, configuration);
+ fOriginal = configuration;
+ fWorkingCopy = configuration.getWorkingCopy();
+ 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);
@@ -868,22 +859,19 @@ 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());
}
};
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 808033ff1..4fed3cb6b 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
@@ -268,14 +268,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);
+ }
+ });
}
}
@@ -365,13 +362,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..ff5253d34 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
@@ -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 cf6b28eca..fd281d86d 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
@@ -219,31 +219,25 @@ 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;
}
@@ -306,20 +300,17 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
*/
@Override
public synchronized void launchRemoved(final ILaunch launch) {
- ISuspendTrigger trigger = launch.getAdapter(ISuspendTrigger.class);
- 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);
- }
- }
+ ISuspendTrigger trigger = launch.getAdapter(ISuspendTrigger.class);
+ if (trigger != null) {
+ trigger.removeSuspendTriggerListener(this);
+ }
+ 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 +420,9 @@ 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 b7bb3427e..8587279b9 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
@@ -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;
@@ -65,7 +63,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 +74,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 +83,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;
@@ -104,7 +98,6 @@ 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;
@@ -136,7 +129,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.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
@@ -1151,15 +1143,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 +1219,23 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
private void selectedAddressChanged(final BigInteger address) {
- Runnable runnable = new Runnable() {
-
- @Override
- public void run() {
+ Runnable runnable = () -> {
- 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 +2135,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 +2384,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 +2545,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 +2564,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..a08b52ab4 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
@@ -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 20ed4bbf0..fb4128dd2 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
@@ -551,18 +551,12 @@ 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 (!page.getWorkbenchWindow().getWorkbench().isClosing()) {
- 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 (!page.getWorkbenchWindow().getWorkbench().isClosing()) {
+ 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 e851b1ee9..32256bde6 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
@@ -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<IResource>();
- traverse(ResourcesPlugin.getWorkspace().getRoot(), fArchives);
- }
+ BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), () -> {
+ fArchives = new HashSet<IResource>();
+ 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..b851fea18 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
@@ -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..90f3c9814 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
@@ -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 2920ebf81..0c8377d71 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
@@ -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 fb83b9a8f..ea979e5ee 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
@@ -266,12 +266,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 84f75aff8..4f209f9fe 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
@@ -78,50 +78,43 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
@Override
protected synchronized void scheduleViewerUpdate() {
- // If filtering is enabled perform child update on all children in order to update
- // viewer filters.
+ // If filtering is enabled perform child update on all children in order
+ // to update
+ // viewer filters.
if (fShouldFilter || fFilteredChildren != null) {
- if (fChildrenUpdate == null) {
- int startIdx;
- int count;
- if (fShouldFilter) {
- startIdx = 0;
- count = getCount();
- } else {
- startIdx = fFilteredChildren[0];
- int endIdx = fFilteredChildren[fFilteredChildren.length - 1];
- count = endIdx - startIdx + 1;
- }
+ if (fChildrenUpdate == null) {
+ int startIdx;
+ int count;
+ if (fShouldFilter) {
+ startIdx = 0;
+ count = getCount();
+ } else {
+ startIdx = fFilteredChildren[0];
+ int endIdx = fFilteredChildren[fFilteredChildren.length - 1];
+ count = endIdx - startIdx + 1;
+ }
- fChildrenUpdate = new ChildrenUpdate(getContentProvider(), getViewerInput(), getElementPath(), getElement(), startIdx, count, getElementContentProvider()) {
- @Override
+ fChildrenUpdate = new ChildrenUpdate(getContentProvider(), getViewerInput(), getElementPath(), getElement(), startIdx, count, getElementContentProvider()) {
+ @Override
protected void performUpdate() {
- performUpdate(true);
- ChildrenCountUpdate.super.scheduleViewerUpdate();
- }
+ performUpdate(true);
+ ChildrenCountUpdate.super.scheduleViewerUpdate();
+ }
- @Override
+ @Override
protected void scheduleViewerUpdate() {
- execInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!getContentProvider().isDisposed() && !isCanceled()) {
- performUpdate();
- }
- }
- });
- }
- };
- execInDisplayThread(new Runnable() {
- @Override
- public void run() {
- fChildrenUpdate.startRequest();
- }
- });
- return;
- }
+ execInDisplayThread(() -> {
+ if (!getContentProvider().isDisposed() && !isCanceled()) {
+ performUpdate();
+ }
+ });
+ }
+ };
+ execInDisplayThread(() -> fChildrenUpdate.startRequest());
+ return;
+ }
} else {
- super.scheduleViewerUpdate();
+ super.scheduleViewerUpdate();
}
}
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..668284e64 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
@@ -65,24 +65,26 @@ public class ElementCompareRequest extends MementoUpdate implements IElementComp
fEqual = equal;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see org.eclipse.core.runtime.IProgressMonitor#done()
*/
@Override
public void done() {
- ITreeModelViewer viewer = getContentProvider().getViewer();
- 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);
- }
- });
- }
+ ITreeModelViewer viewer = getContentProvider().getViewer();
+ if (viewer == null) {
+ return; // disposed
+ }
+ if (viewer.getDisplay().getThread() == Thread.currentThread()) {
+ fProvider.getStateTracker().compareFinished(ElementCompareRequest.this, fDelta);
+ } else {
+ viewer.getDisplay().asyncExec(() -> {
+ if (getContentProvider().isDisposed()) {
+ return;
+ }
+ fProvider.getStateTracker().compareFinished(ElementCompareRequest.this, fDelta);
+ });
+ }
}
public boolean isEqual() {
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..2c54dc77f 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
@@ -47,24 +47,21 @@ class ElementMementoRequest extends MementoUpdate implements IElementMementoRequ
*/
@Override
public void done() {
-
ITreeModelViewer viewer = getContentProvider().getViewer();
- if (viewer == null) return; // disposed
+ if (viewer == null) {
+ return; // disposed
+ }
if (viewer.getDisplay().getThread() == Thread.currentThread()) {
- doComplete();
+ 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 fafeebd65..02a8f502e 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
@@ -306,53 +306,49 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void remove(final Object parentOrTreePath, final int index) {
final List<TreePath> oldSelection = new LinkedList<TreePath>(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
@@ -549,20 +545,17 @@ 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();
- }
- }
- };
- getDisplay().asyncExec(fValidateRunnable);
- }
- }
+ private void validate() {
+ if (fValidateRunnable == null) {
+ fValidateRunnable = () -> {
+ if (!fTree.isDisposed()) {
+ fValidateRunnable = null;
+ fTree.validate();
+ }
+ };
+ getDisplay().asyncExec(fValidateRunnable);
+ }
+ }
@Override
protected void inputChanged(Object input, Object oldInput) {
@@ -628,57 +621,51 @@ public class InternalVirtualTreeModelViewer extends Viewer
}
}
- @Override
+ @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);
- }
- }
- });
- validate();
- }
+ items[i].setItemCount(count);
+ }
+ });
+ validate();
+ }
- @Override
+ @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
public boolean getHasChildren(Object elementOrTreePath) {
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..e264a72dd 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
@@ -196,40 +196,35 @@ public class TimeTriggeredProgressMonitorDialog extends ProgressMonitorDialog {
return wrapperedMonitor;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.operations.IRunnableContext#run(boolean, boolean, IRunnableWithProgress)
- */
- @Override
- public void run(final boolean fork, final boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException,
- 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;
- }
- }
- };
- final Display display = PlatformUI.getWorkbench().getDisplay();
- if (display == null) {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.operations.IRunnableContext#run(boolean, boolean,
+ * IRunnableWithProgress)
+ */
+ @Override
+ public void run(final boolean fork, final boolean cancelable, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+ final InvocationTargetException[] invokes = new InvocationTargetException[1];
+ final InterruptedException[] interrupt = new InterruptedException[1];
+ 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;
}
- //show a busy cursor until the dialog opens
- BusyIndicator.showWhile(display, dialogWaitRunnable);
- if (invokes[0] != null) {
- throw invokes[0];
- }
- if (interrupt[0] != null) {
- throw interrupt[0];
- }
- }
+ // show a busy cursor until the dialog opens
+ BusyIndicator.showWhile(display, dialogWaitRunnable);
+ if (invokes[0] != null) {
+ throw invokes[0];
+ }
+ if (interrupt[0] != null) {
+ throw interrupt[0];
+ }
+ }
}
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 9afa548cf..ad7be8233 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
@@ -724,73 +724,76 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
notifyUpdate(UPDATE_BEGINS, update);
}
- /**
- * Notification an update request has completed
- *
- * @param updates the updates to notify
- */
+ /**
+ * Notification an update request has completed
+ *
+ * @param updates the updates to notify
+ */
void updatesComplete(final List<ViewerUpdateMonitor> updates) {
- for (int i = 0; i < updates.size(); i++) {
- ViewerUpdateMonitor update = updates.get(i);
- notifyUpdate(UPDATE_COMPLETE, update);
- if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
- }
- }
+ for (int i = 0; i < updates.size(); i++) {
+ ViewerUpdateMonitor update = updates.get(i);
+ notifyUpdate(UPDATE_COMPLETE, update);
+ if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
+ }
+ }
- // 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;
+ // Wait a single cycle to allow viewer to queue requests triggered by
+ // completed updates.
+ 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);
+ }
+ });
- }
+ }
/**
* @return Returns true if there are outstanding updates in the viewer.
@@ -879,53 +882,56 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
fStateTracker.cancelStateSubtreeUpdates(path);
}
- /**
- * Returns whether this given request should be run, or should wait for
- * parent update to complete.
- *
- * @param update the update the schedule
- */
- private void schedule(final ViewerUpdateMonitor update) {
- Assert.isTrue(getViewer().getDisplay().getThread() == Thread.currentThread());
+ /**
+ * Returns whether this given request should be run, or should wait for
+ * parent update to complete.
+ *
+ * @param update the update the schedule
+ */
+ private void schedule(final ViewerUpdateMonitor update) {
+ Assert.isTrue(getViewer().getDisplay().getThread() == Thread.currentThread());
- TreePath schedulingPath = update.getSchedulingPath();
+ TreePath schedulingPath = update.getSchedulingPath();
List<ViewerUpdateMonitor> requests = fWaitingRequests.get(schedulingPath);
- if (requests == null) {
+ if (requests == null) {
requests = new LinkedList<ViewerUpdateMonitor>();
- requests.add(update);
- fWaitingRequests.put(schedulingPath, requests);
+ requests.add(update);
+ fWaitingRequests.put(schedulingPath, requests);
List<ViewerUpdateMonitor> inProgressList = fRequestsInProgress.get(schedulingPath);
- if (inProgressList != null) {
- int staleUpdateIndex = inProgressList.indexOf(update);
- if (staleUpdateIndex >= 0) {
- // Cancel update and remove from requests list. Removing from
- // fRequestsInProgress ensures that isRequestBlocked() won't be triggered
- // by a canceled update.
- ViewerUpdateMonitor staleUpdate = inProgressList.remove(staleUpdateIndex);
- staleUpdate.cancel();
- // Note: Do not reset the inProgressList to null. This would cause the
- // updateStarted() method to think that a new update sequence is
- // being started. Since there are waiting requests for this scheduling
- // path, the list will be cleaned up later.
- }
- }
- if (inProgressList == null || inProgressList.isEmpty()) {
- getViewer().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isDisposed()) {
- return;
- }
- trigger(update.getSchedulingPath());
- }
- });
- }
- } else {
- // there are waiting requests: coalesce with existing request and add to list
- requests.add(coalesce(requests, update));
- }
- }
+ if (inProgressList != null) {
+ int staleUpdateIndex = inProgressList.indexOf(update);
+ if (staleUpdateIndex >= 0) {
+ // Cancel update and remove from requests list. Removing
+ // from
+ // fRequestsInProgress ensures that isRequestBlocked() won't
+ // be triggered
+ // by a canceled update.
+ ViewerUpdateMonitor staleUpdate = inProgressList.remove(staleUpdateIndex);
+ staleUpdate.cancel();
+ // Note: Do not reset the inProgressList to null. This would
+ // cause the
+ // updateStarted() method to think that a new update
+ // sequence is
+ // being started. Since there are waiting requests for this
+ // scheduling
+ // path, the list will be cleaned up later.
+ }
+ }
+ if (inProgressList == null || inProgressList.isEmpty()) {
+ getViewer().getDisplay().asyncExec(() -> {
+ if (isDisposed()) {
+ return;
+ }
+ trigger(update.getSchedulingPath());
+ });
+ }
+ } else {
+ // there are waiting requests: coalesce with existing request and
+ // add to list
+ requests.add(coalesce(requests, update));
+ }
+ }
/**
* Tries to coalesce the given request with any request in the list. If a match is found,
@@ -1762,40 +1768,37 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
/**
- * Schedules given update to be performed on the viewer.
- * Updates are queued up if they are completed in the same
- * UI cycle.
+ * Schedules given update to be performed on the viewer. Updates are queued
+ * up if they are completed in the same UI cycle.
+ *
* @param update Update to perform.
*/
void scheduleViewerUpdate(ViewerUpdateMonitor update) {
- Display display;
- Runnable updateJob = null;
- synchronized(this) {
- if (isDisposed()) {
+ Display display;
+ Runnable updateJob = null;
+ synchronized (this) {
+ if (isDisposed()) {
return;
}
- display = getViewer().getDisplay();
- fCompletedUpdates.add(update);
- if (fCompletedUpdatesRunnable == null) {
- fCompletedUpdatesRunnable = new Runnable() {
- @Override
- public void run() {
- if (!isDisposed()) {
- performUpdates();
- }
- }
- };
- updateJob = fCompletedUpdatesRunnable;
- }
- }
+ display = getViewer().getDisplay();
+ fCompletedUpdates.add(update);
+ if (fCompletedUpdatesRunnable == null) {
+ fCompletedUpdatesRunnable = () -> {
+ if (!isDisposed()) {
+ performUpdates();
+ }
+ };
+ updateJob = fCompletedUpdatesRunnable;
+ }
+ }
- if (updateJob != null) {
- if (Thread.currentThread() == display.getThread()) {
- performUpdates();
- } else {
- display.asyncExec(updateJob);
- }
- }
+ if (updateJob != null) {
+ if (Thread.currentThread() == display.getThread()) {
+ performUpdates();
+ } else {
+ display.asyncExec(updateJob);
+ }
+ }
}
/**
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 705b10734..2692ae93e 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
@@ -100,7 +100,17 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
*/
private List<ILabelUpdate> fUpdatesInProgress = new ArrayList<ILabelUpdate>();
- /**
+ private final class RunnableImplementation implements Runnable {
+ @Override
+ public void run() {
+ if (isDisposed()) {
+ return;
+ }
+ startRequests(this);
+ }
+ }
+
+ /**
* Delta visitor actively cancels the outstanding label updates for
* elements that are changed and are about to be updated.
*/
@@ -263,33 +273,25 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
@Override
public boolean update(TreePath elementPath) {
- Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
+ Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
- cancelPathUpdates(elementPath);
+ cancelPathUpdates(elementPath);
String[] visibleColumns = fViewer.getVisibleColumns();
Object element = elementPath.getLastSegment();
IElementLabelProvider presentation = ViewerAdapterService.getLabelProvider(element);
if (presentation != null) {
List<ILabelUpdate> updates = fPendingUpdates.get(presentation);
- if (updates == null) {
+ if (updates == null) {
updates = new LinkedList<ILabelUpdate>();
- fPendingUpdates.put(presentation, updates);
- }
- updates.add(new LabelUpdate(fViewer.getInput(), elementPath, this, visibleColumns, fViewer.getPresentationContext()));
- fPendingUpdatesRunnable = new Runnable() {
- @Override
- public void run() {
- if (isDisposed()) {
- return;
- }
- startRequests(this);
- }
- };
- fViewer.getDisplay().asyncExec(fPendingUpdatesRunnable);
+ fPendingUpdates.put(presentation, updates);
+ }
+ updates.add(new LabelUpdate(fViewer.getInput(), elementPath, this, visibleColumns, fViewer.getPresentationContext()));
+ fPendingUpdatesRunnable = new RunnableImplementation();
+ fViewer.getDisplay().asyncExec(fPendingUpdatesRunnable);
return true;
} else {
- return false;
+ return false;
}
}
@@ -387,41 +389,38 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
return fViewer.getPresentationContext();
}
- /**
- * A label update is complete.
- *
- * @param update Update that is to be completed.
- */
- synchronized void complete(ILabelUpdate update) {
- if (fViewer == null) {
+ /**
+ * A label update is complete.
+ *
+ * @param update Update that is to be completed.
+ */
+ synchronized void complete(ILabelUpdate update) {
+ if (fViewer == null) {
return;
}
if (fComplete == null) {
fComplete = new LinkedList<ILabelUpdate>();
- 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();
- }
- }
- }
+ }
});
}
fComplete.add(update);
- }
+ }
@Override
public void addLabelUpdateListener(ILabelUpdateListener listener) {
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 6368a43df..e3ee51ae1 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
@@ -285,28 +285,25 @@ 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$
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 557eaeb62..3d2ae3bf2 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
@@ -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 7bbddae01..4183b3aad 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..5b60386b8 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
@@ -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;
@@ -218,27 +214,26 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
return new String[] {IDebugUIConstants.ID_DEBUG_VIEW};
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
- */
- @Override
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.
+ * eclipse.debug.core.DebugEvent[])
+ */
+ @Override
public void handleDebugEvents(DebugEvent[] events) {
- 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();
- }
- }
- };
+ for (int i = 0; i < events.length; i++) {
+ DebugEvent event = events[i];
+ if (event.getSource().equals(getProcess())) {
+ Runnable r = () -> {
+ if (fTerminate != null) {
+ fTerminate.update();
+ }
+ };
- DebugUIPlugin.getStandardDisplay().asyncExec(r);
- }
- }
- }
+ DebugUIPlugin.getStandardDisplay().asyncExec(r);
+ }
+ }
+ }
protected IProcess getProcess() {
return fConsole != null ? fConsole.getProcess() : null;
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 53e2351af..fb69cda96 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
@@ -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..5aa2ae025 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
@@ -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 d4e94933c..892f003e1 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
@@ -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 310738b83..9a87113c9 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
@@ -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,88 @@ 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 +441,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 +505,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 +1182,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..e6a1f884f 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
@@ -186,8 +186,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
fTableCursor.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
- if (fTableCursor == null)
+ if (fTableCursor == null) {
return;
+ }
fTableCursor.removeTraverseListener(fCursorTraverseListener);
fTableCursor.removeKeyListener(fCursorKeyAdapter);
fTableCursor.removeMouseListener(fCursorMouseListener);
@@ -231,14 +232,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 +322,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 +341,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 +437,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 +447,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 +478,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 +509,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 +586,9 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
{
if (!fTableCursor.isDisposed())
{
- if (fTableCursor.isVisible() != show)
+ if (fTableCursor.isVisible() != show) {
fTableCursor.setVisible(show);
+ }
}
}
else
@@ -588,8 +599,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 +634,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 +670,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 +693,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 +770,35 @@ 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,
- DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null);
+ } 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 +948,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 +962,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 +989,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 +1012,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 +1047,14 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
// and the cursor should not be redrawn yet.
if (!hasPendingSetTopIndex())
{
- preservingSelection(new Runnable() {
-
- @Override
- public void run() {
-
- int[] coordinates = getCoordinatesFromKey(getSelectionKey());
- if (coordinates.length > 0)
- fTableCursor.setVisible(true);
- else
- fTableCursor.setVisible(false);
- }});
+ preservingSelection(() -> {
+ 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..dd8a601ac 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
@@ -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..c319a1401 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
@@ -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..68d27ba2a 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
@@ -54,21 +54,19 @@ 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..b086c229f 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
@@ -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..9c8f34cfa 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
@@ -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/actions/RunToLineAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java
index b8e18b8cf..e7ee094ca 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
@@ -170,13 +170,7 @@ public class RunToLineAction extends Action implements IUpdate {
*/
@Override
public void update() {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- setEnabled(isTargetEnabled());
- }
- };
- DebugUIPlugin.getStandardDisplay().asyncExec(r);
+ DebugUIPlugin.getStandardDisplay().asyncExec(() -> setEnabled(isTargetEnabled()));
}
private boolean isTargetEnabled() {

Back to the top