Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-08-12 09:50:58 -0400
committerAlexander Kurtakov2019-08-12 10:31:30 -0400
commita3938937f2cd4966dc216c45f8114da4baab02b8 (patch)
treedc7e83c0c18fbe21c22f460dc13a65f7515f013e
parent1e42e5f0e1e6591b5b609db0b864affc746ed5bf (diff)
downloadorg.eclipse.cdt-a3938937f2cd4966dc216c45f8114da4baab02b8.tar.gz
org.eclipse.cdt-a3938937f2cd4966dc216c45f8114da4baab02b8.tar.xz
org.eclipse.cdt-a3938937f2cd4966dc216c45f8114da4baab02b8.zip
Convert new Runnable to lambda.
Take 2. Change-Id: I060b0e41d8c6058db0c2ba88af8454b5517105b8 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java19
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java7
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java34
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileToggleCommentAction.java7
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java90
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java28
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java42
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java96
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/ProjectConverter.java133
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java39
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/IndentAction.java75
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java74
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePage.java52
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java14
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java14
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java102
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/PasteAction.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/AbstractElementListSelectionDialog.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java27
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IncludesSymbolsPropertyPage.java33
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java39
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java26
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDropAdapter.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java17
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java25
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java112
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultBinaryFileEditor.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java22
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java19
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBSetInputJob.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java54
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java35
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java45
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java59
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java38
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java20
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludePragmasBlock.java34
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/RefactoringExecutionHelper.java14
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java62
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFileCreator.java21
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java52
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconciler.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CColorManager.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java29
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CoreUtility.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StatusLineHandler.java44
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/EditorOpener.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ExtendedTreeViewer.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewElementWizard.java21
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java50
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java164
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java113
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java15
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigRunner.java22
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StructureTreeTab.java43
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java93
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizard.java78
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplateInputDialog.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java149
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java25
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java29
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java25
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java76
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java2809
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java33
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java169
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java27
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java194
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java107
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java45
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf/META-INF/MANIFEST.MF2
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/filebrowser/FileBrowserVMProvider.java11
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersVMProvider.java44
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersView.java80
-rw-r--r--dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java25
-rw-r--r--dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/vm/TestModelVMNode.java60
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java25
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java22
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java35
-rw-r--r--lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/PresentationReconcilerCPP.java27
-rw-r--r--lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/Server2ClientProtocolExtension.java43
-rw-r--r--testsrunner/org.eclipse.cdt.testsrunner/META-INF/MANIFEST.MF2
-rw-r--r--testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/ui/view/UIUpdater.java42
-rw-r--r--testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/launcher/BaseTestsLaunchDelegate.java22
115 files changed, 2763 insertions, 4069 deletions
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java
index 6ebfe38f82..16e35a01cf 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java
@@ -36,18 +36,15 @@ public class MakeStartup extends Job {
protected IStatus run(IProgressMonitor monitor) {
final IProject[] oldProject = UpdateMakeProjectAction.getOldProjects();
if (oldProject.length > 0) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- Shell shell = MakeUIPlugin.getDefault().getShell();
- boolean shouldUpdate = MessageDialog.openQuestion(shell,
- MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$
- MakeUIPlugin.getResourceString("MakeUIPlugin.update_project_message")); //$NON-NLS-1$
+ Display.getDefault().asyncExec(() -> {
+ Shell shell = MakeUIPlugin.getDefault().getShell();
+ boolean shouldUpdate = MessageDialog.openQuestion(shell,
+ MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$
+ MakeUIPlugin.getResourceString("MakeUIPlugin.update_project_message")); //$NON-NLS-1$
- if (shouldUpdate) {
- ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
- UpdateMakeProjectAction.run(false, pd, oldProject);
- }
+ if (shouldUpdate) {
+ ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
+ UpdateMakeProjectAction.run(false, pd, oldProject);
}
});
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java
index 6b40aa191d..7811356737 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java
@@ -186,12 +186,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
if (display == null)
display = Display.getDefault();
final IStatus fstatus = status;
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- ErrorDialog.openError(null, title, null, fstatus);
- }
- });
+ display.asyncExec(() -> ErrorDialog.openError(null, title, null, fstatus));
}
public static void logException(Throwable e) {
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java
index b3167933b9..7f1069aaa7 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java
@@ -34,13 +34,10 @@ import org.eclipse.cdt.make.internal.ui.MakeUIImages;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.ui.IWorkingCopyManager;
import org.eclipse.cdt.ui.CDTSharedImages;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
@@ -224,22 +221,14 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
MenuManager manager = new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$
manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager m) {
- contextMenuAboutToShow(m);
- }
- });
+ manager.addMenuListener(m -> contextMenuAboutToShow(m));
Control tree = viewer.getControl();
Menu menu = manager.createContextMenu(tree);
tree.setMenu(menu);
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- if (fOpenIncludeAction != null) {
- fOpenIncludeAction.run();
- }
+ viewer.addDoubleClickListener(event -> {
+ if (fOpenIncludeAction != null) {
+ fOpenIncludeAction.run();
}
});
@@ -283,15 +272,12 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
if (viewer != null) {
final Control control = viewer.getControl();
if (control != null && !control.isDisposed()) {
- control.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!control.isDisposed()) {
- control.setRedraw(false);
- viewer.setInput(fInput);
- viewer.expandAll();
- control.setRedraw(true);
- }
+ control.getDisplay().asyncExec(() -> {
+ if (!control.isDisposed()) {
+ control.setRedraw(false);
+ viewer.setInput(fInput);
+ viewer.expandAll();
+ control.setRedraw(true);
}
});
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileToggleCommentAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileToggleCommentAction.java
index 0e4ff8ac41..ba8a9d032f 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileToggleCommentAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileToggleCommentAction.java
@@ -100,12 +100,7 @@ public final class MakefileToggleCommentAction extends TextEditorAction {
if (shell != null && !shell.isDisposed())
display = shell.getDisplay();
- BusyIndicator.showWhile(display, new Runnable() {
- @Override
- public void run() {
- fOperationTarget.doOperation(operationCode);
- }
- });
+ BusyIndicator.showWhile(display, () -> fOperationTarget.doOperation(operationCode));
}
/**
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java
index 298cfaecdd..19ed970c91 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java
@@ -236,13 +236,10 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
* Refresh the whole view.
*/
private void refreshView() {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
- return;
- viewer.refresh();
- }
+ Display.getDefault().asyncExec(() -> {
+ if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
+ return;
+ viewer.refresh();
});
}
@@ -250,50 +247,47 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
* Refresh the project tree or the project subtree (in case of drill-down adapter) in the view.
*/
private void refreshProjectTree(final IProject project) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
+ Display.getDefault().asyncExec(() -> {
+ if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
+ return;
+
+ // Get first item of the viewer
+ Object firstItem = null;
+ if (viewer instanceof TreeViewer) {
+ if (((TreeViewer) viewer).getTree().getItemCount() <= 0) {
+ // No items yet, no refresh needed
return;
-
- // Get first item of the viewer
- Object firstItem = null;
- if (viewer instanceof TreeViewer) {
- if (((TreeViewer) viewer).getTree().getItemCount() <= 0) {
- // No items yet, no refresh needed
- return;
- } else {
- firstItem = ((TreeViewer) viewer).getTree().getItem(0).getData();
- }
- } else if (viewer instanceof TableViewer) {
- if (((TableViewer) viewer).getTable().getItemCount() <= 0) {
- // No items yet, refresh
- viewer.refresh();
- return;
- } else {
- firstItem = ((TableViewer) viewer).getTable().getItem(0).getData();
- }
+ } else {
+ firstItem = ((TreeViewer) viewer).getTree().getItem(0).getData();
}
-
- IContainer parentContainer = null;
-
- boolean isDrilledDown = !(firstItem instanceof IProject);
- if (!isDrilledDown) {
- // view shows projects
- viewer.refresh(project);
+ } else if (viewer instanceof TableViewer) {
+ if (((TableViewer) viewer).getTable().getItemCount() <= 0) {
+ // No items yet, refresh
+ viewer.refresh();
+ return;
} else {
- // drill-down adapter in the game
- if (firstItem instanceof IResource) {
- parentContainer = ((IResource) firstItem).getParent();
- } else if (firstItem instanceof TargetSourceContainer) {
- parentContainer = ((TargetSourceContainer) firstItem).getContainer().getParent();
- } else if (firstItem instanceof IMakeTarget) {
- parentContainer = ((IMakeTarget) firstItem).getContainer();
- }
+ firstItem = ((TableViewer) viewer).getTable().getItem(0).getData();
+ }
+ }
- if (parentContainer != null && project.equals(parentContainer.getProject())) {
- viewer.refresh();
- }
+ IContainer parentContainer = null;
+
+ boolean isDrilledDown = !(firstItem instanceof IProject);
+ if (!isDrilledDown) {
+ // view shows projects
+ viewer.refresh(project);
+ } else {
+ // drill-down adapter in the game
+ if (firstItem instanceof IResource) {
+ parentContainer = ((IResource) firstItem).getParent();
+ } else if (firstItem instanceof TargetSourceContainer) {
+ parentContainer = ((TargetSourceContainer) firstItem).getContainer().getParent();
+ } else if (firstItem instanceof IMakeTarget) {
+ parentContainer = ((IMakeTarget) firstItem).getContainer();
+ }
+
+ if (parentContainer != null && project.equals(parentContainer.getProject())) {
+ viewer.refresh();
}
}
});
@@ -428,7 +422,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
/**
* Check if the resource is in the list of source entries.
-
+
* @param rc - resource to check.
* @return {@code true} if the resource is a source folder, {@code false} otherwise.
*
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java
index 2e7cf796e4..db3441a3d4 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java
@@ -27,8 +27,6 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -115,12 +113,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
// text field
bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
- bopOpenFileText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- handleModifyOpenFileText();
- }
- });
+ bopOpenFileText.addModifyListener(e -> handleModifyOpenFileText());
bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText());
// browse button
@@ -231,19 +224,14 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
//lock.acquire();
synchronized (lock) {
if (!instance.shell.isDisposed()) {
- instance.shell.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (!instance.shell.isDisposed()) {
- loadButtonInitialEnabled = instance.bopEnabledButton.getSelection()
- && handleModifyOpenFileText();
- instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
- } else {
- loadButtonInitialEnabled = true;
- }
+ instance.shell.getDisplay().asyncExec(() -> {
+ if (!instance.shell.isDisposed()) {
+ loadButtonInitialEnabled = instance.bopEnabledButton.getSelection()
+ && handleModifyOpenFileText();
+ instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
+ } else {
+ loadButtonInitialEnabled = true;
}
-
});
} else {
loadButtonInitialEnabled = true;
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
index 1d099c3b34..a488728d80 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
@@ -27,8 +27,6 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -122,12 +120,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
// text field
bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
- bopOpenFileText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- handleModifyOpenFileText();
- }
- });
+ bopOpenFileText.addModifyListener(e -> handleModifyOpenFileText());
bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText());
// browse button
@@ -181,12 +174,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
// text field
sipRunCommandText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
- sipRunCommandText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- handleModifyRunCommandText();
- }
- });
+ sipRunCommandText.addModifyListener(e -> handleModifyRunCommandText());
// si browse button
Button siBrowseButton = ControlFactory.createPushButton(profileGroup, SI_BROWSE);
@@ -221,12 +209,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
// text field
sipRunArgsText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
((GridData) sipRunArgsText.getLayoutData()).horizontalSpan = 3;
- sipRunArgsText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- handleModifyRunArgsText();
- }
- });
+ sipRunArgsText.addModifyListener(e -> handleModifyRunArgsText());
// si provider console enabled checkbox
String sipConsoleEnabledLabel = MakeUIPlugin
@@ -353,19 +336,14 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
public void done(IJobChangeEvent event) {
synchronized (lock) {
if (!instance.shell.isDisposed()) {
- instance.shell.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (!instance.shell.isDisposed()) {
- loadButtonInitialEnabled = instance.bopEnabledButton.getSelection()
- && handleModifyOpenFileText();
- instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
- } else {
- loadButtonInitialEnabled = true;
- }
+ instance.shell.getDisplay().asyncExec(() -> {
+ if (!instance.shell.isDisposed()) {
+ loadButtonInitialEnabled = instance.bopEnabledButton.getSelection()
+ && handleModifyOpenFileText();
+ instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
+ } else {
+ loadButtonInitialEnabled = true;
}
-
});
} else {
loadButtonInitialEnabled = true;
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
index a498ba1363..8186fc07b9 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
@@ -266,24 +266,9 @@ public class ManagedBuildManager extends AbstractCExtension {
private static Map<IProject, IManagedBuildInfo> fInfoMap = new HashMap<>();
- private static ISorter fToolChainSorter = new ISorter() {
- @Override
- public void sort() {
- resortToolChains();
- }
- };
- private static ISorter fToolSorter = new ISorter() {
- @Override
- public void sort() {
- resortTools();
- }
- };
- private static ISorter fBuilderSorter = new ISorter() {
- @Override
- public void sort() {
- resortBuilders();
- }
- };
+ private static ISorter fToolChainSorter = () -> resortToolChains();
+ private static ISorter fToolSorter = () -> resortTools();
+ private static ISorter fBuilderSorter = () -> resortBuilders();
private static interface ISorter {
void sort();
@@ -291,14 +276,11 @@ public class ManagedBuildManager extends AbstractCExtension {
static {
getEnvironmentVariableProvider()
- .subscribe(fEnvironmentBuildPathsChangeListener = new IEnvironmentBuildPathsChangeListener() {
- @Override
- public void buildPathsChanged(IConfiguration configuration, int buildPathType) {
- // if(buildPathType == IEnvVarBuildPath.BUILDPATH_INCLUDE){
- // initializePathEntries(configuration,null);
- // notifyListeners(configuration,null);
- // }
- }
+ .subscribe(fEnvironmentBuildPathsChangeListener = (configuration, buildPathType) -> {
+ // if(buildPathType == IEnvVarBuildPath.BUILDPATH_INCLUDE){
+ // initializePathEntries(configuration,null);
+ // notifyListeners(configuration,null);
+ // }
});
}
@@ -876,7 +858,7 @@ public class ManagedBuildManager extends AbstractCExtension {
return;
}
} catch (BuildException e) {return;}
-
+
// Figure out if there is a listener for this change
IResource resource = config.getOwner();
List listeners = (List) getBuildModelListeners().get(resource);
@@ -1310,14 +1292,10 @@ public class ManagedBuildManager extends AbstractCExtension {
final Shell shell = window.getShell();
if (shell != null) {
final String exceptionMsg = err.getMessage();
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(shell,
+ shell.getDisplay()
+ .syncExec(() -> MessageDialog.openError(shell,
ManagedMakeMessages.getResourceString("ManagedBuildManager.error.write_failed_title"), //$NON-NLS-1$
- ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_WRITE_FAILED, exceptionMsg));
- }
- });
+ ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_WRITE_FAILED, exceptionMsg)));
}
}
// If we return an honest status when the operation fails, there are instances when the UI behavior
@@ -1385,10 +1363,10 @@ public class ManagedBuildManager extends AbstractCExtension {
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.newDocument();
-
+
// Get the build information for the project
ManagedBuildInfo buildInfo = (ManagedBuildInfo) getBuildInfo(project);
-
+
// Save the build info
if (buildInfo != null &&
!buildInfo.isReadOnly() &&
@@ -1403,7 +1381,7 @@ public class ManagedBuildManager extends AbstractCExtension {
Element rootElement = doc.createElement(ROOT_NODE_NAME);
doc.appendChild(rootElement);
buildInfo.serialize(doc, rootElement);
-
+
// Transform the document to something we can save in a file
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
@@ -1413,11 +1391,11 @@ public class ManagedBuildManager extends AbstractCExtension {
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(stream);
transformer.transform(source, result);
-
+
// Save the document
IFile projectFile = project.getFile(SETTINGS_FILE_NAME);
String utfString = stream.toString("UTF-8"); //$NON-NLS-1$
-
+
if (projectFile.exists()) {
if (projectFile.isReadOnly()) {
// If we are not running headless, and there is a UI Window around, grab it
@@ -1451,7 +1429,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} else {
projectFile.create(new ByteArrayInputStream(utfString.getBytes("UTF-8")), IResource.FORCE, new NullProgressMonitor()); //$NON-NLS-1$
}
-
+
// Close the streams
stream.close();
}
@@ -1472,7 +1450,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// Save to IFile failed
err = e;
}
-
+
if (err != null) {
// Put out an error message indicating that the attempted write to the .cdtbuild project file failed
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
@@ -1480,7 +1458,7 @@ public class ManagedBuildManager extends AbstractCExtension {
IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
window = windows[0];
}
-
+
final Shell shell = window.getShell();
if (shell != null) {
final String exceptionMsg = err.getMessage();
@@ -1558,9 +1536,9 @@ public class ManagedBuildManager extends AbstractCExtension {
for (int i=0; i < configs.length; i++) {
ManagedBuildManager.performValueHandlerEvent(configs[i], IManagedOptionValueHandler.EVENT_CLOSE);
}
-
+
info.setValid(false);
-
+
try {
resource.setSessionProperty(buildInfoProperty, null);
} catch (CoreException e) {
@@ -1841,7 +1819,7 @@ public class ManagedBuildManager extends AbstractCExtension {
return Status.OK_STATUS;
/*
ManagedBuildInfo buildInfo = null;
-
+
// Get the build info associated with this project for this session
try {
buildInfo = findBuildInfo(resource.getProject(), true);
@@ -2127,15 +2105,11 @@ public class ManagedBuildManager extends AbstractCExtension {
final Shell shell = window.getShell();
final String errMsg = ManagedMakeMessages.getFormattedString(MANIFEST_VERSION_ERROR,
extension.getUniqueIdentifier());
- shell.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(shell,
+ shell.getDisplay()
+ .asyncExec(() -> MessageDialog.openError(shell,
ManagedMakeMessages.getResourceString(
"ManagedBuildManager.error.manifest_load_failed_title"), //$NON-NLS-1$
- errMsg);
- }
- });
+ errMsg));
} else {
// Get the "configuraton elements" defined in the plugin.xml file.
// Note that these "configuration elements" are not related to the
@@ -2755,7 +2729,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} catch (Exception e) {
// TODO: Issue error reagarding not being able to load the project file (.cdtbuild)
}
-
+
try {
// Check if the project needs its container initialized
initBuildInfoContainer(buildInfo);
@@ -2837,7 +2811,7 @@ public class ManagedBuildManager extends AbstractCExtension {
*/
/* synchronized private static ManagedBuildInfo findBuildInfoSynchronized(IProject project, boolean forceLoad) {
ManagedBuildInfo buildInfo = null;
-
+
// Check if there is any build info associated with this project for this session
try {
buildInfo = (ManagedBuildInfo)project.getSessionProperty(buildInfoProperty);
@@ -2848,7 +2822,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} catch (CoreException e) {
// return null;
}
-
+
if(buildInfo == null && forceLoad){
// Make sure the extension information is loaded first
try {
@@ -2857,11 +2831,11 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace();
return null;
}
-
-
+
+
// Check weather getBuildInfo is called from converter
buildInfo = UpdateManagedProjectManager.getConvertedManagedBuildInfo(project);
-
+
// Nothing in session store, so see if we can load it from cdtbuild
if (buildInfo == null) {
try {
@@ -2878,7 +2852,7 @@ public class ManagedBuildManager extends AbstractCExtension {
IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
window = windows[0];
}
-
+
final Shell shell = window.getShell();
final String exceptionMsg = e.getMessage();
//using syncExec could cause a dead-lock
@@ -2892,7 +2866,7 @@ public class ManagedBuildManager extends AbstractCExtension {
}
} );
}
-
+
if (buildInfo != null && !buildInfo.isContainerInited()) {
// NOTE: If this is called inside the above rule, then an IllegalArgumentException can
// occur when the CDT project file is saved - it uses the Workspace Root as the scheduling rule.
@@ -2906,7 +2880,7 @@ public class ManagedBuildManager extends AbstractCExtension {
}
}
}
-
+
return buildInfo;
}
*/
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/ProjectConverter.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/ProjectConverter.java
index f50e278209..fe10fe07dd 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/ProjectConverter.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/ProjectConverter.java
@@ -23,8 +23,6 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorOperation;
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IPathEntry;
@@ -58,7 +56,6 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -269,17 +266,14 @@ public class ProjectConverter implements ICProjectConverter {
final Shell shell = window.getShell();
final boolean[] answer = new boolean[1];
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- Object ob = PROPS.getProperty(rc, id);
- if (multiple || ob == null) {
- PROPS.setProperty(rc, id, Boolean.TRUE);
- answer[0] = MessageDialog.openQuestion(shell, title, message);
- PROPS.setProperty(rc, id, answer[0] ? Boolean.TRUE : Boolean.FALSE);
- } else {
- answer[0] = ((Boolean) ob).booleanValue();
- }
+ shell.getDisplay().syncExec(() -> {
+ Object ob = PROPS.getProperty(rc, id);
+ if (multiple || ob == null) {
+ PROPS.setProperty(rc, id, Boolean.TRUE);
+ answer[0] = MessageDialog.openQuestion(shell, title, message);
+ PROPS.setProperty(rc, id, answer[0] ? Boolean.TRUE : Boolean.FALSE);
+ } else {
+ answer[0] = ((Boolean) ob).booleanValue();
}
});
return answer[0];
@@ -294,13 +288,10 @@ public class ProjectConverter implements ICProjectConverter {
}
final Shell shell = window.getShell();
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (multiple || PROPS.getProperty(rc, id) == null) {
- PROPS.setProperty(rc, id, Boolean.TRUE);
- MessageDialog.openInformation(shell, title, message);
- }
+ shell.getDisplay().syncExec(() -> {
+ if (multiple || PROPS.getProperty(rc, id) == null) {
+ PROPS.setProperty(rc, id, Boolean.TRUE);
+ MessageDialog.openInformation(shell, title, message);
}
});
}
@@ -311,42 +302,31 @@ public class ProjectConverter implements ICProjectConverter {
monitor = new NullProgressMonitor();
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(project, des,
- new ICDescriptorOperation() {
-
- @Override
- public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
- final IMakeTargetManager mngr = MakeCorePlugin.getDefault().getTargetManager();
-
- project.accept(new IResourceVisitor() {
-
- @Override
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE)
- return false;
-
- try {
- IContainer cr = (IContainer) resource;
- IMakeTarget targets[] = mngr.getTargets(cr);
- for (int i = 0; i < targets.length; i++) {
- IMakeTarget t = targets[i];
- if (!OLD_MAKE_TARGET_BUIDER_ID.equals(t.getTargetBuilderID()))
- continue;
-
- IMakeTarget newT = mngr.createTarget(project, t.getName(),
- NEW_MAKE_TARGET_BUIDER_ID);
- copySettings(t, newT);
- mngr.removeTarget(t);
- mngr.addTarget(cr, newT);
- }
- } catch (CoreException e) {
- ManagedBuilderCorePlugin.log(e);
- }
- return true;
+ (descriptor, monitor1) -> {
+ final IMakeTargetManager mngr = MakeCorePlugin.getDefault().getTargetManager();
+
+ project.accept(resource -> {
+ if (resource.getType() == IResource.FILE)
+ return false;
+
+ try {
+ IContainer cr = (IContainer) resource;
+ IMakeTarget targets[] = mngr.getTargets(cr);
+ for (int i = 0; i < targets.length; i++) {
+ IMakeTarget t = targets[i];
+ if (!OLD_MAKE_TARGET_BUIDER_ID.equals(t.getTargetBuilderID()))
+ continue;
+
+ IMakeTarget newT = mngr.createTarget(project, t.getName(), NEW_MAKE_TARGET_BUIDER_ID);
+ copySettings(t, newT);
+ mngr.removeTarget(t);
+ mngr.addTarget(cr, newT);
}
-
- });
- }
-
+ } catch (CoreException e) {
+ ManagedBuilderCorePlugin.log(e);
+ }
+ return true;
+ });
}, monitor);
}
@@ -541,32 +521,27 @@ public class ProjectConverter implements ICProjectConverter {
}
final IWorkspace wsp = ResourcesPlugin.getWorkspace();
- wsp.run(new IWorkspaceRunnable() {
-
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- project.setDescription(eDes, monitor);
- CCorePlugin.getDefault().setProjectDescription(project, newDes);
- Job job = new Job(DataProviderMessages.getString("ProjectConverter.7")) { //$NON-NLS-1$
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project);
- convertMakeTargetInfo(project, des, monitor);
- CCorePlugin.getDefault().setProjectDescription(project, des);
- } catch (CoreException e) {
- return e.getStatus();
- }
- return Status.OK_STATUS;
+ wsp.run((IWorkspaceRunnable) monitor1 -> {
+ project.setDescription(eDes, monitor1);
+ CCorePlugin.getDefault().setProjectDescription(project, newDes);
+ Job job = new Job(DataProviderMessages.getString("ProjectConverter.7")) { //$NON-NLS-1$
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project);
+ convertMakeTargetInfo(project, des, monitor);
+ CCorePlugin.getDefault().setProjectDescription(project, des);
+ } catch (CoreException e) {
+ return e.getStatus();
}
+ return Status.OK_STATUS;
+ }
- };
-
- job.setRule(wsp.getRoot());
- job.schedule();
- }
+ };
+ job.setRule(wsp.getRoot());
+ job.schedule();
}, wsp.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
}
return true;
diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java
index 132df31243..3cc455f63c 100644
--- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java
+++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java
@@ -48,7 +48,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
@@ -98,13 +97,10 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
if (elements != null && !monitor.isCanceled()) {
final Shell shell = getShell();
if (shell != null && !shell.isDisposed()) {
- Runnable update = new Runnable() {
- @Override
- public void run() {
- if (!shell.isDisposed() && !monitor.isCanceled()) {
- setListElements(elements);
- updateOkState();
- }
+ Runnable update = () -> {
+ if (!shell.isDisposed() && !monitor.isCanceled()) {
+ setListElements(elements);
+ updateOkState();
}
};
shell.getDisplay().asyncExec(update);
@@ -132,12 +128,9 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
fDone = true;
final Shell shell = getShell();
if (shell != null && !shell.isDisposed()) {
- Runnable update = new Runnable() {
- @Override
- public void run() {
- if (!shell.isDisposed() && fDone) {
- fMonitor.done();
- }
+ Runnable update = () -> {
+ if (!shell.isDisposed() && fDone) {
+ fMonitor.done();
}
};
shell.getDisplay().asyncExec(update);
@@ -149,13 +142,10 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
fDone = false;
final Shell shell = getShell();
if (shell != null && !shell.isDisposed()) {
- Runnable update = new Runnable() {
- @Override
- public void run() {
- if (!shell.isDisposed() && !fDone) {
- fMonitor.beginTask(OpenTypeMessages.ElementSelectionDialog_UpdateElementsJob_inProgress,
- IProgressMonitor.UNKNOWN);
- }
+ Runnable update = () -> {
+ if (!shell.isDisposed() && !fDone) {
+ fMonitor.beginTask(OpenTypeMessages.ElementSelectionDialog_UpdateElementsJob_inProgress,
+ IProgressMonitor.UNKNOWN);
}
};
shell.getDisplay().asyncExec(update);
@@ -345,12 +335,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
@Override
protected Text createFilterText(Composite parent) {
final Text result = super.createFilterText(parent);
- Listener listener = new Listener() {
- @Override
- public void handleEvent(Event e) {
- scheduleUpdate(result.getText());
- }
- };
+ Listener listener = e -> scheduleUpdate(result.getText());
result.addListener(SWT.Modify, listener);
return result;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/IndentAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/IndentAction.java
index 26b8ba5fcd..5813e20f0d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/IndentAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/IndentAction.java
@@ -111,47 +111,44 @@ public class IndentAction extends TextEditorAction {
return;
}
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- IRewriteTarget target = getTextEditor().getAdapter(IRewriteTarget.class);
- if (target != null)
- target.beginCompoundChange();
-
- try {
- CHeuristicScanner scanner = new CHeuristicScanner(document);
- CIndenter indenter = new CIndenter(document, scanner, getCProject());
- final boolean multiLine = nLines > 1;
- boolean hasChanged = false;
- for (int i = 0; i < nLines; i++) {
- hasChanged |= indentLine(document, firstLine + i, offset, indenter, scanner, multiLine);
- }
-
- // update caret position: move to new position when indenting just one line
- // keep selection when indenting multiple
- int newOffset, newLength;
- if (!fIsTabAction && multiLine) {
- newOffset = offset;
- newLength = end.getOffset() - offset;
- } else {
- newOffset = fCaretOffset;
- newLength = 0;
- }
+ Runnable runnable = () -> {
+ IRewriteTarget target = getTextEditor().getAdapter(IRewriteTarget.class);
+ if (target != null)
+ target.beginCompoundChange();
+
+ try {
+ CHeuristicScanner scanner = new CHeuristicScanner(document);
+ CIndenter indenter = new CIndenter(document, scanner, getCProject());
+ final boolean multiLine = nLines > 1;
+ boolean hasChanged = false;
+ for (int i = 0; i < nLines; i++) {
+ hasChanged |= indentLine(document, firstLine + i, offset, indenter, scanner, multiLine);
+ }
- // always reset the selection if anything was replaced
- // but not when we had a single line non-tab invocation
- if (newOffset != -1 && (hasChanged || newOffset != offset || newLength != length))
- selectAndReveal(newOffset, newLength);
-
- } catch (BadLocationException e) {
- // will only happen on concurrent modification
- CUIPlugin.log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.OK,
- "ConcurrentModification in IndentAction", e)); //$NON-NLS-1$
- } finally {
- document.removePosition(end);
- if (target != null)
- target.endCompoundChange();
+ // update caret position: move to new position when indenting just one line
+ // keep selection when indenting multiple
+ int newOffset, newLength;
+ if (!fIsTabAction && multiLine) {
+ newOffset = offset;
+ newLength = end.getOffset() - offset;
+ } else {
+ newOffset = fCaretOffset;
+ newLength = 0;
}
+
+ // always reset the selection if anything was replaced
+ // but not when we had a single line non-tab invocation
+ if (newOffset != -1 && (hasChanged || newOffset != offset || newLength != length))
+ selectAndReveal(newOffset, newLength);
+
+ } catch (BadLocationException e) {
+ // will only happen on concurrent modification
+ CUIPlugin.log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.OK,
+ "ConcurrentModification in IndentAction", e)); //$NON-NLS-1$
+ } finally {
+ document.removePosition(end);
+ if (target != null)
+ target.endCompoundChange();
}
};
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java
index a043cedac9..c456e9f212 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java
@@ -276,44 +276,35 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
fName = name;
fContextMenuId = contextId;
- runUI(new Runnable() {
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- // add console to the Console view
- fConsole = createBuildConsole(fName, fContextMenuId, iconUrl);
- ConsolePlugin.getDefault().getConsoleManager()
- .addConsoles(new org.eclipse.ui.console.IConsole[] { fConsole });
-
- infoStream.setConsole(fConsole);
- infoColor = createColor(CUIPlugin.getStandardDisplay(),
- BuildConsolePreferencePage.PREF_BUILDCONSOLE_INFO_COLOR);
- infoStream.setColor(infoColor);
- outputStream.setConsole(fConsole);
- outputColor = createColor(CUIPlugin.getStandardDisplay(),
- BuildConsolePreferencePage.PREF_BUILDCONSOLE_OUTPUT_COLOR);
- outputStream.setColor(outputColor);
- errorStream.setConsole(fConsole);
- errorColor = createColor(CUIPlugin.getStandardDisplay(),
- BuildConsolePreferencePage.PREF_BUILDCONSOLE_ERROR_COLOR);
- errorStream.setColor(errorColor);
- backgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
- BuildConsolePreferencePage.PREF_BUILDCONSOLE_BACKGROUND_COLOR);
- fConsole.setBackground(backgroundColor);
- problemHighlightedColor = createColor(CUIPlugin.getStandardDisplay(),
- BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR);
- problemErrorBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
- BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_BACKGROUND_COLOR);
- problemWarningBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
- BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_WARNING_BACKGROUND_COLOR);
- problemInfoBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
- BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR);
- }
+ runUI(() -> {
+ // add console to the Console view
+ fConsole = createBuildConsole(fName, fContextMenuId, iconUrl);
+ ConsolePlugin.getDefault().getConsoleManager()
+ .addConsoles(new org.eclipse.ui.console.IConsole[] { fConsole });
+
+ infoStream.setConsole(fConsole);
+ infoColor = createColor(CUIPlugin.getStandardDisplay(),
+ BuildConsolePreferencePage.PREF_BUILDCONSOLE_INFO_COLOR);
+ infoStream.setColor(infoColor);
+ outputStream.setConsole(fConsole);
+ outputColor = createColor(CUIPlugin.getStandardDisplay(),
+ BuildConsolePreferencePage.PREF_BUILDCONSOLE_OUTPUT_COLOR);
+ outputStream.setColor(outputColor);
+ errorStream.setConsole(fConsole);
+ errorColor = createColor(CUIPlugin.getStandardDisplay(),
+ BuildConsolePreferencePage.PREF_BUILDCONSOLE_ERROR_COLOR);
+ errorStream.setColor(errorColor);
+ backgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
+ BuildConsolePreferencePage.PREF_BUILDCONSOLE_BACKGROUND_COLOR);
+ fConsole.setBackground(backgroundColor);
+ problemHighlightedColor = createColor(CUIPlugin.getStandardDisplay(),
+ BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR);
+ problemErrorBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
+ BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_BACKGROUND_COLOR);
+ problemWarningBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
+ BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_WARNING_BACKGROUND_COLOR);
+ problemInfoBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
+ BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR);
});
CUIPlugin.getWorkspace().addResourceChangeListener(this);
CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
@@ -382,12 +373,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
if (v == null)
return;
Display display = Display.getDefault();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- v.getTextWidget().redraw();
- }
- });
+ display.asyncExec(() -> v.getTextWidget().redraw());
}
public IBuildConsoleStreamDecorator getStreamDecorator(int type) throws CoreException {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePage.java
index 2b41062fb4..f7de34b83d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePage.java
@@ -40,7 +40,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
@@ -59,7 +58,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Font;
@@ -109,13 +107,7 @@ public class BuildConsolePage extends Page
private IProject fProject;
// text selection listener
- private ISelectionChangedListener fTextListener = new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateSelectionDependentActions();
- }
- };
+ private ISelectionChangedListener fTextListener = event -> updateSelectionDependentActions();
// actions
private ClearOutputAction fClearOutputAction;
@@ -181,25 +173,15 @@ public class BuildConsolePage extends Page
Control control = getControl();
if (control != null && !control.isDisposed()) {
Display display = control.getDisplay();
- display.asyncExec(new Runnable() {
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
+ display.asyncExec(() -> {
+ if (isAvailable()) {
+ if (event.getType() == IBuildConsoleEvent.CONSOLE_CLOSE && getProject() != event.getProject()) {
+ return;
+ }
+ setProject(event.getProject());
if (isAvailable()) {
- if (event.getType() == IBuildConsoleEvent.CONSOLE_CLOSE
- && getProject() != event.getProject()) {
- return;
- }
- setProject(event.getProject());
- if (isAvailable()) {
- setDocument();
- getConsole().setTitle(getProject());
- }
+ setDocument();
+ getConsole().setTitle(getProject());
}
}
});
@@ -217,13 +199,7 @@ public class BuildConsolePage extends Page
MenuManager manager = new MenuManager("#MessageConsole", "#MessageConsole"); //$NON-NLS-1$ //$NON-NLS-2$
manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(new IMenuListener() {
-
- @Override
- public void menuAboutToShow(IMenuManager m) {
- contextMenuAboutToShow(m);
- }
- });
+ manager.addMenuListener(m -> contextMenuAboutToShow(m));
fMenu = manager.createContextMenu(getControl());
getControl().setMenu(fMenu);
IPageSite site = getSite();
@@ -272,13 +248,7 @@ public class BuildConsolePage extends Page
IBuildConsoleStreamDecorator stream = (IBuildConsoleStreamDecorator) source;
if (stream.getConsole().equals(getConsole()) && getControl() != null) {
Display display = getControl().getDisplay();
- display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- getViewer().getTextWidget().redraw();
- }
- });
+ display.asyncExec(() -> getViewer().getTextWidget().redraw());
}
} else if (property.equals(BuildConsolePreferencePage.PREF_BUILDCONSOLE_FONT)) {
setFont(JFaceResources.getFont(BuildConsolePreferencePage.PREF_BUILDCONSOLE_FONT));
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java
index bcea084b0d..9803484f6e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java
@@ -482,12 +482,7 @@ public class BuildConsolePartitioner
Display display = CUIPlugin.getStandardDisplay();
if (display != null) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- fManager.startConsoleActivity(project);
- }
- });
+ display.asyncExec(() -> fManager.startConsoleActivity(project));
}
if (BuildConsolePreferencePage.isClearBuildConsole()) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java
index 42ebe62c90..59ea39358c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java
@@ -137,21 +137,11 @@ public class CHContentProvider extends AsyncTreeContentProvider {
}
if (!IndexUI.isIndexed(index, input)) {
- getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- fView.reportNotIndexed(input);
- }
- });
+ getDisplay().asyncExec(() -> fView.reportNotIndexed(input));
} else {
element = IndexUI.attemptConvertionToHandle(index, input);
final ICElement finalElement = element;
- getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- fView.reportInputReplacement(input, finalElement);
- }
- });
+ getDisplay().asyncExec(() -> fView.reportInputReplacement(input, finalElement));
}
ITranslationUnit tu = CModelUtil.getTranslationUnit(element);
if (!fComputeReferencedBy && element instanceof IMethod) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java
index 0f624c11dd..8c8d939066 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java
@@ -87,12 +87,7 @@ public class CallHierarchyUI {
protected IStatus run(IProgressMonitor monitor) {
final ICElement[] elems = findDefinitions(input);
if (elems != null && elems.length > 0) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- internalOpen(window, elems);
- }
- });
+ display.asyncExec(() -> internalOpen(window, elems));
}
return Status.OK_STATUS;
}
@@ -164,12 +159,7 @@ public class CallHierarchyUI {
StatusLineHandler.clearStatusLine(editor.getSite());
final ICElement[] elems = findDefinitions(project, editorInput, sel);
if (elems.length > 0) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- internalOpen(editor.getSite().getWorkbenchWindow(), elems);
- }
- });
+ display.asyncExec(() -> internalOpen(editor.getSite().getWorkbenchWindow(), elems));
} else {
StatusLineHandler.showStatusLineMessage(editor.getSite(),
CHMessages.CallHierarchyUI_openFailureMessage);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java
index 9b5bff1ec9..b409055f27 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java
@@ -57,7 +57,6 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -66,11 +65,8 @@ import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.OpenEvent;
@@ -86,7 +82,6 @@ import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ScrollBar;
@@ -178,27 +173,22 @@ public class CView extends ViewPart
}
};
- private IPropertyChangeListener workingSetListener = new IPropertyChangeListener() {
+ private IPropertyChangeListener workingSetListener = ev -> {
+ String property = ev.getProperty();
+ Object newValue = ev.getNewValue();
+ Object oldValue = ev.getOldValue();
+ IWorkingSet filterWorkingSet = workingSetFilter.getWorkingSet();
- @Override
- public void propertyChange(PropertyChangeEvent ev) {
- String property = ev.getProperty();
- Object newValue = ev.getNewValue();
- Object oldValue = ev.getOldValue();
- IWorkingSet filterWorkingSet = workingSetFilter.getWorkingSet();
-
- if (property == null) {
- return;
- }
- if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) && oldValue == filterWorkingSet) {
- setWorkingSet(null);
- } else if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property)
- && newValue == filterWorkingSet) {
- updateTitle();
- } else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)
- && newValue == filterWorkingSet) {
- getViewer().refresh();
- }
+ if (property == null) {
+ return;
+ }
+ if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) && oldValue == filterWorkingSet) {
+ setWorkingSet(null);
+ } else if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) && newValue == filterWorkingSet) {
+ updateTitle();
+ } else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)
+ && newValue == filterWorkingSet) {
+ getViewer().refresh();
}
};
@@ -286,16 +276,12 @@ public class CView extends ViewPart
updateActionBars(selection);
dragDetected = false;
if (isLinkingEnabled()) {
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (dragDetected == false) {
- // only synchronize with editor when the selection is
- // not the result
- // of a drag. Fixes bug 22274.
- linkToEditor(selection);
- }
+ getSite().getShell().getDisplay().asyncExec(() -> {
+ if (dragDetected == false) {
+ // only synchronize with editor when the selection is
+ // not the result
+ // of a drag. Fixes bug 22274.
+ linkToEditor(selection);
}
});
}
@@ -375,13 +361,7 @@ public class CView extends ViewPart
initDrag();
initDrop();
- dragDetectListener = new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- dragDetected = true;
- }
- };
+ dragDetectListener = event -> dragDetected = true;
viewer.getControl().addListener(SWT.DragDetect, dragDetectListener);
}
@@ -440,13 +420,7 @@ public class CView extends ViewPart
protected void initContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
-
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- CView.this.fillContextMenu(manager);
- }
- });
+ menuMgr.addMenuListener(manager -> CView.this.fillContextMenu(manager));
TreeViewer viewer = getViewer();
Menu menu = menuMgr.createContextMenu(viewer.getTree());
viewer.getTree().setMenu(menu);
@@ -481,28 +455,11 @@ public class CView extends ViewPart
* Add listeners to the viewer.
*/
protected void initListeners(TreeViewer viewer) {
- viewer.addDoubleClickListener(new IDoubleClickListener() {
+ viewer.addDoubleClickListener(event -> handleDoubleClick(event));
- @Override
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged(event);
- }
- });
+ viewer.addSelectionChangedListener(event -> handleSelectionChanged(event));
- viewer.addOpenListener(new IOpenListener() {
- @Override
- public void open(OpenEvent event) {
- handleOpen(event);
- }
- });
+ viewer.addOpenListener(event -> handleOpen(event));
viewer.getControl().addKeyListener(new KeyAdapter() {
@@ -1077,12 +1034,7 @@ public class CView extends ViewPart
* Returns the <code>IShowInSource</code> for this view.
*/
protected IShowInSource getShowInSource() {
- return new IShowInSource() {
- @Override
- public ShowInContext getShowInContext() {
- return new ShowInContext(getViewer().getInput(), getViewer().getSelection());
- }
- };
+ return () -> new ShowInContext(getViewer().getInput(), getViewer().getSelection());
}
@Override
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/PasteAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/PasteAction.java
index bbce06a646..c42fe309df 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/PasteAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/PasteAction.java
@@ -174,13 +174,10 @@ public class PasteAction extends SelectionListenerAction {
return false;
final IResource[][] clipboardData = new IResource[1][];
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- // clipboard must have resources or files
- ResourceTransfer resTransfer = ResourceTransfer.getInstance();
- clipboardData[0] = (IResource[]) clipboard.getContents(resTransfer);
- }
+ shell.getDisplay().syncExec(() -> {
+ // clipboard must have resources or files
+ ResourceTransfer resTransfer = ResourceTransfer.getInstance();
+ clipboardData[0] = (IResource[]) clipboard.getContents(resTransfer);
});
IResource[] resourceData = clipboardData[0];
if (resourceData != null && resourceData.length > 0 && resourceData[0].getType() == IResource.PROJECT) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/AbstractElementListSelectionDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/AbstractElementListSelectionDialog.java
index 8d2fb34393..5e7889c961 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/AbstractElementListSelectionDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/AbstractElementListSelectionDialog.java
@@ -220,12 +220,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
*/
@Override
public int open() {
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- access$superOpen();
- }
- });
+ BusyIndicator.showWhile(null, () -> access$superOpen());
return getReturnCode();
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java
index 00a020c031..220f5bd0a4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TableTextCellEditor.java
@@ -31,8 +31,6 @@ import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
@@ -143,12 +141,7 @@ public class TableTextCellEditor extends CellEditor {
private ModifyListener getModifyListener() {
if (fModifyListener == null) {
- fModifyListener = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- editOccured(e);
- }
- };
+ fModifyListener = e -> editOccured(e);
}
return fModifyListener;
}
@@ -227,12 +220,9 @@ public class TableTextCellEditor extends CellEditor {
checkSelectable();
}
});
- text.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
+ text.addTraverseListener(e -> {
+ if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
+ e.doit = false;
}
});
// We really want a selection listener but it is not supported so we
@@ -249,13 +239,8 @@ public class TableTextCellEditor extends CellEditor {
text.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
- e.display.asyncExec(new Runnable() {
- @Override
- public void run() {
- // without the asyncExec, focus has not had a chance to go to the content assist proposals
- TableTextCellEditor.this.focusLost();
- }
- });
+ // without the asyncExec, focus has not had a chance to go to the content assist proposals
+ e.display.asyncExec(() -> TableTextCellEditor.this.focusLost());
}
});
text.setFont(parent.getFont());
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IncludesSymbolsPropertyPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IncludesSymbolsPropertyPage.java
index 39b5711bc2..c47206436b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IncludesSymbolsPropertyPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IncludesSymbolsPropertyPage.java
@@ -30,7 +30,6 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -191,15 +190,11 @@ public class IncludesSymbolsPropertyPage extends PropertyPage
getSettings().put(INDEX, fIncludesSymbolsBlock.getPageIndex());
Shell shell = getControl().getShell();
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
-
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- fIncludesSymbolsBlock.configureCProject(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ IRunnableWithProgress runnable = monitor -> {
+ try {
+ fIncludesSymbolsBlock.configureCProject(monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
};
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
@@ -237,17 +232,13 @@ public class IncludesSymbolsPropertyPage extends PropertyPage
if (event.hasContentChanged()) {
Control control = getControl();
if (control != null && !control.isDisposed()) {
- control.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- Control control = getControl();
- if (control != null && !control.isDisposed()) {
- try {
- fIncludesSymbolsBlock.init(getCElement(), fIncludesSymbolsBlock.getRawCPath());
- } catch (CModelException e) {
- CUIPlugin.log(e);
- }
+ control.getDisplay().asyncExec(() -> {
+ Control control1 = getControl();
+ if (control1 != null && !control1.isDisposed()) {
+ try {
+ fIncludesSymbolsBlock.init(getCElement(), fIncludesSymbolsBlock.getRawCPath());
+ } catch (CModelException e) {
+ CUIPlugin.log(e);
}
}
});
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java
index 796215f4c6..a5beece483 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java
@@ -25,7 +25,6 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -160,23 +159,19 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
@Override
public void create() {
- BusyIndicator.showWhile(null, new Runnable() {
+ BusyIndicator.showWhile(null, () -> {
+ access$superCreate();
- @Override
- public void run() {
- access$superCreate();
-
- fViewer.setCheckedElements(getInitialElementSelections().toArray());
+ fViewer.setCheckedElements(getInitialElementSelections().toArray());
- fViewer.expandToLevel(2);
- if (fExisting != null) {
- for (Iterator<Object> iter = fExisting.iterator(); iter.hasNext();) {
- fViewer.reveal(iter.next());
- }
+ fViewer.expandToLevel(2);
+ if (fExisting != null) {
+ for (Iterator<Object> iter = fExisting.iterator(); iter.hasNext();) {
+ fViewer.reveal(iter.next());
}
-
- updateOKStatus();
}
+
+ updateOKStatus();
});
}
@@ -193,13 +188,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
fViewer.setContentProvider(fContentProvider);
fViewer.setLabelProvider(fLabelProvider);
- fViewer.addCheckStateListener(new ICheckStateListener() {
-
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateOKStatus();
- }
- });
+ fViewer.addCheckStateListener(event -> updateOKStatus());
fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (fFilters != null) {
@@ -262,13 +251,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
if (fFocusElement != null) {
treeViewer.setSelection(new StructuredSelection(fFocusElement), true);
}
- treeViewer.addCheckStateListener(new ICheckStateListener() {
-
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- forceExistingChecked(event);
- }
- });
+ treeViewer.addCheckStateListener(event -> forceExistingChecked(event));
applyDialogFont(composite);
return composite;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java
index 761d3e32b2..b1d124d1d7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java
@@ -422,15 +422,11 @@ public class SourceAttachmentBlock {
* Creates a runnable that sets the source attachment by modifying the project's classpath or updating a container.
*/
public IRunnableWithProgress getRunnable(final Shell shell) {
- return new IRunnableWithProgress() {
-
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- attachSource(shell, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ return monitor -> {
+ try {
+ attachSource(shell, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
};
}
@@ -475,14 +471,10 @@ public class SourceAttachmentBlock {
private boolean putJarOnClasspathDialog(Shell shell) {
final boolean[] result = new boolean[1];
- shell.getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- String title = CPathEntryMessages.SourceAttachmentBlock_putoncpdialog_title;
- String message = CPathEntryMessages.SourceAttachmentBlock_putoncpdialog_message;
- result[0] = MessageDialog.openQuestion(CUIPlugin.getActiveWorkbenchShell(), title, message);
- }
+ shell.getDisplay().syncExec(() -> {
+ String title = CPathEntryMessages.SourceAttachmentBlock_putoncpdialog_title;
+ String message = CPathEntryMessages.SourceAttachmentBlock_putoncpdialog_message;
+ result[0] = MessageDialog.openQuestion(CUIPlugin.getActiveWorkbenchShell(), title, message);
});
return result[0];
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDropAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDropAdapter.java
index d992a62035..20e99ec3ae 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDropAdapter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDropAdapter.java
@@ -92,14 +92,11 @@ public class FileTransferDropAdapter extends CDTViewerDropAdapter implements Tra
// Run the import operation asynchronously.
// Otherwise the drag source (e.g., Windows Explorer) will be blocked
// while the operation executes. Fixes bug 35796.
- Display.getCurrent().asyncExec(new Runnable() {
- @Override
- public void run() {
- getShell().forceActive();
- new CopyFilesAndFoldersOperation(getShell()).copyFiles((String[]) data, target);
- // Import always performs a copy.
- event.detail = DND.DROP_COPY;
- }
+ Display.getCurrent().asyncExec(() -> {
+ getShell().forceActive();
+ new CopyFilesAndFoldersOperation(getShell()).copyFiles((String[]) data, target);
+ // Import always performs a copy.
+ event.detail = DND.DROP_COPY;
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java
index 7205c082c0..02529a91d4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java
@@ -70,16 +70,13 @@ public class AddIncludeAction extends TextEditorAction {
@Override
public <T> T selectElement(final Collection<T> elements) {
final Object[] result = new Object[1];
- runInUIThread(new Runnable() {
- @Override
- public void run() {
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
- dialog.setElements(elements.toArray());
- dialog.setTitle(CEditorMessages.AddInclude_label);
- dialog.setMessage(CEditorMessages.AddInclude_description);
- if (dialog.open() == Window.OK)
- result[0] = dialog.getFirstResult();
- }
+ runInUIThread(() -> {
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
+ dialog.setElements(elements.toArray());
+ dialog.setTitle(CEditorMessages.AddInclude_label);
+ dialog.setMessage(CEditorMessages.AddInclude_description);
+ if (dialog.open() == Window.OK)
+ result[0] = dialog.getFirstResult();
});
return (T) result[0];
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
index eb35a76809..9da4664ef7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
@@ -85,20 +85,17 @@ public class CContentOutlinerProvider extends BaseCElementContentProvider {
*/
public void contentUpdated() {
if (treeViewer != null && !treeViewer.getControl().isDisposed()) {
- treeViewer.getControl().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!treeViewer.getControl().isDisposed()) {
- if (fInitialDeltaPending) {
- fInitialDeltaPending = false;
- treeViewer.setInput(root);
- } else {
- // setting the selection here causes a secondary editor to scroll
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=191358
- // final ISelection sel = treeViewer.getSelection();
- // treeViewer.setSelection(updateSelection(sel));
- treeViewer.refresh();
- }
+ treeViewer.getControl().getDisplay().asyncExec(() -> {
+ if (!treeViewer.getControl().isDisposed()) {
+ if (fInitialDeltaPending) {
+ fInitialDeltaPending = false;
+ treeViewer.setInput(root);
+ } else {
+ // setting the selection here causes a secondary editor to scroll
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=191358
+ // final ISelection sel = treeViewer.getSelection();
+ // treeViewer.setSelection(updateSelection(sel));
+ treeViewer.refresh();
}
}
});
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
index 183d606b18..9ddb6a982d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
@@ -49,7 +49,6 @@ import org.eclipse.cdt.core.model.ISourceReference;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.ITranslationUnitHolder;
import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
@@ -137,8 +136,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension;
import org.eclipse.jface.text.IDocumentExtension4;
import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ISelectionValidator;
@@ -199,17 +196,13 @@ import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.custom.ST;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPartService;
@@ -840,26 +833,23 @@ public class CEditor extends TextEditor
final IDocument document = sourceViewer.getDocument();
if (document instanceof IDocumentExtension) {
IDocumentExtension extension = (IDocumentExtension) document;
- extension.registerPostNotificationReplace(null, new IDocumentExtension.IReplace() {
- @Override
- public void perform(IDocument d, IDocumentListener owner) {
- if ((level.fFirstPosition.isDeleted || level.fFirstPosition.length == 0)
- && !level.fSecondPosition.isDeleted
- && level.fSecondPosition.offset == level.fFirstPosition.offset) {
- try {
- document.replace(level.fSecondPosition.offset, level.fSecondPosition.length, null);
- } catch (BadLocationException e) {
- CUIPlugin.log(e);
- }
+ extension.registerPostNotificationReplace(null, (d, owner) -> {
+ if ((level.fFirstPosition.isDeleted || level.fFirstPosition.length == 0)
+ && !level.fSecondPosition.isDeleted
+ && level.fSecondPosition.offset == level.fFirstPosition.offset) {
+ try {
+ document.replace(level.fSecondPosition.offset, level.fSecondPosition.length, null);
+ } catch (BadLocationException e1) {
+ CUIPlugin.log(e1);
}
+ }
- if (fBracketLevelStack.size() == 0) {
- document.removePositionUpdater(fUpdater);
- try {
- document.removePositionCategory(CATEGORY);
- } catch (BadPositionCategoryException e) {
- CUIPlugin.log(e);
- }
+ if (fBracketLevelStack.size() == 0) {
+ document.removePositionUpdater(fUpdater);
+ try {
+ document.removePositionCategory(CATEGORY);
+ } catch (BadPositionCategoryException e2) {
+ CUIPlugin.log(e2);
}
}
});
@@ -1590,12 +1580,7 @@ public class CEditor extends TextEditor
ce = null;
}
final ISelection selection = ce != null ? new StructuredSelection(ce) : null;
- return (T) new IShowInSource() {
- @Override
- public ShowInContext getShowInContext() {
- return new ShowInContext(getEditorInput(), selection);
- }
- };
+ return (T) (IShowInSource) () -> new ShowInContext(getEditorInput(), selection);
} else if (adapterClass.isAssignableFrom(ProjectionAnnotationModel.class)) {
if (fProjectionSupport != null) {
T adapter = fProjectionSupport.getAdapter(getSourceViewer(), adapterClass);
@@ -1764,13 +1749,10 @@ public class CEditor extends TextEditor
if (isEnableScalablilityMode()) {
if (PreferenceConstants.SCALABILITY_RECONCILER.equals(property)
|| PreferenceConstants.SCALABILITY_SYNTAX_COLOR.equals(property)) {
- BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() {
- @Override
- public void run() {
- setOutlinePageInput(fOutlinePage, getEditorInput());
- asv.unconfigure();
- asv.configure(getSourceViewerConfiguration());
- }
+ BusyIndicator.showWhile(getSite().getShell().getDisplay(), () -> {
+ setOutlinePageInput(fOutlinePage, getEditorInput());
+ asv.unconfigure();
+ asv.configure(getSourceViewerConfiguration());
});
return;
}
@@ -2525,19 +2507,16 @@ public class CEditor extends TextEditor
// bug 291008 - register custom help listener
final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- parent.addHelpListener(new HelpListener() {
- @Override
- public void helpRequested(HelpEvent e) {
- IContextProvider provider = CEditor.this.getAdapter(IContextProvider.class);
- if (provider != null) {
- IContext context = provider.getContext(CEditor.this);
- if (context != null) {
- helpSystem.displayHelp(context);
- return;
- }
+ parent.addHelpListener(e -> {
+ IContextProvider provider = CEditor.this.getAdapter(IContextProvider.class);
+ if (provider != null) {
+ IContext context = provider.getContext(CEditor.this);
+ if (context != null) {
+ helpSystem.displayHelp(context);
+ return;
}
- helpSystem.displayHelp(ICHelpContextIds.CEDITOR_VIEW);
}
+ helpSystem.displayHelp(ICHelpContextIds.CEDITOR_VIEW);
});
fEditorSelectionChangedListener = new EditorSelectionChangedListener();
@@ -2832,12 +2811,8 @@ public class CEditor extends TextEditor
fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
fProjectionSupport.addSummarizableAnnotationType("org.eclipse.search.results"); //$NON-NLS-1$
- fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell shell) {
- return new SourceViewerInformationControl(shell, false, getOrientation(), null);
- }
- });
+ fProjectionSupport.setHoverControlCreator(
+ shell -> new SourceViewerInformationControl(shell, false, getOrientation(), null));
fProjectionSupport.install();
fProjectionModelUpdater = CUIPlugin.getDefault().getFoldingStructureProviderRegistry()
@@ -3467,24 +3442,16 @@ public class CEditor extends TextEditor
protected void installOccurrencesFinder(boolean forceUpdate) {
fMarkOccurrenceAnnotations = true;
- fPostSelectionListenerWithAST = new ISelectionListenerWithAST() {
- @Override
- public void selectionChanged(IEditorPart part, ITextSelection selection, IASTTranslationUnit astRoot) {
- updateOccurrenceAnnotations(selection, astRoot);
- }
- };
+ fPostSelectionListenerWithAST = (part, selection, astRoot) -> updateOccurrenceAnnotations(selection, astRoot);
SelectionListenerWithASTManager.getDefault().addListener(this, fPostSelectionListenerWithAST);
if (forceUpdate && getSelectionProvider() != null) {
ICElement inputCElement = getInputCElement();
if (inputCElement instanceof ITranslationUnit) {
fForcedMarkOccurrencesSelection = getSelectionProvider().getSelection();
ASTProvider.getASTProvider().runOnAST(inputCElement, ASTProvider.WAIT_NO, getProgressMonitor(),
- new ASTRunnable() {
- @Override
- public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
- updateOccurrenceAnnotations((ITextSelection) fForcedMarkOccurrencesSelection, ast);
- return Status.OK_STATUS;
- }
+ (lang, ast) -> {
+ updateOccurrenceAnnotations((ITextSelection) fForcedMarkOccurrencesSelection, ast);
+ return Status.OK_STATUS;
});
}
}
@@ -3675,13 +3642,10 @@ public class CEditor extends TextEditor
ICElement inputCElement = getInputCElement();
if (provideAST && inputCElement instanceof ITranslationUnit) {
ASTProvider.getASTProvider().runOnAST(inputCElement, ASTProvider.WAIT_ACTIVE_ONLY, getProgressMonitor(),
- new ASTRunnable() {
- @Override
- public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
- if (ast != null)
- fOverrideIndicatorManager.reconciled(ast, true, getProgressMonitor());
- return Status.OK_STATUS;
- }
+ (lang, ast) -> {
+ if (ast != null)
+ fOverrideIndicatorManager.reconciled(ast, true, getProgressMonitor());
+ return Status.OK_STATUS;
});
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java
index 5e627d5c12..8b92fcda9c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java
@@ -108,12 +108,7 @@ public class CEditorErrorTickUpdater implements IProblemChangedListener {
private void postImageChange(final Image newImage) {
Shell shell = fCEditor.getEditorSite().getShell();
if (shell != null && !shell.isDisposed()) {
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- fCEditor.updatedTitleImage(newImage);
- }
- });
+ shell.getDisplay().syncExec(() -> fCEditor.updatedTitleImage(newImage));
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultBinaryFileEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultBinaryFileEditor.java
index b700e191bc..a4b390fe21 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultBinaryFileEditor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultBinaryFileEditor.java
@@ -249,14 +249,11 @@ public class DefaultBinaryFileEditor extends AbstractTextEditor implements IReso
}
protected void refresh() {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- try {
- doSetInput(getEditorInput());
- } catch (CoreException e) {
- CUIPlugin.log(e);
- }
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
+ try {
+ doSetInput(getEditorInput());
+ } catch (CoreException e) {
+ CUIPlugin.log(e);
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java
index d3f916e79b..32f08c0fa9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java
@@ -44,12 +44,8 @@ class EclipsePreferencesAdapter implements IPreferenceStore {
@Override
public void preferenceChange(final IEclipsePreferences.PreferenceChangeEvent event) {
if (Display.getCurrent() == null) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue());
- }
- });
+ Display.getDefault().asyncExec(
+ () -> firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()));
} else {
firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue());
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java
index 1a7aea46a5..3aebe616ca 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java
@@ -30,9 +30,7 @@ import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfndefStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.internal.core.model.ASTCache;
import org.eclipse.cdt.internal.ui.LineBackgroundPainter;
import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
import org.eclipse.cdt.ui.CUIPlugin;
@@ -108,12 +106,9 @@ public class InactiveCodeHighlighting implements ICReconcilingListener, ITextInp
if (fTranslationUnit != null) {
final ASTProvider astProvider = CUIPlugin.getDefault().getASTProvider();
result = astProvider.runOnAST(fTranslationUnit, ASTProvider.WAIT_IF_OPEN, monitor,
- new ASTCache.ASTRunnable() {
- @Override
- public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) {
- reconciled(ast, true, monitor);
- return Status.OK_STATUS;
- }
+ (lang, ast) -> {
+ reconciled(ast, true, monitor);
+ return Status.OK_STATUS;
});
}
if (monitor.isCanceled()) {
@@ -200,13 +195,10 @@ public class InactiveCodeHighlighting implements ICReconcilingListener, ITextInp
return;
}
final List<Position> newInactiveCodePositions = collectInactiveCodePositions(ast);
- Runnable updater = new Runnable() {
- @Override
- public void run() {
- if (fEditor != null && fLineBackgroundPainter != null && !fLineBackgroundPainter.isDisposed()) {
- fLineBackgroundPainter.replaceHighlightPositions(fInactiveCodePositions, newInactiveCodePositions);
- fInactiveCodePositions = newInactiveCodePositions;
- }
+ Runnable updater = () -> {
+ if (fEditor != null && fLineBackgroundPainter != null && !fLineBackgroundPainter.isDisposed()) {
+ fLineBackgroundPainter.replaceHighlightPositions(fInactiveCodePositions, newInactiveCodePositions);
+ fInactiveCodePositions = newInactiveCodePositions;
}
};
if (fEditor != null) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java
index 18e32bf442..746454fcfe 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java
@@ -59,17 +59,14 @@ public class InteractiveHeaderChooser implements IHeaderChooser {
// Ask the user.
final IPath[] elemArray = headers.toArray(new IPath[headers.size()]);
final IPath[] selectedElement = new IPath[1];
- runInUIThread(new Runnable() {
- @Override
- public void run() {
- if (!shell.isDisposed()) {
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
- dialog.setElements(elemArray);
- dialog.setTitle(title);
- dialog.setMessage(NLS.bind(CEditorMessages.OrganizeIncludes_choose_header, bindingName));
- if (dialog.open() == Window.OK) {
- selectedElement[0] = (IPath) dialog.getFirstResult();
- }
+ runInUIThread(() -> {
+ if (!shell.isDisposed()) {
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
+ dialog.setElements(elemArray);
+ dialog.setTitle(title);
+ dialog.setMessage(NLS.bind(CEditorMessages.OrganizeIncludes_choose_header, bindingName));
+ if (dialog.open() == Window.OK) {
+ selectedElement[0] = (IPath) dialog.getFirstResult();
}
}
});
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java
index d81f5646e7..7ce371c063 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java
@@ -343,12 +343,7 @@ public class SemanticHighlightingPresenter implements ITextPresentationListener,
if (isCanceled())
return null;
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- updatePresentation(textPresentation, added, removed);
- }
- };
+ Runnable runnable = () -> updatePresentation(textPresentation, added, removed);
return runnable;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java
index 342903f8f5..9bb6f15674 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java
@@ -102,12 +102,7 @@ public final class ToggleCommentAction extends TextEditorAction {
if (shell != null && !shell.isDisposed())
display = shell.getDisplay();
- BusyIndicator.showWhile(display, new Runnable() {
- @Override
- public void run() {
- fOperationTarget.doOperation(operationCode);
- }
- });
+ BusyIndicator.showWhile(display, () -> fOperationTarget.doOperation(operationCode));
}
/**
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBSetInputJob.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBSetInputJob.java
index 0639739921..0faa0592fe 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBSetInputJob.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBSetInputJob.java
@@ -41,12 +41,7 @@ public class IBSetInputJob extends Job {
protected IStatus run(IProgressMonitor monitor) {
if (CCorePlugin.getIndexManager().joinIndexer(IIndexManager.FOREVER, monitor)) {
try {
- fDisplay.asyncExec(new Runnable() {
- @Override
- public void run() {
- fViewPart.setInput(fInput);
- }
- });
+ fDisplay.asyncExec(() -> fViewPart.setInput(fInput));
} catch (SWTException e) {
// display may be disposed
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java
index 6090b5ab3f..2f08a5a6ee 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java
@@ -55,21 +55,17 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.bindings.BindingManagerEvent;
import org.eclipse.jface.bindings.IBindingManagerListener;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -240,23 +236,17 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
final ITranslationUnit alt = CoreModelUtil
.findTranslationUnitForLocation(input.getLocation(), input.getCProject());
if (alt != null && IndexUI.isIndexed(index, alt)) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fTreeViewer.getInput() == input) {
- setInput(alt);
- }
+ display.asyncExec(() -> {
+ if (fTreeViewer.getInput() == input) {
+ setInput(alt);
}
});
} else {
final String msg = IndexUI.getFileNotIndexedMessage(input);
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fTreeViewer.getInput() == input) {
- setMessage(msg);
- fTreeViewer.setInput(null);
- }
+ display.asyncExec(() -> {
+ if (fTreeViewer.getInput() == input) {
+ setMessage(msg);
+ fTreeViewer.setInput(null);
}
});
}
@@ -298,16 +288,12 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
if (bindingService != null) {
- bindingManagerListener = new IBindingManagerListener() {
- @Override
- public void bindingManagerChanged(BindingManagerEvent event) {
- if (event.isActiveBindingsChanged()) {
- String keyBinding = bindingService
- .getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_DELETE);
- if (keyBinding != null) {
- fRemoveFromViewAction
- .setText(IBMessages.IBViewPart_RemoveFromView_label + '\t' + keyBinding);
- }
+ bindingManagerListener = event -> {
+ if (event.isActiveBindingsChanged()) {
+ String keyBinding = bindingService
+ .getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_DELETE);
+ if (keyBinding != null) {
+ fRemoveFromViewAction.setText(IBMessages.IBViewPart_RemoveFromView_label + '\t' + keyBinding);
}
}
};
@@ -435,12 +421,7 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
private void createContextMenu() {
MenuManager manager = new MenuManager();
manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager m) {
- onContextMenuAboutToShow(m);
- }
- });
+ manager.addMenuListener(m -> onContextMenuAboutToShow(m));
Menu menu = manager.createContextMenu(fTreeViewer.getControl());
fTreeViewer.getControl().setMenu(menu);
IWorkbenchPartSite site = getSite();
@@ -461,12 +442,7 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
fTreeViewer.setContentProvider(fContentProvider);
fTreeViewer.setLabelProvider(fLabelProvider);
fTreeViewer.setAutoExpandLevel(2);
- fTreeViewer.addOpenListener(new IOpenListener() {
- @Override
- public void open(OpenEvent event) {
- onShowInclude(event.getSelection());
- }
- });
+ fTreeViewer.addOpenListener(event -> onShowInclude(event.getSelection()));
}
private void createInfoPage() {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java
index 13b005fa17..478d2d6404 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java
@@ -48,9 +48,6 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -331,12 +328,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
getSite().registerContextMenu(menuMgr, viewer);
getSite().setSelectionProvider(viewer);
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged(event);
- }
- });
+ viewer.addSelectionChangedListener(event -> handleSelectionChanged(event));
}
@Override
@@ -367,12 +359,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- IndexView.this.fillContextMenu(manager);
- }
- });
+ menuMgr.addMenuListener(manager -> IndexView.this.fillContextMenu(manager));
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
@@ -393,12 +380,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
}
private void hookDoubleClickAction() {
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- openDefinitionAction.run();
- }
- });
+ viewer.addDoubleClickListener(event -> openDefinitionAction.run());
}
private void contributeToActionBars() {
@@ -426,13 +408,10 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
private void requestUpdate() {
if (!fUpdateRequested) {
fUpdateRequested = true;
- viewer.getControl().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- fUpdateRequested = false;
- if (!viewer.getControl().isDisposed()) {
- contentProvider.recompute();
- }
+ viewer.getControl().getDisplay().asyncExec(() -> {
+ fUpdateRequested = false;
+ if (!viewer.getControl().isDisposed()) {
+ contentProvider.recompute();
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java
index 7e77928980..9e6775df92 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java
@@ -81,33 +81,24 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
fetchWorkspaceMappings();
fInheritedMappingWidget.createContents(group, null);
- fInheritedMappingsChangeListener = new ILanguageMappingChangeListener() {
- @Override
- public void handleLanguageMappingChangeEvent(final ILanguageMappingChangeEvent event) {
- if (event.getType() == ILanguageMappingChangeEvent.TYPE_WORKSPACE) {
- if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
- fetchWorkspaceMappings();
- fInheritedMappingWidget.refreshMappings();
- }
- }
- });
- }
- } else if (event.getType() == ILanguageMappingChangeEvent.TYPE_PROJECT) {
- if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
- fetchMappings(event.getProject());
- fMappingWidget.refreshMappings();
- }
- }
- });
- }
+ fInheritedMappingsChangeListener = event -> {
+ if (event.getType() == ILanguageMappingChangeEvent.TYPE_WORKSPACE) {
+ if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
+ Display.getDefault().asyncExec(() -> {
+ if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
+ fetchWorkspaceMappings();
+ fInheritedMappingWidget.refreshMappings();
+ }
+ });
+ }
+ } else if (event.getType() == ILanguageMappingChangeEvent.TYPE_PROJECT) {
+ if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
+ Display.getDefault().asyncExec(() -> {
+ if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
+ fetchMappings(event.getProject());
+ fMappingWidget.refreshMappings();
+ }
+ });
}
}
};
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java
index c6591ab41a..10223e4aa7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java
@@ -39,11 +39,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IMemento;
@@ -70,46 +68,35 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
IMemento memento = commonContentExtensionSite.getMemento();
restoreState(memento);
- fPropertyChangeListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- boolean refreshViewer = false;
- String property = event.getProperty();
- Object newValue = event.getNewValue();
-
- if (property.equals(PreferenceConstants.PREF_SHOW_CU_CHILDREN)) {
- boolean showCUChildren = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
- setProvideMembers(showCUChildren);
- refreshViewer = true;
- } else if (property.equals(PreferenceConstants.CVIEW_GROUP_INCLUDES)) {
- boolean groupIncludes = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
- setIncludesGrouping(groupIncludes);
- refreshViewer = true;
- } else if (property.equals(PreferenceConstants.CVIEW_GROUP_MACROS)) {
- boolean groupMacros = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
- setMacroGrouping(groupMacros);
- refreshViewer = true;
- }
+ fPropertyChangeListener = event -> {
+ boolean refreshViewer = false;
+ String property = event.getProperty();
+ Object newValue = event.getNewValue();
+
+ if (property.equals(PreferenceConstants.PREF_SHOW_CU_CHILDREN)) {
+ boolean showCUChildren = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
+ setProvideMembers(showCUChildren);
+ refreshViewer = true;
+ } else if (property.equals(PreferenceConstants.CVIEW_GROUP_INCLUDES)) {
+ boolean groupIncludes = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
+ setIncludesGrouping(groupIncludes);
+ refreshViewer = true;
+ } else if (property.equals(PreferenceConstants.CVIEW_GROUP_MACROS)) {
+ boolean groupMacros = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
+ setMacroGrouping(groupMacros);
+ refreshViewer = true;
+ }
- if (refreshViewer && getViewer() != null) {
- getViewer().refresh();
- }
+ if (refreshViewer && getViewer() != null) {
+ getViewer().refresh();
}
};
CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
// Note that this listener listens to CCorePlugin preferences
- fPreferenceChangeListener = new IPreferenceChangeListener() {
- @Override
- public void preferenceChange(PreferenceChangeEvent event) {
- if (event.getKey().equals(CCorePreferenceConstants.SHOW_SOURCE_ROOTS_AT_TOP_LEVEL_OF_PROJECT)) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- getViewer().refresh();
- }
- });
- }
+ fPreferenceChangeListener = event -> {
+ if (event.getKey().equals(CCorePreferenceConstants.SHOW_SOURCE_ROOTS_AT_TOP_LEVEL_OF_PROJECT)) {
+ Display.getDefault().asyncExec(() -> getViewer().refresh());
}
};
InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).addPreferenceChangeListener(fPreferenceChangeListener);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java
index 5bf9be83ce..d0f88d6645 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java
@@ -33,7 +33,6 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
@@ -114,13 +113,10 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
// Run the import operation asynchronously.
// Otherwise the drag source (e.g., Windows Explorer) will be blocked
// while the operation executes. Fixes bug 35796.
- Display.getCurrent().asyncExec(new Runnable() {
- @Override
- public void run() {
- getShell().forceActive();
- CopyFilesAndFoldersOperation op = new CopyFilesAndFoldersOperation(getShell());
- op.copyOrLinkFiles(names, destination, dropOperation);
- }
+ Display.getCurrent().asyncExec(() -> {
+ getShell().forceActive();
+ CopyFilesAndFoldersOperation op = new CopyFilesAndFoldersOperation(getShell());
+ op.copyOrLinkFiles(names, destination, dropOperation);
});
} else if (event.detail == DND.DROP_COPY || event.detail == DND.DROP_LINK) {
return performResourceCopy(dropAdapter, getShell(), resources);
@@ -363,14 +359,11 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
}
}
final ICElement[] siblings = neighbours;
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- CoreModel.getDefault().getCModel().copy(cElements, containers, siblings, null, false, monitor);
- } catch (CModelException e) {
- throw new InvocationTargetException(e);
- }
+ IRunnableWithProgress runnable = monitor -> {
+ try {
+ CoreModel.getDefault().getCModel().copy(cElements, containers, siblings, null, false, monitor);
+ } catch (CModelException e) {
+ throw new InvocationTargetException(e);
}
};
run(runnable);
@@ -403,14 +396,11 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
}
}
final ICElement[] siblings = neighbours;
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- CoreModel.getDefault().getCModel().move(cElements, containers, siblings, null, false, monitor);
- } catch (CModelException e) {
- throw new InvocationTargetException(e);
- }
+ IRunnableWithProgress runnable = monitor -> {
+ try {
+ CoreModel.getDefault().getCModel().move(cElements, containers, siblings, null, false, monitor);
+ } catch (CModelException e) {
+ throw new InvocationTargetException(e);
}
};
run(runnable);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java
index fc10db591e..cf2f1132b2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java
@@ -50,11 +50,9 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.osgi.framework.Bundle;
@@ -314,12 +312,9 @@ public class CEditorPreferencePage extends AbstractPreferencePage {
String text = PreferencesMessages.CEditorPreferencePage_link;
Link link = new Link(parent, SWT.NONE);
link.setText(text);
- link.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- String u = event.text;
- PreferencesUtil.createPreferenceDialogOn(getShell(), u, null, null);
- }
+ link.addListener(SWT.Selection, event -> {
+ String u = event.text;
+ PreferencesUtil.createPreferenceDialogOn(getShell(), u, null, null);
});
// TODO replace by link-specific tooltips when
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 gets fixed
@@ -364,12 +359,9 @@ public class CEditorPreferencePage extends AbstractPreferencePage {
for (String[] element : fAppearanceColorListModel) {
fAppearanceColorList.add(element[0]);
}
- fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- fAppearanceColorList.select(0);
- handleAppearanceColorListSelection();
- }
+ fAppearanceColorList.getDisplay().asyncExec(() -> {
+ fAppearanceColorList.select(0);
+ handleAppearanceColorListSelection();
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludePragmasBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludePragmasBlock.java
index abdc8d82c6..c7e1a55dc7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludePragmasBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludePragmasBlock.java
@@ -29,9 +29,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWebBrowser;
@@ -98,27 +96,19 @@ public class IncludePragmasBlock extends OptionsConfigurationBlock {
String text = PreferencesMessages.IncludePragmasBlock_description;
Link link = new Link(parent, SWT.NONE);
link.setText(text);
- link.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(final Event event) {
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- try {
- URL url = new URL(event.text);
- IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
- IWebBrowser browser = browserSupport.getExternalBrowser();
- browser.openURL(url);
- } catch (PartInitException e) {
- // TODO(sprigogin): Should we show an error dialog?
- CUIPlugin.log(e.getStatus());
- } catch (MalformedURLException e) {
- CUIPlugin.log(e);
- }
- }
- });
+ link.addListener(SWT.Selection, event -> BusyIndicator.showWhile(null, () -> {
+ try {
+ URL url = new URL(event.text);
+ IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
+ IWebBrowser browser = browserSupport.getExternalBrowser();
+ browser.openURL(url);
+ } catch (PartInitException e1) {
+ // TODO(sprigogin): Should we show an error dialog?
+ CUIPlugin.log(e1.getStatus());
+ } catch (MalformedURLException e2) {
+ CUIPlugin.log(e2);
}
- });
+ }));
// TODO replace by link-specific tooltips when
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 is fixed
link.setToolTipText(PreferencesMessages.IncludePragmasBlock_link_tooltip);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/RefactoringExecutionHelper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/RefactoringExecutionHelper.java
index ab37d9efbd..cfbac60541 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/RefactoringExecutionHelper.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/RefactoringExecutionHelper.java
@@ -78,12 +78,7 @@ public class RefactoringExecutionHelper {
if (status.getSeverity() >= fStopSeverity) {
final boolean[] canceled = { false };
if (fForked) {
- fParent.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- canceled[0] = showStatusDialog(status);
- }
- });
+ fParent.getDisplay().syncExec(() -> canceled[0] = showStatusDialog(status));
} else {
canceled[0] = showStatusDialog(status);
}
@@ -186,12 +181,7 @@ public class RefactoringExecutionHelper {
final ISchedulingRule rule = getSchedulingRule();
try {
try {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- manager.beginRule(rule, null);
- }
- };
+ Runnable r = () -> manager.beginRule(rule, null);
BusyIndicator.showWhile(fParent.getDisplay(), r);
} catch (OperationCanceledException e) {
throw new InterruptedException(e.getMessage());
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java
index 5795eb9c6c..3a6dad32a8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java
@@ -172,13 +172,10 @@ public class ParameterNamesInputPage extends UserInputWizardPage {
if (shell != null) {
Display display = shell.getDisplay();
if (display != null) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- Control control = translationUnitPreview.getControl();
- if (control != null && !control.isDisposed()) {
- translationUnitPreview.setPreviewText(text);
- }
+ display.asyncExec(() -> {
+ Control control = translationUnitPreview.getControl();
+ if (control != null && !control.isDisposed()) {
+ translationUnitPreview.setPreviewText(text);
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java
index c44b8adef5..29e2f4dfbd 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java
@@ -52,15 +52,11 @@ import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
@@ -102,29 +98,25 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
fEditor.getSite().getShell().addControlListener(this);
viewer.addTextListener(this);
viewer.addViewportListener(this);
- fPopup.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- fEditor.getSite().getWorkbenchWindow().getPartService()
- .removePartListener(PopupVisibilityManager.this);
- if (!textWidget.isDisposed()) {
- textWidget.removeControlListener(PopupVisibilityManager.this);
- textWidget.removeMouseListener(PopupVisibilityManager.this);
- textWidget.removeKeyListener(PopupVisibilityManager.this);
- }
- fEditor.getSite().getShell().removeControlListener(PopupVisibilityManager.this);
- viewer.removeTextListener(PopupVisibilityManager.this);
- viewer.removeViewportListener(PopupVisibilityManager.this);
- if (fMenuImage != null) {
- fMenuImage.dispose();
- fMenuImage = null;
- }
- if (fMenuManager != null) {
- fMenuManager.dispose();
- fMenuManager = null;
- }
- fRenameLinkedMode.cancel();
+ fPopup.addDisposeListener(e -> {
+ fEditor.getSite().getWorkbenchWindow().getPartService().removePartListener(PopupVisibilityManager.this);
+ if (!textWidget.isDisposed()) {
+ textWidget.removeControlListener(PopupVisibilityManager.this);
+ textWidget.removeMouseListener(PopupVisibilityManager.this);
+ textWidget.removeKeyListener(PopupVisibilityManager.this);
}
+ fEditor.getSite().getShell().removeControlListener(PopupVisibilityManager.this);
+ viewer.removeTextListener(PopupVisibilityManager.this);
+ viewer.removeViewportListener(PopupVisibilityManager.this);
+ if (fMenuImage != null) {
+ fMenuImage.dispose();
+ fMenuImage = null;
+ }
+ if (fMenuManager != null) {
+ fMenuManager.dispose();
+ fMenuManager = null;
+ }
+ fRenameLinkedMode.cancel();
});
}
@@ -324,26 +316,18 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
return;
final Shell editorShell = fEditor.getSite().getShell();
- display.asyncExec(new Runnable() {
+ display.asyncExec(() -> {
// Post to UI thread since editor shell only gets activated after popup has lost focus
- @Override
- public void run() {
- Shell activeShell = display.getActiveShell();
- if (activeShell != editorShell) {
- fRenameLinkedMode.cancel();
- }
+ Shell activeShell = display.getActiveShell();
+ if (activeShell != editorShell) {
+ fRenameLinkedMode.cancel();
}
});
}
});
if (!MAC) { // carbon and cocoa draw their own border...
- fPopup.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent pe) {
- pe.gc.drawPolygon(getPolygon(true));
- }
- });
+ fPopup.addPaintListener(pe -> pe.gc.drawPolygon(getPolygon(true)));
}
UIJob delayJob = new UIJob(display, RenameMessages.RenameInformationPopup_delayJobName) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFileCreator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFileCreator.java
index a3ecc67ccb..dda5efd1d7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFileCreator.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFileCreator.java
@@ -55,19 +55,16 @@ public class ToggleFileCreator {
return context.getDefaultAnswer();
}
final boolean[] answer = new boolean[1];
- Runnable r = new Runnable() {
- @Override
- public void run() {
- Shell shell = CUIPlugin.getDefault().getWorkbench().getWorkbenchWindows()[0].getShell();
- String functionName;
- if (context.getDeclaration() != null) {
- functionName = context.getDeclaration().getRawSignature();
- } else {
- functionName = context.getDefinition().getDeclarator().getRawSignature();
- }
- answer[0] = MessageDialog.openQuestion(shell, Messages.ToggleFileCreator_NewImplFile,
- NLS.bind(Messages.ToggleFileCreator_CreateNewFilePrompt, getNewFileName(), functionName));
+ Runnable r = () -> {
+ Shell shell = CUIPlugin.getDefault().getWorkbench().getWorkbenchWindows()[0].getShell();
+ String functionName;
+ if (context.getDeclaration() != null) {
+ functionName = context.getDeclaration().getRawSignature();
+ } else {
+ functionName = context.getDefinition().getDeclarator().getRawSignature();
}
+ answer[0] = MessageDialog.openQuestion(shell, Messages.ToggleFileCreator_NewImplFile,
+ NLS.bind(Messages.ToggleFileCreator_CreateNewFilePrompt, getNewFileName(), functionName));
};
PlatformUI.getWorkbench().getDisplay().syncExec(r);
return answer[0];
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java
index ec2cb0d5e6..7db9a8abaf 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java
@@ -74,7 +74,6 @@ import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.core.index.IndexFilter;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICElementVisitor;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IInclude;
import org.eclipse.cdt.core.model.ILanguage;
@@ -197,14 +196,11 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
// Search for an element in the assembly file.
// Some things in assembly files like macro definitions are
// modelled in the C model, so those will be found here.
- fTranslationUnit.accept(new ICElementVisitor() {
- @Override
- public boolean visit(ICElement element) throws CoreException {
- if (element.getElementName().equals(fSelectedText)) {
- elems.add(element);
- }
- return true;
+ fTranslationUnit.accept(element1 -> {
+ if (element1.getElementName().equals(fSelectedText)) {
+ elems.add(element1);
}
+ return true;
});
// Search for a binding in the index.
@@ -812,14 +808,11 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
final int offset = fileloc.getNodeOffset();
final int length = fileloc.getNodeLength();
- runInUIThread(new Runnable() {
- @Override
- public void run() {
- try {
- fAction.open(path, offset, length);
- } catch (CoreException e) {
- CUIPlugin.log(e);
- }
+ runInUIThread(() -> {
+ try {
+ fAction.open(path, offset, length);
+ } catch (CoreException e) {
+ CUIPlugin.log(e);
}
});
return true;
@@ -834,14 +827,11 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
}
private void openInclude(IPath path) {
- runInUIThread(new Runnable() {
- @Override
- public void run() {
- try {
- fAction.open(path, 0, 0);
- } catch (CoreException e) {
- CUIPlugin.log(e);
- }
+ runInUIThread(() -> {
+ try {
+ fAction.open(path, 0, 0);
+ } catch (CoreException e) {
+ CUIPlugin.log(e);
}
});
}
@@ -877,15 +867,11 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
} else if (paths.size() == 1) {
openInclude(paths.get(0));
} else {
- runInUIThread(new Runnable() {
- @Override
- public void run() {
- IPath selected = OpenActionUtil.selectPath(paths,
- CEditorMessages.OpenDeclarationsAction_dialog_title,
- CEditorMessages.OpenDeclarationsAction_selectMessage);
- if (selected != null) {
- openInclude(selected);
- }
+ runInUIThread(() -> {
+ IPath selected = OpenActionUtil.selectPath(paths, CEditorMessages.OpenDeclarationsAction_dialog_title,
+ CEditorMessages.OpenDeclarationsAction_selectMessage);
+ if (selected != null) {
+ openInclude(selected);
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconciler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconciler.java
index cda418fa86..3f9c70523f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconciler.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconciler.java
@@ -282,12 +282,7 @@ public class CReconciler extends MonoReconciler {
CCorePlugin.getIndexManager().addIndexerStateListener(fIndexerListener);
CCorePlugin.getIndexManager().addIndexChangeListener(fIndexerListener);
- fTriggerReconcilerJob = new SingletonJob("Trigger Reconciler", new Runnable() { //$NON-NLS-1$
- @Override
- public void run() {
- forceReconciling();
- }
- });
+ fTriggerReconcilerJob = new SingletonJob("Trigger Reconciler", () -> forceReconciling()); //$NON-NLS-1$
}
@Override
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CColorManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CColorManager.java
index cee9988ae4..44dc7de10a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CColorManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CColorManager.java
@@ -80,12 +80,7 @@ public class CColorManager implements IColorManager {
colorTable = new HashMap<>(10);
fDisplayTable.put(display, colorTable);
if (fAutoDisposeOnDisplayDispose) {
- display.disposeExec(new Runnable() {
- @Override
- public void run() {
- dispose(display);
- }
- });
+ display.disposeExec(() -> dispose(display));
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java
index 11f620ee84..147d8d9632 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java
@@ -313,24 +313,21 @@ class THHierarchyModel {
synchronized private void onJobDone(final THGraph graph, Job job) {
if (fJob == job) {
fJob = null;
- fDisplay.asyncExec(new Runnable() {
- @Override
- public void run() {
- fGraph = graph;
- THGraphNode inputNode = fGraph.getInputNode();
- if (!fGraph.isFileIndexed()) {
- fView.setMessage(IndexUI.getFileNotIndexedMessage(fInput));
- } else if (inputNode == null) {
- fView.setMessage(Messages.THHierarchyModel_errorComputingHierarchy);
- } else {
- if (fTypeToSelect == fInput) {
- fTypeToSelect = inputNode.getElement();
- }
- fInput = inputNode.getElement();
+ fDisplay.asyncExec(() -> {
+ fGraph = graph;
+ THGraphNode inputNode = fGraph.getInputNode();
+ if (!fGraph.isFileIndexed()) {
+ fView.setMessage(IndexUI.getFileNotIndexedMessage(fInput));
+ } else if (inputNode == null) {
+ fView.setMessage(Messages.THHierarchyModel_errorComputingHierarchy);
+ } else {
+ if (fTypeToSelect == fInput) {
+ fTypeToSelect = inputNode.getElement();
}
- computeNodes();
- notifyEvent(END_OF_COMPUTATION);
+ fInput = inputNode.getElement();
}
+ computeNodes();
+ notifyEvent(END_OF_COMPUTATION);
});
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java
index f70d181939..4e7ed0e8d2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java
@@ -121,12 +121,8 @@ public class TypeHierarchyUI {
IRegion reg = new Region(sel.getOffset(), sel.getLength());
final ICElement[] elems = findInput(project, editorInput, reg);
if (elems != null && elems.length == 2) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- openInViewPart(editor.getSite().getWorkbenchWindow(), elems[0], elems[1]);
- }
- });
+ display.asyncExec(() -> openInViewPart(editor.getSite().getWorkbenchWindow(), elems[0],
+ elems[1]));
} else {
StatusLineHandler.showStatusLineMessage(editor.getSite(),
Messages.TypeHierarchyUI_OpenFailure_message);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CoreUtility.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CoreUtility.java
index b3affe73eb..2f96096380 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CoreUtility.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CoreUtility.java
@@ -60,14 +60,11 @@ public class CoreUtility {
}
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)
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java
index 8dfa618e90..07237ef5e8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java
@@ -84,11 +84,6 @@ public class ImageDescriptorRegistry {
}
private void hookDisplay() {
- fDisplay.disposeExec(new Runnable() {
- @Override
- public void run() {
- dispose();
- }
- });
+ fDisplay.disposeExec(() -> dispose());
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StatusLineHandler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StatusLineHandler.java
index ca69515140..1e18a5a534 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StatusLineHandler.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StatusLineHandler.java
@@ -33,42 +33,30 @@ public abstract class StatusLineHandler {
public static void showStatusLineMessage(final IWorkbenchSite site, final String message) {
// run the code to update the status line on the Display thread
// this way any other thread can invoke operationNotAvailable(String)
- CUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- IStatusLineManager statusManager = null;
- if (site instanceof IViewSite) {
- statusManager = ((IViewSite) site).getActionBars().getStatusLineManager();
- } else if (site instanceof IEditorSite) {
- statusManager = ((IEditorSite) site).getActionBars().getStatusLineManager();
- }
- if (statusManager != null)
- statusManager.setErrorMessage(message);
+ CUIPlugin.getStandardDisplay().asyncExec(() -> {
+ IStatusLineManager statusManager = null;
+ if (site instanceof IViewSite) {
+ statusManager = ((IViewSite) site).getActionBars().getStatusLineManager();
+ } else if (site instanceof IEditorSite) {
+ statusManager = ((IEditorSite) site).getActionBars().getStatusLineManager();
}
+ if (statusManager != null)
+ statusManager.setErrorMessage(message);
});
}
public static void clearStatusLine(final IWorkbenchSite site) {
// run the code to update the status line on the Display thread
// this way any other thread can invoke clearStatusLine()
- CUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- IStatusLineManager statusManager = null;
- if (site instanceof IViewSite) {
- statusManager = ((IViewSite) site).getActionBars().getStatusLineManager();
- } else if (site instanceof IEditorSite) {
- statusManager = ((IEditorSite) site).getActionBars().getStatusLineManager();
- }
- if (statusManager != null)
- statusManager.setErrorMessage(""); //$NON-NLS-1$
+ CUIPlugin.getStandardDisplay().asyncExec(() -> {
+ IStatusLineManager statusManager = null;
+ if (site instanceof IViewSite) {
+ statusManager = ((IViewSite) site).getActionBars().getStatusLineManager();
+ } else if (site instanceof IEditorSite) {
+ statusManager = ((IEditorSite) site).getActionBars().getStatusLineManager();
}
+ if (statusManager != null)
+ statusManager.setErrorMessage(""); //$NON-NLS-1$
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java
index 9094dc4806..c16271ec71 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java
@@ -343,12 +343,7 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider {
if (children != null) {
final Object[] finalChildren = children;
fChildNodes.put(parentElement, children);
- fDisplay.asyncExec(new Runnable() {
- @Override
- public void run() {
- checkForAutoExpand(finalChildren);
- }
- });
+ fDisplay.asyncExec(() -> checkForAutoExpand(finalChildren));
}
}
return children;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java
index 250e568985..7a58d59ec0 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java
@@ -69,12 +69,7 @@ public class ColoredViewersManager implements IPropertyChangeListener {
|| property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME)
|| property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)
|| property.equals(HIGHLIGHT_WRITE_BG_COLOR_NAME)) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- refreshAllViewers();
- }
- });
+ Display.getDefault().asyncExec(() -> refreshAllViewers());
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/EditorOpener.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/EditorOpener.java
index 84cf8bd3cf..f50402faeb 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/EditorOpener.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/EditorOpener.java
@@ -74,12 +74,7 @@ public class EditorOpener {
private static void showStatus(final IWorkbenchPartSite site, int duration, String msg) {
StatusLineHandler.showStatusLineMessage(site, msg);
- Display.getCurrent().timerExec(duration, new Runnable() {
- @Override
- public void run() {
- StatusLineHandler.clearStatusLine(site);
- }
- });
+ Display.getCurrent().timerExec(duration, () -> StatusLineHandler.clearStatusLine(site));
}
private static void selectRegion(IPath filebufferKey, IRegion region, long timestamp, IEditorPart editor) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ExtendedTreeViewer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ExtendedTreeViewer.java
index 21df9ddb07..b650d440ba 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ExtendedTreeViewer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ExtendedTreeViewer.java
@@ -30,12 +30,9 @@ public class ExtendedTreeViewer extends TreeViewer {
}
public void refresh(final Object[] elements) {
- preservingSelection(new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < elements.length; i++) {
- refresh(elements[i]);
- }
+ preservingSelection(() -> {
+ for (int i = 0; i < elements.length; i++) {
+ refresh(elements[i]);
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java
index a100cadd85..3525499785 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java
@@ -240,12 +240,7 @@ class IndexedFilesCache implements IIndexChangeListener, IIndexerStateListener,
fIsDirty = false;
final IWorkbench workbench = PlatformUI.getWorkbench();
try {
- workbench.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- workbench.getDecoratorManager().update(DECORATOR_ID);
- }
- });
+ workbench.getDisplay().asyncExec(() -> workbench.getDecoratorManager().update(DECORATOR_ID));
} catch (SWTException e) {
// in case the display is no longer valid
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewElementWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewElementWizard.java
index 8d384ddeb0..53662baf4a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewElementWizard.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewElementWizard.java
@@ -24,7 +24,6 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
@@ -50,14 +49,11 @@ public abstract class NewElementWizard extends Wizard implements INewWizard {
if (activePage != null) {
final Display display = getShell().getDisplay();
if (display != null) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- try {
- IDE.openEditor(activePage, resource, true);
- } catch (PartInitException e) {
- CUIPlugin.log(e);
- }
+ display.asyncExec(() -> {
+ try {
+ IDE.openEditor(activePage, resource, true);
+ } catch (PartInitException e) {
+ CUIPlugin.log(e);
}
});
}
@@ -89,12 +85,7 @@ public abstract class NewElementWizard extends Wizard implements INewWizard {
@Override
public boolean performFinish() {
- IWorkspaceRunnable op = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- finishPage(monitor);
- }
- };
+ IWorkspaceRunnable op = monitor -> finishPage(monitor);
try {
getContainer().run(canRunForked(), true, new WorkbenchRunnableAdapter(op, getSchedulingRule()));
} catch (InvocationTargetException e) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java
index bfa5146a56..daa5558157 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java
@@ -18,7 +18,6 @@ import java.util.ArrayList;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICContainer;
import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICElementVisitor;
import org.eclipse.cdt.core.model.ICModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit;
@@ -366,15 +365,12 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
@Override
public void create() {
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- superCreate();
- fViewer.setSelection(new StructuredSelection(getInitialElementSelections()), true);
- setPathFields(fInitialFolderName, fInitialFileName);
- fFileNameDialogField.setFocus();
- doStatusUpdate();
- }
+ BusyIndicator.showWhile(null, () -> {
+ superCreate();
+ fViewer.setSelection(new StructuredSelection(getInitialElementSelections()), true);
+ setPathFields(fInitialFolderName, fInitialFileName);
+ fFileNameDialogField.setFocus();
+ doStatusUpdate();
});
}
@@ -516,28 +512,24 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
if (fInput != null) {
final ICElement[] foundElem = { /*base_folder*/ null, /*exact_folder*/ null, /*exact_file*/ null };
try {
- fInput.accept(new ICElementVisitor() {
- @Override
- public boolean visit(ICElement elem) {
- IPath path = elem.getPath();
- if (path.isPrefixOf(folderPath)) {
- if (foundElem[0] == null
- || path.segmentCount() > foundElem[0].getPath().segmentCount()) {
- foundElem[0] = elem; /*base_folder*/
- }
- if (path.equals(folderPath)) {
- foundElem[1] = elem; /*exact_folder*/
- if (fInitialFileName == null)
- return false; // no need to search children
- } else if (fInitialFileName != null
- && elem.getElementName().equals(fInitialFileName)) {
- foundElem[2] = elem; /*exact_file*/
+ fInput.accept(elem -> {
+ IPath path = elem.getPath();
+ if (path.isPrefixOf(folderPath)) {
+ if (foundElem[0] == null
+ || path.segmentCount() > foundElem[0].getPath().segmentCount()) {
+ foundElem[0] = elem; /*base_folder*/
+ }
+ if (path.equals(folderPath)) {
+ foundElem[1] = elem; /*exact_folder*/
+ if (fInitialFileName == null)
return false; // no need to search children
- }
- return true;
+ } else if (fInitialFileName != null && elem.getElementName().equals(fInitialFileName)) {
+ foundElem[2] = elem; /*exact_file*/
+ return false; // no need to search children
}
- return false;
+ return true;
}
+ return false;
});
ICElement selectedElement = foundElem[2]; /*exact_file*/
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java
index 5f06bfa9bc..6b4560231c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java
@@ -78,12 +78,7 @@ public class DialogField {
*/
public void postSetFocusOnDialogField(Display display) {
if (display != null) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- setFocus();
- }
- });
+ display.asyncExec(() -> setFocus());
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java
index d9c74fcbf8..825b28be04 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java
@@ -719,12 +719,9 @@ public class ListDialogField<T> extends DialogField {
public void postSetSelection(final ISelection selection) {
if (isOkToUse(fTableControl)) {
Display d = fTableControl.getDisplay();
- d.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isOkToUse(fTableControl)) {
- selectElements(selection);
- }
+ d.asyncExec(() -> {
+ if (isOkToUse(fTableControl)) {
+ selectElements(selection);
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
index 3f394d8602..ae61ad390d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
@@ -706,12 +706,9 @@ public class TreeListDialogField<T> extends DialogField {
public void postSetSelection(final ISelection selection) {
if (isOkToUse(fTreeControl)) {
Display d = fTreeControl.getDisplay();
- d.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isOkToUse(fTreeControl)) {
- selectElements(selection);
- }
+ d.asyncExec(() -> {
+ if (isOkToUse(fTreeControl)) {
+ selectElements(selection);
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java
index e368a3e7d6..90b15362e9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java
@@ -39,15 +39,12 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.ITreeViewerListener;
import org.eclipse.jface.viewers.TreeExpansionEvent;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -111,12 +108,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
fWorkingSetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
fWorkingSetName.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- fWorkingSetName.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- });
+ fWorkingSetName.addModifyListener(e -> validateInput());
fWorkingSetName.setFocus();
label = new Label(composite, SWT.WRAP);
@@ -143,12 +135,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
fTree.setInput(CoreModel.create(CUIPlugin.getWorkspace().getRoot()));
- fTree.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleCheckStateChange(event);
- }
- });
+ fTree.addCheckStateListener(event -> handleCheckStateChange(event));
fTree.addTreeListener(new ITreeViewerListener() {
@Override
@@ -159,12 +146,8 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
public void treeExpanded(TreeExpansionEvent event) {
final Object element = event.getElement();
if (fTree.getGrayed(element) == false)
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- @Override
- public void run() {
- setSubtreeChecked(element, fTree.getChecked(element), false);
- }
- });
+ BusyIndicator.showWhile(getShell().getDisplay(),
+ () -> setSubtreeChecked(element, fTree.getChecked(element), false));
}
});
@@ -230,19 +213,16 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
* @param event the checked state change event.
*/
void handleCheckStateChange(final CheckStateChangedEvent event) {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- @Override
- public void run() {
- IAdaptable element = (IAdaptable) event.getElement();
- boolean state = event.getChecked();
+ BusyIndicator.showWhile(getShell().getDisplay(), () -> {
+ IAdaptable element = (IAdaptable) event.getElement();
+ boolean state = event.getChecked();
- fTree.setGrayed(element, false);
- if (isExpandable(element)) {
- setSubtreeChecked(element, state, true);
- }
- updateParentState(element, state);
- validateInput();
+ fTree.setGrayed(element, false);
+ if (isExpandable(element)) {
+ setSubtreeChecked(element, state, true);
}
+ updateParentState(element, state);
+ validateInput();
});
}
@@ -289,76 +269,72 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
* working set, if any.
*/
private void initializeCheckedState() {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- @Override
- public void run() {
- Object[] elements;
- if (fWorkingSet == null) {
- // Use current part's selection for initialization
- IWorkbenchPage page = CUIPlugin.getActivePage();
- if (page == null)
- return;
-
- IWorkbenchPart part = CUIPlugin.getActivePage().getActivePart();
- if (part == null)
- return;
-
- try {
- elements = SelectionConverter.getStructuredSelection(part).toArray();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof IResource) {
- ICElement ce = ((IResource) elements[i]).getAdapter(ICElement.class);
- if (ce != null && ce.exists()
- && ce.getCProject().isOnSourceRoot((IResource) elements[i]))
- elements[i] = ce;
- }
+ BusyIndicator.showWhile(getShell().getDisplay(), () -> {
+ Object[] elements;
+ if (fWorkingSet == null) {
+ // Use current part's selection for initialization
+ IWorkbenchPage page = CUIPlugin.getActivePage();
+ if (page == null)
+ return;
+
+ IWorkbenchPart part = CUIPlugin.getActivePage().getActivePart();
+ if (part == null)
+ return;
+
+ try {
+ elements = SelectionConverter.getStructuredSelection(part).toArray();
+ for (int i1 = 0; i1 < elements.length; i1++) {
+ if (elements[i1] instanceof IResource) {
+ ICElement ce = ((IResource) elements[i1]).getAdapter(ICElement.class);
+ if (ce != null && ce.exists() && ce.getCProject().isOnSourceRoot((IResource) elements[i1]))
+ elements[i1] = ce;
}
- } catch (CModelException e) {
- return;
}
- } else
- elements = fWorkingSet.getElements();
-
- for (int i = 0; i < elements.length; i++) {
- Object element = elements[i];
- if (element instanceof IResource) {
- IProject project = ((IResource) element).getProject();
- if (!project.isAccessible()) {
- elements[i] = project;
- } else {
- // for backwards compatibility: adapt to ICElement if possible
- if (CoreModel.hasCNature(project)) {
- ICElement cElement = CoreModel.getDefault().create((IResource) element);
- if (cElement != null) {
- elements[i] = cElement;
- }
+ } catch (CModelException e) {
+ return;
+ }
+ } else
+ elements = fWorkingSet.getElements();
+
+ for (int i2 = 0; i2 < elements.length; i2++) {
+ Object element1 = elements[i2];
+ if (element1 instanceof IResource) {
+ IProject project = ((IResource) element1).getProject();
+ if (!project.isAccessible()) {
+ elements[i2] = project;
+ } else {
+ // for backwards compatibility: adapt to ICElement if possible
+ if (CoreModel.hasCNature(project)) {
+ ICElement cElement = CoreModel.getDefault().create((IResource) element1);
+ if (cElement != null) {
+ elements[i2] = cElement;
}
}
- } else if (element instanceof ICElement) {
- ICProject cProject = ((ICElement) element).getCProject();
- if (cProject != null && !cProject.getProject().isAccessible())
- elements[i] = cProject.getProject();
}
+ } else if (element1 instanceof ICElement) {
+ ICProject cProject = ((ICElement) element1).getCProject();
+ if (cProject != null && !cProject.getProject().isAccessible())
+ elements[i2] = cProject.getProject();
}
- fTree.setCheckedElements(elements);
- HashSet<Object> parents = new HashSet<>();
- for (Object element : elements) {
- if (isExpandable(element))
- setSubtreeChecked(element, true, true);
-
- if (element instanceof IAdaptable) {
- IResource resource = ((IAdaptable) element).getAdapter(IResource.class);
- if (resource != null && !resource.isAccessible())
- continue;
- }
- Object parent = fTreeContentProvider.getParent(element);
- if (parent != null)
- parents.add(parent);
+ }
+ fTree.setCheckedElements(elements);
+ HashSet<Object> parents = new HashSet<>();
+ for (Object element2 : elements) {
+ if (isExpandable(element2))
+ setSubtreeChecked(element2, true, true);
+
+ if (element2 instanceof IAdaptable) {
+ IResource resource = ((IAdaptable) element2).getAdapter(IResource.class);
+ if (resource != null && !resource.isAccessible())
+ continue;
}
-
- for (Object object : parents)
- updateObjectState(object, true);
+ Object parent = fTreeContentProvider.getParent(element2);
+ if (parent != null)
+ parents.add(parent);
}
+
+ for (Object object : parents)
+ updateObjectState(object, true);
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java
index 1ec0733029..fa75526158 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java
@@ -20,14 +20,11 @@ import java.util.Iterator;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -108,41 +105,37 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange
this.tree.setInput(workspace.getWorkingSets());
if (!workspace.getWorkingSets().isEmpty()) {
- tree.getTree().getDisplay().asyncExec(new Runnable() {
+ tree.getTree().getDisplay().asyncExec(() -> {
+ Object initialSelection;
- @Override
- public void run() {
- Object initialSelection;
+ ITreeContentProvider content = (ITreeContentProvider) tree.getContentProvider();
- ITreeContentProvider content = (ITreeContentProvider) tree.getContentProvider();
-
- if ((initialWorkingSet != null)
- && Arrays.asList(content.getElements(tree.getInput())).contains(initialWorkingSet)) {
- initialSelection = initialWorkingSet;
- } else {
- // we have a most-recently-used working set. Just
- // take the first in tree order
- initialSelection = tree.getTree().getItem(0).getData();
- }
+ if ((initialWorkingSet != null)
+ && Arrays.asList(content.getElements(tree.getInput())).contains(initialWorkingSet)) {
+ initialSelection = initialWorkingSet;
+ } else {
+ // we have a most-recently-used working set. Just
+ // take the first in tree order
+ initialSelection = tree.getTree().getItem(0).getData();
+ }
- Object[] children = content.getChildren(initialSelection);
- IStructuredSelection sel;
-
- if ((children == null) || (children.length == 0)) {
- // Shouldn't happen: there should at least be the
- // read-only config.
- // Can only select the initial working set
- sel = new StructuredSelection(initialSelection);
- } else {
- Object[] toSort = new Object[children.length];
- System.arraycopy(children, 0, toSort, 0, children.length);
- tree.getComparator().sort(tree, toSort);
- sel = new StructuredSelection(toSort[0]);
- }
+ Object[] children = content.getChildren(initialSelection);
+ IStructuredSelection sel;
- // make the selection
- tree.setSelection(sel, true);
+ if ((children == null) || (children.length == 0)) {
+ // Shouldn't happen: there should at least be the
+ // read-only config.
+ // Can only select the initial working set
+ sel = new StructuredSelection(initialSelection);
+ } else {
+ Object[] toSort = new Object[children.length];
+ System.arraycopy(children, 0, toSort, 0, children.length);
+ tree.getComparator().sort(tree, toSort);
+ sel = new StructuredSelection(toSort[0]);
}
+
+ // make the selection
+ tree.setSelection(sel, true);
});
}
}
@@ -288,18 +281,14 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange
private void addConfig() {
InputDialog dlg = new InputDialog(tree.getTree().getShell(),
WorkingSetMessages.WSConfigsController_addDlg_title, WorkingSetMessages.WSConfigsController_addDlg_msg,
- WorkingSetMessages.WSConfigsController_addDlg_defaultName, new IInputValidator() {
-
- @Override
- public String isValid(String newText) {
- if (currentWorkingSet.getConfiguration(newText) != null) {
- return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
- }
- if (newText.length() == 0) {
- return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
- }
- return null;
+ WorkingSetMessages.WSConfigsController_addDlg_defaultName, newText -> {
+ if (currentWorkingSet.getConfiguration(newText) != null) {
+ return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
}
+ if (newText.length() == 0) {
+ return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
+ }
+ return null;
});
if (dlg.open() == IDialogConstants.OK_ID) {
@@ -331,21 +320,17 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange
private void renameConfig() {
InputDialog dlg = new InputDialog(tree.getTree().getShell(),
WorkingSetMessages.WSConfigsController_renameDlg_title,
- WorkingSetMessages.WSConfigsController_renameDlg_msg, currentConfig.getName(), new IInputValidator() {
-
- @Override
- public String isValid(String newText) {
- if (newText.equals(currentConfig.getName())) {
- return ""; //$NON-NLS-1$
- }
- if (currentWorkingSet.getConfiguration(newText) != null) {
- return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
- }
- if (newText.length() == 0) {
- return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
- }
- return null;
+ WorkingSetMessages.WSConfigsController_renameDlg_msg, currentConfig.getName(), newText -> {
+ if (newText.equals(currentConfig.getName())) {
+ return ""; //$NON-NLS-1$
}
+ if (currentWorkingSet.getConfiguration(newText) != null) {
+ return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
+ }
+ if (newText.length() == 0) {
+ return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
+ }
+ return null;
});
if (dlg.open() == IDialogConstants.OK_ID) {
@@ -403,14 +388,10 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange
try {
ProgressMonitorDialog dlg = new ProgressMonitorDialog(tree.getControl().getShell());
- dlg.run(true, true, new IRunnableWithProgress() {
-
- @Override
- public void run(IProgressMonitor monitor) {
- IStatus status = currentConfig.build(monitor);
- if (status.matches(IStatus.WARNING | IStatus.ERROR)) {
- problem[0] = status;
- }
+ dlg.run(true, true, monitor -> {
+ IStatus status = currentConfig.build(monitor);
+ if (status.matches(IStatus.WARNING | IStatus.ERROR)) {
+ problem[0] = status;
}
});
} catch (Exception e) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java
index 1eabfae897..979f4f9298 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java
@@ -443,14 +443,11 @@ public class CElementContentProvider extends BaseCElementContentProvider
if (pendingRefreshes.contains(r))
return;
pendingRefreshes.add(r);
- ctrl.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- pendingRefreshes.remove(r);
- Control ctrl = fViewer.getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
- r.refresh();
- }
+ ctrl.getDisplay().asyncExec(() -> {
+ pendingRefreshes.remove(r);
+ Control ctrl1 = fViewer.getControl();
+ if (ctrl1 != null && !ctrl1.isDisposed()) {
+ r.refresh();
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java
index d0c64a40e3..246b8aa0e4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java
@@ -100,12 +100,9 @@ public class CElementLabelProvider extends LabelProvider {
fWorkbenchLabelProvider = new WorkbenchLabelProvider();
} else {
// Delay initialization
- CUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fCElementLabelProvider != null) {
- fWorkbenchLabelProvider = new WorkbenchLabelProvider();
- }
+ CUIPlugin.getStandardDisplay().asyncExec(() -> {
+ if (fCElementLabelProvider != null) {
+ fWorkbenchLabelProvider = new WorkbenchLabelProvider();
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java
index 56105d1dda..aae507d3b8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java
@@ -46,7 +46,6 @@ import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -274,12 +273,7 @@ public class FormatAllAction extends SelectionDispatchAction {
}
PlatformUI.getWorkbench().getProgressService().run(true, true,
- new WorkbenchRunnableAdapter(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- doRunOnMultiple(tus, status, monitor);
- }
- })); // workspace lock
+ new WorkbenchRunnableAdapter(monitor -> doRunOnMultiple(tus, status, monitor))); // workspace lock
if (!status.isOK()) {
String title = ActionMessages.FormatAllAction_multi_status_title;
ErrorDialog.openError(getShell(), title, null, status);
@@ -413,12 +407,7 @@ public class FormatAllAction extends SelectionDispatchAction {
private void formatTranslationUnit(final ITextFileBuffer fileBuffer, final Map<String, Object> options) {
if (fileBuffer.isShared()) {
- getShell().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- doFormat(fileBuffer.getDocument(), options);
- }
- });
+ getShell().getDisplay().syncExec(() -> doFormat(fileBuffer.getDocument(), options));
} else {
doFormat(fileBuffer.getDocument(), options); // run in context thread
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java
index 33b2b3e6e2..191e337d54 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java
@@ -305,12 +305,7 @@ public class MemberFilterActionGroup extends ActionGroup {
}
if (refresh) {
fViewer.getControl().setRedraw(false);
- BusyIndicator.showWhile(fViewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- fViewer.refresh();
- }
- });
+ BusyIndicator.showWhile(fViewer.getControl().getDisplay(), () -> fViewer.refresh());
fViewer.getControl().setRedraw(true);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigRunner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigRunner.java
index 115bc1dd1f..f676c9d04a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigRunner.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigRunner.java
@@ -22,7 +22,6 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
@@ -80,20 +79,13 @@ public class ManageConfigRunner implements IConfigManager {
}
public IRunnableWithProgress getRunnable() {
- return new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
- CUIPlugin.getDefault().getShell().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- try {
- CoreModel.getDefault().setProjectDescription(prj, des);
- } catch (CoreException e) {
- e.printStackTrace();
- }
+ return new WorkspaceModifyDelegatingOperation(
+ imonitor -> CUIPlugin.getDefault().getShell().getDisplay().syncExec(() -> {
+ try {
+ CoreModel.getDefault().setProjectDescription(prj, des);
+ } catch (CoreException e) {
+ e.printStackTrace();
}
- });
- }
- });
+ }));
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StructureTreeTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StructureTreeTab.java
index fe06a0a17e..28860d9f60 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StructureTreeTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StructureTreeTab.java
@@ -838,30 +838,27 @@ public class StructureTreeTab extends AbstractCPropertyTab {
@Override
public void updateData(ICResourceDescription rcfg) {
cfg = rcfg;
- tree.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- try {
- tree.removeAll();
- TreeItem ti = new TreeItem(tree, 0);
- ti.setText(0, Messages.StructureTreeTab_11);
- tree.update();
- tree.setRedraw(false);
- tree.removeAll();
- switch (combo.getSelectionIndex()) {
- case 0:
- update(cfg.getConfiguration().getProjectDescription());
- break;
- case 1:
- update(null, "ICConfigurationDescription", cfg.getConfiguration()); //$NON-NLS-1$
- break;
- case 2:
- update(null, "ICResourceDescription", cfg); //$NON-NLS-1$
- break;
- }
- } finally {
- tree.setRedraw(true);
+ tree.getDisplay().asyncExec(() -> {
+ try {
+ tree.removeAll();
+ TreeItem ti = new TreeItem(tree, 0);
+ ti.setText(0, Messages.StructureTreeTab_11);
+ tree.update();
+ tree.setRedraw(false);
+ tree.removeAll();
+ switch (combo.getSelectionIndex()) {
+ case 0:
+ update(cfg.getConfiguration().getProjectDescription());
+ break;
+ case 1:
+ update(null, "ICConfigurationDescription", cfg.getConfiguration()); //$NON-NLS-1$
+ break;
+ case 2:
+ update(null, "ICResourceDescription", cfg); //$NON-NLS-1$
+ break;
}
+ } finally {
+ tree.setRedraw(true);
}
});
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java
index eccdec4095..ecb71b4fe9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java
@@ -238,57 +238,47 @@ public abstract class CDTCommonProjectWizard extends BasicNewResourceWizard
private IRunnableWithProgress getRunnable(boolean _defaults, final boolean onFinish) {
final boolean defaults = _defaults;
- return new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
- final Exception except[] = new Exception[1];
- getShell().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- final IProgressMonitor fMonitor;
- if (monitor == null) {
- fMonitor = new NullProgressMonitor();
- } else {
- fMonitor = monitor;
- }
- fMonitor.beginTask(CUIPlugin.getResourceString("CProjectWizard.op_description"), 100); //$NON-NLS-1$
- fMonitor.worked(10);
- try {
- newProject = createIProject(lastProjectName, lastProjectLocation,
- new SubProgressMonitor(fMonitor, 40));
- if (newProject != null)
- fMainPage.h_selected.createProject(newProject, defaults, onFinish,
- new SubProgressMonitor(fMonitor, 40));
- fMonitor.worked(10);
- } catch (CoreException e) {
- CUIPlugin.log(e);
- } finally {
- fMonitor.done();
- }
- }
- });
- try {
- getContainer().run(false, true, op);
- } catch (InvocationTargetException e) {
- except[0] = e;
- } catch (InterruptedException e) {
- except[0] = e;
- }
+ return imonitor -> {
+ final Exception except[] = new Exception[1];
+ getShell().getDisplay().syncExec(() -> {
+ IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(monitor -> {
+ final IProgressMonitor fMonitor;
+ if (monitor == null) {
+ fMonitor = new NullProgressMonitor();
+ } else {
+ fMonitor = monitor;
}
- });
- if (except[0] != null) {
- if (except[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException) except[0];
- }
- if (except[0] instanceof InterruptedException) {
- throw (InterruptedException) except[0];
+ fMonitor.beginTask(CUIPlugin.getResourceString("CProjectWizard.op_description"), 100); //$NON-NLS-1$
+ fMonitor.worked(10);
+ try {
+ newProject = createIProject(lastProjectName, lastProjectLocation,
+ new SubProgressMonitor(fMonitor, 40));
+ if (newProject != null)
+ fMainPage.h_selected.createProject(newProject, defaults, onFinish,
+ new SubProgressMonitor(fMonitor, 40));
+ fMonitor.worked(10);
+ } catch (CoreException e) {
+ CUIPlugin.log(e);
+ } finally {
+ fMonitor.done();
}
- throw new InvocationTargetException(except[0]);
+ });
+ try {
+ getContainer().run(false, true, op);
+ } catch (InvocationTargetException e1) {
+ except[0] = e1;
+ } catch (InterruptedException e2) {
+ except[0] = e2;
}
+ });
+ if (except[0] != null) {
+ if (except[0] instanceof InvocationTargetException) {
+ throw (InvocationTargetException) except[0];
+ }
+ if (except[0] instanceof InterruptedException) {
+ throw (InterruptedException) except[0];
+ }
+ throw new InvocationTargetException(except[0]);
}
};
}
@@ -331,12 +321,7 @@ public abstract class CDTCommonProjectWizard extends BasicNewResourceWizard
newProject = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle,
new SubProgressMonitor(monitor, 25));
} else {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- }
- };
+ IWorkspaceRunnable runnable = monitor1 -> newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor1);
workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, new SubProgressMonitor(monitor, 25));
newProject = newProjectHandle;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizard.java
index ecb1923c7e..d4e20f1729 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizard.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizard.java
@@ -209,53 +209,43 @@ public abstract class NewCProjectWizard extends BasicNewResourceWizard implement
}
public IRunnableWithProgress getRunnable() {
- return new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
- final Exception except[] = new Exception[1];
- // ugly, need to make the wizard page run in a non ui thread so that this can go away!!!
- getShell().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- final IProgressMonitor fMonitor;
- if (monitor == null) {
- fMonitor = new NullProgressMonitor();
- } else {
- fMonitor = monitor;
- }
- fMonitor.beginTask(CUIPlugin.getResourceString(OP_DESC), 3);
- doRunPrologue(new SubProgressMonitor(fMonitor, 1));
- try {
- doRun(new SubProgressMonitor(fMonitor, 1));
- } catch (CoreException e) {
- except[0] = e;
- }
- doRunEpilogue(new SubProgressMonitor(fMonitor, 1));
- fMonitor.done();
- }
- });
- try {
- getContainer().run(false, true, op);
- } catch (InvocationTargetException e) {
- except[0] = e;
- } catch (InterruptedException e) {
- except[0] = e;
- }
+ return new WorkspaceModifyDelegatingOperation(imonitor -> {
+ final Exception except[] = new Exception[1];
+ // ugly, need to make the wizard page run in a non ui thread so that this can go away!!!
+ getShell().getDisplay().syncExec(() -> {
+ IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(monitor -> {
+ final IProgressMonitor fMonitor;
+ if (monitor == null) {
+ fMonitor = new NullProgressMonitor();
+ } else {
+ fMonitor = monitor;
}
- });
- if (except[0] != null) {
- if (except[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException) except[0];
- }
- if (except[0] instanceof InterruptedException) {
- throw (InterruptedException) except[0];
+ fMonitor.beginTask(CUIPlugin.getResourceString(OP_DESC), 3);
+ doRunPrologue(new SubProgressMonitor(fMonitor, 1));
+ try {
+ doRun(new SubProgressMonitor(fMonitor, 1));
+ } catch (CoreException e) {
+ except[0] = e;
}
- throw new InvocationTargetException(except[0]);
+ doRunEpilogue(new SubProgressMonitor(fMonitor, 1));
+ fMonitor.done();
+ });
+ try {
+ getContainer().run(false, true, op);
+ } catch (InvocationTargetException e1) {
+ except[0] = e1;
+ } catch (InterruptedException e2) {
+ except[0] = e2;
+ }
+ });
+ if (except[0] != null) {
+ if (except[0] instanceof InvocationTargetException) {
+ throw (InvocationTargetException) except[0];
+ }
+ if (except[0] instanceof InterruptedException) {
+ throw (InterruptedException) except[0];
}
+ throw new InvocationTargetException(except[0]);
}
});
}
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplateInputDialog.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplateInputDialog.java
index defa490adc..6ac5508546 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplateInputDialog.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/pages/TemplateInputDialog.java
@@ -17,7 +17,6 @@ import org.eclipse.cdt.core.templateengine.TemplateEngineUtil;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
@@ -203,12 +202,9 @@ public class TemplateInputDialog extends Dialog {
*/
public void addTextListener(final Text aText) {
- ModifyListener mListener = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- String nameField = aText.getText();
- textChanged(nameField);
- }
+ ModifyListener mListener = e -> {
+ String nameField = aText.getText();
+ textChanged(nameField);
};
aText.addModifyListener(mListener);
@@ -257,14 +253,11 @@ public class TemplateInputDialog extends Dialog {
public int popDuplicate() {
final int[] result = new int[] { 0 };
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- MessageBox mBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_INFORMATION);
- mBox.setText(TemplatePreferencePage.Message);
- mBox.setMessage(TemplatePreferencePage.DuplicateEntry);
- result[0] = mBox.open();
- }
+ Display.getDefault().syncExec(() -> {
+ MessageBox mBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_INFORMATION);
+ mBox.setText(TemplatePreferencePage.Message);
+ mBox.setMessage(TemplatePreferencePage.DuplicateEntry);
+ result[0] = mBox.open();
});
return result[0];
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java
index beb4d200b8..81812d5e2f 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java
@@ -39,21 +39,18 @@ public class DsfExtendedTerminateCommand extends DsfTerminateCommand {
// Make sure we run on the UI thread.
// We may not already be on the UI thread, for example, when GdbLaunch.terminate() is called
// directly when closing a project.
- display.syncExec(new Runnable() {
- @Override
- public void run() {
- Shell shell = display.getActiveShell();
- if (shell != null) {
- boolean confirmed = MessageDialog.openConfirm(shell,
- ActionMessages.DsfExtendedTerminateCommand_Confirm_Termination,
- ActionMessages.DsfExtendedTerminateCommand_Terminate_the_session);
- if (!confirmed) {
- request.cancel();
- return;
- }
+ display.syncExec(() -> {
+ Shell shell = display.getActiveShell();
+ if (shell != null) {
+ boolean confirmed = MessageDialog.openConfirm(shell,
+ ActionMessages.DsfExtendedTerminateCommand_Confirm_Termination,
+ ActionMessages.DsfExtendedTerminateCommand_Terminate_the_session);
+ if (!confirmed) {
+ request.cancel();
+ return;
}
- DsfExtendedTerminateCommand.super.execute(request);
}
+ DsfExtendedTerminateCommand.super.execute(request);
});
}
return false;
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java
index 5528b8cdde..bb2d5bf62d 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java
@@ -72,12 +72,7 @@ public class ServiceEventWaitor<V> {
assert eventClass != null;
fSession = session;
fEventTypeClass = eventClass;
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fSession.addServiceEventListener(ServiceEventWaitor.this, null);
- }
- };
+ Runnable runnable = () -> fSession.addServiceEventListener(ServiceEventWaitor.this, null);
try {
fSession.getExecutor().submit(runnable).get();
} catch (InterruptedException e) {
@@ -91,12 +86,7 @@ public class ServiceEventWaitor<V> {
protected void finalize() throws Throwable {
super.finalize();
if (fEventTypeClass != null) {
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fSession.removeServiceEventListener(ServiceEventWaitor.this);
- }
- };
+ Runnable runnable = () -> fSession.removeServiceEventListener(ServiceEventWaitor.this);
fSession.getExecutor().submit(runnable).get();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
index df37b5fdea..0a97f39caf 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
@@ -117,23 +117,19 @@ public class SyncUtil {
public static void initialize(DsfSession session) throws Exception {
fSession = session;
- Runnable runnable = new Runnable() {
-
- @Override
- public void run() {
- DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
-
- fGdbControl = tracker.getService(IGDBControl.class);
- fRunControl = tracker.getService(IMIRunControl.class);
- fStack = tracker.getService(MIStack.class);
- fExpressions = tracker.getService(IExpressions.class);
- fProcessesService = tracker.getService(IGDBProcesses.class);
- fMemory = tracker.getService(IMemory.class);
- fCommandFactory = fGdbControl.getCommandFactory();
- fSourceLookup = tracker.getService(ISourceLookup.class);
-
- tracker.dispose();
- }
+ Runnable runnable = () -> {
+ DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+
+ fGdbControl = tracker.getService(IGDBControl.class);
+ fRunControl = tracker.getService(IMIRunControl.class);
+ fStack = tracker.getService(MIStack.class);
+ fExpressions = tracker.getService(IExpressions.class);
+ fProcessesService = tracker.getService(IGDBProcesses.class);
+ fMemory = tracker.getService(IMemory.class);
+ fCommandFactory = fGdbControl.getCommandFactory();
+ fSourceLookup = tracker.getService(ISourceLookup.class);
+
+ tracker.dispose();
};
fSession.getExecutor().submit(runnable).get();
}
@@ -173,47 +169,41 @@ public class SyncUtil {
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
if (!reverse) {
- fRunControl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // No need for a RequestMonitor since we will wait for the
- // ServiceEvent telling us the program has been suspended again
- switch (stepType) {
- case STEP_INTO:
- fGdbControl.queueCommand(fCommandFactory.createMIExecStep(dmc), null);
- break;
- case STEP_OVER:
- fGdbControl.queueCommand(fCommandFactory.createMIExecNext(dmc), null);
- break;
- case STEP_RETURN:
- fGdbControl.queueCommand(
- fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)), null);
- break;
- default:
- fail("Unsupported step type; " + stepType.toString());
- }
+ fRunControl.getExecutor().submit(() -> {
+ // No need for a RequestMonitor since we will wait for the
+ // ServiceEvent telling us the program has been suspended again
+ switch (stepType) {
+ case STEP_INTO:
+ fGdbControl.queueCommand(fCommandFactory.createMIExecStep(dmc), null);
+ break;
+ case STEP_OVER:
+ fGdbControl.queueCommand(fCommandFactory.createMIExecNext(dmc), null);
+ break;
+ case STEP_RETURN:
+ fGdbControl.queueCommand(fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)),
+ null);
+ break;
+ default:
+ fail("Unsupported step type; " + stepType.toString());
}
});
} else {
- fRunControl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // No need for a RequestMonitor since we will wait for the
- // ServiceEvent telling us the program has been suspended again
- switch (stepType) {
- case STEP_INTO:
- fGdbControl.queueCommand(fCommandFactory.createMIExecReverseStep(dmc), null);
- break;
- case STEP_OVER:
- fGdbControl.queueCommand(fCommandFactory.createMIExecReverseNext(dmc), null);
- break;
- case STEP_RETURN:
- fGdbControl.queueCommand(
- fCommandFactory.createMIExecUncall(fStack.createFrameDMContext(dmc, 0)), null);
- break;
- default:
- fail("Unsupported step type; " + stepType.toString());
- }
+ fRunControl.getExecutor().submit(() -> {
+ // No need for a RequestMonitor since we will wait for the
+ // ServiceEvent telling us the program has been suspended again
+ switch (stepType) {
+ case STEP_INTO:
+ fGdbControl.queueCommand(fCommandFactory.createMIExecReverseStep(dmc), null);
+ break;
+ case STEP_OVER:
+ fGdbControl.queueCommand(fCommandFactory.createMIExecReverseNext(dmc), null);
+ break;
+ case STEP_RETURN:
+ fGdbControl.queueCommand(fCommandFactory.createMIExecUncall(fStack.createFrameDMContext(dmc, 0)),
+ null);
+ break;
+ default:
+ fail("Unsupported step type; " + stepType.toString());
}
});
}
@@ -281,14 +271,9 @@ public class SyncUtil {
throws Throwable {
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
- fRunControl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // No need for a RequestMonitor since we will wait for the
- // ServiceEvent telling us the program has been suspended again
- fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null);
- }
- });
+ // No need for a RequestMonitor since we will wait for the ServiceEvent telling us the program has been suspended again
+ fRunControl.getExecutor()
+ .submit(() -> fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null));
// Wait for the execution to suspend after the step
return eventWaitor.waitForEvent(massagedTimeout);
@@ -308,14 +293,9 @@ public class SyncUtil {
public static MIRunningEvent resume(final IExecutionDMContext dmc, int massagedTimeout) throws Throwable {
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIRunningEvent.class);
- fRunControl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // No need for a RequestMonitor since we will wait for the
- // ServiceEvent telling us the program has been resumed
- fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null);
- }
- });
+ // No need for a RequestMonitor since we will wait for the ServiceEvent telling us the program has been suspended again
+ fRunControl.getExecutor()
+ .submit(() -> fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null));
// Wait for the execution to start after the step
return eventWaitor.waitForEvent(massagedTimeout);
@@ -485,12 +465,7 @@ public class SyncUtil {
public static IExpressionDMContext createExpression(final IDMContext parentCtx, final String expression)
throws Throwable {
- Callable<IExpressionDMContext> callable = new Callable<IExpressionDMContext>() {
- @Override
- public IExpressionDMContext call() throws Exception {
- return fExpressions.createExpression(parentCtx, expression);
- }
- };
+ Callable<IExpressionDMContext> callable = () -> fExpressions.createExpression(parentCtx, expression);
return fSession.getExecutor().submit(callable).get();
}
@@ -541,25 +516,17 @@ public class SyncUtil {
public static FormattedValueDMContext getFormattedValue(final IFormattedValues service,
final IFormattedDataDMContext dmc, final String formatId) throws Throwable {
- Callable<FormattedValueDMContext> callable = new Callable<FormattedValueDMContext>() {
- @Override
- public FormattedValueDMContext call() throws Exception {
- return service.getFormattedValueContext(dmc, formatId);
- }
- };
+ Callable<FormattedValueDMContext> callable = () -> service.getFormattedValueContext(dmc, formatId);
return fSession.getExecutor().submit(callable).get();
}
public static IMIExecutionDMContext createExecutionContext(final IContainerDMContext parentCtx, final int threadId)
throws Throwable {
- Callable<IMIExecutionDMContext> callable = new Callable<IMIExecutionDMContext>() {
- @Override
- public IMIExecutionDMContext call() throws Exception {
- String threadIdStr = Integer.toString(threadId);
- IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentCtx, IProcessDMContext.class);
- IThreadDMContext threadDmc = fProcessesService.createThreadContext(processDmc, threadIdStr);
- return fProcessesService.createExecutionContext(parentCtx, threadDmc, threadIdStr);
- }
+ Callable<IMIExecutionDMContext> callable = () -> {
+ String threadIdStr = Integer.toString(threadId);
+ IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentCtx, IProcessDMContext.class);
+ IThreadDMContext threadDmc = fProcessesService.createThreadContext(processDmc, threadIdStr);
+ return fProcessesService.createExecutionContext(parentCtx, threadDmc, threadIdStr);
};
return fSession.getExecutor().submit(callable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java
index c5190b2375..2cc8a719f7 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java
@@ -78,13 +78,10 @@ public class CommandLineArgsTest extends BaseParametrizedTestCase {
super.doLaunch();
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fExpService = fServicesTracker.getService(IExpressions.class);
- }
+ fExpService = fServicesTracker.getService(IExpressions.class);
};
fSession.getExecutor().submit(runnable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java
index 1ad33dc43e..e0f8d37106 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java
@@ -122,24 +122,21 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
super.doBeforeTest();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- Assert.assertTrue(fServicesTracker != null);
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Assert.assertTrue(fServicesTracker != null);
- fCommandControl = fServicesTracker.getService(IGDBControl.class);
- Assert.assertTrue(fCommandControl != null);
+ fCommandControl = fServicesTracker.getService(IGDBControl.class);
+ Assert.assertTrue(fCommandControl != null);
- fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
- Assert.assertTrue(fBreakpointService != null);
+ fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
+ Assert.assertTrue(fBreakpointService != null);
- fBreakpointsSynchronizer = fServicesTracker.getService(MIBreakpointsSynchronizer.class);
- Assert.assertTrue(fBreakpointsSynchronizer != null);
+ fBreakpointsSynchronizer = fServicesTracker.getService(MIBreakpointsSynchronizer.class);
+ Assert.assertTrue(fBreakpointsSynchronizer != null);
- // Register to breakpoint events
- fSession.addServiceEventListener(GDBConsoleBreakpointsTest.this, null);
- }
+ // Register to breakpoint events
+ fSession.addServiceEventListener(GDBConsoleBreakpointsTest.this, null);
};
fSession = getGDBLaunch().getSession();
fSession.getExecutor().submit(runnable).get();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java
index cb4ed53ace..a7b02084ef 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java
@@ -89,27 +89,24 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
super.doBeforeTest();
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- Assert.assertTrue(fServicesTracker != null);
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Assert.assertTrue(fServicesTracker != null);
- fCommandControl = fServicesTracker.getService(IGDBControl.class);
- Assert.assertTrue(fCommandControl != null);
+ fCommandControl = fServicesTracker.getService(IGDBControl.class);
+ Assert.assertTrue(fCommandControl != null);
- fMemoryService = fServicesTracker.getService(IMemory.class);
- Assert.assertTrue(fMemoryService != null);
+ fMemoryService = fServicesTracker.getService(IMemory.class);
+ Assert.assertTrue(fMemoryService != null);
- fExprService = fServicesTracker.getService(IExpressions.class);
- Assert.assertTrue(fExprService != null);
+ fExprService = fServicesTracker.getService(IExpressions.class);
+ Assert.assertTrue(fExprService != null);
- fRunControl = fServicesTracker.getService(IRunControl.class);
- Assert.assertTrue(fRunControl != null);
+ fRunControl = fServicesTracker.getService(IRunControl.class);
+ Assert.assertTrue(fRunControl != null);
- // Register to breakpoint events
- fSession.addServiceEventListener(GDBConsoleSynchronizingTest.this, null);
- }
+ // Register to breakpoint events
+ fSession.addServiceEventListener(GDBConsoleSynchronizingTest.this, null);
};
fSession.getExecutor().submit(runnable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java
index f6ae6ff200..020547d18f 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java
@@ -80,15 +80,12 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
super.doBeforeTest();
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fExpService = fServicesTracker.getService(IMIExpressions.class);
+ fExpService = fServicesTracker.getService(IMIExpressions.class);
- fRegService = fServicesTracker.getService(IRegisters2.class);
- }
+ fRegService = fServicesTracker.getService(IRegisters2.class);
};
fSession.getExecutor().submit(runnable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java
index a4a0e76e1b..36bdf242a5 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java
@@ -60,12 +60,9 @@ public class GDBProcessesTest extends BaseParametrizedTestCase {
resolveLineTagLocations(SOURCE_NAME, MIRunControlTest.LINE_TAGS);
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fProcService = fServicesTracker.getService(IMIProcesses.class);
- }
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ fProcService = fServicesTracker.getService(IMIProcesses.class);
};
fSession.getExecutor().submit(runnable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java
index 71dbd000b3..5e047087b5 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java
@@ -167,24 +167,21 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
- fGdbControl = fServicesTracker.getService(IGDBControl.class);
- fCommandFactory = fGdbControl.getCommandFactory();
+ fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
+ fGdbControl = fServicesTracker.getService(IGDBControl.class);
+ fCommandFactory = fGdbControl.getCommandFactory();
- // fTraceService = fServicesTracker.getService(ITraceControl.class);
- fSession.addServiceEventListener(GDBRemoteTracepointsTest.this, null);
+ // fTraceService = fServicesTracker.getService(ITraceControl.class);
+ fSession.addServiceEventListener(GDBRemoteTracepointsTest.this, null);
- // Create a large array to make sure we don't run out
- fTracepoints = new IBreakpointDMContext[100];
+ // Create a large array to make sure we don't run out
+ fTracepoints = new IBreakpointDMContext[100];
- // Run an initial test to check that everything is ok with GDB
- checkTraceInitialStatus();
- }
+ // Run an initial test to check that everything is ok with GDB
+ checkTraceInitialStatus();
};
fSession.getExecutor().submit(runnable).get();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java
index e91dfea68d..715db49d7a 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java
@@ -128,14 +128,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
super.doLaunch();
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fExpService = fServicesTracker.getService(IExpressions.class);
- fGdbControl = fServicesTracker.getService(IGDBControl.class);
- }
+ fExpService = fServicesTracker.getService(IExpressions.class);
+ fGdbControl = fServicesTracker.getService(IGDBControl.class);
};
fSession.getExecutor().submit(runnable).get();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
index 18cce53ce6..9e576db32d 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
@@ -187,23 +187,20 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
super.doBeforeTest();
// Get a reference to the breakpoint service
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- assert (fServicesTracker != null);
- fRunControl = fServicesTracker.getService(MIRunControl.class);
- assert (fRunControl != null);
- fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
- assert (fBreakpointService != null);
- fExpressionService = fServicesTracker.getService(IExpressions.class);
- assert (fExpressionService != null);
- fCommandControl = fServicesTracker.getService(IGDBControl.class);
- assert (fCommandControl != null);
- // Register to breakpoint events
- fRunControl.getSession().addServiceEventListener(MIBreakpointsTest.this, null);
- clearEventCounters();
- }
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ assert (fServicesTracker != null);
+ fRunControl = fServicesTracker.getService(MIRunControl.class);
+ assert (fRunControl != null);
+ fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
+ assert (fBreakpointService != null);
+ fExpressionService = fServicesTracker.getService(IExpressions.class);
+ assert (fExpressionService != null);
+ fCommandControl = fServicesTracker.getService(IGDBControl.class);
+ assert (fCommandControl != null);
+ // Register to breakpoint events
+ fRunControl.getSession().addServiceEventListener(MIBreakpointsTest.this, null);
+ clearEventCounters();
};
fSession.getExecutor().submit(runnable).get();
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
index 8f5ad1a846..c525cebc52 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
@@ -158,26 +158,23 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Get a reference to the breakpoint service
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- assertNotNull(fServicesTracker);
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ assertNotNull(fServicesTracker);
- fRunControl = fServicesTracker.getService(MIRunControl.class);
- assertNotNull(fRunControl);
+ fRunControl = fServicesTracker.getService(MIRunControl.class);
+ assertNotNull(fRunControl);
- fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
- assertNotNull(fBreakpointService);
+ fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
+ assertNotNull(fBreakpointService);
- fExpressionService = fServicesTracker.getService(IExpressions.class);
- assertNotNull(fExpressionService);
+ fExpressionService = fServicesTracker.getService(IExpressions.class);
+ assertNotNull(fExpressionService);
- // Register to receive breakpoint events
- fRunControl.getSession().addServiceEventListener(MICatchpointsTest.this, null);
+ // Register to receive breakpoint events
+ fRunControl.getSession().addServiceEventListener(MICatchpointsTest.this, null);
- clearEventCounters();
- }
+ clearEventCounters();
};
fSession.getExecutor().submit(runnable).get();
@@ -201,12 +198,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
public void doAfterTest() throws Exception {
super.doAfterTest();
if (fSession != null) {
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this);
- }
- };
+ Runnable runnable = () -> fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this);
fSession.getExecutor().submit(runnable).get();
}
// Clear the references (not strictly necessary)
@@ -365,12 +357,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Evaluate the expression (asynchronously)
fWait.waitReset();
- fSession.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fExpressionService.getFormattedExpressionValue(formattedValueDMC, drm);
- }
- });
+ fSession.getExecutor().submit(() -> fExpressionService.getFormattedExpressionValue(formattedValueDMC, drm));
// Wait for completion
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -411,12 +398,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Issue the breakpoint request
fWait.waitReset();
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fBreakpointService.getBreakpoints(context, drm);
- }
- });
+ fBreakpointService.getExecutor().submit(() -> fBreakpointService.getBreakpoints(context, drm));
// Wait for completion
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -453,12 +435,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Issue the breakpoint request
fWait.waitReset();
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fBreakpointService.getBreakpointDMData(breakpoint, drm);
- }
- });
+ fBreakpointService.getExecutor().submit(() -> fBreakpointService.getBreakpointDMData(breakpoint, drm));
// Wait for completion
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -496,12 +473,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
};
// Issue the remove breakpoint request
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fBreakpointService.insertBreakpoint(context, attributes, drm);
- }
- });
+ fBreakpointService.getExecutor().submit(() -> fBreakpointService.insertBreakpoint(context, attributes, drm));
// Wait for the result and return the breakpoint id
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -534,12 +506,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
};
// Issue the add breakpoint request
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fBreakpointService.removeBreakpoint(breakpoint, rm);
- }
- });
+ fBreakpointService.getExecutor().submit(() -> fBreakpointService.removeBreakpoint(breakpoint, rm));
// Wait for the result
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -572,12 +539,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
};
// Issue the update breakpoint request
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fBreakpointService.updateBreakpoint(breakpoint, delta, rm);
- }
- });
+ fBreakpointService.getExecutor().submit(() -> fBreakpointService.updateBreakpoint(breakpoint, delta, rm));
// Wait for the result
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java
index 4cbb4467fc..77ae0e1503 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java
@@ -89,19 +89,16 @@ public class MIDisassemblyTest extends BaseParametrizedTestCase {
super.doBeforeTest();
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- // Get a reference to the memory service
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- assert (fServicesTracker != null);
+ Runnable runnable = () -> {
+ // Get a reference to the memory service
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ assert (fServicesTracker != null);
- fDisassembly = fServicesTracker.getService(MIDisassembly.class);
- assert (fDisassembly != null);
+ fDisassembly = fServicesTracker.getService(MIDisassembly.class);
+ assert (fDisassembly != null);
- fExpressionService = fServicesTracker.getService(IExpressions.class);
- assert (fExpressionService != null);
- }
+ fExpressionService = fServicesTracker.getService(IExpressions.class);
+ assert (fExpressionService != null);
};
fSession.getExecutor().submit(runnable).get();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
index 2ad7f9e6bb..ca9f8681d9 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
@@ -107,15 +107,12 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fExpService = fServicesTracker.getService(IExpressions.class);
- fSession.addServiceEventListener(MIExpressionsTest.this, null);
- clearExprChangedData();
- }
+ fExpService = fServicesTracker.getService(IExpressions.class);
+ fSession.addServiceEventListener(MIExpressionsTest.this, null);
+ clearExprChangedData();
};
fSession.getExecutor().submit(runnable).get();
}
@@ -608,18 +605,13 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
// Write the new value using its formatted value
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fExpService.writeExpression(exprDmc, invalidValueFormatted, format,
- new RequestMonitor(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
- }
- });
+ fExpService.getExecutor().submit(() -> fExpService.writeExpression(exprDmc, invalidValueFormatted, format,
+ new RequestMonitor(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue("Got an OK status for an error test case. Should not be able to write value "
@@ -646,49 +638,46 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a[0]");
+ fExpService.getExecutor().submit(() -> {
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a[0]");
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("28")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("28")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format", null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format", null));
}
}
- });
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equalsIgnoreCase("0x1c")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equalsIgnoreCase("0x1c")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format", null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format", null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -718,10 +707,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// First we get the expected value of the array pointer.
final IExpressionDMContext addrDmc = SyncUtil.createExpression(frameDmc, "&a");
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fExpService.getFormattedExpressionValue(
+ fExpService.getExecutor()
+ .submit(() -> fExpService.getFormattedExpressionValue(
fExpService.getFormattedValueContext(addrDmc, IFormattedValues.NATURAL_FORMAT),
new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
@Override
@@ -732,9 +719,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
wait.waitFinished(getStatus());
}
- });
- }
- });
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
@@ -744,76 +729,73 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
wait.waitReset();
// Now perform the test
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getExecutor().submit(() -> {
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(actualAddrStr)) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals(actualAddrStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format", null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format", null));
}
}
- });
-
- wait.increment();
- fExpService.getSubExpressions(exprDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- IExpressionDMContext[] children = getData();
- int failedIndex = -1;
- for (int i = 0; i < 2; i++) {
- if (!children[i].getExpression().equals("a[" + i + "]")) {
- failedIndex = i;
- }
+ }
+ });
+
+ wait.increment();
+ fExpService.getSubExpressions(exprDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ IExpressionDMContext[] children = getData();
+ int failedIndex = -1;
+ for (int i = 0; i < 2; i++) {
+ if (!children[i].getExpression().equals("a[" + i + "]")) {
+ failedIndex = i;
}
+ }
- if (failedIndex != -1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting child number: " + failedIndex, null));
- } else {
- wait.waitFinished();
- }
+ if (failedIndex != -1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting child number: " + failedIndex, null));
+ } else {
+ wait.waitFinished();
}
}
- });
-
- // Use different format to avoid triggering the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ // Use different format to avoid triggering the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(actualAddrStr)) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals(actualAddrStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format", null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format", null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -842,10 +824,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// First we get the expected value of the array pointer.
final IExpressionDMContext addrDmc = SyncUtil.createExpression(frameDmc, "&a");
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fExpService.getFormattedExpressionValue(
+ fExpService.getExecutor()
+ .submit(() -> fExpService.getFormattedExpressionValue(
fExpService.getFormattedValueContext(addrDmc, IFormattedValues.NATURAL_FORMAT),
new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
@Override
@@ -856,9 +836,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
wait.waitFinished(getStatus());
}
- });
- }
- });
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
@@ -867,70 +845,66 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
wait.waitReset();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- wait.increment();
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
+ fExpService.getExecutor().submit(() -> {
+ wait.increment();
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(actualAddrStr)) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals(actualAddrStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format", null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format", null));
}
}
- });
-
- wait.increment();
- fExpService.getSubExpressionCount(exprDmc,
- new DataRequestMonitor<Integer>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ wait.increment();
+ fExpService.getSubExpressionCount(exprDmc,
+ new DataRequestMonitor<Integer>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ int count = getData();
+ if (count != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting count for children. Got" + count + "instead of 2", null));
} else {
- int count = getData();
- if (count != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting count for children. Got" + count + "instead of 2",
- null));
- } else {
- wait.waitFinished();
- }
+ wait.waitFinished();
}
}
- });
-
- // Use different format to avoid triggering the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ // Use different format to avoid triggering the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(actualAddrStr)) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals(actualAddrStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format", null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format", null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -960,68 +934,63 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("32")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("32")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got "
- + getData().getFormattedValue() + " instead of 32",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got " + getData().getFormattedValue()
+ + " instead of 32",
+ null));
}
}
- });
-
- wait.increment();
- fExpService.writeExpression(exprDmc, "56", IFormattedValues.NATURAL_FORMAT,
- new RequestMonitor(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- wait.waitFinished();
- }
+ }
+ });
+
+ wait.increment();
+ fExpService.writeExpression(exprDmc, "56", IFormattedValues.NATURAL_FORMAT,
+ new RequestMonitor(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ wait.waitFinished();
}
- });
-
- // Use different format to avoid triggering the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ // Use different format to avoid triggering the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("0x38")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("0x38")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format, got "
- + getData().getFormattedValue() + " instead of 0x38",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format, got " + getData().getFormattedValue()
+ + " instead of 0x38",
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1055,113 +1024,107 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("32")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("32")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got "
- + getData().getFormattedValue() + " instead of 32",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got " + getData().getFormattedValue()
+ + " instead of 32",
+ null));
}
}
- });
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("0x20")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("0x20")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format, got "
- + getData().getFormattedValue() + " instead of 0x20",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format, got " + getData().getFormattedValue()
+ + " instead of 0x20",
+ null));
}
}
- });
-
- wait.increment();
- fExpService.getSubExpressionCount(exprDmc,
- new DataRequestMonitor<Integer>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ wait.increment();
+ fExpService.getSubExpressionCount(exprDmc,
+ new DataRequestMonitor<Integer>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData() != 0) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting child count; expecting 0 got " + getData(), null));
} else {
- if (getData() != 0) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting child count; expecting 0 got " + getData(), null));
- } else {
- wait.waitFinished();
- }
+ wait.waitFinished();
}
}
- });
-
- wait.increment();
- fExpService.getSubExpressions(exprDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ wait.increment();
+ fExpService.getSubExpressions(exprDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().length != 0) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 0 got " + getData().length, null));
} else {
- if (getData().length != 0) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 0 got " + getData().length, null));
- } else {
- wait.waitFinished();
- }
+ wait.waitFinished();
}
}
- });
-
- // Must use a different format or else the cache will be triggered
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.OCTAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ // Must use a different format or else the cache will be triggered
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.OCTAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("040")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("040")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format, got "
- + getData().getFormattedValue() + " instead of 040",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format, got " + getData().getFormattedValue()
+ + " instead of 040",
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1199,98 +1162,92 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("32")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("32")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got "
- + getData().getFormattedValue() + " instead of 32",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got " + getData().getFormattedValue()
+ + " instead of 32",
+ null));
}
}
- });
-
- wait.increment();
- fExpService.writeExpression(exprDmc, "56", IFormattedValues.NATURAL_FORMAT,
- new RequestMonitor(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- wait.waitFinished();
- }
+ }
+ });
+
+ wait.increment();
+ fExpService.writeExpression(exprDmc, "56", IFormattedValues.NATURAL_FORMAT,
+ new RequestMonitor(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ wait.waitFinished();
}
- });
-
- // Must use a different format or else the cache will be
- // triggered
- // This will prove that the write has changed the backend
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.OCTAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ // Must use a different format or else the cache will be
+ // triggered
+ // This will prove that the write has changed the backend
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.OCTAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("070")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("070")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format, got "
- + getData().getFormattedValue() + " instead of 070",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format, got " + getData().getFormattedValue()
+ + " instead of 070",
+ null));
}
}
- });
-
- // Test that the cache is triggered, giving us the old value
- // This happens because we are calling this operation on the
- // same executor run call.
- // NOTE that this is not a problem, because the writeExpression
- // will eventually
- // reset the cache (we'll test this below).
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ // Test that the cache is triggered, giving us the old value
+ // This happens because we are calling this operation on the
+ // same executor run call.
+ // NOTE that this is not a problem, because the writeExpression
+ // will eventually
+ // reset the cache (we'll test this below).
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("32")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("32")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got "
- + getData().getFormattedValue() + " instead of 32",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got " + getData().getFormattedValue()
+ + " instead of 32",
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1300,32 +1257,28 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// reset, do a similar
// request as above to see that the cache has indeed been reset
wait.waitReset();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getExecutor().submit(() -> {
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("56")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("56")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got "
- + getData().getFormattedValue() + " instead of 56",
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got " + getData().getFormattedValue()
+ + " instead of 56",
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1357,10 +1310,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
// First get the address of 'a' through 'a_ptr'
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fExpService.getFormattedExpressionValue(
+ fExpService.getExecutor()
+ .submit(() -> fExpService.getFormattedExpressionValue(
fExpService.getFormattedValueContext(exprDmc2, IFormattedValues.NATURAL_FORMAT),
new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
@Override
@@ -1371,9 +1322,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
wait.waitFinished(getStatus());
}
- });
- }
- });
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
@@ -1533,53 +1482,47 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + getData().length, null));
- } else {
- // now get the value of the child
- final String valueStr = "1";
- final IExpressionDMContext child = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child,
- IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + child.getExpression() + ", got "
- + getData().getFormattedValue() + " instead of "
- + valueStr,
- null));
- }
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got " + getData().length, null));
+ } else {
+ // now get the value of the child
+ final String valueStr = "1";
+ final IExpressionDMContext child = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + child.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of "
+ + valueStr,
+ null));
}
+ }
- });
- }
-
+ });
}
- });
- }
+
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1589,53 +1532,47 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
SyncUtil.step(StepType.STEP_RETURN);
stoppedEvent = SyncUtil.step(4, StepType.STEP_INTO);
final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc2, "z");
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc2, "z");
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + getData().length, null));
- } else {
- // now get the value of the child
- final String valueStr = "2";
- final IExpressionDMContext child = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child,
- IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + child.getExpression() + ", got "
- + getData().getFormattedValue() + " instead of "
- + valueStr,
- null));
- }
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got " + getData().length, null));
+ } else {
+ // now get the value of the child
+ final String valueStr = "2";
+ final IExpressionDMContext child = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + child.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of "
+ + valueStr,
+ null));
}
+ }
- });
- }
-
+ });
}
- });
- }
+
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1645,53 +1582,47 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
SyncUtil.step(StepType.STEP_RETURN);
stoppedEvent = SyncUtil.step(4, StepType.STEP_INTO);
final IFrameDMContext frameDmc3 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc3, "z");
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc3, "z");
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + getData().length, null));
- } else {
- // now get the value of the child
- final String valueStr = "3";
- final IExpressionDMContext child = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child,
- IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + child.getExpression() + ", got "
- + getData().getFormattedValue() + " instead of "
- + valueStr,
- null));
- }
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got " + getData().length, null));
+ } else {
+ // now get the value of the child
+ final String valueStr = "3";
+ final IExpressionDMContext child = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + child.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of "
+ + valueStr,
+ null));
}
+ }
- });
- }
-
+ });
}
- });
- }
+
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1728,85 +1659,78 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
public void doUpdateTest(final IFrameDMContext frameDmc, final int baseValue) throws Throwable {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "a");
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "a");
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
- // Now list the children of this child
- fExpService.getSubExpressions(getData()[0],
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- final IExpressionDMContext[] childDmcs = getData();
-
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (childDmcs.length != 2) {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got "
- + childDmcs.length,
- null));
- } else {
- // now get the value of the two children
- for (int i = 0; i < 2; i++) {
- final String valueStr = Integer
- .toString(baseValue + i + 10);
- final int finali = i;
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(childDmcs[i],
- IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue()
- .equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(
- IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Failed evaluating "
- + childDmcs[finali]
- .getExpression()
- + ", got "
- + getData()
- .getFormattedValue()
- + " instead of "
- + valueStr,
- null));
- }
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
+ // Now list the children of this child
+ fExpService.getSubExpressions(getData()[0],
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ final IExpressionDMContext[] childDmcs = getData();
+
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (childDmcs.length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got "
+ + childDmcs.length,
+ null));
+ } else {
+ // now get the value of the two children
+ for (int i = 0; i < 2; i++) {
+ final String valueStr = Integer.toString(baseValue + i + 10);
+ final int finali = i;
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(childDmcs[i],
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue()
+ .equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating "
+ + childDmcs[finali]
+ .getExpression()
+ + ", got "
+ + getData()
+ .getFormattedValue()
+ + " instead of " + valueStr,
+ null));
}
+ }
- });
- }
+ });
}
}
- });
- }
-
+ }
+ });
}
- });
- }
+
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1819,85 +1743,78 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc2, "a");
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc2, "a");
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
- // Now list the children of this child
- fExpService.getSubExpressions(getData()[0],
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- final IExpressionDMContext[] childDmcs = getData();
-
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (childDmcs.length != 2) {
- wait.waitFinished(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got "
- + childDmcs.length,
- null));
- } else {
- // now get the value of the two children
- for (int i = 0; i < 2; i++) {
- final String valueStr = Integer
- .toString(baseValue + i + 20);
- final int finali = i;
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(childDmcs[i],
- IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue()
- .equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(
- IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Failed evaluating "
- + childDmcs[finali]
- .getExpression()
- + ", got "
- + getData()
- .getFormattedValue()
- + " instead of "
- + valueStr,
- null));
- }
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
+ // Now list the children of this child
+ fExpService.getSubExpressions(getData()[0],
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ final IExpressionDMContext[] childDmcs = getData();
+
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (childDmcs.length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got "
+ + childDmcs.length,
+ null));
+ } else {
+ // now get the value of the two children
+ for (int i = 0; i < 2; i++) {
+ final String valueStr = Integer.toString(baseValue + i + 20);
+ final int finali = i;
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(childDmcs[i],
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue()
+ .equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating "
+ + childDmcs[finali]
+ .getExpression()
+ + ", got "
+ + getData()
+ .getFormattedValue()
+ + " instead of " + valueStr,
+ null));
}
+ }
- });
- }
+ });
}
}
- });
- }
-
+ }
+ });
}
- });
- }
+
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1922,70 +1839,64 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "f");
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "f");
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().length != 5) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 5 got " + getData().length, null));
} else {
- if (getData().length != 5) {
+ String childStr = "((bar) f)";
+ if (!getData()[0].getExpression().equals(childStr)) {
wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 5 got " + getData().length, null));
+ "Got child " + getData()[0].getExpression() + " instead of " + childStr,
+ null));
} else {
- String childStr = "((bar) f)";
- if (!getData()[0].getExpression().equals(childStr)) {
- wait.waitFinished(new Status(
- IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Got child "
- + getData()[0].getExpression() + " instead of " + childStr,
- null));
- } else {
- // Now list the children of the first element
- fExpService.getSubExpressions(getData()[0],
- new DataRequestMonitor<IExpressionDMContext[]>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ // Now list the children of the first element
+ fExpService.getSubExpressions(getData()[0],
+ new DataRequestMonitor<IExpressionDMContext[]>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got "
+ + getData().length,
+ null));
} else {
- if (getData().length != 2) {
+ String childStr = "((((bar) f)).d)";
+ if (!getData()[0].getExpression().equals(childStr)) {
wait.waitFinished(new Status(IStatus.ERROR,
TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got "
- + getData().length,
+ "Got child " + getData()[0].getExpression()
+ + " instead of " + childStr,
null));
} else {
- String childStr = "((((bar) f)).d)";
- if (!getData()[0].getExpression()
- .equals(childStr)) {
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Got child "
- + getData()[0].getExpression()
- + " instead of " + childStr,
- null));
- } else {
- wait.setReturnInfo(getData()[0]);
- wait.waitFinished();
- }
+ wait.setReturnInfo(getData()[0]);
+ wait.waitFinished();
}
}
}
- });
- }
+ }
+ });
}
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -1994,42 +1905,15 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
wait.waitReset();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- // Now create more than 1000 expressions to trigger the deletion of the children
- // that were created above
- for (int i = 0; i < 1100; i++) {
- IExpressionDMContext dmc = fExpService.createExpression(frameDmc, "a[" + i + "]");
-
- wait.increment();
- fExpService.getExpressionData(dmc,
- new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- wait.waitFinished();
- }
- }
- });
- }
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
+ fExpService.getExecutor().submit(() -> {
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ // Now create more than 1000 expressions to trigger the deletion of the children
+ // that were created above
+ for (int i = 0; i < 1100; i++) {
+ IExpressionDMContext dmc = fExpService.createExpression(frameDmc, "a[" + i + "]");
- // Evaluate the expression of a child that we know is deleted to make sure
- // the expression service can handle that
- fExpService.getExpressionData(deletedChildDmc,
+ wait.increment();
+ fExpService.getExpressionData(dmc,
new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
@Override
protected void handleCompleted() {
@@ -2047,6 +1931,22 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
assertTrue(wait.getMessage(), wait.isOK());
wait.waitReset();
+ fExpService.getExecutor().submit(() -> fExpService.getExpressionData(deletedChildDmc,
+ new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ wait.waitFinished();
+ }
+ }
+ }));
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
}
/**
@@ -2069,34 +1969,31 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // First create the var object and all its children
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
-
- // This call will create the variable object in natural format and then change
- // it to binary to fetch the value
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.BINARY_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getExecutor().submit(() -> {
+ // First create the var object and all its children
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
+
+ // This call will create the variable object in natural format and then change
+ // it to binary to fetch the value
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.BINARY_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("1011")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("1011")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating binary format, expected 1011 but got "
- + getData().getFormattedValue(),
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating binary format, expected 1011 but got "
+ + getData().getFormattedValue(),
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -2107,34 +2004,31 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // First create the var object and all its children
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc2, "a");
-
- // This call will create the variable object in natural format and then change
- // it to binary to fetch the value
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.BINARY_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getExecutor().submit(() -> {
+ // First create the var object and all its children
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc2, "a");
+
+ // This call will create the variable object in natural format and then change
+ // it to binary to fetch the value
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.BINARY_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("11")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("11")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating binary format, expected 11 but got "
- + getData().getFormattedValue(),
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating binary format, expected 11 but got "
+ + getData().getFormattedValue(),
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -2172,56 +2066,53 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // First create the var object and all its children
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
-
- // check that we have the proper value
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getExecutor().submit(() -> {
+ // First create the var object and all its children
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
+
+ // check that we have the proper value
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("1.99")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("1.99")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating a, expected 1.99 but got "
- + getData().getFormattedValue(),
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating a, expected 1.99 but got "
+ + getData().getFormattedValue(),
+ null));
}
}
- });
-
- // ask for hex to set the format to hex
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ }
+ });
+
+ // ask for hex to set the format to hex
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("0x1")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("0x1")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating a, expected 0x1 but got "
- + getData().getFormattedValue(),
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating a, expected 0x1 but got "
+ + getData().getFormattedValue(),
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -2232,35 +2123,32 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // First create the var object and all its children
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc2, "a");
-
- // trigger the var-update in the last format (hex)
- // then request the actual value in natural which should not be taken from the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getExecutor().submit(() -> {
+ // First create the var object and all its children
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc2, "a");
+
+ // trigger the var-update in the last format (hex)
+ // then request the actual value in natural which should not be taken from the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("1.22")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("1.22")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, expected 1.22 but got "
- + getData().getFormattedValue(),
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, expected 1.22 but got "
+ + getData().getFormattedValue(),
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -2296,38 +2184,58 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
+ fExpService.getExecutor().submit(() -> {
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
- // check that we have the proper value
- // This will cache the value 1 in the natural format cache
- final String valueStr = "1";
- globalExpressionCtx1 = getData()[0];
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1,
- IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
+ // check that we have the proper value
+ // This will cache the value 1 in the natural format cache
+ final String valueStr = "1";
+ globalExpressionCtx1 = getData()[0];
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1,
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression()
+ + ", got " + getData().getFormattedValue()
+ + " instead of " + valueStr,
+ null));
+ }
+ }
+ });
+
+ // ask for decimal to set the format to decimal
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1,
+ IFormattedValues.DECIMAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(valueStr)) {
wait.waitFinished();
} else {
wait.waitFinished(new Status(IStatus.ERROR,
@@ -2339,39 +2247,12 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
null));
}
}
- });
-
- // ask for decimal to set the format to decimal
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1,
- IFormattedValues.DECIMAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Failed evaluating "
- + globalExpressionCtx1.getExpression()
- + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr,
- null));
- }
- }
- }
- });
+ }
+ });
- }
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -2381,33 +2262,30 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// Now step to change the value of "a" in natural but it remains the same in decimal
SyncUtil.step(1, StepType.STEP_OVER);
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- // trigger the var-update in the last format (decimal)
- // then request the actual value in natural which should not be taken from the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getExecutor().submit(() -> {
+
+ // trigger the var-update in the last format (decimal)
+ // then request the actual value in natural which should not be taken from the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("1.22")) {
+ wait.waitFinished();
} else {
- if (getData().getFormattedValue().equals("1.22")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, expected 1.22 but got "
- + getData().getFormattedValue(),
- null));
- }
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, expected 1.22 but got "
+ + getData().getFormattedValue(),
+ null));
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -2429,52 +2307,46 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
// Ask for one value to create the var object
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
-
- wait.increment();
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
- // now get the value of the child
- final String valueStr = "01";
- globalExpressionCtx1 = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1,
- IFormattedValues.OCTAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Failed evaluating "
- + globalExpressionCtx1.getExpression()
- + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr,
- null));
- }
+ fExpService.getExecutor().submit(() -> {
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
+
+ wait.increment();
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
+ // now get the value of the child
+ final String valueStr = "01";
+ globalExpressionCtx1 = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1,
+ IFormattedValues.OCTAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression()
+ + ", got " + getData().getFormattedValue()
+ + " instead of " + valueStr,
+ null));
}
- });
- }
+ }
+ });
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -2484,50 +2356,49 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// Now do two reads in two different formats
// We need to make sure that the locking properly works although we are calling
// the internal update method, which does affect the state of the object
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.BINARY_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- final String valueStr = "1";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
- + getData().getFormattedValue() + " instead of " + valueStr,
- null));
- }
+ fExpService.getExecutor().submit(() -> {
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.BINARY_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ final String valueStr = "1";
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
}
- });
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- final String valueStr = "0x1";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
- + getData().getFormattedValue() + " instead of " + valueStr,
- null));
- }
+ }
+ });
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ final String valueStr = "0x1";
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
}
+ }
- });
- }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -2553,52 +2424,46 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // First create the var object and its child
- globalExpressionCtx1 = fExpService.createExpression(frameDmc, "z");
+ fExpService.getExecutor().submit(() -> {
+ // First create the var object and its child
+ globalExpressionCtx1 = fExpService.createExpression(frameDmc, "z");
- wait.increment();
- fExpService.getSubExpressions(globalExpressionCtx1,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
- // now get the value of the child
- final String valueStr = "1";
- globalExpressionCtx2 = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx2,
- IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Failed evaluating "
- + globalExpressionCtx2.getExpression()
- + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr,
- null));
- }
+ wait.increment();
+ fExpService.getSubExpressions(globalExpressionCtx1,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
+ // now get the value of the child
+ final String valueStr = "1";
+ globalExpressionCtx2 = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx2,
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx2.getExpression()
+ + ", got " + getData().getFormattedValue()
+ + " instead of " + valueStr,
+ null));
}
- });
- }
+ }
+ });
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -2610,80 +2475,77 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// Now step to another method to make the previous variable objects out-of-scope
// then first request the child and then the parent. We want to test this order
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx2, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- final String valueStr = "2";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx2.getExpression() + ", got "
- + getData().getFormattedValue() + " instead of " + valueStr,
- null));
- }
+ fExpService.getExecutor().submit(() -> {
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx2, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ final String valueStr = "2";
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx2.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
assertTrue(wait.getMessage(), wait.isOK());
wait.waitReset();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- final String valueStr = "{...}";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
- + getData().getFormattedValue() + " instead of " + valueStr,
- null));
- }
+ fExpService.getExecutor().submit(() -> {
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ final String valueStr = "{...}";
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
}
- });
-
- // Ask a second time but in a different format, to avoid the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.DECIMAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- final String valueStr = "{...}";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
- + getData().getFormattedValue() + " instead of " + valueStr,
- null));
- }
+ }
+ });
+
+ // Ask a second time but in a different format, to avoid the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.DECIMAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ final String valueStr = "{...}";
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
}
- });
+ }
+ });
- }
});
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -2807,53 +2669,50 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- final int exprCount = 5;
- final IExpressionDMContext dmcs[] = new IExpressionDMContext[exprCount];
- final boolean expectedValues[] = new boolean[exprCount];
-
- int exprIndex = 0;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "a");
- expectedValues[exprIndex] = true;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "b");
- expectedValues[exprIndex] = true;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "c");
- expectedValues[exprIndex] = false;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "d");
- expectedValues[exprIndex] = false;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "d[1]");
- expectedValues[exprIndex] = true;
- exprIndex++;
-
- for (int index = 0; index < exprCount; index++) {
- final int finalIndex = index;
- wait.increment();
- fExpService.canWriteExpression(dmcs[finalIndex],
- new DataRequestMonitor<Boolean>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData() == expectedValues[finalIndex]) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed establishing proper canWrite for "
- + dmcs[finalIndex].getExpression() + ", got " + getData()
- + " instead of " + expectedValues[finalIndex],
- null));
- }
-
+ fExpService.getExecutor().submit(() -> {
+
+ final int exprCount = 5;
+ final IExpressionDMContext dmcs[] = new IExpressionDMContext[exprCount];
+ final boolean expectedValues[] = new boolean[exprCount];
+
+ int exprIndex = 0;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "a");
+ expectedValues[exprIndex] = true;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "b");
+ expectedValues[exprIndex] = true;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "c");
+ expectedValues[exprIndex] = false;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "d");
+ expectedValues[exprIndex] = false;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "d[1]");
+ expectedValues[exprIndex] = true;
+ exprIndex++;
+
+ for (int index = 0; index < exprCount; index++) {
+ final int finalIndex = index;
+ wait.increment();
+ fExpService.canWriteExpression(dmcs[finalIndex],
+ new DataRequestMonitor<Boolean>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData() == expectedValues[finalIndex]) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed establishing proper canWrite for "
+ + dmcs[finalIndex].getExpression() + ", got " + getData()
+ + " instead of " + expectedValues[finalIndex],
+ null));
}
- });
- }
+
+ }
+ });
}
});
@@ -2874,44 +2733,41 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- final int exprCount = 2;
- final IExpressionDMContext dmcs[] = new IExpressionDMContext[exprCount];
- final boolean expectedValues[] = new boolean[exprCount];
-
- int exprIndex = 0;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "&a");
- expectedValues[exprIndex] = false;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "1");
- expectedValues[exprIndex] = false;
- exprIndex++;
-
- for (int index = 0; index < exprCount; index++) {
- final int finalIndex = index;
- wait.increment();
- fExpService.canWriteExpression(dmcs[finalIndex],
- new DataRequestMonitor<Boolean>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData() == expectedValues[finalIndex]) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed establishing proper canWrite for "
- + dmcs[finalIndex].getExpression() + ", got " + getData()
- + " instead of " + expectedValues[finalIndex],
- null));
- }
+ fExpService.getExecutor().submit(() -> {
+
+ final int exprCount = 2;
+ final IExpressionDMContext dmcs[] = new IExpressionDMContext[exprCount];
+ final boolean expectedValues[] = new boolean[exprCount];
+ int exprIndex = 0;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "&a");
+ expectedValues[exprIndex] = false;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "1");
+ expectedValues[exprIndex] = false;
+ exprIndex++;
+
+ for (int index = 0; index < exprCount; index++) {
+ final int finalIndex = index;
+ wait.increment();
+ fExpService.canWriteExpression(dmcs[finalIndex],
+ new DataRequestMonitor<Boolean>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData() == expectedValues[finalIndex]) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed establishing proper canWrite for "
+ + dmcs[finalIndex].getExpression() + ", got " + getData()
+ + " instead of " + expectedValues[finalIndex],
+ null));
}
- });
- }
+
+ }
+ });
}
});
@@ -2957,107 +2813,94 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// Get the list of available format IDs for this expression and for
// each one,
// get the value of the expression
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fExpService.getAvailableFormats(exprDMC,
- new DataRequestMonitor<String[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- final String[] formatIds = getData();
-
- // Now run the current sub-test using each of
- // the formats available for the type of
- // the expression in the sub-test.
-
- for (final String formatId : formatIds) {
- // Get a FormattedValueCMContext object for
- // the expression-formatID pair.
- final FormattedValueDMContext valueDmc = fExpService
- .getFormattedValueContext(exprDMC, formatId);
-
- // Increment the number of completed
- // requests to wait for, since we will send
- // multiple concurrent requests
- wait.increment();
-
- // Evaluate the expression represented by
- // the FormattedValueDMContext object
- // This actually evaluates the expression.
- fExpService.getFormattedExpressionValue(valueDmc,
- new DataRequestMonitor<FormattedValueDMData>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
+ fExpService.getExecutor().submit(() -> fExpService.getAvailableFormats(exprDMC,
+ new DataRequestMonitor<String[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ final String[] formatIds = getData();
+
+ // Now run the current sub-test using each of
+ // the formats available for the type of
+ // the expression in the sub-test.
+
+ for (final String formatId : formatIds) {
+ // Get a FormattedValueCMContext object for
+ // the expression-formatID pair.
+ final FormattedValueDMContext valueDmc = fExpService
+ .getFormattedValueContext(exprDMC, formatId);
+
+ // Increment the number of completed
+ // requests to wait for, since we will send
+ // multiple concurrent requests
+ wait.increment();
- // Get the
- // FormattedValueDMData
- // object from the waiter.
- FormattedValueDMData exprValueDMData = getData();
-
- final String[] expectedValues = tests
- .get(expressionToEvaluate);
-
- // Check the value of the expression for correctness.
- String actualValue = exprValueDMData
- .getFormattedValue();
- String expectedValue;
-
- if (formatId.equals(IFormattedValues.HEX_FORMAT))
- expectedValue = expectedValues[0];
- else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
- expectedValue = expectedValues[1];
- else if (formatId
- .equals(IFormattedValues.BINARY_FORMAT))
- expectedValue = expectedValues[2];
- else if (formatId
- .equals(IFormattedValues.DECIMAL_FORMAT))
- expectedValue = expectedValues[3];
- else if (formatId
- .equals(IFormattedValues.NATURAL_FORMAT))
- expectedValue = expectedValues[4];
- else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
- expectedValue = expectedValues[5];
- else
- expectedValue = "[Unrecognized format ID: "
- + formatId + "]";
-
- if ((exact == false)
- && (formatId
- .equals(IFormattedValues.NATURAL_FORMAT)
- || formatId.equals(
- MIExpressions.DETAILS_FORMAT))
- && (expectedValue.length() < actualValue
- .length())) {
- actualValue = actualValue.substring(0,
- expectedValue.length());
- }
+ // Evaluate the expression represented by
+ // the FormattedValueDMContext object
+ // This actually evaluates the expression.
+ fExpService.getFormattedExpressionValue(valueDmc,
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
- if (actualValue.equalsIgnoreCase(expectedValue)) {
- wait.waitFinished();
- } else {
- String errorMsg = "Failed to correctly evalutate '"
- + expressionToEvaluate + "': expected '"
- + expectedValue + "', got '" + actualValue
- + "'";
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID, errorMsg, null));
- }
- }
+ // Get the
+ // FormattedValueDMData
+ // object from the waiter.
+ FormattedValueDMData exprValueDMData = getData();
+
+ final String[] expectedValues = tests.get(expressionToEvaluate);
+
+ // Check the value of the expression for correctness.
+ String actualValue = exprValueDMData.getFormattedValue();
+ String expectedValue;
+
+ if (formatId.equals(IFormattedValues.HEX_FORMAT))
+ expectedValue = expectedValues[0];
+ else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
+ expectedValue = expectedValues[1];
+ else if (formatId.equals(IFormattedValues.BINARY_FORMAT))
+ expectedValue = expectedValues[2];
+ else if (formatId.equals(IFormattedValues.DECIMAL_FORMAT))
+ expectedValue = expectedValues[3];
+ else if (formatId.equals(IFormattedValues.NATURAL_FORMAT))
+ expectedValue = expectedValues[4];
+ else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
+ expectedValue = expectedValues[5];
+ else
+ expectedValue = "[Unrecognized format ID: " + formatId
+ + "]";
+
+ if ((exact == false)
+ && (formatId.equals(IFormattedValues.NATURAL_FORMAT)
+ || formatId
+ .equals(MIExpressions.DETAILS_FORMAT))
+ && (expectedValue.length() < actualValue.length())) {
+ actualValue = actualValue.substring(0,
+ expectedValue.length());
}
- });
- }
- }
+
+ if (actualValue.equalsIgnoreCase(expectedValue)) {
+ wait.waitFinished();
+ } else {
+ String errorMsg = "Failed to correctly evalutate '"
+ + expressionToEvaluate + "': expected '"
+ + expectedValue + "', got '" + actualValue + "'";
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID, errorMsg, null));
+ }
+ }
+ }
+ });
}
- });
- }
- });
+ }
+ }
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
@@ -3084,22 +2927,17 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fExpService.getExpressionAddressData(dmc,
- new DataRequestMonitor<IExpressionDMAddress>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
+ fExpService.getExecutor().submit(() -> fExpService.getExpressionAddressData(dmc,
+ new DataRequestMonitor<IExpressionDMAddress>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
- wait.waitFinished(getStatus());
- }
- });
- }
- });
+ wait.waitFinished(getStatus());
+ }
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
@@ -3169,22 +3007,16 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- });
- }
- });
+ fExpService.getExecutor().submit(() -> fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
@@ -3216,22 +3048,16 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- fExpService.getSubExpressions(parentDmc, startIndex, length,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- });
- }
- });
+ fExpService.getExecutor().submit(() -> fExpService.getSubExpressions(parentDmc, startIndex, length,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
@@ -4267,71 +4093,65 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
+ fExpService.getExecutor().submit(() -> {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "f");
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "f");
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().length != 5) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 5 got " + getData().length, null));
} else {
- if (getData().length != 5) {
+ String childStr = "((class bar) f)";
+ if (!getData()[0].getExpression().equals(childStr)) {
wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 5 got " + getData().length, null));
+ "Got child " + getData()[0].getExpression() + " instead of " + childStr,
+ null));
} else {
- String childStr = "((class bar) f)";
- if (!getData()[0].getExpression().equals(childStr)) {
- wait.waitFinished(new Status(
- IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Got child "
- + getData()[0].getExpression() + " instead of " + childStr,
- null));
- } else {
- // Now list the children of the
- // first element
- fExpService.getSubExpressions(getData()[0],
- new DataRequestMonitor<IExpressionDMContext[]>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
+ // Now list the children of the
+ // first element
+ fExpService.getSubExpressions(getData()[0],
+ new DataRequestMonitor<IExpressionDMContext[]>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got "
+ + getData().length,
+ null));
} else {
- if (getData().length != 2) {
+ String childStr = "((((class bar) f)).d)";
+ if (!getData()[0].getExpression().equals(childStr)) {
wait.waitFinished(new Status(IStatus.ERROR,
TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got "
- + getData().length,
+ "Got child " + getData()[0].getExpression()
+ + " instead of " + childStr,
null));
} else {
- String childStr = "((((class bar) f)).d)";
- if (!getData()[0].getExpression()
- .equals(childStr)) {
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID,
- "Got child "
- + getData()[0].getExpression()
- + " instead of " + childStr,
- null));
- } else {
- wait.setReturnInfo(getData()[0]);
- wait.waitFinished();
- }
+ wait.setReturnInfo(getData()[0]);
+ wait.waitFinished();
}
}
}
- });
- }
+ }
+ });
}
}
}
- });
- }
+ }
+ });
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -4340,44 +4160,16 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
wait.waitReset();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- // Now create more than 1000 expressions to trigger the deletion
- // of the children
- // that were created above
- for (int i = 0; i < 1100; i++) {
- IExpressionDMContext dmc = fExpService.createExpression(frameDmc, "a[" + i + "]");
+ fExpService.getExecutor().submit(() -> {
- wait.increment();
- fExpService.getExpressionData(dmc,
- new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- wait.waitFinished();
- }
- }
- });
- }
- }
- });
+ // Now create more than 1000 expressions to trigger the deletion
+ // of the children
+ // that were created above
+ for (int i = 0; i < 1100; i++) {
+ IExpressionDMContext dmc = fExpService.createExpression(frameDmc, "a[" + i + "]");
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
-
- // Evaluate the expression of a child that we know is deleted to
- // make sure
- // the expression service can handle that
- fExpService.getExpressionData(deletedChildDmc,
+ wait.increment();
+ fExpService.getExpressionData(dmc,
new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
@Override
protected void handleCompleted() {
@@ -4395,6 +4187,23 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
assertTrue(wait.getMessage(), wait.isOK());
wait.waitReset();
+ // Evaluate the expression of a child that we know is deleted to make sure the expression service can handle that
+ fExpService.getExecutor().submit(() -> fExpService.getExpressionData(deletedChildDmc,
+ new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ wait.waitFinished();
+ }
+ }
+ }));
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
}
/**
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java
index 08d58fdbaa..dce41175a8 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java
@@ -104,29 +104,26 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
fMemoryDmc = (IMemoryDMContext) SyncUtil.getContainerContext();
assert (fMemoryDmc != null);
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- // Get a reference to the memory service
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- assert (fServicesTracker != null);
+ Runnable runnable = () -> {
+ // Get a reference to the memory service
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ assert (fServicesTracker != null);
- fRunControl = fServicesTracker.getService(MIRunControl.class);
- assert (fRunControl != null);
+ fRunControl = fServicesTracker.getService(MIRunControl.class);
+ assert (fRunControl != null);
- fMemoryService = fServicesTracker.getService(IMemory.class);
- assert (fMemoryService != null);
+ fMemoryService = fServicesTracker.getService(IMemory.class);
+ assert (fMemoryService != null);
- fExpressionService = fServicesTracker.getService(IExpressions.class);
- assert (fExpressionService != null);
+ fExpressionService = fServicesTracker.getService(IExpressions.class);
+ assert (fExpressionService != null);
- fSession.addServiceEventListener(MIMemoryTest.this, null);
- fBaseAddress = null;
- clearEventCounters();
+ fSession.addServiceEventListener(MIMemoryTest.this, null);
+ fBaseAddress = null;
+ clearEventCounters();
- fWordSize = SyncUtil.readAddressableSize(fMemoryDmc);
- fByteOrder = SyncUtil.getMemoryByteOrder(fMemoryDmc);
- }
+ fWordSize = SyncUtil.readAddressableSize(fMemoryDmc);
+ fByteOrder = SyncUtil.getMemoryByteOrder(fMemoryDmc);
};
fSession.getExecutor().submit(runnable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
index ed14ac8825..42794ba246 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
@@ -101,16 +101,13 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
fSession = getGDBLaunch().getSession();
resolveLineTagLocations(SOURCE_NAME, MIRunControlTest.LINE_TAGS);
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- // We obtain the services we need after the new
- // launch has been performed
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Runnable runnable = () -> {
+ // We obtain the services we need after the new
+ // launch has been performed
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fRegService = (IRegisters2) fServicesTracker.getService(IRegisters.class);
- fRunControl = fServicesTracker.getService(IRunControl.class);
- }
+ fRegService = (IRegisters2) fServicesTracker.getService(IRegisters.class);
+ fRunControl = fServicesTracker.getService(IRunControl.class);
};
fSession.getExecutor().submit(runnable).get();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java
index c715c21c27..75fe7a60fd 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java
@@ -65,14 +65,11 @@ public class MIRunControlReverseTest extends BaseParametrizedTestCase {
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
- fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
- fExpressions = fServicesTracker.getService(IExpressions.class);
- }
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
+ fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
+ fExpressions = fServicesTracker.getService(IExpressions.class);
};
fSession.getExecutor().submit(runnable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java
index 58d7ba19f8..0ab1552130 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java
@@ -65,14 +65,11 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
final DsfSession session = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
- fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
- fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
- }
+ fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
};
session.getExecutor().submit(runnable).get();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java
index 4ec35480c8..3cc2906ead 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java
@@ -109,22 +109,19 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
final DsfSession session = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
- fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
-
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(),
- MIProcesses.UNIQUE_GROUP_ID);
- fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
- IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
- fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
-
- fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
- fBackEnd = fServicesTracker.getService(IGDBBackend.class);
- }
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
+
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(),
+ MIProcesses.UNIQUE_GROUP_ID);
+ fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
+ IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
+ fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
+
+ fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
+ fBackEnd = fServicesTracker.getService(IGDBBackend.class);
};
session.getExecutor().submit(runnable).get();
}
@@ -221,12 +218,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
/*
* Test getExecutionContexts() when only one thread exist.
*/
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.getExecutionContexts(containerDmc, rm);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionContexts(containerDmc, rm));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
@@ -287,12 +279,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
/*
* Test getExecutionContexts for a valid container DMC
*/
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.getExecutionContexts(containerDmc, rmExecutionCtxts);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionContexts(containerDmc, rmExecutionCtxts));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
wait.waitReset();
@@ -353,12 +340,8 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
/*
* Call getModelData for Execution DMC
*/
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.getExecutionData(((MIRunControl) fRunCtrl).createMIExecutionContext(containerDmc, "1"), rm);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl
+ .getExecutionData(((MIRunControl) fRunCtrl).createMIExecutionContext(containerDmc, "1"), rm));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
@@ -403,12 +386,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
/*
* getModelData for Execution DMC
*/
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
@@ -450,12 +428,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
wait.waitFinished(getStatus());
}
};
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
@@ -497,12 +470,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
}
};
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.getExecutionData(fContainerDmc, rm);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionData(fContainerDmc, rm));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
@@ -534,13 +502,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
}
};
// final IContainerDMContext ctxt = new GDBControlDMContext("-1", getClass().getName() + ":" + 1);
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- // Pass an invalid dmc
- fRunCtrl.getExecutionContexts(fContainerDmc, rm);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionContexts(fContainerDmc, rm));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
Assert.assertTrue(wait.getMessage(), !wait.isOK());
@@ -585,12 +547,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.resume(containerDmc, rm);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.resume(containerDmc, rm));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
try {
@@ -604,12 +561,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
wait.waitReset();
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
- wait.waitFinished();
- }
+ fRunCtrl.getExecutor().submit(() -> {
+ wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
+ wait.waitFinished();
});
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -632,12 +586,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
final ServiceEventWaitor<IResumedDMEvent> eventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
IResumedDMEvent.class);
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.resume(fContainerDmc, rm);
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.resume(fContainerDmc, rm));
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
try {
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(5000));
@@ -654,12 +603,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
- wait.waitFinished();
- }
+ fRunCtrl.getExecutor().submit(() -> {
+ wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
+ wait.waitFinished();
});
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -685,18 +631,13 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<>(
getGDBLaunch().getSession(), ISuspendedDMEvent.class);
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.runToLine(fThreadExecDmc, SOURCE_NAME, getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), true,
- new RequestMonitor(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
- }
- });
+ fRunCtrl.getExecutor().submit(() -> fRunCtrl.runToLine(fThreadExecDmc, SOURCE_NAME,
+ getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), true, new RequestMonitor(fRunCtrl.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ }));
wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
@@ -705,12 +646,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(10000));
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
- wait.waitFinished();
- }
+ fRunCtrl.getExecutor().submit(() -> {
+ wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
+ wait.waitFinished();
});
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
@@ -730,17 +668,13 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
getGDBLaunch().getSession(), ISuspendedDMEvent.class);
// Resume the target
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.resume(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
+ fRunCtrl.getExecutor()
+ .submit(() -> fRunCtrl.resume(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
@Override
protected void handleCompleted() {
wait.waitFinished(getStatus());
}
- });
- }
- });
+ }));
wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
wait.waitReset();
@@ -752,17 +686,13 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
// interrupts after the threads exit.
// Ref: https://sourceware.org/bugzilla/show_bug.cgi?id=17627
Thread.sleep(1000);
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fRunCtrl.suspend(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
+ fRunCtrl.getExecutor()
+ .submit(() -> fRunCtrl.suspend(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
@Override
protected void handleCompleted() {
wait.waitFinished(getStatus());
}
- });
- }
- });
+ }));
wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
Assert.assertTrue(wait.getMessage(), wait.isOK());
@@ -773,12 +703,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
// Double check that the target is in the suspended state
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
- wait.waitFinished();
- }
+ fRunCtrl.getExecutor().submit(() -> {
+ wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
+ wait.waitFinished();
});
wait.waitUntilDone(TestsPlugin.massageTimeout(2000));
Assert.assertTrue("Target is running. It should have been suspended", (Boolean) wait.getReturnInfo());
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java
index e9aff95a70..1fc39f91c2 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java
@@ -73,14 +73,11 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
final DsfSession session = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
- fProcesses = fServicesTracker.getService(IGDBProcesses.class);
- fControl = fServicesTracker.getService(IGDBControl.class);
- }
+ fProcesses = fServicesTracker.getService(IGDBProcesses.class);
+ fControl = fServicesTracker.getService(IGDBControl.class);
};
session.getExecutor().submit(runnable).get();
@@ -182,12 +179,9 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
// Don't use a query here. The terminate, because it kills GDB, may not return right away
// but that is ok because we wait for a shutdown event right after
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- IProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
- fProcesses.terminate(processDmc, new ImmediateRequestMonitor());
- }
+ Runnable runnable = () -> {
+ IProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
+ fProcesses.terminate(processDmc, new ImmediateRequestMonitor());
};
fProcesses.getExecutor().execute(runnable);
@@ -265,12 +259,7 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
// Don't use a query here. Because GDB will be killed, the call to detach may not return right away
// but that is ok because we wait for a shutdown event right after
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fProcesses.detachDebuggerFromProcess(fContainerDmc, new ImmediateRequestMonitor());
- }
- };
+ Runnable runnable = () -> fProcesses.detachDebuggerFromProcess(fContainerDmc, new ImmediateRequestMonitor());
fProcesses.getExecutor().execute(runnable);
// The shutdown must happen quickly, which will confirm that it was
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java
index 0134a187b3..897fe8b100 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java
@@ -115,12 +115,9 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
fMemoryDmc = (IMemoryDMContext) SyncUtil.getContainerContext();
assert (fMemoryDmc != null);
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fExpService = fServicesTracker.getService(IExpressions.class);
- }
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ fExpService = fServicesTracker.getService(IExpressions.class);
};
fSession.getExecutor().submit(runnable).get();
}
@@ -526,107 +523,94 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
// Get the list of available format IDs for this expression and for
// each one,
// get the value of the expression
- fExpService.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fExpService.getAvailableFormats(exprDMC,
- new DataRequestMonitor<String[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- final String[] formatIds = getData();
-
- // Now run the current sub-test using each of
- // the formats available for the type of
- // the expression in the sub-test.
-
- for (final String formatId : formatIds) {
- // Get a FormattedValueCMContext object for
- // the expression-formatID pair.
- final FormattedValueDMContext valueDmc = fExpService
- .getFormattedValueContext(exprDMC, formatId);
-
- // Increment the number of completed
- // requests to wait for, since we will send
- // multiple concurrent requests
- wait.increment();
-
- // Evaluate the expression represented by
- // the FormattedValueDMContext object
- // This actually evaluates the expression.
- fExpService.getFormattedExpressionValue(valueDmc,
- new DataRequestMonitor<FormattedValueDMData>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
-
- // Get the
- // FormattedValueDMData
- // object from the waiter.
- FormattedValueDMData exprValueDMData = getData();
-
- final String[] expectedValues = tests
- .get(expressionToEvaluate);
-
- // Check the value of the expression for correctness.
- String actualValue = exprValueDMData
- .getFormattedValue();
- String expectedValue;
-
- if (formatId.equals(IFormattedValues.HEX_FORMAT))
- expectedValue = expectedValues[0];
- else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
- expectedValue = expectedValues[1];
- else if (formatId
- .equals(IFormattedValues.BINARY_FORMAT))
- expectedValue = expectedValues[2];
- else if (formatId
- .equals(IFormattedValues.DECIMAL_FORMAT))
- expectedValue = expectedValues[3];
- else if (formatId
- .equals(IFormattedValues.NATURAL_FORMAT))
- expectedValue = expectedValues[4];
- else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
- expectedValue = expectedValues[5];
- else
- expectedValue = "[Unrecognized format ID: "
- + formatId + "]";
-
- if ((exact == false)
- && (formatId
- .equals(IFormattedValues.NATURAL_FORMAT)
- || formatId.equals(
- MIExpressions.DETAILS_FORMAT))
- && (expectedValue.length() < actualValue
- .length())) {
- actualValue = actualValue.substring(0,
- expectedValue.length());
- }
-
- if (actualValue.equalsIgnoreCase(expectedValue)) {
- wait.waitFinished();
- } else {
- String errorMsg = "Failed to correctly evalutate '"
- + expressionToEvaluate + "': expected '"
- + expectedValue + "', got '" + actualValue
- + "'";
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID, errorMsg, null));
- }
- }
+ fExpService.getExecutor().submit(() -> fExpService.getAvailableFormats(exprDMC,
+ new DataRequestMonitor<String[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ final String[] formatIds = getData();
+
+ // Now run the current sub-test using each of
+ // the formats available for the type of
+ // the expression in the sub-test.
+
+ for (final String formatId : formatIds) {
+ // Get a FormattedValueCMContext object for
+ // the expression-formatID pair.
+ final FormattedValueDMContext valueDmc = fExpService
+ .getFormattedValueContext(exprDMC, formatId);
+
+ // Increment the number of completed
+ // requests to wait for, since we will send
+ // multiple concurrent requests
+ wait.increment();
+
+ // Evaluate the expression represented by
+ // the FormattedValueDMContext object
+ // This actually evaluates the expression.
+ fExpService.getFormattedExpressionValue(valueDmc,
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+
+ // Get the
+ // FormattedValueDMData
+ // object from the waiter.
+ FormattedValueDMData exprValueDMData = getData();
+
+ final String[] expectedValues = tests.get(expressionToEvaluate);
+
+ // Check the value of the expression for correctness.
+ String actualValue = exprValueDMData.getFormattedValue();
+ String expectedValue;
+
+ if (formatId.equals(IFormattedValues.HEX_FORMAT))
+ expectedValue = expectedValues[0];
+ else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
+ expectedValue = expectedValues[1];
+ else if (formatId.equals(IFormattedValues.BINARY_FORMAT))
+ expectedValue = expectedValues[2];
+ else if (formatId.equals(IFormattedValues.DECIMAL_FORMAT))
+ expectedValue = expectedValues[3];
+ else if (formatId.equals(IFormattedValues.NATURAL_FORMAT))
+ expectedValue = expectedValues[4];
+ else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
+ expectedValue = expectedValues[5];
+ else
+ expectedValue = "[Unrecognized format ID: " + formatId
+ + "]";
+
+ if ((exact == false)
+ && (formatId.equals(IFormattedValues.NATURAL_FORMAT)
+ || formatId
+ .equals(MIExpressions.DETAILS_FORMAT))
+ && (expectedValue.length() < actualValue.length())) {
+ actualValue = actualValue.substring(0,
+ expectedValue.length());
+ }
+
+ if (actualValue.equalsIgnoreCase(expectedValue)) {
+ wait.waitFinished();
+ } else {
+ String errorMsg = "Failed to correctly evalutate '"
+ + expressionToEvaluate + "': expected '"
+ + expectedValue + "', got '" + actualValue + "'";
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID, errorMsg, null));
}
- });
- }
- }
+ }
+ }
+ });
}
- });
- }
- });
+ }
+ }
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java
index d0742df6dc..c4bb8c8d64 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java
@@ -239,15 +239,11 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
super.doLaunch();
final DsfSession session = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
-
- @Override
- public void run() {
- DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
- fCommandControl = tracker.getService(IGDBControl.class);
- fCommandFactory = fCommandControl.getCommandFactory();
- tracker.dispose();
- }
+ Runnable runnable = () -> {
+ DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ fCommandControl = tracker.getService(IGDBControl.class);
+ fCommandFactory = fCommandControl.getCommandFactory();
+ tracker.dispose();
};
session.getExecutor().submit(runnable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java
index ddb9e54fe8..3928966079 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java
@@ -106,12 +106,9 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
public void doBeforeTest() throws Exception {
super.doBeforeTest();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fRunCtrl = fServicesTracker.getService(IRunControl3.class);
- }
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ fRunCtrl = fServicesTracker.getService(IRunControl3.class);
};
fSession = getGDBLaunch().getSession();
fSession.getExecutor().submit(runnable).get();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java
index f05f698ac8..1ca93eaa7e 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java
@@ -222,8 +222,7 @@ public class TraceFileTest extends BaseParametrizedTestCase {
/**
* This test sets up by first creating a trace file and importing it back
- * by calling {@link #testTraceFile} which also calls {@link #createTraceFile}
-
+ * by calling {@link #testTraceFile} which also calls {@link #createTraceFile}.
* It then verifies that the tracepoint actions and platform tracepoints
* created by {@link #testTraceFile()} are associated with the corresponding target
* tracepoints and are not created a second time.
@@ -352,13 +351,10 @@ public class TraceFileTest extends BaseParametrizedTestCase {
// Initialize
fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
- fTraceService = fServicesTracker.getService(IGDBTraceControl.class);
- }
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
+ fTraceService = fServicesTracker.getService(IGDBTraceControl.class);
};
fSession.getExecutor().submit(runnable).get();
@@ -371,48 +367,39 @@ public class TraceFileTest extends BaseParametrizedTestCase {
private void startTracing() throws Throwable {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fSession.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fTraceService.getTraceStatus(fTraceTargetDmc,
- new DataRequestMonitor<ITraceStatusDMData>(fSession.getExecutor(), null) {
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleCompleted() {
- if (isSuccess() && getData().isTracingSupported()) {
- fTraceService.startTracing(fTraceTargetDmc,
- new RequestMonitor(fSession.getExecutor(), null) {
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
- } else {
- wait.waitFinished(getStatus());
- }
- }
- });
- }
- });
+ fSession.getExecutor().submit(() -> fTraceService.getTraceStatus(fTraceTargetDmc,
+ new DataRequestMonitor<ITraceStatusDMData>(fSession.getExecutor(), null) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleCompleted() {
+ if (isSuccess() && getData().isTracingSupported()) {
+ fTraceService.startTracing(fTraceTargetDmc,
+ new RequestMonitor(fSession.getExecutor(), null) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ });
+ } else {
+ wait.waitFinished(getStatus());
+ }
+ }
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
}
private void stopTracing() throws Throwable {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fSession.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fTraceService.stopTracing(fTraceTargetDmc, new RequestMonitor(fSession.getExecutor(), null) {
+ fSession.getExecutor().submit(
+ () -> fTraceService.stopTracing(fTraceTargetDmc, new RequestMonitor(fSession.getExecutor(), null) {
@Override
@ConfinedToDsfExecutor("fExecutor")
protected void handleCompleted() {
wait.waitFinished(getStatus());
}
- });
- }
- });
+ }));
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
}
@@ -462,19 +449,14 @@ public class TraceFileTest extends BaseParametrizedTestCase {
final Map<String, Object> attributes) throws InterruptedException {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fSession.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fBreakpointService.insertBreakpoint(context, attributes,
- new DataRequestMonitor<IBreakpointDMContext>(fBreakpointService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.setReturnInfo(getData());
- wait.waitFinished(getStatus());
- }
- });
- }
- });
+ fSession.getExecutor().submit(() -> fBreakpointService.insertBreakpoint(context, attributes,
+ new DataRequestMonitor<IBreakpointDMContext>(fBreakpointService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ wait.setReturnInfo(getData());
+ wait.waitFinished(getStatus());
+ }
+ }));
// Wait for the result and return the breakpoint context
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -487,18 +469,13 @@ public class TraceFileTest extends BaseParametrizedTestCase {
final File traceFile = new Path(TRACE_FILE_PATH).toFile();
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fSession.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fTraceService.saveTraceData(fTraceTargetDmc, traceFile.getAbsolutePath(), false,
- new RequestMonitor(fSession.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
- }
- });
+ fSession.getExecutor().submit(() -> fTraceService.saveTraceData(fTraceTargetDmc, traceFile.getAbsolutePath(),
+ false, new RequestMonitor(fSession.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ }));
// Wait for the result and verify the trace file is created
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java
index 53c6418383..e00b5aecc5 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java
@@ -76,12 +76,9 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final DsfSession session = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
- fMultiRun = fServicesTracker.getService(IMultiRunControl.class);
- }
+ Runnable runnable = () -> {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ fMultiRun = fServicesTracker.getService(IMultiRunControl.class);
};
session.getExecutor().submit(runnable).get();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java
index 57a7e025ee..56f3bac1b1 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java
@@ -98,28 +98,25 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
fSession = getGDBLaunch().getSession();
Assert.assertNotNull(fSession);
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
+ Runnable runnable = () -> {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- Assert.assertTrue(fServicesTracker != null);
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Assert.assertTrue(fServicesTracker != null);
- fCommandControl = fServicesTracker.getService(IGDBControl.class);
- Assert.assertTrue(fCommandControl != null);
+ fCommandControl = fServicesTracker.getService(IGDBControl.class);
+ Assert.assertTrue(fCommandControl != null);
- fMultiRunControl = fServicesTracker.getService(IMultiRunControl.class);
- Assert.assertTrue(fMultiRunControl != null);
+ fMultiRunControl = fServicesTracker.getService(IMultiRunControl.class);
+ Assert.assertTrue(fMultiRunControl != null);
- fGdbSync = fServicesTracker.getService(IGDBFocusSynchronizer.class);
- Assert.assertTrue(fGdbSync != null);
+ fGdbSync = fServicesTracker.getService(IGDBFocusSynchronizer.class);
+ Assert.assertTrue(fGdbSync != null);
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- Assert.assertTrue(procService != null);
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ Assert.assertTrue(procService != null);
- // Register to receive DSF events
- fSession.addServiceEventListener(ThreadStackFrameSyncTest.this, null);
- }
+ // Register to receive DSF events
+ fSession.addServiceEventListener(ThreadStackFrameSyncTest.this, null);
};
fSession.getExecutor().submit(runnable).get();
}
@@ -297,22 +294,14 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
// do a few of times
for (int i = 0; i < 50; i++) {
// have the sync service switch stack frame to 1
- fSession.getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- fGdbSync.setFocus(new IDMContext[] { frame1 }, new ImmediateRequestMonitor());
- }
- });
+ fSession.getExecutor()
+ .execute(() -> fGdbSync.setFocus(new IDMContext[] { frame1 }, new ImmediateRequestMonitor()));
Thread.sleep(100);
assertEquals("1", getCurrentStackFrameLevel());
// have the sync service switch stack frame to 0
- fSession.getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- fGdbSync.setFocus(new IDMContext[] { frame0 }, new ImmediateRequestMonitor());
- }
- });
+ fSession.getExecutor()
+ .execute(() -> fGdbSync.setFocus(new IDMContext[] { frame0 }, new ImmediateRequestMonitor()));
Thread.sleep(100);
assertEquals("0", getCurrentStackFrameLevel());
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf/META-INF/MANIFEST.MF b/dsf/org.eclipse.cdt.examples.dsf/META-INF/MANIFEST.MF
index 0fa8841eb3..6edb118246 100644
--- a/dsf/org.eclipse.cdt.examples.dsf/META-INF/MANIFEST.MF
+++ b/dsf/org.eclipse.cdt.examples.dsf/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.examples.dsf;singleton:=true
-Bundle-Version: 2.2.1.qualifier
+Bundle-Version: 2.2.100.qualifier
Bundle-Activator: org.eclipse.cdt.examples.dsf.DsfExamplesPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
diff --git a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/filebrowser/FileBrowserVMProvider.java b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/filebrowser/FileBrowserVMProvider.java
index cff346d7c9..e018d1a42e 100644
--- a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/filebrowser/FileBrowserVMProvider.java
+++ b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/filebrowser/FileBrowserVMProvider.java
@@ -89,13 +89,10 @@ public class FileBrowserVMProvider extends AbstractVMProvider {
// We're in the UI thread. Re-dispach to VM Adapter executor thread
// and then call root layout node.
try {
- getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- if (isDisposed())
- return;
- handleEvent(text);
- }
+ getExecutor().execute(() -> {
+ if (isDisposed())
+ return;
+ handleEvent(text);
});
} catch (RejectedExecutionException e) {
// Ignore. This exception could be thrown if the provider is being
diff --git a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersVMProvider.java b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersVMProvider.java
index e6c29cba1b..237aca3e32 100644
--- a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersVMProvider.java
+++ b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersVMProvider.java
@@ -56,13 +56,10 @@ public class TimersVMProvider extends AbstractDMVMProvider {
// Add ourselves as listener for DM events events.
try {
- session.getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- if (DsfSession.isSessionActive(getSession().getId())) {
- getSession().addServiceEventListener(TimersVMProvider.this, null);
- fRegisteredEventListener = true;
- }
+ session.getExecutor().execute(() -> {
+ if (DsfSession.isSessionActive(getSession().getId())) {
+ getSession().addServiceEventListener(TimersVMProvider.this, null);
+ fRegisteredEventListener = true;
}
});
} catch (RejectedExecutionException e) {
@@ -83,13 +80,10 @@ public class TimersVMProvider extends AbstractDMVMProvider {
// RejectedExecutionException. We put this here all the same for
// completeness sake.
try {
- getSession().getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- if (fRegisteredEventListener && DsfSession.isSessionActive(getSession().getId())) {
- getSession().removeServiceEventListener(TimersVMProvider.this);
- fRegisteredEventListener = false;
- }
+ getSession().getExecutor().execute(() -> {
+ if (fRegisteredEventListener && DsfSession.isSessionActive(getSession().getId())) {
+ getSession().removeServiceEventListener(TimersVMProvider.this);
+ fRegisteredEventListener = false;
}
});
} catch (RejectedExecutionException e) {
@@ -148,13 +142,10 @@ public class TimersVMProvider extends AbstractDMVMProvider {
return;
try {
- getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- if (isDisposed())
- return;
- handleEvent(event);
- }
+ getExecutor().execute(() -> {
+ if (isDisposed())
+ return;
+ handleEvent(event);
});
} catch (RejectedExecutionException e) {
}
@@ -166,13 +157,10 @@ public class TimersVMProvider extends AbstractDMVMProvider {
return;
try {
- getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- if (isDisposed())
- return;
- handleEvent(event);
- }
+ getExecutor().execute(() -> {
+ if (isDisposed())
+ return;
+ handleEvent(event);
});
} catch (RejectedExecutionException e) {
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersView.java b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersView.java
index 6671f63410..8aab054e12 100644
--- a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersView.java
+++ b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersView.java
@@ -35,7 +35,6 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -165,13 +164,10 @@ public class TimersView extends ViewPart {
// First dispose the view model, which is the client of services.
// This operation needs to be performed in the session executor
// thread. Block using Future.get() until this call completes.
- fSession.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- fSession.unregisterModelAdapter(IElementContentProvider.class);
- fSession.unregisterModelAdapter(IModelProxyFactory.class);
- fSession.unregisterModelAdapter(IColumnPresentationFactory.class);
- }
+ fSession.getExecutor().submit(() -> {
+ fSession.unregisterModelAdapter(IElementContentProvider.class);
+ fSession.unregisterModelAdapter(IModelProxyFactory.class);
+ fSession.unregisterModelAdapter(IColumnPresentationFactory.class);
}).get();
// Dispose the VM adapter.
@@ -191,14 +187,11 @@ public class TimersView extends ViewPart {
}
// Finally end the session and the executor.
- fSession.getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- DsfSession.endSession(fSession);
- fSession = null;
- fExecutor.shutdown();
- fExecutor = null;
- }
+ fSession.getExecutor().submit(() -> {
+ DsfSession.endSession(fSession);
+ fSession = null;
+ fExecutor.shutdown();
+ fExecutor = null;
}).get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
@@ -237,14 +230,8 @@ public class TimersView extends ViewPart {
fAddTimerAction = new Action("Add New Timer") {
@Override
public void run() {
- fExecutor.execute(new Runnable() {
- @Override
- public void run() {
- // Only need to create the new timer, the events will
- // cause the view to refresh.
- fServices.getService(TimerService.class).startTimer();
- }
- });
+ // Only need to create the new timer, the events will cause the view to refresh.
+ fExecutor.execute(() -> fServices.getService(TimerService.class).startTimer());
}
};
fAddTimerAction.setToolTipText("Add a new timer");
@@ -255,19 +242,16 @@ public class TimersView extends ViewPart {
public void run() {
// Ask user for the new trigger value.
InputDialog inputDialog = new InputDialog(getSite().getShell(), "New Trigger",
- "Please enter trigger value", "", new IInputValidator() {
- @Override
- public String isValid(String input) {
- try {
- int i = Integer.parseInt(input);
- if (i <= 0)
- return "Please enter a positive integer";
-
- } catch (NumberFormatException x) {
+ "Please enter trigger value", "", input -> {
+ try {
+ int i = Integer.parseInt(input);
+ if (i <= 0)
return "Please enter a positive integer";
- }
- return null;
+
+ } catch (NumberFormatException x) {
+ return "Please enter a positive integer";
}
+ return null;
});
if (inputDialog.open() != Window.OK)
return;
@@ -278,13 +262,8 @@ public class TimersView extends ViewPart {
assert false;
}
final int triggerValue = tmpTriggerValue;
- fExecutor.execute(new Runnable() {
- @Override
- public void run() {
- // Create the new trigger
- fServices.getService(AlarmService.class).createTrigger(triggerValue);
- }
- });
+ // Create the new trigger
+ fExecutor.execute(() -> fServices.getService(AlarmService.class).createTrigger(triggerValue));
}
};
fAddTriggerAction.setToolTipText("Add a new trigger");
@@ -300,20 +279,11 @@ public class TimersView extends ViewPart {
// Based on the context from the selection, call the
// appropriate service to remove the item.
if (selectedCtx instanceof TimerDMContext) {
- fExecutor.execute(new Runnable() {
- @Override
- public void run() {
- fServices.getService(TimerService.class).killTimer(((TimerDMContext) selectedCtx));
- }
- });
+ fExecutor.execute(
+ () -> fServices.getService(TimerService.class).killTimer(((TimerDMContext) selectedCtx)));
} else if (selectedCtx instanceof AlarmService.TriggerDMContext) {
- fExecutor.execute(new Runnable() {
- @Override
- public void run() {
- fServices.getService(AlarmService.class)
- .deleteTrigger((AlarmService.TriggerDMContext) selectedCtx);
- }
- });
+ fExecutor.execute(() -> fServices.getService(AlarmService.class)
+ .deleteTrigger((AlarmService.TriggerDMContext) selectedCtx));
}
}
};
diff --git a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java
index 75d88e6cd2..65ef583c42 100644
--- a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java
+++ b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java
@@ -20,7 +20,6 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
@@ -201,19 +200,16 @@ public class CacheTests {
assertFalse(fTestCache.isValid());
// Complete the cache's retrieve data request.
- fExecutor.submit(new Callable<Object>() {
- @Override
- public Object call() {
- fRetrieveRm.setData(1);
- fRetrieveRm.done();
+ fExecutor.submit(() -> {
+ fRetrieveRm.setData(1);
+ fRetrieveRm.done();
- // Check that the data is available in the cache immediately
- // (in the same dispatch cycle).
- assertEquals(1, (int) fTestCache.getData());
- assertTrue(fTestCache.isValid());
+ // Check that the data is available in the cache immediately
+ // (in the same dispatch cycle).
+ assertEquals(1, (int) fTestCache.getData());
+ assertTrue(fTestCache.isValid());
- return null;
- }
+ return null;
}).get();
assertEquals(1, (int) q.get());
@@ -594,10 +590,7 @@ public class CacheTests {
// called in a separate dispatch cycle, so we have to wait one cycle of the executor
// after is canceled is called.
fRetrieveRm.isCanceled();
- fExecutor.submit(new Runnable() {
- @Override
- public void run() {
- }
+ fExecutor.submit(() -> {
}).get();
assertTrue(canceledCalled[0]);
diff --git a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/vm/TestModelVMNode.java b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/vm/TestModelVMNode.java
index 53185fe576..5aab9360ab 100644
--- a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/vm/TestModelVMNode.java
+++ b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/vm/TestModelVMNode.java
@@ -71,64 +71,52 @@ public class TestModelVMNode extends AbstractVMNode
@Override
public void update(final IHasChildrenUpdate[] updates) {
- getTestProvider().getDsfExecutor().execute(new Runnable() {
- @Override
- public void run() {
- for (IHasChildrenUpdate update : updates) {
- if (update.getElement() instanceof TestElementVMContext) {
- TestElement element = ((TestElementVMContext) update.getElement()).getElement();
- update.setHasChilren(element.getChildren().length != 0);
- }
- update.done();
+ getTestProvider().getDsfExecutor().execute(() -> {
+ for (IHasChildrenUpdate update : updates) {
+ if (update.getElement() instanceof TestElementVMContext) {
+ TestElement element = ((TestElementVMContext) update.getElement()).getElement();
+ update.setHasChilren(element.getChildren().length != 0);
}
+ update.done();
}
});
}
@Override
public void update(final IChildrenCountUpdate[] updates) {
- getTestProvider().getDsfExecutor().execute(new Runnable() {
- @Override
- public void run() {
- for (IChildrenCountUpdate update : updates) {
- if (update.getElement() instanceof TestElementVMContext) {
- TestElement element = ((TestElementVMContext) update.getElement()).getElement();
- update.setChildCount(element.getChildren().length);
- }
- update.done();
+ getTestProvider().getDsfExecutor().execute(() -> {
+ for (IChildrenCountUpdate update : updates) {
+ if (update.getElement() instanceof TestElementVMContext) {
+ TestElement element = ((TestElementVMContext) update.getElement()).getElement();
+ update.setChildCount(element.getChildren().length);
}
+ update.done();
}
});
}
@Override
public void update(final IChildrenUpdate[] updates) {
- getTestProvider().getDsfExecutor().execute(new Runnable() {
- @Override
- public void run() {
- for (IChildrenUpdate update : updates) {
- if (update.getElement() instanceof TestElementVMContext) {
- TestElement element = ((TestElementVMContext) update.getElement()).getElement();
- fillUpdateWithTestElements(update, element.getChildren());
- }
- update.done();
+ getTestProvider().getDsfExecutor().execute(() -> {
+ for (IChildrenUpdate update : updates) {
+ if (update.getElement() instanceof TestElementVMContext) {
+ TestElement element = ((TestElementVMContext) update.getElement()).getElement();
+ fillUpdateWithTestElements(update, element.getChildren());
}
+ update.done();
}
});
}
@Override
public void update(final IPropertiesUpdate[] updates) {
- getTestProvider().getDsfExecutor().execute(new Runnable() {
- @Override
- public void run() {
- for (IPropertiesUpdate update : updates) {
- if (update.getElement() instanceof TestElementVMContext) {
- TestElement element = ((TestElementVMContext) update.getElement()).getElement();
- update.setProperty(PROP_TEST_ELEMENT_LABEL, element.getLabel());
- }
- update.done();
+ getTestProvider().getDsfExecutor().execute(() -> {
+ for (IPropertiesUpdate update : updates) {
+ if (update.getElement() instanceof TestElementVMContext) {
+ TestElement element = ((TestElementVMContext) update.getElement()).getElement();
+ update.setProperty(PROP_TEST_ELEMENT_LABEL, element.getLabel());
}
+ update.done();
}
});
}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
index 248c15c7fc..e90b1be21c 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
@@ -261,20 +261,17 @@ public class LaunchUtils {
*/
public static void enableActivity(final String activityID, final boolean enableit) {
if (PlatformUI.isWorkbenchRunning()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
- IActivityManager activityManager = workbenchActivitySupport.getActivityManager();
- Set<String> enabledActivityIds = new HashSet<>(activityManager.getEnabledActivityIds());
- boolean changed = false;
- if (enableit)
- changed = enabledActivityIds.add(activityID);
- else
- changed = enabledActivityIds.remove(activityID);
- if (changed)
- workbenchActivitySupport.setEnabledActivityIds(enabledActivityIds);
- }
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
+ IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
+ IActivityManager activityManager = workbenchActivitySupport.getActivityManager();
+ Set<String> enabledActivityIds = new HashSet<>(activityManager.getEnabledActivityIds());
+ boolean changed = false;
+ if (enableit)
+ changed = enabledActivityIds.add(activityID);
+ else
+ changed = enabledActivityIds.remove(activityID);
+ if (changed)
+ workbenchActivitySupport.setEnabledActivityIds(enabledActivityIds);
});
}
}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java
index 689eb1ca29..851ac30e36 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/MultiLaunchConfigurationDelegate.java
@@ -377,15 +377,12 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
localMode = mode;
}
if (!conf.supportsMode(localMode)) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ PlatformUI.getWorkbench().getDisplay()
+ .asyncExec(() -> MessageDialog.openError(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
LaunchMessages.LaunchUIPlugin_Error,
NLS.bind(LaunchMessages.MultiLaunchConfigurationDelegate_Cannot, conf.toString(),
- localMode));
- }
- });
+ localMode)));
continue;
}
@@ -411,14 +408,11 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
postLaunchAction(subLaunch, le.action, le.actionParam, monitor);
} catch (StackOverflowError e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ PlatformUI.getWorkbench().getDisplay()
+ .asyncExec(() -> MessageDialog.openError(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
LaunchMessages.LaunchUIPlugin_Error,
- NLS.bind(LaunchMessages.MultiLaunchConfigurationDelegate_Loop, conf.toString()));
- }
- });
+ NLS.bind(LaunchMessages.MultiLaunchConfigurationDelegate_Loop, conf.toString())));
}
}
if (!launch.hasChildren()) {
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java
index 3ac57ff265..98ae3a3c20 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CAbstractMainTab.java
@@ -46,8 +46,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -146,14 +144,11 @@ public abstract class CAbstractMainTab extends CLaunchConfigurationTab {
fProjText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fProjText.setLayoutData(gd);
- fProjText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent evt) {
- // if project changes, invalidate program name cache
- fPreviouslyCheckedProgram = null;
- updateBuildConfigCombo(EMPTY_STRING);
- updateLaunchConfigurationDialog();
- }
+ fProjText.addModifyListener(evt -> {
+ // if project changes, invalidate program name cache
+ fPreviouslyCheckedProgram = null;
+ updateBuildConfigCombo(EMPTY_STRING);
+ updateLaunchConfigurationDialog();
});
fProjButton = createPushButton(projComp, LaunchMessages.Launch_common_Browse_1, null);
fProjButton.addSelectionListener(new SelectionAdapter() {
@@ -457,12 +452,7 @@ public abstract class CAbstractMainTab extends CLaunchConfigurationTab {
fCoreText = new Text(coreComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fCoreText.setLayoutData(gd);
- fCoreText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
+ fCoreText.addModifyListener(evt -> updateLaunchConfigurationDialog());
Button browseForCoreButton;
browseForCoreButton = createPushButton(coreComp, LaunchMessages.Launch_common_Browse_3, null);
browseForCoreButton.addSelectionListener(new SelectionAdapter() {
@@ -515,14 +505,11 @@ public abstract class CAbstractMainTab extends CLaunchConfigurationTab {
display = getShell().getDisplay();
}
final IBinary[][] ret = new IBinary[1][];
- BusyIndicator.showWhile(display, new Runnable() {
- @Override
- public void run() {
- try {
- ret[0] = cproject.getBinaryContainer().getBinaries();
- } catch (CModelException e) {
- LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$
- }
+ BusyIndicator.showWhile(display, () -> {
+ try {
+ ret[0] = cproject.getBinaryContainer().getBinaries();
+ } catch (CModelException e) {
+ LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$
}
});
return ret[0];
diff --git a/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/PresentationReconcilerCPP.java b/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/PresentationReconcilerCPP.java
index 679a7f9ce8..899c880432 100644
--- a/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/PresentationReconcilerCPP.java
+++ b/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/PresentationReconcilerCPP.java
@@ -45,7 +45,6 @@ import org.eclipse.cdt.ui.text.AbstractCScanner;
import org.eclipse.cdt.ui.text.ICColorConstants;
import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.ui.text.ICTokenScanner;
-import org.eclipse.cdt.ui.text.ITokenStore;
import org.eclipse.cdt.ui.text.ITokenStoreFactory;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -90,13 +89,8 @@ public class PresentationReconcilerCPP extends CPresentationReconciler {
public static Set<PresentationReconcilerCPP> presentationReconcilers = ConcurrentHashMap.newKeySet();
protected ITokenStoreFactory getTokenStoreFactory() {
- return new ITokenStoreFactory() {
- @Override
- public ITokenStore createTokenStore(String[] propertyColorNames) {
- return new TokenStore(CUIPlugin.getDefault().getTextTools().getColorManager(),
- CUIPlugin.getDefault().getCombinedPreferenceStore(), propertyColorNames);
- }
- };
+ return propertyColorNames -> new TokenStore(CUIPlugin.getDefault().getTextTools().getColorManager(),
+ CUIPlugin.getDefault().getCombinedPreferenceStore(), propertyColorNames);
}
protected ILanguage getLanguage() {
@@ -358,16 +352,13 @@ public class PresentationReconcilerCPP extends CPresentationReconciler {
// Using asyncExec() to make sure that by the time Runnable runs,
// the Editor is active and we don't get a NPE.
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- // To provide bracket auto-completion support of CEditor in Generic Editor of LSP4E-CPP.
- TextEditor editor = (TextEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .getActiveEditor();
- fBracketInserter = new BracketInserter(editor, true);
- fBracketInserter.setSourceViewer((SourceViewer) textViewer);
- ((TextViewer) textViewer).prependVerifyKeyListener(fBracketInserter);
- }
+ Display.getDefault().asyncExec(() -> {
+ // To provide bracket auto-completion support of CEditor in Generic Editor of LSP4E-CPP.
+ TextEditor editor = (TextEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .getActiveEditor();
+ fBracketInserter = new BracketInserter(editor, true);
+ fBracketInserter.setSourceViewer((SourceViewer) textViewer);
+ ((TextViewer) textViewer).prependVerifyKeyListener(fBracketInserter);
});
}
diff --git a/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/Server2ClientProtocolExtension.java b/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/Server2ClientProtocolExtension.java
index 2465e048ab..31071e6a69 100644
--- a/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/Server2ClientProtocolExtension.java
+++ b/lsp/org.eclipse.cdt.lsp.core/src/org/eclipse/cdt/lsp/core/Server2ClientProtocolExtension.java
@@ -53,24 +53,21 @@ public class Server2ClientProtocolExtension extends LanguageClientImpl {
@JsonNotification("$cquery/progress")
public final void indexingProgress(IndexingProgressStats stats) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- final String cqueryStatusFieldId = "org.eclipse.cdt.lsp.core.status"; //$NON-NLS-1$
- final int width = 28;
- IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (IWorkbenchWindow window : workbenchWindows) {
- StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager();
- StatusLineContributionItem cqueryStatusField = (StatusLineContributionItem) statusLine
- .find(cqueryStatusFieldId);
- if (cqueryStatusField == null) {
- cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width);
- statusLine.add(cqueryStatusField);
- }
- String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs())
- : Messages.CqueryStateIdle;
- cqueryStatusField.setText(msg);
+ Display.getDefault().asyncExec(() -> {
+ final String cqueryStatusFieldId = "org.eclipse.cdt.lsp.core.status"; //$NON-NLS-1$
+ final int width = 28;
+ IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ for (IWorkbenchWindow window : workbenchWindows) {
+ StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager();
+ StatusLineContributionItem cqueryStatusField = (StatusLineContributionItem) statusLine
+ .find(cqueryStatusFieldId);
+ if (cqueryStatusField == null) {
+ cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width);
+ statusLine.add(cqueryStatusField);
}
+ String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs())
+ : Messages.CqueryStateIdle;
+ cqueryStatusField.setText(msg);
}
});
}
@@ -226,14 +223,10 @@ public class Server2ClientProtocolExtension extends LanguageClientImpl {
}
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (PresentationReconcilerCPP eachReconciler : matchingReconcilers) {
- TextPresentation presentation = eachReconciler.createPresentation(new Region(0, doc.getLength()),
- doc);
- eachReconciler.getTextViewer().changeTextPresentation(presentation, false);
- }
+ Display.getDefault().asyncExec(() -> {
+ for (PresentationReconcilerCPP eachReconciler : matchingReconcilers) {
+ TextPresentation presentation = eachReconciler.createPresentation(new Region(0, doc.getLength()), doc);
+ eachReconciler.getTextViewer().changeTextPresentation(presentation, false);
}
});
}
diff --git a/testsrunner/org.eclipse.cdt.testsrunner/META-INF/MANIFEST.MF b/testsrunner/org.eclipse.cdt.testsrunner/META-INF/MANIFEST.MF
index 6b58d5036c..423350bb84 100644
--- a/testsrunner/org.eclipse.cdt.testsrunner/META-INF/MANIFEST.MF
+++ b/testsrunner/org.eclipse.cdt.testsrunner/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.testsrunner;singleton:=true
-Bundle-Version: 8.1.100.qualifier
+Bundle-Version: 8.1.200.qualifier
Bundle-Activator: org.eclipse.cdt.testsrunner.internal.TestsRunnerPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/ui/view/UIUpdater.java b/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/ui/view/UIUpdater.java
index ec4516de77..5a8770c417 100644
--- a/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/ui/view/UIUpdater.java
+++ b/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/ui/view/UIUpdater.java
@@ -359,14 +359,10 @@ public class UIUpdater {
@Override
public void testingStarted() {
resultsView.updateActionsFromSession();
- Display.getDefault().syncExec(new Runnable() {
-
- @Override
- public void run() {
- resultsView.setCaption(testingSession.getStatusMessage());
- progressCountPanel.updateInfoFromSession();
- testsHierarchyViewer.getTreeViewer().refresh();
- }
+ Display.getDefault().syncExec(() -> {
+ resultsView.setCaption(testingSession.getStatusMessage());
+ progressCountPanel.updateInfoFromSession();
+ testsHierarchyViewer.getTreeViewer().refresh();
});
startUpdateUIJob();
}
@@ -375,17 +371,13 @@ public class UIUpdater {
public void testingFinished() {
stopUpdateUIJob();
resultsView.updateActionsFromSession();
- Display.getDefault().syncExec(new Runnable() {
-
- @Override
- public void run() {
- uiChangesCache.applyChanges();
- resultsView.setCaption(testingSession.getStatusMessage());
- progressCountPanel.updateInfoFromSession();
- testsHierarchyViewer.getTreeViewer().refresh();
- testsHierarchyViewer.getTreeViewer().collapseAll();
- testsHierarchyViewer.getTreeViewer().expandToLevel(2);
- }
+ Display.getDefault().syncExec(() -> {
+ uiChangesCache.applyChanges();
+ resultsView.setCaption(testingSession.getStatusMessage());
+ progressCountPanel.updateInfoFromSession();
+ testsHierarchyViewer.getTreeViewer().refresh();
+ testsHierarchyViewer.getTreeViewer().collapseAll();
+ testsHierarchyViewer.getTreeViewer().expandToLevel(2);
});
}
}
@@ -406,14 +398,10 @@ public class UIUpdater {
subscribeToSessionEvent();
resultsView.updateActionsFromSession();
- Display.getDefault().syncExec(new Runnable() {
-
- @Override
- public void run() {
- progressCountPanel.setTestingSession(testingSession);
- testsHierarchyViewer.setTestingSession(testingSession);
- resultsView.setCaption(testingSession != null ? testingSession.getStatusMessage() : ""); //$NON-NLS-1$
- }
+ Display.getDefault().syncExec(() -> {
+ progressCountPanel.setTestingSession(testingSession);
+ testsHierarchyViewer.setTestingSession(testingSession);
+ resultsView.setCaption(testingSession != null ? testingSession.getStatusMessage() : ""); //$NON-NLS-1$
});
if (newTestingSession != null && !newTestingSession.isFinished()) {
startUpdateUIJob();
diff --git a/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/launcher/BaseTestsLaunchDelegate.java b/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/launcher/BaseTestsLaunchDelegate.java
index dfd80e78f5..3da86e1c9e 100644
--- a/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/launcher/BaseTestsLaunchDelegate.java
+++ b/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/launcher/BaseTestsLaunchDelegate.java
@@ -237,19 +237,15 @@ public abstract class BaseTestsLaunchDelegate extends LaunchConfigurationDelegat
* Activates the view showing testing results.
*/
private void activateTestingView() {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- try {
- IWorkbenchWindow activeWindow = TestsRunnerPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow();
- IViewPart view = activeWindow.getActivePage()
- .showView(ITestsRunnerConstants.TESTS_RUNNER_RESULTS_VIEW_ID);
- TestsRunnerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .activate(view);
- } catch (PartInitException e) {
- TestsRunnerPlugin.log(e);
- }
+ Display.getDefault().syncExec(() -> {
+ try {
+ IWorkbenchWindow activeWindow = TestsRunnerPlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow();
+ IViewPart view = activeWindow.getActivePage()
+ .showView(ITestsRunnerConstants.TESTS_RUNNER_RESULTS_VIEW_ID);
+ TestsRunnerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(view);
+ } catch (PartInitException e) {
+ TestsRunnerPlugin.log(e);
}
});
}

Back to the top