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

Convert new Runnable to lambda.

Change-Id: I8b827013a29802a3f3ae6400ddce8d8753eb6399
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2019-08-10 17:36:47 +03:00
parent 51da3eb3a6
commit 1e42e5f0e1
113 changed files with 1723 additions and 2688 deletions

View file

@ -88,15 +88,12 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
@Override
public void tearDown() throws Exception {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages();
for (IWorkbenchPage page : pages) {
page.closeAllEditors(false);
dispatch(0);
}
}
});
super.tearDown();
@ -141,9 +138,7 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
}
public void doRunQuickFix() {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
for (int i = 0; i < markers.length; i++) {
IMarker marker = markers[i];
isApplicableMap.put(marker, quickFix.isApplicable(marker));
@ -153,7 +148,6 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
}
}
PlatformUI.getWorkbench().saveAllEditors(false);
}
});
}

View file

@ -50,17 +50,14 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
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.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
@ -256,12 +253,7 @@ public class ControlFlowGraphView extends ViewPart {
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
ControlFlowGraphView.this.fillContextMenu(manager);
}
});
menuMgr.addMenuListener(manager -> ControlFlowGraphView.this.fillContextMenu(manager));
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
@ -334,13 +326,7 @@ public class ControlFlowGraphView extends ViewPart {
}
};
ast.accept(visitor);
viewer.getControl().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
viewer.setInput(functions);
}
});
viewer.getControl().getDisplay().asyncExec(() -> viewer.setInput(functions));
}
/**
@ -406,11 +392,6 @@ public class ControlFlowGraphView extends ViewPart {
}
private void hookSingleClickAction() {
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
new ASTHighlighterAction(null).run();
}
});
viewer.addSelectionChangedListener(event -> new ASTHighlighterAction(null).run());
}
}

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.ui.cxx;singleton:=true
Bundle-Version: 3.5.0.qualifier
Bundle-Version: 3.5.100.qualifier
Bundle-Activator: org.eclipse.cdt.codan.internal.ui.cxx.Activator
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui,

View file

@ -34,9 +34,7 @@ public class Startup implements IStartup {
*/
private void registerListeners() {
final IWorkbench workbench = PlatformUI.getWorkbench();
workbench.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
workbench.getDisplay().asyncExec(() -> {
// Install a part listener on currenly open workbench windows.
for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
CodanPartListener.installOnWindow(window);
@ -45,7 +43,6 @@ public class Startup implements IStartup {
// Install a window listener which will be notified of
// new windows opening, and install a part listener on them.
workbench.addWindowListener(new CodanWindowListener());
}
});
}
}

View file

@ -360,13 +360,10 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
PreferenceManager manager = new PreferenceManager();
manager.addToRoot(targetNode);
final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager);
BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(getControl().getDisplay(), () -> {
dialog.create();
dialog.setMessage(targetNode.getLabelText());
dialog.open();
}
});
}
}

View file

@ -206,12 +206,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
addIndexerSetupParticipant(new WaitForRefreshJobs());
fProjectDescriptionListener = new CProjectDescriptionListener(this);
fJobChangeListener = new JobChangeListener(this);
fPreferenceChangeListener = new IPreferenceChangeListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
onPreferenceChange(event);
}
};
fPreferenceChangeListener = event -> onPreferenceChange(event);
fSetupJob = new PDOMSetupJob(this);
fIndexerJob = new PDOMIndexerJob(this);
fNotificationJob = createNotifyJob();
@ -541,9 +536,8 @@ public class PDOMManager implements IWritableIndexManager, IListener {
registerIndexer(cproject, indexer);
createPolicy(cproject).clearTUs();
if (oldIndexer instanceof AbstractPDOMIndexer) {
if (IndexerPreferences.preferDefaultLanguage(
((AbstractPDOMIndexer) oldIndexer).getProperties()) != IndexerPreferences
.preferDefaultLanguage(props)) {
if (IndexerPreferences.preferDefaultLanguage(((AbstractPDOMIndexer) oldIndexer)
.getProperties()) != IndexerPreferences.preferDefaultLanguage(props)) {
enqueue(new NotifyCModelManagerTask(cproject.getProject()));
}
}
@ -1089,9 +1083,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (fStateListeners.isEmpty()) {
return;
}
Runnable notify = new Runnable() {
@Override
public void run() {
Runnable notify = () -> {
fIndexerStateEvent.setState(state);
Object[] listeners = fStateListeners.getListeners();
for (Object listener2 : listeners) {
@ -1108,7 +1100,6 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
});
}
}
};
scheduleNotification(notify);
}
@ -1127,9 +1118,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (project != null) {
final ICProject finalProject = project;
Runnable notify = new Runnable() {
@Override
public void run() {
Runnable notify = () -> {
fIndexChangeEvent.setAffectedProject(finalProject, e);
Object[] listeners = fChangeListeners.getListeners();
for (Object listener2 : listeners) {
@ -1146,7 +1135,6 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
});
}
}
};
scheduleNotification(notify);
}
@ -1528,9 +1516,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
fPostponedProjects.remove(cproject);
final IndexerSetupParticipant[] participants = fSetupParticipants
.toArray(new IndexerSetupParticipant[fSetupParticipants.size()]);
Runnable notify = new Runnable() {
@Override
public void run() {
Runnable notify = () -> {
for (final IndexerSetupParticipant p : participants) {
SafeRunner.run(new ISafeRunnable() {
@Override
@ -1544,7 +1530,6 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
});
}
}
};
scheduleNotification(notify);
}

View file

@ -1008,9 +1008,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
final ListOptions options = createListOptionsForLambdaCapturesParameters(node);
ICPPASTCapture[] captures = node.getCaptures();
formatList(Arrays.asList(captures), options, true, captures.length > 0 && captures[0].isPackExpansion(), null,
new Runnable() {
@Override
public void run() {
() -> {
if (options.captureDefault == CaptureDefault.BY_COPY) {
scribe.printNextToken(Token.tASSIGN, options.fSpaceAfterOpeningParen);
} else if (options.captureDefault == CaptureDefault.BY_REFERENCE) {
@ -1022,7 +1020,6 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (options.fSpaceAfterSeparator)
scribe.space();
}
}
});
// declarator

View file

@ -70,10 +70,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
autoDisposeAddr2line = getAddr2line();
if (autoDisposeAddr2line != null) {
starttime = System.currentTimeMillis();
Runnable worker = new Runnable() {
@Override
public void run() {
Runnable worker = () -> {
long diff = System.currentTimeMillis() - starttime;
while (diff < 10000) {
@ -85,7 +82,6 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
diff = System.currentTimeMillis() - starttime;
}
stopAddr2Line();
}
};
new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$
}

View file

@ -67,10 +67,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
autoDisposeAddr2line = getAddr2line();
if (autoDisposeAddr2line != null) {
starttime = System.currentTimeMillis();
Runnable worker = new Runnable() {
@Override
public void run() {
Runnable worker = () -> {
long diff = System.currentTimeMillis() - starttime;
while (diff < 10000) {
@ -82,7 +79,6 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
diff = System.currentTimeMillis() - starttime;
}
stopAddr2Line();
}
};
new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$
}

View file

@ -235,10 +235,7 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
addr2line = getAddr2line();
if (addr2line != null) {
starttime = System.currentTimeMillis();
Runnable worker = new Runnable() {
@Override
public void run() {
Runnable worker = () -> {
long diff = System.currentTimeMillis() - starttime;
while (diff < 10000) {
try {
@ -249,7 +246,6 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
diff = System.currentTimeMillis() - starttime;
}
stopAddr2Line();
}
};
new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$
}

View file

@ -237,10 +237,7 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
addr2line = getAddr2line();
if (addr2line != null) {
starttime = System.currentTimeMillis();
Runnable worker = new Runnable() {
@Override
public void run() {
Runnable worker = () -> {
long diff = System.currentTimeMillis() - starttime;
while (diff < 10000) {
try {
@ -251,7 +248,6 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
diff = System.currentTimeMillis() - starttime;
}
stopAddr2Line();
}
};
new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$
}

View file

@ -109,12 +109,9 @@ public class Application implements IApplication {
final IWorkbench workbench = PlatformUI.getWorkbench();
final Display display = workbench.getDisplay();
fInstanceLoc.release();
display.syncExec(new Runnable() {
@Override
public void run() {
display.syncExec(() -> {
if (!display.isDisposed())
workbench.close();
}
});
}
}

View file

@ -265,13 +265,10 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
final String executablePath = executable;
final String coreFilePath = corefile;
Display.getDefault().syncExec(new Runnable() {
Display.getDefault().syncExec(() -> {
@Override
public void run() {
CoreFileDialog dialog = new CoreFileDialog(getWindowConfigurer().getWindow().getShell(),
0, executablePath, coreFilePath);
CoreFileDialog dialog = new CoreFileDialog(getWindowConfigurer().getWindow().getShell(), 0,
executablePath, coreFilePath);
dialog.setBlockOnOpen(true);
if (dialog.open() == IDialogConstants.OK_ID) {
CoreFileInfo info2 = dialog.getCoreFileInfo();
@ -281,7 +278,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
IStatus.ERROR | IStatus.WARNING);
}
}
});
// Check and see if we failed above and if so, quit
if (info.getHostPath().isEmpty()) {
@ -318,10 +314,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
final String buildLogPath = buildLog;
final boolean attach = attachExecutable;
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
RemoteExecutableDialog dialog = new RemoteExecutableDialog(
getWindowConfigurer().getWindow().getShell(), executablePath, buildLogPath,
@ -334,7 +327,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
IStatus.ERROR | IStatus.WARNING);
}
}
});
// Check and see if we failed above and if so, quit
if (info[0] == null) {
@ -364,10 +356,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
final String executableArgs = arguments;
final String buildLogPath = buildLog;
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
NewExecutableDialog dialog = new NewExecutableDialog(
getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath,
@ -381,7 +370,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
IStatus.ERROR | IStatus.WARNING);
}
}
});
// Check and see if we failed above and if so, quit
if (info.getHostPath().isEmpty()) {
@ -429,10 +417,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
final String buildLogPath = oldBuildLog;
// Bring up New Executable dialog with values from
// the last launch.
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
NewExecutableDialog dialog = new NewExecutableDialog(
getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath,
@ -447,7 +432,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
IStatus.ERROR | IStatus.WARNING);
}
}
});
// Check and see if we failed above and if so, quit
if (info.getHostPath().isEmpty()) {
@ -488,13 +472,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
}
});
monitor.subTask(Messages.LaunchingConfig);
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
}
});
Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE));
if (LaunchJobs.getLaunchJob() != null) {
try {
LaunchJobs.getLaunchJob().join();
@ -533,15 +511,12 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
final MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, 1, Messages.ProblemSavingWorkbench, null);
try {
final ProgressMonitorDialog p = new ProgressMonitorDialog(null);
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) {
IRunnableWithProgress runnable = monitor -> {
try {
status.merge(ResourcesPlugin.getWorkspace().save(true, monitor));
} catch (CoreException e) {
status.merge(e.getStatus());
}
}
};
p.run(true, false, runnable);
} catch (InvocationTargetException e) {

View file

@ -34,13 +34,7 @@ public class DebugAttachedExecutableHandler extends AbstractHandler {
final ILaunchConfiguration config = DebugAttachedExecutable.createLaunchConfig(new NullProgressMonitor(),
null);
if (config != null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
}
});
Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE));
}
} catch (InterruptedException e) {
e.printStackTrace();

View file

@ -42,13 +42,7 @@ public class DebugCoreFileHandler extends AbstractHandler {
final ILaunchConfiguration config = DebugCoreFile.createLaunchConfig(new NullProgressMonitor(), null,
info.getHostPath(), info.getCoreFilePath());
if (config != null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
}
});
Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE));
}
} catch (InterruptedException e) {
e.printStackTrace();

View file

@ -68,13 +68,7 @@ public class DebugNewExecutableHandler extends AbstractHandler {
public void done(IJobChangeEvent event) {
}
});
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
}
});
Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE));
if (LaunchJobs.getLaunchJob() != null) {
try {
LaunchJobs.getLaunchJob().join();

View file

@ -47,13 +47,7 @@ public class DebugRemoteExecutableHandler extends AbstractHandler {
final ILaunchConfiguration config = DebugRemoteExecutable.createLaunchConfig(new NullProgressMonitor(),
buildLog, executable, address, port, attach);
if (config != null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
}
});
Display.getDefault().syncExec(() -> DebugUITools.launch(config, ILaunchManager.DEBUG_MODE));
}
} catch (InterruptedException e) {
e.printStackTrace();

View file

@ -80,17 +80,7 @@ public class CDebugImageDescriptorRegistry {
}
private void hookDisplay() {
fDisplay.asyncExec(new Runnable() {
@Override
public void run() {
getDisplay().disposeExec(new Runnable() {
@Override
public void run() {
dispose();
}
});
}
});
fDisplay.asyncExec(() -> getDisplay().disposeExec(() -> dispose()));
}
protected Display getDisplay() {

View file

@ -38,13 +38,8 @@ public class CValueDetailProvider {
if (value instanceof ICValue) {
final ICStackFrame frame = CDebugUIUtils.getCurrentStackFrame();
if (frame != null) {
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
listener.detailComputed(value, ((ICValue) value).evaluateAsExpression(frame));
}
});
DebugPlugin.getDefault()
.asyncExec(() -> listener.detailComputed(value, ((ICValue) value).evaluateAsExpression(frame)));
} else { // no valid stack frame, clear detail pane
listener.detailComputed(value, ""); //$NON-NLS-1$
}

View file

@ -35,9 +35,7 @@ public class CWatchExpressionDelegate implements IWatchExpressionDelegate {
return;
}
final ICStackFrame frame = (ICStackFrame) context;
Runnable runnable = new Runnable() {
@Override
public void run() {
Runnable runnable = () -> {
IValue value = null;
DebugException de = null;
try {
@ -47,7 +45,6 @@ public class CWatchExpressionDelegate implements IWatchExpressionDelegate {
}
IWatchExpressionResult result = evaluationComplete(expression, value, de);
listener.watchEvaluationFinished(result);
}
};
DebugPlugin.getDefault().asyncExec(runnable);
}

View file

@ -42,13 +42,8 @@ public class ErrorStatusHandler implements IStatusHandler {
title = CDebugUIMessages.getString("ErrorStatusHandler.1"); //$NON-NLS-1$
}
final String title_f = title;
CDebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
@Override
public void run() {
ErrorDialog.openError(CDebugUIPlugin.getActiveWorkbenchShell(), title_f, null, status);
}
});
CDebugUIPlugin.getStandardDisplay().asyncExec(
() -> ErrorDialog.openError(CDebugUIPlugin.getActiveWorkbenchShell(), title_f, null, status));
}
return null;
}

View file

@ -33,13 +33,8 @@ public class InfoStatusHandler implements IStatusHandler {
if (status != null && source != null && source instanceof IDebugTarget) {
final String title = ((IDebugTarget) source).getName();
final String message = status.getMessage();
CDebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openInformation(CDebugUIPlugin.getActiveWorkbenchShell(), title, message);
}
});
CDebugUIPlugin.getStandardDisplay().asyncExec(
() -> MessageDialog.openInformation(CDebugUIPlugin.getActiveWorkbenchShell(), title, message));
}
return null;
}

View file

@ -34,13 +34,8 @@ public class QuestionStatusHandler implements IStatusHandler {
if (status != null && source != null && source instanceof IDebugTarget) {
final String title = ((IDebugTarget) source).getName();
final String message = status.getMessage();
CDebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
@Override
public void run() {
result[0] = MessageDialog.openQuestion(CDebugUIPlugin.getActiveWorkbenchShell(), title, message);
}
});
CDebugUIPlugin.getStandardDisplay().syncExec(() -> result[0] = MessageDialog
.openQuestion(CDebugUIPlugin.getActiveWorkbenchShell(), title, message));
}
return Boolean.valueOf(result[0]);
}

View file

@ -49,15 +49,12 @@ public abstract class AbstractListenerActionDelegate extends AbstractDebugAction
if (shell == null || shell.isDisposed()) {
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
for (int i = 0; i < events.length; i++) {
if (events[i].getSource() != null) {
doHandleDebugEvent(events[i]);
}
}
}
};
shell.getDisplay().asyncExec(r);

View file

@ -96,16 +96,12 @@ public abstract class AbstractViewActionDelegate extends ActionDelegate
public void run(IAction action) {
final MultiStatus ms = new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "", //$NON-NLS-1$
null);
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(Display.getCurrent(), () -> {
try {
doAction();
} catch (DebugException e) {
ms.merge(e.getStatus());
}
}
});
if (!ms.isOK()) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
@ -162,16 +158,12 @@ public abstract class AbstractViewActionDelegate extends ActionDelegate
if (shell == null || shell.isDisposed()) {
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
for (int i = 0; i < events.length; i++) {
if (events[i].getSource() != null) {
doHandleDebugEvent(events[i]);
}
}
}
};
shell.getDisplay().asyncExec(r);
}

View file

@ -38,8 +38,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.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@ -153,23 +151,11 @@ public class CastToArrayActionHandler extends AbstractHandler {
ActionMessages.getString("CastToArrayActionDelegate.1")); //$NON-NLS-1$
((GridData) label.getLayoutData()).horizontalSpan = 3;
fFirstIndexText = ControlFactory.createTextField(composite);
fFirstIndexText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
validateInput();
}
});
fFirstIndexText.addModifyListener(e -> validateInput());
label = ControlFactory.createLabel(composite, ActionMessages.getString("CastToArrayActionDelegate.2")); //$NON-NLS-1$
((GridData) label.getLayoutData()).horizontalSpan = 3;
fLengthText = ControlFactory.createTextField(composite);
fLengthText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
validateInput();
}
});
fLengthText.addModifyListener(e -> validateInput());
}
protected void validateInput() {
@ -250,17 +236,13 @@ public class CastToArrayActionHandler extends AbstractHandler {
if (getCastToArray() == null || getCastToArray().length == 0)
return null;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(Display.getCurrent(), () -> {
try {
doAction(getCastToArray());
setStatus(null);
} catch (DebugException e) {
setStatus(e.getStatus());
}
}
});
if (getStatus() != null && !getStatus().isOK()) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();

View file

@ -99,17 +99,13 @@ public class CastToTypeActionHandler extends AbstractHandler {
if (getCastToType() == null || getCastToType().length == 0)
return null;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(Display.getCurrent(), () -> {
try {
doAction(getCastToType());
setStatus(null);
} catch (DebugException e) {
setStatus(e.getStatus());
}
}
});
if (getStatus() != null && !getStatus().isOK()) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();

View file

@ -59,15 +59,12 @@ public class LoadModuleSymbolsActionDelegate extends ActionDelegate implements I
final ICModule module = getModule();
if (module != null) {
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
DebugPlugin.getDefault().asyncExec(() -> {
try {
doAction(module);
} catch (DebugException e) {
failed(e);
}
}
});
}
}

View file

@ -119,9 +119,7 @@ public class MoveToLineActionDelegate implements IEditorActionDelegate, IActionD
if (fAction == null) {
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
boolean enabled = false;
if (fPartTarget != null && fTargetElement != null) {
IWorkbenchPartSite site = fActivePart.getSite();
@ -135,7 +133,6 @@ public class MoveToLineActionDelegate implements IEditorActionDelegate, IActionD
}
}
fAction.setEnabled(enabled);
}
};
CDebugUIPlugin.getStandardDisplay().asyncExec(r);
}

View file

@ -67,15 +67,12 @@ public class MoveToLineAdapter implements IMoveToLineTarget {
final IPath path = new Path(fileName);
final IMoveToLine moveToLine = ((IAdaptable) target).getAdapter(IMoveToLine.class);
if (moveToLine != null && moveToLine.canMoveToLine(path.toPortableString(), lineNumber)) {
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
try {
moveToLine.moveToLine(path.toPortableString(), lineNumber);
} catch (DebugException e) {
failed(e);
}
}
};
runInBackground(r);
}

View file

@ -312,12 +312,7 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
if (fAction != null && !fAction.isChecked()) {
final boolean pinnable = PinCloneUtils.isPinnable(fPart, event.getContext());
if (pinnable != fAction.isEnabled()) {
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
fAction.setEnabled(pinnable);
}
});
PlatformUI.getWorkbench().getDisplay().syncExec(() -> fAction.setEnabled(pinnable));
}
}
}

View file

@ -55,17 +55,13 @@ public class RestoreDefaultTypeActionHandler extends AbstractHandler {
if (getCastToType() == null || getCastToType().length == 0)
return null;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(Display.getCurrent(), () -> {
try {
doAction(getCastToType());
setStatus(null);
} catch (DebugException e) {
setStatus(e.getStatus());
}
}
});
if (getStatus() != null && !getStatus().isOK()) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();

View file

@ -119,9 +119,7 @@ public class ResumeAtLineActionDelegate implements IEditorActionDelegate, IActio
if (fAction == null) {
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
boolean enabled = false;
if (fPartTarget != null && fTargetElement != null) {
IWorkbenchPartSite site = fActivePart.getSite();
@ -135,7 +133,6 @@ public class ResumeAtLineActionDelegate implements IEditorActionDelegate, IActio
}
}
fAction.setEnabled(enabled);
}
};
CDebugUIPlugin.getStandardDisplay().asyncExec(r);
}

View file

@ -67,15 +67,12 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget {
if (target instanceof IAdaptable) {
final IResumeAtLine resumeAtLine = ((IAdaptable) target).getAdapter(IResumeAtLine.class);
if (resumeAtLine != null && resumeAtLine.canResumeAtLine(path.toPortableString(), lineNumber)) {
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
try {
resumeAtLine.resumeAtLine(path.toPortableString(), lineNumber);
} catch (DebugException e) {
failed(e);
}
}
};
runInBackground(r);
}

View file

@ -70,10 +70,7 @@ public class RunToLineAdapter implements IRunToLineTarget {
if (target instanceof IAdaptable) {
final IRunToLine runToLine = ((IAdaptable) target).getAdapter(IRunToLine.class);
if (runToLine != null && runToLine.canRunToLine(path.toPortableString(), lineNumber)) {
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
try {
runToLine.runToLine(path.toPortableString(), lineNumber,
DebugUITools.getPreferenceStore().getBoolean(
@ -81,7 +78,6 @@ public class RunToLineAdapter implements IRunToLineTarget {
} catch (DebugException e) {
failed(e);
}
}
};
runInBackground(r);
}

View file

@ -68,9 +68,7 @@ public class ShowFullPathsAction extends ViewFilterAction {
IDebugModelPresentation pres = view.getPresentation(CDIDebugModel.getPluginIdentifier());
if (pres != null) {
pres.setAttribute(CDebugModelPresentation.DISPLAY_FULL_PATHS, Boolean.valueOf(getValue()));
BusyIndicator.showWhile(viewer.getControl().getDisplay(), new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(viewer.getControl().getDisplay(), () -> {
String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
getPreferenceStore().setValue(key, getValue());
CDebugUIPlugin.getDefault().savePluginPreferences();
@ -78,7 +76,6 @@ public class ShowFullPathsAction extends ViewFilterAction {
// Refresh the viewer after we've set the preference because
// DSF-based debuggers trigger off this preference.
viewer.refresh();
}
});
}
}

View file

@ -43,16 +43,12 @@ public class SignalActionDelegate extends ActionDelegate implements IObjectActio
if (getSignal() != null) {
final MultiStatus ms = new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED,
ActionMessages.getString("SignalActionDelegate.0"), null); //$NON-NLS-1$
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(Display.getCurrent(), () -> {
try {
doAction(getSignal());
} catch (DebugException e) {
ms.merge(e.getStatus());
}
}
});
if (!ms.isOK()) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();

View file

@ -50,10 +50,7 @@ public class CBreakpointUpdater implements ICBreakpointListener {
@Override
public void breakpointChanged(IDebugTarget target, final IBreakpoint breakpoint,
@SuppressWarnings("rawtypes") final Map attributes) {
asyncExec(new Runnable() {
@Override
public void run() {
asyncExec(() -> {
try {
Boolean enabled = (Boolean) attributes.get(IBreakpoint.ENABLED);
breakpoint.setEnabled((enabled != null) ? enabled.booleanValue() : false);
@ -64,16 +61,12 @@ public class CBreakpointUpdater implements ICBreakpointListener {
} catch (CoreException e) {
CDebugUIPlugin.log(e.getStatus());
}
}
});
}
@Override
public void breakpointsRemoved(IDebugTarget target, final IBreakpoint[] breakpoints) {
asyncExec(new Runnable() {
@Override
public void run() {
asyncExec(() -> {
for (int i = 0; i < breakpoints.length; ++i) {
try {
if (((ICBreakpoint) breakpoints[i]).decrementInstallCount() == 0)
@ -83,7 +76,6 @@ public class CBreakpointUpdater implements ICBreakpointListener {
// if breakpoint has already been deleted
}
}
}
});
}

View file

@ -87,12 +87,7 @@ public class DialogField {
*/
public void postSetFocusOnDialogField(Display display) {
if (display != null) {
display.asyncExec(new Runnable() {
@Override
public void run() {
setFocus();
}
});
display.asyncExec(() -> setFocus());
}
}

View file

@ -617,13 +617,10 @@ public class ListDialogField extends DialogField {
public void postSetSelection(final ISelection selection) {
if (isOkToUse(fTableControl)) {
Display d = fTableControl.getDisplay();
d.asyncExec(new Runnable() {
@Override
public void run() {
d.asyncExec(() -> {
if (isOkToUse(fTableControl)) {
selectElements(selection);
}
}
});
}
}

View file

@ -65,12 +65,7 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
* @param status
*/
protected void handleError(final IStatus status) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, status); //$NON-NLS-1$
}
});
fCallback.asyncExec(() -> ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, status)); //$NON-NLS-1$
}
/**

View file

@ -142,12 +142,9 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
* @param event debug event
*/
public void delegateEvent(final DebugContextEvent event) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
fActiveContext = event.getContext();
fire(event);
}
});
}
}

View file

@ -328,10 +328,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
* affects these views.
*/
private void refreshViews() {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(getShell().getDisplay(), () -> {
// Refresh interested views
IWorkbenchWindow[] windows = CDebugUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
IWorkbenchPage page = null;
@ -343,7 +340,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
refreshViews(page, IDebugUIConstants.ID_REGISTER_VIEW);
}
}
}
});
}

View file

@ -89,15 +89,12 @@ public class ModulePropertyPage extends PropertyPage {
final ICModule module = getModule();
if (module != null) {
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
DebugPlugin.getDefault().asyncExec(() -> {
try {
module.setSymbolsFileName(path);
} catch (DebugException e) {
failed(PropertyPageMessages.getString("ModulePropertyPage.15"), e); //$NON-NLS-1$
}
}
});
}
}

View file

@ -114,24 +114,21 @@ public class SignalPropertyPage extends PropertyPage {
public boolean performOk() {
boolean result = super.performOk();
if (result) {
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
DebugPlugin.getDefault().asyncExec(() -> {
if (!getSignal().canModify())
return;
if (getPassButton() != null) {
try {
getSignal().setPassEnabled(getPassButton().isSelected());
} catch (DebugException e) {
failed(PropertyPageMessages.getString("SignalPropertyPage.5"), e); //$NON-NLS-1$
} catch (DebugException e1) {
failed(PropertyPageMessages.getString("SignalPropertyPage.5"), e1); //$NON-NLS-1$
}
}
if (getStopButton() != null) {
try {
getSignal().setStopEnabled(getStopButton().isSelected());
} catch (DebugException e) {
failed(PropertyPageMessages.getString("SignalPropertyPage.5"), e); //$NON-NLS-1$
}
} catch (DebugException e2) {
failed(PropertyPageMessages.getString("SignalPropertyPage.5"), e2); //$NON-NLS-1$
}
}
});

View file

@ -67,16 +67,13 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
if (!isAvailable()) {
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
if (isAvailable()) {
if (isViewVisible()) {
doHandleDebugEvents(events);
}
updateForDebugEvents(events);
}
}
};
getView().asyncExec(r);
}

View file

@ -123,9 +123,7 @@ public class AddMemoryBlocks implements IAddMemoryBlocksTarget {
msRetrieval.getMemorySpaces(context, new GetMemorySpacesRequest() {
@Override
public void done() {
runOnUIThread(new Runnable() {
@Override
public void run() {
runOnUIThread(() -> {
if (isSuccess()) {
String[] memorySpaces = getMemorySpaces();
@ -142,7 +140,6 @@ public class AddMemoryBlocks implements IAddMemoryBlocksTarget {
// If we get here, then the custom dialog isn't
// necessary. Use the standard (platform) one
invokePlatformAction(renderingSite);
}
});
}
});

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui;singleton:=true
Bundle-Version: 1.1.1.qualifier
Bundle-Version: 1.1.100.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,

View file

@ -100,8 +100,6 @@ import org.eclipse.debug.internal.ui.commands.actions.StepReturnCommandAction;
import org.eclipse.debug.internal.ui.commands.actions.SuspendCommandAction;
import org.eclipse.debug.internal.ui.commands.actions.TerminateCommandAction;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
import org.eclipse.debug.internal.ui.views.launch.LaunchView;
import org.eclipse.debug.ui.DebugUITools;
@ -833,32 +831,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
if (m_debugViewer == null) {
m_debugViewer = DebugViewUtils.getDebugViewer();
if (m_debugViewer != null) {
m_modelChangedListener = new IModelChangedListener() {
@Override
public void modelChanged(IModelDelta delta, IModelProxy proxy) {
// Execute a refresh after any pending UI updates.
GUIUtils.exec(new Runnable() {
@Override
public void run() {
// check if we need to update the debug context
updateDebugContext();
}
});
}
};
m_debugViewSelectionChangedListener = new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
// Execute a refresh after any pending UI updates.
GUIUtils.exec(new Runnable() {
@Override
public void run() {
// Update canvas selection to match to dbg view selection
updateCanvasSelectionFromDebugView();
}
});
}
};
m_modelChangedListener = (delta, proxy) -> GUIUtils.exec(() -> updateDebugContext());
m_debugViewSelectionChangedListener = event -> GUIUtils
.exec(() -> updateCanvasSelectionFromDebugView());
m_debugViewer.addModelChangedListener(m_modelChangedListener);
m_debugViewer.addSelectionChangedListener(m_debugViewSelectionChangedListener);
}
@ -1128,27 +1104,18 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
/** Sets canvas model. (Also updates canvas selection.) */
protected void setCanvasModel(VisualizerModel model) {
final VisualizerModel model_f = model;
GUIUtils.exec(new Runnable() {
@Override
public void run() {
GUIUtils.exec(() -> {
if (m_canvas != null) {
m_canvas.setModel(model_f);
// Update the canvas's selection from the current workbench selection.
updateCanvasSelectionInternal();
}
}
});
}
/** Updates canvas selection from current workbench selection. */
protected void updateCanvasSelection() {
GUIUtils.exec(new Runnable() {
@Override
public void run() {
// Update the canvas's selection from the current workbench selection.
updateCanvasSelectionInternal();
}
});
GUIUtils.exec(() -> updateCanvasSelectionInternal());
}
/** Updates canvas selection from current workbench selection.
@ -1481,12 +1448,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
if (session != null) {
DsfExecutor executor = session.getExecutor();
if (executor != null) {
executor.execute(new Runnable() {
@Override
public void run() {
updateLoads(fDataModel);
}
});
executor.execute(() -> updateLoads(fDataModel));
}
}
}

View file

@ -335,13 +335,10 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas implements ISelecti
* multiple update requests on same tick are batched.
*/
public void requestUpdate() {
GUIUtils.exec(new Runnable() {
@Override
public void run() {
GUIUtils.exec(() -> {
if (m_updateTimer != null) {
m_updateTimer.start();
}
}
});
}

View file

@ -95,12 +95,7 @@ public class GdbPinProvider implements IPinProvider {
public GdbPinProvider(DsfSession session) {
fSession = session;
session.getExecutor().execute(new Runnable() {
@Override
public void run() {
fSession.addServiceEventListener(GdbPinProvider.this, null);
}
});
session.getExecutor().execute(() -> fSession.addServiceEventListener(GdbPinProvider.this, null));
}
/**
@ -108,12 +103,7 @@ public class GdbPinProvider implements IPinProvider {
*/
public void dispose() {
try {
fSession.getExecutor().execute(new Runnable() {
@Override
public void run() {
fSession.removeServiceEventListener(GdbPinProvider.this);
}
});
fSession.getExecutor().execute(() -> fSession.removeServiceEventListener(GdbPinProvider.this));
} catch (RejectedExecutionException e) {
// Session already gone.
}

View file

@ -30,35 +30,22 @@ public class GdbStatusHandler implements IStatusHandler {
public Object handleStatus(final IStatus status, Object source) throws CoreException {
Runnable runnable = null;
if (status.getSeverity() == IStatus.ERROR) {
runnable = new Runnable() {
@Override
public void run() {
runnable = () -> {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
if (parent != null)
MessageDialog.openError(parent, Messages.GdbStatusHandler_Error, status.getMessage());
}
};
} else if (status.getSeverity() == IStatus.WARNING) {
runnable = new Runnable() {
@Override
public void run() {
runnable = () -> {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
if (parent != null)
MessageDialog.openWarning(parent, Messages.GdbStatusHandler_Warning, status.getMessage());
}
};
} else if (status.getSeverity() == IStatus.INFO) {
runnable = new Runnable() {
@Override
public void run() {
runnable = () -> {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
if (parent != null)
MessageDialog.openInformation(parent, Messages.GdbStatusHandler_Information,
status.getMessage());
}
MessageDialog.openInformation(parent, Messages.GdbStatusHandler_Information, status.getMessage());
};
}
if (runnable != null)

View file

@ -212,9 +212,7 @@ public class DsfTerminateCommand implements ITerminateHandler {
// session is also terminated before the timeout).
// We haven't found a problem with delaying the completion
// of the request that way.
fFutureWrapper.fFuture = fExecutor.schedule(new Runnable() {
@Override
public void run() {
fFutureWrapper.fFuture = fExecutor.schedule(() -> {
// Check that the session is still active when the timeout hits.
// If it is not, then everything has been cleaned up already.
if (DsfSession.isSessionActive(fSession.getId())) {
@ -229,7 +227,6 @@ public class DsfTerminateCommand implements ITerminateHandler {
request.setStatus(Status.CANCEL_STATUS);
request.done();
}
}
}, 1, TimeUnit.MINUTES);
}

View file

@ -161,9 +161,7 @@ public class GdbDisconnectCommand implements IDisconnectHandler {
// need it anymore, once the session has terminated;
// instead, we let it timeout and ignore it if the session
// is already terminated.
fExecutor.schedule(new Runnable() {
@Override
public void run() {
fExecutor.schedule(() -> {
// Check that the session is still active when the timeout hits.
// If it is not, then everything has been cleaned up already.
if (DsfSession.isSessionActive(fSession.getId())) {
@ -178,7 +176,6 @@ public class GdbDisconnectCommand implements IDisconnectHandler {
request.setStatus(Status.CANCEL_STATUS);
request.done();
}
}
}, 1, TimeUnit.MINUTES);
}

View file

@ -71,12 +71,7 @@ public class GdbSaveTraceDataCommand extends AbstractDebugCommand implements ISa
}
final String[] fileName = new String[1];
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
fileName[0] = promptForFileName();
}
});
PlatformUI.getWorkbench().getDisplay().syncExec(() -> fileName[0] = promptForFileName());
if (fileName[0] != null) {
Query<Object> saveTraceDataQuery = new Query<Object>() {

View file

@ -175,9 +175,7 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
// Must use syncExec because the logic within must complete before the rest
// of the class methods (specifically getProcess()) is called
fMainComposite.getDisplay().syncExec(new Runnable() {
@Override
public void run() {
fMainComposite.getDisplay().syncExec(() -> {
if (fTerminalControl != null && !fTerminalControl.isDisposed()) {
fTerminalControl.clearTerminal();
fTerminalControl.connectTerminal();
@ -186,7 +184,6 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
// lets override them with our application defaults right after.
setDefaults();
}
}
});
}

View file

@ -42,16 +42,13 @@ public interface IGDBDebuggerConsole extends IDebuggerConsole {
}
}
session.getExecutor().execute(new Runnable() {
@Override
public void run() {
session.getExecutor().execute(() -> {
DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class);
tracker.dispose();
if (gdbSync != null) {
gdbSync.sessionSelected();
}
}
});
}
}

View file

@ -53,12 +53,7 @@ public class ConsoleSaveAction extends Action {
return;
}
Runnable saveJob = new Runnable() {
@Override
public void run() {
saveContent(fileName);
}
};
Runnable saveJob = () -> saveContent(fileName);
BusyIndicator.showWhile(Display.getCurrent(), saveJob);
}

View file

@ -241,14 +241,10 @@ public class SessionOSData {
// async/job runnables, like perspective switch runnable using during debug launch,
// causing launch to be stuck at random point.
//
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
if (!c.isDisposed())
fUIListener.update();
}
});
}

View file

@ -64,11 +64,8 @@ public class GdbDebugContextSyncManager implements IDebugContextListener {
DsfSession session = DsfSession.getSession(eventSessionId);
// order GDB to switch thread
session.getExecutor().execute(new Runnable() {
@Override
public void run() {
DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(),
eventSessionId);
session.getExecutor().execute(() -> {
DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), eventSessionId);
IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class);
tracker.dispose();
@ -81,7 +78,6 @@ public class GdbDebugContextSyncManager implements IDebugContextListener {
}
});
}
}
});
}
}

View file

@ -72,13 +72,10 @@ public class TraceControlModel {
private volatile ITraceTargetDMContext fTargetContext;
private TraceControlView fTraceControlView;
private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
@Override
public void debugContextChanged(DebugContextEvent event) {
private IDebugContextListener fDebugContextListener = event -> {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
updateDebugContext();
}
}
};
TraceControlModel(TraceControlView view) {
@ -461,14 +458,11 @@ public class TraceControlModel {
private void notifyUI(final ITraceStatusDMData2 data) {
final TraceControlView v = fTraceControlView;
if (v != null) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
if (v != null) {
v.fLastRefreshTime = System.currentTimeMillis();
v.updateUI(data);
}
}
});
}
}
@ -476,13 +470,10 @@ public class TraceControlModel {
private void notifyUI(final String message) {
final TraceControlView v = fTraceControlView;
if (v != null) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
if (v != null) {
v.updateUI(message);
}
}
});
}
}

View file

@ -119,9 +119,7 @@ public class GdbVariableVMNode extends VariableVMNode {
final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getDMContext(),
IExpressionDMContext.class);
if (exprDmc != null) {
getSession().getExecutor().execute(new Runnable() {
@Override
public void run() {
getSession().getExecutor().execute(() -> {
final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
if (expressionService != null) {
final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(
@ -141,7 +139,6 @@ public class GdbVariableVMNode extends VariableVMNode {
request.setStatus(internalError());
request.done();
}
}
});
} else {
request.setStatus(internalError());
@ -161,9 +158,7 @@ public class GdbVariableVMNode extends VariableVMNode {
final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getDMContext(),
IExpressionDMContext.class);
if (exprDmc != null) {
getSession().getExecutor().execute(new Runnable() {
@Override
public void run() {
getSession().getExecutor().execute(() -> {
final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
if (expressionService != null) {
final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(
@ -183,7 +178,6 @@ public class GdbVariableVMNode extends VariableVMNode {
request.setStatus(internalError());
request.done();
}
}
});
} else {
request.setStatus(internalError());

View file

@ -53,9 +53,7 @@ public class GdbStackFramesVMNode extends StackFramesVMNode {
}
private void buildDeltaForFocusChangedEvent(IGDBFocusChangedEvent event, VMDelta parentDelta, RequestMonitor rm) {
getSession().getExecutor().execute(new Runnable() {
@Override
public void run() {
getSession().getExecutor().execute(() -> {
IDMContext ctx = event.getDMContext();
// Is IGDBFocusChangedEvent pertinent for this VMNode?
@ -86,17 +84,15 @@ public class GdbStackFramesVMNode extends StackFramesVMNode {
// Retrieve the list of stack frames
getVMProvider().updateNode(GdbStackFramesVMNode.this,
new VMChildrenUpdate(parentDelta,
getVMProvider().getPresentationContext(), -1, -1,
new DataRequestMonitor<List<Object>>(getExecutor(), rm) {
new VMChildrenUpdate(parentDelta, getVMProvider().getPresentationContext(),
-1, -1, new DataRequestMonitor<List<Object>>(getExecutor(), rm) {
@Override
public void handleSuccess() {
final List<Object> data = getData();
if (data != null && data.size() != 0) {
// create the delta to select the
// current stack frame
parentDelta.addNode(data.get(frameOffset),
frameOffset,
parentDelta.addNode(data.get(frameOffset), frameOffset,
IModelDelta.SELECT | IModelDelta.FORCE);
}
rm.done();
@ -112,7 +108,6 @@ public class GdbStackFramesVMNode extends StackFramesVMNode {
// context not a frame - nothing to do here
rm.done();
}
}
});
}
}

View file

@ -613,9 +613,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
};
startGdbJob.schedule();
fGDBLaunchMonitor.fTimeoutFuture = getExecutor().schedule(new Runnable() {
@Override
public void run() {
fGDBLaunchMonitor.fTimeoutFuture = getExecutor().schedule(() -> {
// Only process the event if we have not finished yet (hit
// the breakpoint).
if (!fGDBLaunchMonitor.fLaunched) {
@ -631,7 +629,6 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
DebugException.TARGET_REQUEST_FAILED, "Timed out trying to launch GDB.", null)); //$NON-NLS-1$
requestMonitor.done();
}
}
}, fGDBLaunchTimeout, TimeUnit.SECONDS);
}

View file

@ -482,12 +482,7 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
public <V extends ICommandResult> ICommandToken queueCommand(final ICommand<V> command,
DataRequestMonitor<V> rm) {
final ICommandToken token = new ICommandToken() {
@Override
public ICommand<? extends ICommandResult> getCommand() {
return command;
}
};
final ICommandToken token = () -> command;
// The class does not buffer commands itself, but sends them directly to the real
// MICommandControl service. Therefore, we must immediately tell our calling cache that the command
@ -723,18 +718,15 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
// delete temp file
new File(localFile).delete();
getExecutor().schedule(new Runnable() {
@Override
public void run() {
fCommandControl.queueCommand(
getExecutor().schedule(() -> fCommandControl.queueCommand(
fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleCompleted() {
if (!isSuccess()) {
fLoadRequestOngoing = false;
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
"Can't get load info for CPU", null)); //$NON-NLS-1$
return;
}
@ -742,8 +734,8 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
try {
procStatParser.parseStatFile(localFile);
} catch (Exception e) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
"Can't get load info for CPU", null)); //$NON-NLS-1$
fLoadRequestOngoing = false;
return;
}
@ -763,9 +755,7 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
}
fLoadInfoRequestCache.clear();
}
});
}
}, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
}), LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
}
});
// Local debugging? Then we can read /proc/stat directly
@ -781,12 +771,10 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
}
// Read /proc/stat file again after a delay
getExecutor().schedule(new Runnable() {
@Override
public void run() {
getExecutor().schedule(() -> {
try {
procStatParser.parseStatFile(statFile);
} catch (Exception e) {
} catch (Exception e1) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
"Can't get load info for CPU", null)); //$NON-NLS-1$
fLoadRequestOngoing = false;
@ -799,11 +787,10 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
// done with request
fLoadRequestOngoing = false;
// process any queued request
for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e : fLoadInfoRequestCache.entrySet()) {
processLoads(e.getKey(), e.getValue(), fCachedLoads);
for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e2 : fLoadInfoRequestCache.entrySet()) {
processLoads(e2.getKey(), e2.getValue(), fCachedLoads);
}
fLoadInfoRequestCache.clear();
}
}, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
}
}

View file

@ -553,9 +553,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
// Add the inferior to the launch.
// This cannot be done on the executor or things deadlock.
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
DebugPlugin.getDefault().asyncExec(() -> {
if (restart) {
// For a restart, remove the old inferior
IProcess[] launchProcesses = launch.getProcesses();
@ -578,11 +576,9 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE);
IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label, attributes);
// Now set the inferior groupId
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR,
MIProcesses.UNIQUE_GROUP_ID);
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, MIProcesses.UNIQUE_GROUP_ID);
rm.done();
}
});
}
});

View file

@ -1849,9 +1849,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IGDBProcesse
private void addProcessToLaunch(Process inferior, String groupId, String label) {
// Add the inferior to the launch.
// This cannot be done on the executor or things deadlock.
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
DebugPlugin.getDefault().asyncExec(() -> {
// Add the inferior
// Need to go through DebugPlugin.newProcess so that we can use
// the overrideable process factory to allow others to override.
@ -1865,7 +1863,6 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IGDBProcesse
attributes);
// Now set the inferior groupId
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, groupId);
}
});
}

View file

@ -804,12 +804,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
// the number of frames collected. Having a small interval of
// stale data is currently not a big deal, and not user-visible.
// Bug 353034
getExecutor().schedule(new Runnable() {
@Override
public void run() {
fTraceStatusCache.reset(context);
}
}, 300, TimeUnit.MILLISECONDS);
getExecutor().schedule(() -> fTraceStatusCache.reset(context), 300, TimeUnit.MILLISECONDS);
fTraceStatusCache.execute(fCommandFactory.createMITraceStatus(context),
new DataRequestMonitor<MITraceStatusInfo>(getExecutor(), rm) {

View file

@ -453,10 +453,8 @@ public class MIBreakpointsManager extends AbstractDsfService
@Override
protected IStatus run(IProgressMonitor monitor) {
// Submit the runnable to plant the breakpoints on dispatch thread.
getExecutor().submit(new Runnable() {
@Override
public void run() {
installInitialBreakpoints(dmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
getExecutor().submit(
() -> installInitialBreakpoints(dmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
@Override
protected void handleSuccess() {
// Notify breakpoints tracking listeners that the tracking is started.
@ -465,9 +463,7 @@ public class MIBreakpointsManager extends AbstractDsfService
}
rm.done();
}
});
}
});
}));
return Status.OK_STATUS;
}
@ -1765,9 +1761,7 @@ public class MIBreakpointsManager extends AbstractDsfService
* @param bps
*/
private void clearBreakpointStatus(final ICBreakpoint[] bps, final IBreakpointsTargetDMContext ctx) {
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
IWorkspaceRunnable wr = monitor -> {
// For every platform breakpoint that has at least one target breakpoint installed
// we must decrement the install count, for every target breakpoint.
// Note that we cannot simply call resetInstallCount() because another
@ -1779,7 +1773,6 @@ public class MIBreakpointsManager extends AbstractDsfService
decrementInstallCount(targetBp, breakpoint, new RequestMonitor(getExecutor(), null));
}
}
}
};
// Create the scheduling rule to clear all bp planted.

View file

@ -52,10 +52,7 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
}
public static void startup() {
Runnable r = new Runnable() {
@Override
public void run() {
Runnable r = () -> {
if (fgManager == null) {
// FindBugs reported that it is unsafe to set s_resources
// before we finish to initialize the object, because of
@ -70,7 +67,6 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
fgManager = manager;
}
}
};
Display display = Display.getCurrent();
if (display == null)

View file

@ -400,9 +400,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
fViewerUpdateListener = new IViewerUpdateListener() {
@Override
public void viewerUpdatesComplete() {
fViewer.getDisplay().timerExec(100, new Runnable() {
@Override
public void run() {
fViewer.getDisplay().timerExec(100, () -> {
if (!fViewer.getTree().isDisposed()) {
TreeSelection selection = (TreeSelection) fViewer.getSelection();
if (selection.isEmpty()) {
@ -413,7 +411,6 @@ public class ExpressionInformationControlCreator implements IInformationControlC
fDetailPane.display(selection);
}
}
}
});
}

View file

@ -963,15 +963,12 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
private void notifyUser(final String message) {
Runnable runnable = new Runnable() {
@Override
public void run() {
Runnable runnable = () -> {
Shell parent = DsfUIPlugin.getActiveWorkbenchShell();
if (parent != null) {
MessageDialog.openInformation(parent, Messages.Information,
Messages.RegisterGroupInfo + ": " + message); //$NON-NLS-1$
}
}
};
Display.getDefault().asyncExec(runnable);

View file

@ -353,12 +353,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (canDisassemble()) {
final BigInteger address = getLastKnownAddress();
if (address != null && !UNKNOWN_ADDRESS.equals(address)) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.updatePC(address);
}
});
fCallback.asyncExec(() -> fCallback.updatePC(address));
}
}
}
@ -387,9 +382,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (DEBUG)
System.out
.println("retrieveFrameAddress done " + DisassemblyUtils.getAddressText(addressValue)); //$NON-NLS-1$
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.asyncExec(() -> {
if (address.getSize() * 8 != fCallback.getAddressSize()) {
fCallback.addressSizeChanged(address.getSize() * 8);
}
@ -398,7 +391,6 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} else {
fCallback.gotoFrame(frame, addressValue);
}
}
});
} else {
final IStatus status = getStatus();
@ -474,12 +466,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
}
final IExecutionDMContext context = event.getDMContext();
if (context.equals(fTargetContext) || DMContexts.isAncestorOf(fTargetContext, context)) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.handleTargetEnded();
}
});
fCallback.asyncExec(() -> fCallback.handleTargetEnded());
}
}
@ -571,10 +558,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
final IDisassemblyDMContext context = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
// align the start address first (bug 328168)
executor.execute(new Runnable() {
@Override
public void run() {
alignOpCodeAddress(startAddress, new DataRequestMonitor<BigInteger>(executor, null) {
executor.execute(() -> alignOpCodeAddress(startAddress, new DataRequestMonitor<BigInteger>(executor, null) {
@Override
public void handleCompleted() {
@ -586,41 +570,23 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
public void handleCompleted() {
final IMixedInstruction[] data = getData();
if (!isCanceled() && data != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
if (!insertDisassembly(finalStartAddress, finalEndAddress, data,
showSymbols, showDisassembly)) {
fCallback.asyncExec(() -> {
if (!insertDisassembly(finalStartAddress, finalEndAddress, data, showSymbols,
showDisassembly)) {
// retry in non-mixed mode
fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress,
linesHint, false, true);
}
fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress, linesHint,
false, true);
}
});
} else {
final IStatus status = getStatus();
if (status != null && !status.isOK()) {
if (file != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.retrieveDisassembly(finalStartAddress,
finalEndAddress, linesHint, true, true);
}
});
fCallback.asyncExec(() -> fCallback.retrieveDisassembly(finalStartAddress,
finalEndAddress, linesHint, true, true));
} else {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
status.getMessage());
}
});
}
});
fCallback.asyncExec(() -> fCallback.doScrollLocked(
() -> fCallback.insertError(finalStartAddress, status.getMessage())));
}
}
fCallback.setUpdatePending(false);
@ -628,26 +594,18 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
}
};
if (file != null) {
executor.execute(new Runnable() {
@Override
public void run() {
final IDisassembly disassembly = fServicesTracker
.getService(IDisassembly.class);
executor.execute(() -> {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
disassembly.getMixedInstructions(context, file, lineNumber, lines * 2,
disassemblyRequest);
}
disassembly.getMixedInstructions(context, file, lineNumber, lines * 2, disassemblyRequest);
});
} else {
executor.execute(new Runnable() {
@Override
public void run() {
final IDisassembly disassembly = fServicesTracker
.getService(IDisassembly.class);
executor.execute(() -> {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
@ -655,7 +613,6 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
}
disassembly.getMixedInstructions(context, finalStartAddress, finalEndAddress,
disassemblyRequest);
}
});
}
} else {
@ -664,59 +621,35 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
@Override
public void handleCompleted() {
if (!isCanceled() && getData() != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
if (!insertDisassembly(finalStartAddress, finalEndAddress, getData(),
showSymbols, showDisassembly)) {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
DisassemblyMessages.DisassemblyBackendDsf_error_UnableToRetrieveData);
}
});
}
fCallback.asyncExec(() -> {
if (!insertDisassembly(finalStartAddress, finalEndAddress, getData(), showSymbols,
showDisassembly)) {
fCallback.doScrollLocked(() -> fCallback.insertError(finalStartAddress,
DisassemblyMessages.DisassemblyBackendDsf_error_UnableToRetrieveData));
}
});
} else {
final IStatus status = getStatus();
if (status != null && !status.isOK()) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
status.getMessage());
}
});
}
});
fCallback.asyncExec(() -> fCallback.doScrollLocked(
() -> fCallback.insertError(finalStartAddress, status.getMessage())));
}
fCallback.setUpdatePending(false);
}
}
};
executor.execute(new Runnable() {
@Override
public void run() {
executor.execute(() -> {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
disassembly.getInstructions(context, finalStartAddress, finalEndAddress,
disassemblyRequest);
}
disassembly.getInstructions(context, finalStartAddress, finalEndAddress, disassemblyRequest);
});
}
}
});
}
});
}));
}
private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IInstruction[] instructions,
@ -1039,12 +972,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
protected void handleSuccess() {
final BigInteger address = getData();
if (address != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.gotoAddress(address);
}
});
fCallback.asyncExec(() -> fCallback.gotoAddress(address));
}
}
});
@ -1090,12 +1018,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
final IAddress address = data.getAddress();
if (address != null && address != IExpressionDMLocation.INVALID_ADDRESS) {
final BigInteger addressValue = address.getValue();
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.gotoAddress(addressValue);
}
});
fCallback.asyncExec(() -> fCallback.gotoAddress(addressValue));
rm.setData(addressValue);
rm.done();
} else {
@ -1191,14 +1114,11 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
public void handleCompleted() {
final IMixedInstruction[] data = getData();
if (!isCanceled() && data != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.asyncExec(() -> {
if (!insertDisassembly(null, endAddress, data, showSymbols, showDisassembly)) {
// retry in non-mixed mode
retrieveDisassembly(file, lines, endAddress, false, showSymbols, showDisassembly);
}
}
});
} else {
final IStatus status = getStatus();
@ -1211,9 +1131,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
};
assert !fCallback.getUpdatePending();
fCallback.setUpdatePending(true);
executor.execute(new Runnable() {
@Override
public void run() {
executor.execute(() -> {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
@ -1221,7 +1139,6 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
return;
}
disassembly.getMixedInstructions(context, finalFile, 1, lines, disassemblyRequest);
}
});
}

View file

@ -136,12 +136,9 @@ import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSource;
import org.eclipse.swt.dnd.DropTarget;
@ -150,7 +147,6 @@ import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
@ -580,12 +576,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
} else if (Control.class.equals(required)) {
return fViewer != null ? (T) fViewer.getTextWidget() : null;
} else if (IGotoMarker.class.equals(required)) {
return (T) new IGotoMarker() {
@Override
public void gotoMarker(IMarker marker) {
DisassemblyPart.this.gotoMarker(marker);
}
};
return (T) (IGotoMarker) marker -> DisassemblyPart.this.gotoMarker(marker);
} else if (IColumnSupport.class.equals(required)) {
if (fColumnSupport == null)
fColumnSupport = createColumnSupport();
@ -780,9 +771,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
hookContextMenu();
contributeToActionBars();
fViewer.getTextWidget().addVerifyKeyListener(new VerifyKeyListener() {
@Override
public void verifyKey(VerifyEvent event) {
fViewer.getTextWidget().addVerifyKeyListener(event -> {
switch (event.keyCode) {
case SWT.PAGE_UP:
case SWT.PAGE_DOWN:
@ -790,15 +779,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
case SWT.ARROW_DOWN:
event.doit = !keyScroll(event.keyCode);
}
}
});
fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateSelectionDependentActions();
}
});
fViewer.addSelectionChangedListener(event -> updateSelectionDependentActions());
fErrorColor = EditorsUI.getSharedTextColors().getColor(
PreferenceConverter.getColor(getPreferenceStore(), DisassemblyPreferenceConstants.ERROR_COLOR));
@ -834,13 +817,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
protected void setSite(IWorkbenchPartSite site) {
super.setSite(site);
site.getPage().addPartListener(fPartListener);
fDebugContextListener = new IDebugContextListener() {
@Override
public void debugContextChanged(DebugContextEvent event) {
fDebugContextListener = event -> {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
updateDebugContext();
}
}
};
DebugUITools.addPartDebugContextListener(site, fDebugContextListener);
}
@ -1198,12 +1178,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
String id = "#DisassemblyPartContext"; //$NON-NLS-1$
MenuManager menuMgr = new MenuManager(id, id);
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
DisassemblyPart.this.fillContextMenu(manager);
}
});
menuMgr.addMenuListener(manager -> DisassemblyPart.this.fillContextMenu(manager));
Menu menu = menuMgr.createContextMenu(fViewer.getTextWidget());
fViewer.getTextWidget().setMenu(menu);
getSite().registerContextMenu(id, menuMgr, fViewer);
@ -1213,12 +1188,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
String id = "#DisassemblyPartRulerContext"; //$NON-NLS-1$
MenuManager menuMgr = new MenuManager(id, id);
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
DisassemblyPart.this.fillRulerContextMenu(manager);
}
});
menuMgr.addMenuListener(manager -> DisassemblyPart.this.fillRulerContextMenu(manager));
Menu menu = menuMgr.createContextMenu(fVerticalRuler.getControl());
fVerticalRuler.getControl().setMenu(menu);
getSite().registerContextMenu(id, menuMgr, fViewer);
@ -1442,13 +1412,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
assert isGuiThread();
if (address != null) {
final BigInteger addr = address.getValue();
startUpdate(new Runnable() {
@Override
public void run() {
startUpdate(() -> {
fGotoFramePending = false;
fGotoAddressPending = PC_UNKNOWN;
gotoAddress(addr);
}
});
}
}
@ -1560,9 +1527,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
&& !fRefreshViewPending && fFocusAddress != PC_UNKNOWN) {
fUpdatePending = true;
final int updateCount = fUpdateCount;
invokeLater(new Runnable() {
@Override
public void run() {
invokeLater(() -> {
if (updateCount == fUpdateCount) {
assert fUpdatePending;
if (fUpdatePending) {
@ -1570,7 +1535,6 @@ public abstract class DisassemblyPart extends WorkbenchPart
updateVisibleArea();
}
}
}
});
}
}
@ -1767,13 +1731,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
if (fDebugSessionId == null) {
return;
}
startUpdate(new Runnable() {
@Override
public void run() {
startUpdate(() -> {
if (DEBUG)
System.out.println("retrieveDisassembly " + file); //$NON-NLS-1$
fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
}
});
}
@ -2002,12 +1963,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
prevBackend.dispose();
}
if (needUpdate && fViewer != null) {
startUpdate(new Runnable() {
@Override
public void run() {
debugContextChanged();
}
});
startUpdate(() -> debugContextChanged());
}
}
@ -2107,9 +2063,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
fRunnableQueue.clear();
fRefreshViewPending = true;
final long refreshViewScheduled = System.currentTimeMillis() + delay;
final Runnable refresh = new Runnable() {
@Override
public void run() {
final Runnable refresh = () -> {
fRefreshViewPending = false;
long now = System.currentTimeMillis();
if (now >= refreshViewScheduled) {
@ -2137,15 +2091,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
} else {
refreshView((int) (refreshViewScheduled - now));
}
}
};
if (delay > 0) {
invokeLater(delay, new Runnable() {
@Override
public void run() {
doScrollLocked(refresh);
}
});
invokeLater(delay, () -> doScrollLocked(refresh));
} else {
doScrollLocked(refresh);
}
@ -2610,12 +2558,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
private void scheduleDoPending() {
if (!fUpdatePending && !fDoPendingPosted) {
fDoPendingPosted = true;
invokeLater(new Runnable() {
@Override
public void run() {
invokeLater(() -> {
doPending();
fDoPendingPosted = false;
}
});
}
}
@ -2678,13 +2623,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
final int updateCount = fUpdateCount;
if (fUpdatePending) {
if (fRunnableQueue.size() == 1) {
Runnable doitlater = new Runnable() {
@Override
public void run() {
Runnable doitlater = () -> {
if (updateCount == fUpdateCount) {
doScrollLocked(null);
}
}
};
invokeLater(doitlater);
}
@ -3113,12 +3055,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
*/
@Override
public void handleTargetSuspended() {
asyncExec(new Runnable() {
@Override
public void run() {
asyncExec(() -> {
updatePC(PC_UNKNOWN);
firePropertyChange(PROP_SUSPENDED);
}
});
}
@ -3127,12 +3066,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
*/
@Override
public void handleTargetResumed() {
asyncExec(new Runnable() {
@Override
public void run() {
asyncExec(() -> {
updatePC(PC_RUNNING);
firePropertyChange(PROP_SUSPENDED);
}
});
}
@ -3141,17 +3077,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
*/
@Override
public void handleTargetEnded() {
asyncExec(new Runnable() {
@Override
public void run() {
asyncExec(() -> {
fDebugSessionId = null;
startUpdate(new Runnable() {
@Override
public void run() {
debugContextChanged();
}
});
}
startUpdate(() -> debugContextChanged());
});
}

View file

@ -266,12 +266,7 @@ public class CSourcePresentationCreator extends PresentationReconciler
fDamagerRepairer = new SourceTagDamagerRepairer(scanner, fSourceTagProvider, colorManager, store);
if (fSourceTagProvider != null) {
if (fSourceTagListener == null) {
fSourceTagListener = new ISourceTagListener() {
@Override
public void sourceTagsChanged(ISourceTagProvider provider) {
handleSourceTagsChanged();
}
};
fSourceTagListener = provider -> handleSourceTagsChanged();
}
fSourceTagProvider.addSourceTagListener(fSourceTagListener);
}
@ -341,13 +336,10 @@ public class CSourcePresentationCreator extends PresentationReconciler
if (fViewer != null) {
Display display = fViewer.getTextWidget().getDisplay();
if (display.getThread() != Thread.currentThread()) {
display.asyncExec(new Runnable() {
@Override
public void run() {
display.asyncExec(() -> {
if (fViewer != null) {
fViewer.invalidateTextPresentation();
}
}
});
} else {
fViewer.invalidateTextPresentation();

View file

@ -40,14 +40,10 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontMetrics;
@ -393,14 +389,11 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Redraw runnable
*/
private Runnable fRunnable = new Runnable() {
@Override
public void run() {
private Runnable fRunnable = () -> {
synchronized (fRunnableLock) {
fIsRunnablePosted = false;
}
redraw();
}
};
private boolean fAlignRight;
private boolean fPaintStyleBackground;
@ -608,21 +601,15 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
fCanvas.setForeground(fForeground);
fCanvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent event) {
fCanvas.addPaintListener(event -> {
if (fCachedTextViewer != null)
doubleBufferPaint(event.gc);
}
});
fCanvas.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
fCanvas.addDisposeListener(e -> {
handleDispose();
fCachedTextViewer = null;
fCachedTextWidget = null;
}
});
fCanvas.addMouseListener(new MouseHandler());

View file

@ -756,12 +756,9 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
// Need to remove annotations in UI thread.
Display display = PlatformUI.getWorkbench().getDisplay();
if (display != null && !display.isDisposed()) {
display.asyncExec(new Runnable() {
@Override
public void run() {
display.asyncExec(() -> {
enableLineBackgroundPainter();
fIPManager.removeAllAnnotations();
}
});
}
}
@ -997,9 +994,7 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
System.out.println("[DsfSourceDisplayAdapter] eventDispatched e=" + e); //$NON-NLS-1$
}
// trigger source display immediately (should be optional?)
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
Object context = DebugUITools.getDebugContext();
if (context instanceof IDMVMContext) {
final IDMContext dmc = ((IDMVMContext) context).getDMContext();
@ -1010,7 +1005,6 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
}
}
doneStepping(e.getDMContext());
}
});
} else {
doneStepping(e.getDMContext());

View file

@ -83,12 +83,7 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
store.getInt(IDsfDebugUIConstants.PREF_STACK_FRAME_LIMIT));
}
fPreferencesListener = new IPropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent event) {
handlePropertyChanged(store, event);
}
};
fPreferencesListener = event -> handlePropertyChanged(store, event);
store.addPropertyChangeListener(fPreferencesListener);
final IPreferenceStore cStore = CDebugUIPlugin.getDefault().getPreferenceStore();
@ -116,16 +111,13 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
// We're in session's executor thread. Re-dispatch to our executor thread
// and then call root layout node.
try {
getExecutor().execute(new Runnable() {
@Override
public void run() {
getExecutor().execute(() -> {
if (isDisposed())
return;
for (final DebugEvent event : events) {
handleEvent(event);
}
}
});
} catch (RejectedExecutionException e) {
// Ignore. This exception could be thrown if the provider is being
@ -175,16 +167,13 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
@Override
public void run() {
if (getSession().isActive()) {
getExecutor().execute(new Runnable() {
@Override
public void run() {
getExecutor().execute(() -> {
// trigger full stack frame update
ScheduledFuture<?> future = fRefreshStackFramesFutures.get(exeContext);
if (future != null && !isDisposed()) {
fRefreshStackFramesFutures.remove(exeContext);
handleEvent(new FullStackRefreshEvent(exeContext, suspendEvent), null);
}
}
});
}
}
@ -259,9 +248,7 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
// We're in session's executor thread. Re-dispach to our executor thread
// and then call root layout node.
try {
getExecutor().execute(new Runnable() {
@Override
public void run() {
getExecutor().execute(() -> {
if (isDisposed())
return;
@ -269,7 +256,6 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
if (rootLayoutNode != null && rootLayoutNode.getDeltaFlags(event) != IModelDelta.NO_CHANGE) {
handleEvent(event);
}
}
});
} catch (RejectedExecutionException e) {
// Ignore. This exception could be thrown if the provider is being

View file

@ -418,16 +418,13 @@ public class VariableVMNode extends AbstractExpressionVMNode
DebugUITools.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
}
fPreferenceChangeListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
fPreferenceChangeListener = event -> {
if (event.getProperty().equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND)) {
columnIdValueBackground.setBackground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
columnNoColumnsBackground.setBackground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
}
}
};
DebugUITools.getPreferenceStore().addPropertyChangeListener(fPreferenceChangeListener);
@ -865,9 +862,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
@Override
public void update(final IExpressionUpdate update) {
try {
getSession().getExecutor().execute(new Runnable() {
@Override
public void run() {
getSession().getExecutor().execute(() -> {
final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
if (expressionService != null) {
IExpressionDMContext expressionDMC = createExpression(expressionService,
@ -881,7 +876,6 @@ public class VariableVMNode extends AbstractExpressionVMNode
} else {
handleFailedUpdate(update);
}
}
});
} catch (RejectedExecutionException e) {
handleFailedUpdate(update);

View file

@ -29,8 +29,6 @@ import org.eclipse.cdt.dsf.concurrent.DsfExecutable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
/**
* DSF executor which uses the display thread to run the submitted runnables
@ -78,13 +76,10 @@ public class DisplayDsfExecutor extends DefaultDsfExecutor {
private DisplayDsfExecutor(Display display) {
super("Display DSF Executor"); //$NON-NLS-1$
fDisplay = display;
fDisplay.addListener(SWT.Dispose, new Listener() {
@Override
public void handleEvent(Event event) {
fDisplay.addListener(SWT.Dispose, event -> {
if (event.type == SWT.Dispose) {
DisplayDsfExecutor.super.shutdownNow();
}
}
});
}
@ -120,15 +115,12 @@ public class DisplayDsfExecutor extends DefaultDsfExecutor {
final Throwable[] e = new Throwable[1];
try {
fDisplay.syncExec(new Runnable() {
@Override
public void run() {
fDisplay.syncExec(() -> {
try {
v[0] = callable.call();
} catch (Throwable exception) {
e[0] = exception;
}
}
});
} catch (SWTException swtException) {
if (swtException.code == SWT.ERROR_DEVICE_DISPOSED) {
@ -164,22 +156,14 @@ public class DisplayDsfExecutor extends DefaultDsfExecutor {
((DsfExecutable) runnable).setSubmitted();
}
return new Runnable() {
@Override
public void run() {
return () -> {
try {
fDisplay.syncExec(new Runnable() {
@Override
public void run() {
runnable.run();
}
});
fDisplay.syncExec(() -> runnable.run());
} catch (SWTException swtException) {
if (swtException.code == SWT.ERROR_DEVICE_DISPOSED) {
DisplayDsfExecutor.super.shutdownNow();
}
}
}
};
}

View file

@ -78,12 +78,7 @@ public class SimpleDisplayExecutor implements Executor {
final boolean needsPosting = enqueue(command);
if (needsPosting) {
try {
fDisplay.asyncExec(new Runnable() {
@Override
public void run() {
runInSwtThread();
}
});
fDisplay.asyncExec(() -> runInSwtThread());
} catch (final SWTException e) {
if (e.code == SWT.ERROR_DEVICE_DISPOSED) {
throw new RejectedExecutionException("Display " + fDisplay + " is disposed", e); //$NON-NLS-1$ //$NON-NLS-2$

View file

@ -104,12 +104,7 @@ abstract public class AbstractVMAdapter implements IVMAdapter {
for (final IVMProvider provider : providers) {
try {
provider.getExecutor().execute(new Runnable() {
@Override
public void run() {
provider.dispose();
}
});
provider.getExecutor().execute(() -> provider.dispose());
} catch (RejectedExecutionException e) {
// Not much we can do at this point.
}
@ -155,9 +150,7 @@ abstract public class AbstractVMAdapter implements IVMAdapter {
private void updateProvider(final IVMProvider provider, final IViewerUpdate[] updates) {
try {
provider.getExecutor().execute(new Runnable() {
@Override
public void run() {
provider.getExecutor().execute(() -> {
if (updates instanceof IHasChildrenUpdate[]) {
provider.update((IHasChildrenUpdate[]) updates);
} else if (updates instanceof IChildrenCountUpdate[]) {
@ -165,7 +158,6 @@ abstract public class AbstractVMAdapter implements IVMAdapter {
} else if (updates instanceof IChildrenUpdate[]) {
provider.update((IChildrenUpdate[]) updates);
}
}
});
} catch (RejectedExecutionException e) {
for (IViewerUpdate update : updates) {

View file

@ -50,14 +50,11 @@ abstract public class AbstractDMVMAdapter extends AbstractVMAdapter {
fSession = session;
// Add ourselves as listener for DM events events.
try {
session.getExecutor().execute(new Runnable() {
@Override
public void run() {
session.getExecutor().execute(() -> {
if (DsfSession.isSessionActive(getSession().getId())) {
getSession().addServiceEventListener(AbstractDMVMAdapter.this, null);
fRegisteredAsEventListener = true;
}
}
});
} catch (RejectedExecutionException e) {
// Session shut down, not much we can do but wait to be disposed.
@ -67,13 +64,10 @@ abstract public class AbstractDMVMAdapter extends AbstractVMAdapter {
@Override
public void dispose() {
try {
getSession().getExecutor().execute(new Runnable() {
@Override
public void run() {
getSession().getExecutor().execute(() -> {
if (fRegisteredAsEventListener && getSession().isActive()) {
fSession.removeServiceEventListener(AbstractDMVMAdapter.this);
}
}
});
} catch (RejectedExecutionException e) {
// Session shut down.

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf;singleton:=true
Bundle-Version: 2.8.1.qualifier
Bundle-Version: 2.8.100.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.internal.DsfPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,

View file

@ -41,12 +41,7 @@ public abstract class AbstractCache<V> implements ICache<V> {
private class RequestCanceledListener implements RequestMonitor.ICanceledListener {
@Override
public void requestCanceled(final RequestMonitor canceledRm) {
fExecutor.getDsfExecutor().execute(new Runnable() {
@Override
public void run() {
handleCanceledRm(canceledRm);
}
});
fExecutor.getDsfExecutor().execute(() -> handleCanceledRm(canceledRm));
}
}

View file

@ -39,21 +39,11 @@ public class DsfLaunch extends Launch {
@Override
protected void fireChanged() {
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
DsfLaunch.super.fireChanged();
}
});
DebugPlugin.getDefault().asyncExec(() -> DsfLaunch.super.fireChanged());
}
@Override
protected void fireTerminate() {
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
DsfLaunch.super.fireTerminate();
}
});
DebugPlugin.getDefault().asyncExec(() -> DsfLaunch.super.fireTerminate());
}
}

View file

@ -109,12 +109,8 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
fBlock = null;
try {
fRetrieval.getExecutor().execute(new Runnable() {
@Override
public void run() {
fRetrieval.getSession().addServiceEventListener(DsfMemoryBlock.this, null);
}
});
fRetrieval.getExecutor()
.execute(() -> fRetrieval.getSession().addServiceEventListener(DsfMemoryBlock.this, null));
} catch (RejectedExecutionException e) {
// Session is shut down.
}
@ -565,12 +561,8 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
@Override
public void dispose() throws DebugException {
try {
fRetrieval.getExecutor().execute(new Runnable() {
@Override
public void run() {
fRetrieval.getSession().removeServiceEventListener(DsfMemoryBlock.this);
}
});
fRetrieval.getExecutor()
.execute(() -> fRetrieval.getSession().removeServiceEventListener(DsfMemoryBlock.this));
} catch (RejectedExecutionException e) {
// Session is down.
}

View file

@ -217,15 +217,12 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
DEFAULT_ATTR_DEBUGGER_MEMORY_BLOCKS_VALUE);
if (memento != null && memento.trim().length() != 0) {
// Submit the runnable to install the monitors on dispatch thread.
getExecutor().submit(new Runnable() {
@Override
public void run() {
getExecutor().submit(() -> {
try {
createBlocksFromConfiguration(memoryCtx, memento);
} catch (CoreException e) {
DsfPlugin.getDefault().getLog().log(e.getStatus());
}
}
});
}
} catch (CoreException e) {

View file

@ -296,12 +296,7 @@ public class BreakpointsMediator extends AbstractDsfService implements IBreakpoi
}
// Submit the runnable to plant the breakpoints on dispatch thread.
getExecutor().submit(new Runnable() {
@Override
public void run() {
installInitialBreakpoints(breakpointsDmc, initialPlatformBPs, rm);
}
});
getExecutor().submit(() -> installInitialBreakpoints(breakpointsDmc, initialPlatformBPs, rm));
return Status.OK_STATUS;
}

View file

@ -977,9 +977,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
public void listChanged(IDockerConnection c, java.util.List<IDockerImage> list) {
final IDockerImage[] finalList = list.toArray(new IDockerImage[0]);
if (c.getName().equals(connection.getName())) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
connection.removeImageListener(containerTab);
ArrayList<String> imageNames = new ArrayList<>();
displayedImages = new ArrayList<>();
@ -995,8 +993,6 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(containerTab);
}
});
}
}

View file

@ -736,9 +736,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab
setErrorMessage(Messages.ContainerTab_Error_No_Images);
}
if (c.getName().equals(connection.getName())) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
connection.removeImageListener(containerTab);
ArrayList<String> imageNames = new ArrayList<>();
for (IDockerImage image : finalList) {
@ -752,8 +750,6 @@ public class ContainerTab extends AbstractLaunchConfigurationTab
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(containerTab);
}
});
}
}

View file

@ -467,15 +467,8 @@ public class LaunchShortcut implements ILaunchShortcut {
}
// issue error message if no connections exist
if (connection == null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openError(Display.getCurrent().getActiveShell(),
Messages.LaunchShortcut_Error_Launching, Messages.LaunchShortcut_No_Connections);
}
});
Display.getDefault().syncExec(() -> MessageDialog.openError(Display.getCurrent().getActiveShell(),
Messages.LaunchShortcut_Error_Launching, Messages.LaunchShortcut_No_Connections));
return null;
}
@ -495,15 +488,8 @@ public class LaunchShortcut implements ILaunchShortcut {
// issue error msg if no images exist
if (image == null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openError(Display.getCurrent().getActiveShell(),
Messages.LaunchShortcut_Error_Launching, Messages.LaunchShortcut_No_Images);
}
});
Display.getDefault().syncExec(() -> MessageDialog.openError(Display.getCurrent().getActiveShell(),
Messages.LaunchShortcut_Error_Launching, Messages.LaunchShortcut_No_Images));
return null;
}

View file

@ -273,9 +273,7 @@ public class NewContainerTargetWizardPage extends WizardPage
setErrorMessage(Messages.NewContainerTargetWizardPage_no_images);
}
if (c.getName().equals(connection.getName())) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(() -> {
connection.removeImageListener(wizardPage);
ArrayList<String> imageNames = new ArrayList<>();
for (IDockerImage image : finalList) {
@ -289,8 +287,6 @@ public class NewContainerTargetWizardPage extends WizardPage
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(wizardPage);
}
});
}
}

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.floatingpoint;singleton:=true
Bundle-Version: 1.0.1.qualifier
Bundle-Version: 1.0.100.qualifier
Bundle-Localization: plugin
Require-Bundle: org.eclipse.debug.core;bundle-version="3.7.100",
org.eclipse.debug.ui;bundle-version="3.8.1",

View file

@ -53,17 +53,13 @@ import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
import org.eclipse.debug.ui.memory.IResettableMemoryRendering;
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.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.jface.window.Window;
@ -121,19 +117,14 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
public FPRendering(String id) {
super(id);
JFaceResources.getFontRegistry().addListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
JFaceResources.getFontRegistry().addListener(event -> {
if (event.getProperty().equals(IInternalDebugUIConstants.FONT_NAME)) {
FPRendering.this.fRendering
.handleFontPreferenceChange(JFaceResources.getFont(IInternalDebugUIConstants.FONT_NAME));
}
}
});
this.addPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
this.addPropertyChangeListener(event -> {
IMemoryRendering sourceRendering = (IMemoryRendering) event.getSource();
if (!sourceRendering.getMemoryBlock().equals(getMemoryBlock()))
return;
@ -144,28 +135,21 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
&& address instanceof BigInteger) {
FPRendering.this.fRendering.ensureVisible((BigInteger) address);
}
}
});
FPRenderingPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
FPRenderingPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(event -> {
disposeColors();
allocateColors();
applyPreferences();
}
});
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(event -> {
if (event.getProperty().equals(IDebugUIConstants.PREF_PADDED_STR)) {
if (FPRendering.this.fRendering != null) {
setRenderingPadding((String) event.getNewValue());
FPRendering.this.fRendering.redrawPanes();
}
}
}
});
}
@ -221,14 +205,11 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
* We use the UI dispatch thread to protect the proxy information. Even though I believe the
* dispose routine is always called in the UI dispatch thread. I am going to make sure.
*/
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
if (fModel != null) {
fModel.removeModelChangedListener(FPRendering.this);
fModel.dispose();
}
}
});
if (this.fRendering != null)
@ -246,9 +227,7 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
*/
final IModelProxyFactory factory = (IModelProxyFactory) DebugPlugin.getAdapter(block, IModelProxyFactory.class);
if (factory != null) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
/*
* The asynchronous model assumes we have an asynchronous viewer that has an IPresentationContext
@ -268,7 +247,6 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
fModel.addModelChangedListener(FPRendering.this);
}
}
});
}
@ -605,12 +583,7 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
{
@Override
public void run() {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
FPRendering.this.fRendering.copyAddressToClipboard();
}
});
Display.getDefault().asyncExec(() -> FPRendering.this.fRendering.copyAddressToClipboard());
}
};
@ -621,12 +594,8 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
{
@Override
public void run() {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
FPRendering.this.fRendering.gotoAddress(FPRendering.this.fRendering.fBaseAddress);
}
});
Display.getDefault().asyncExec(
() -> FPRendering.this.fRendering.gotoAddress(FPRendering.this.fRendering.fBaseAddress));
}
};
@ -636,9 +605,7 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
{
@Override
public void run() {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
// For compatibility with DSF update modes (hopefully this will either be replaced
// by an enhanced platform interface or the caching will move out of the data layer)
@ -650,7 +617,6 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
}
FPRendering.this.fRendering.refresh();
}
});
}
};
@ -826,10 +792,7 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
@Override
public void run() {
InputDialog inputDialog = new InputDialog(fRendering.getShell(), "Set Column Count", //$NON-NLS-1$
"Please enter column count", "", new IInputValidator() //$NON-NLS-1$ //$NON-NLS-2$
{
@Override
public String isValid(String input) {
"Please enter column count", "", input -> {
try {
int index = Integer.parseInt(input);
@ -843,7 +806,6 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
}
return null;
}
});
if (inputDialog.open() != Window.OK) {
@ -927,9 +889,7 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
// Add the right-mouse-click (RMC) context menu items
getPopupMenuManager().addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
getPopupMenuManager().addMenuListener(manager -> {
manager.add(new Separator());
MenuManager sub = new MenuManager(FPRenderingMessages.getString("FPRendering.PANES")); //$NON-NLS-1$
@ -955,12 +915,12 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
sub = new MenuManager(FPRenderingMessages.getString("FPRendering.COLUMN_COUNT")); //$NON-NLS-1$
sub.add(displayColumnCountAuto);
for (int index = 0; index < displayColumnCounts.length; index++)
sub.add(displayColumnCounts[index]);
for (int index1 = 0; index1 < displayColumnCounts.length; index1++)
sub.add(displayColumnCounts[index1]);
boolean currentCountIsCustom = fRendering.getColumnsSetting() != 0;
for (int index = 0, j = 1; index < MAX_MENU_COLUMN_COUNT && currentCountIsCustom; index++, j *= 2)
for (int index2 = 0, j = 1; index2 < MAX_MENU_COLUMN_COUNT && currentCountIsCustom; index2++, j *= 2)
currentCountIsCustom = (j != fRendering.getColumnsSetting());
if (currentCountIsCustom)
@ -1024,7 +984,6 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
manager.add(refreshAction);
manager.add(new Separator());
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
});
}
@ -1097,12 +1056,7 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
@Override
public void goToAddress(final BigInteger address) throws DebugException {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
fRendering.gotoAddress(address);
}
});
Display.getDefault().asyncExec(() -> fRendering.gotoAddress(address));
}
protected void setTargetMemoryLittleEndian(boolean littleEndian) {
@ -1145,27 +1099,19 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
if (adapter == IMemoryBlockConnection.class) {
if (fConnection == null) {
fConnection = new IMemoryBlockConnection() {
@Override
public void update() {
fConnection = () -> {
// update UI asynchronously
Display display = FPRenderingPlugin.getDefault().getWorkbench().getDisplay();
display.asyncExec(new Runnable() {
@Override
public void run() {
display.asyncExec(() -> {
try {
if (fBigBaseAddress != FPRendering.this.fRendering.getMemoryBlock()
.getBigBaseAddress()) {
fBigBaseAddress = FPRendering.this.fRendering.getMemoryBlock()
.getBigBaseAddress();
if (fBigBaseAddress != FPRendering.this.fRendering.getMemoryBlock().getBigBaseAddress()) {
fBigBaseAddress = FPRendering.this.fRendering.getMemoryBlock().getBigBaseAddress();
FPRendering.this.fRendering.gotoAddress(fBigBaseAddress);
}
FPRendering.this.fRendering.refresh();
} catch (DebugException e) {
}
}
});
}
};
}

View file

@ -36,12 +36,7 @@ public class FPRenderingPreferenceAction extends ActionDelegate implements IView
}
protected void showPreferencePage(String id, IPreferencePage page) {
BusyIndicator.showWhile(FPRenderingPlugin.getStandardDisplay(), new Runnable() {
@Override
public void run() {
PreferencesUtil.createPreferenceDialogOn(FPRenderingPlugin.getShell(), id, new String[] { id }, null)
.open();
}
});
BusyIndicator.showWhile(FPRenderingPlugin.getStandardDisplay(), () -> PreferencesUtil
.createPreferenceDialogOn(FPRenderingPlugin.getShell(), id, new String[] { id }, null).open());
}
}

View file

@ -51,8 +51,6 @@ import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
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.SelectionListener;
@ -238,12 +236,9 @@ public class Rendering extends Composite implements IDebugEventSetListener {
getHorizontalBar().addSelectionListener(createHorizontalBarSelectionListener());
getVerticalBar().addSelectionListener(createVerticalBarSelectinListener());
this.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent pe) {
this.addPaintListener(pe -> {
pe.gc.setBackground(Rendering.this.getFPRendering().getColorBackground());
pe.gc.fillRectangle(0, 0, Rendering.this.getBounds().width, Rendering.this.getBounds().height);
}
});
setLayout();
@ -560,24 +555,16 @@ public class Rendering extends Composite implements IDebugEventSetListener {
protected void handleSuspend(boolean isBreakpointHit) {
if (getUpdateMode() == UPDATE_ALWAYS || (getUpdateMode() == UPDATE_ON_BREAKPOINT && isBreakpointHit)) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
archiveDeltas();
refresh();
}
});
}
}
protected void handleChange() {
if (getUpdateMode() == UPDATE_ALWAYS) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
refresh();
}
});
Display.getDefault().asyncExec(() -> refresh());
}
}
@ -859,9 +846,7 @@ public class Rendering extends Composite implements IDebugEventSetListener {
fCache.end = endAddress;
fCache.bytes = cachedBytesFinal;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
// Generate deltas
for (int historyIndex = 0; historyIndex < getHistoryDepth(); historyIndex++) {
@ -880,8 +865,8 @@ public class Rendering extends Composite implements IDebugEventSetListener {
for (int i = overlapLength.intValue(); i >= 0; i--) {
cachedBytesFinal[offsetIntoNew + i].setChanged(historyIndex,
cachedBytesFinal[offsetIntoNew + i]
.getValue() != fHistoryCache[historyIndex].bytes[offsetIntoOld
+ i].getValue());
.getValue() != fHistoryCache[historyIndex].bytes[offsetIntoOld + i]
.getValue());
}
// There are several scenarios where the history cache must be updated from the data cache, so that when a
@ -910,18 +895,18 @@ public class Rendering extends Composite implements IDebugEventSetListener {
|| (dataStart > historyEnd)) {
// Create a new history cache: Copy the data cache bytes to the history cache
MemoryUnit newHistoryCache = new MemoryUnit();
MemoryUnit newHistoryCache1 = new MemoryUnit();
newHistoryCache.start = fCache.start;
newHistoryCache.end = fCache.end;
int newHistoryCacheSize = fCache.bytes.length;
newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
newHistoryCache1.start = fCache.start;
newHistoryCache1.end = fCache.end;
int newHistoryCacheSize1 = fCache.bytes.length;
newHistoryCache1.bytes = new FPMemoryByte[newHistoryCacheSize1];
for (int index = 0; index < newHistoryCacheSize; index++)
newHistoryCache.bytes[index] = new FPMemoryByte(
fCache.bytes[index].getValue());
for (int index1 = 0; index1 < newHistoryCacheSize1; index1++)
newHistoryCache1.bytes[index1] = new FPMemoryByte(
fCache.bytes[index1].getValue());
fHistoryCache[0] = newHistoryCache;
fHistoryCache[0] = newHistoryCache1;
continue;
}
@ -932,32 +917,32 @@ public class Rendering extends Composite implements IDebugEventSetListener {
&& ((dataEnd >= historyStart) && (dataEnd <= historyEnd))) {
// Create a new history cache with the missing data from the main cache and append the old history to it.
int missingDataByteCount = historyStart - dataStart;
int historyCacheSize = historyLength;
int newHistoryCacheSize = missingDataByteCount + historyLength;
int missingDataByteCount1 = historyStart - dataStart;
int historyCacheSize1 = historyLength;
int newHistoryCacheSize2 = missingDataByteCount1 + historyLength;
if (missingDataByteCount <= 0 && historyCacheSize <= 0)
if (missingDataByteCount1 <= 0 && historyCacheSize1 <= 0)
break;
MemoryUnit newHistoryCache = new MemoryUnit();
MemoryUnit newHistoryCache2 = new MemoryUnit();
newHistoryCache.start = fCache.start;
newHistoryCache.end = fHistoryCache[0].end;
newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
newHistoryCache2.start = fCache.start;
newHistoryCache2.end = fHistoryCache[0].end;
newHistoryCache2.bytes = new FPMemoryByte[newHistoryCacheSize2];
// Copy the missing bytes from the beginning of the main cache to the history cache.
for (int index = 0; index < missingDataByteCount; index++)
newHistoryCache.bytes[index] = new FPMemoryByte(
fCache.bytes[index].getValue());
for (int index2 = 0; index2 < missingDataByteCount1; index2++)
newHistoryCache2.bytes[index2] = new FPMemoryByte(
fCache.bytes[index2].getValue());
// Copy the remaining bytes from the old history cache to the new history cache
for (int index = 0; index < historyCacheSize; index++)
newHistoryCache.bytes[index + missingDataByteCount] = new FPMemoryByte(
fHistoryCache[0].bytes[index].getValue());
for (int index3 = 0; index3 < historyCacheSize1; index3++)
newHistoryCache2.bytes[index3 + missingDataByteCount1] = new FPMemoryByte(
fHistoryCache[0].bytes[index3].getValue());
fHistoryCache[0] = newHistoryCache;
fHistoryCache[0] = newHistoryCache2;
continue;
}
@ -968,32 +953,32 @@ public class Rendering extends Composite implements IDebugEventSetListener {
&& (dataEnd > historyEnd)) {
// Append the missing main cache bytes to the history cache.
int missingDataByteCount = dataEnd - historyEnd;
int historyCacheSize = historyEnd - historyStart;
int newHistoryCacheSize = missingDataByteCount + historyLength;
int missingDataByteCount2 = dataEnd - historyEnd;
int historyCacheSize2 = historyEnd - historyStart;
int newHistoryCacheSize3 = missingDataByteCount2 + historyLength;
if (missingDataByteCount > 0 && historyCacheSize > 0) {
MemoryUnit newHistoryCache = new MemoryUnit();
if (missingDataByteCount2 > 0 && historyCacheSize2 > 0) {
MemoryUnit newHistoryCache3 = new MemoryUnit();
newHistoryCache.start = fHistoryCache[0].start;
newHistoryCache.end = fCache.end;
newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
newHistoryCache3.start = fHistoryCache[0].start;
newHistoryCache3.end = fCache.end;
newHistoryCache3.bytes = new FPMemoryByte[newHistoryCacheSize3];
// Copy the old history bytes to the new history cache
System.arraycopy(fHistoryCache[0].bytes, 0, newHistoryCache.bytes, 0,
System.arraycopy(fHistoryCache[0].bytes, 0, newHistoryCache3.bytes, 0,
historyLength);
// Copy the bytes from the main cache that are not in the history cache to the end of the new history cache.
for (int index = 0; index < missingDataByteCount; index++) {
int srcIndex = dataLength - missingDataByteCount + index;
int dstIndex = historyLength + index;
newHistoryCache.bytes[dstIndex] = new FPMemoryByte(
for (int index4 = 0; index4 < missingDataByteCount2; index4++) {
int srcIndex = dataLength - missingDataByteCount2 + index4;
int dstIndex = historyLength + index4;
newHistoryCache3.bytes[dstIndex] = new FPMemoryByte(
fCache.bytes[srcIndex].getValue());
}
fHistoryCache[0] = newHistoryCache;
fHistoryCache[0] = newHistoryCache3;
continue;
}
@ -1007,41 +992,41 @@ public class Rendering extends Composite implements IDebugEventSetListener {
// Create a new history cache to reflect the entire data cache
MemoryUnit newHistoryCache = new MemoryUnit();
MemoryUnit newHistoryCache4 = new MemoryUnit();
newHistoryCache.start = fCache.start;
newHistoryCache.end = fCache.end;
int newHistoryCacheSize = fCache.bytes.length;
newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
newHistoryCache4.start = fCache.start;
newHistoryCache4.end = fCache.end;
int newHistoryCacheSize4 = fCache.bytes.length;
newHistoryCache4.bytes = new FPMemoryByte[newHistoryCacheSize4];
int topByteCount = historyStart - dataStart;
int bottomByteCount = dataEnd - historyEnd;
// Copy the bytes from the beginning of the data cache to the new history cache
for (int index = 0; index < topByteCount; index++)
newHistoryCache.bytes[index] = new FPMemoryByte(
fCache.bytes[index].getValue());
for (int index5 = 0; index5 < topByteCount; index5++)
newHistoryCache4.bytes[index5] = new FPMemoryByte(
fCache.bytes[index5].getValue());
// Copy the old history cache bytes to the new history cache
start = topByteCount;
end = topByteCount + historyLength;
for (int index = start; index < end; index++)
newHistoryCache.bytes[index] = new FPMemoryByte(
fCache.bytes[index].getValue());
for (int index6 = start; index6 < end; index6++)
newHistoryCache4.bytes[index6] = new FPMemoryByte(
fCache.bytes[index6].getValue());
// Copy the bytes from the end of the data cache to the new history cache
start = topByteCount + historyLength;
end = topByteCount + historyLength + bottomByteCount;
for (int index = start; index < end; index++)
newHistoryCache.bytes[index] = new FPMemoryByte(
fCache.bytes[index].getValue());
for (int index7 = start; index7 < end; index7++)
newHistoryCache4.bytes[index7] = new FPMemoryByte(
fCache.bytes[index7].getValue());
fHistoryCache[0] = newHistoryCache;
fHistoryCache[0] = newHistoryCache4;
continue;
}
@ -1057,7 +1042,6 @@ public class Rendering extends Composite implements IDebugEventSetListener {
fHistoryCache[0] = fCache.clone();
Rendering.this.redrawPanes();
}
});
} catch (Exception e) {
@ -1728,12 +1712,9 @@ public class Rendering extends Composite implements IDebugEventSetListener {
fParent.setTargetMemoryLittleEndian(littleEndian);
fIsTargetLittleEndian = littleEndian;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
fireSettingsChanged();
layoutPanes();
}
});
}
@ -1747,12 +1728,7 @@ public class Rendering extends Composite implements IDebugEventSetListener {
fIsDisplayLittleEndian = isLittleEndian;
fireSettingsChanged();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
layoutPanes();
}
});
Display.getDefault().asyncExec(() -> layoutPanes());
}
public int getCharsPerColumn() {

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.memorybrowser;singleton:=true
Bundle-Version: 1.3.1.qualifier
Bundle-Version: 1.3.100.qualifier
Bundle-Activator: org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowserPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -59,7 +59,6 @@ import org.eclipse.debug.ui.memory.IMemoryRenderingType;
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
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;
@ -575,26 +574,18 @@ public class MemoryBrowser extends ViewPart
renderingFinal.goToAddress(newBase);
}
runOnUIThread(new Runnable() {
@Override
public void run() {
runOnUIThread(() -> {
CTabItem selection = activeFolder.getSelection();
selection.setData(KEY_EXPRESSION, expression);
selection.setData(KEY_EXPRESSION_ADDRESS, newBase);
fGotoAddressBar.handleExpressionStatus(Status.OK_STATUS);
updateLabel(selection, renderingFinal);
}
});
} catch (final DebugException e1) {
// widgets update require Display
runOnUIThread(new Runnable() {
@Override
public void run() {
fGotoAddressBar.handleExpressionStatus(
new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1)); //$NON-NLS-1$
}
});
runOnUIThread(() -> fGotoAddressBar
.handleExpressionStatus(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1)));
}
}
}.start();
@ -769,12 +760,7 @@ public class MemoryBrowser extends ViewPart
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
MemoryBrowser.this.fillContextMenu(manager);
}
});
menuMgr.addMenuListener(manager -> MemoryBrowser.this.fillContextMenu(manager));
Menu menu = menuMgr.createContextMenu(getControl());
getControl().setMenu(menu);
}
@ -1097,9 +1083,7 @@ public class MemoryBrowser extends ViewPart
*/
private void updateTab(final IMemoryBlockRetrieval retrieval, final Object context, final String[] memorySpaces) {
// GUI activity must be on the main thread
runOnUIThread(new Runnable() {
@Override
public void run() {
runOnUIThread(() -> {
if (fGotoAddressBarControl.isDisposed() || fGotoMemorySpaceControl.isDisposed()) {
return;
}
@ -1159,8 +1143,7 @@ public class MemoryBrowser extends ViewPart
// says it requires a memory space ID in all cases
boolean addNA = true;
if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) {
addNA = !((IMemorySpaceAwareMemoryBlockRetrieval) retrieval)
.creatingBlockRequiresMemorySpaceID();
addNA = !((IMemorySpaceAwareMemoryBlockRetrieval) retrieval).creatingBlockRequiresMemorySpaceID();
}
if (addNA) {
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0);
@ -1176,7 +1159,6 @@ public class MemoryBrowser extends ViewPart
fGotoMemorySpaceControl.isVisible() ? fGotoMemorySpaceControl.getText() : null);
fStackLayout.topControl.getParent().layout(true);
}
});
}
@ -1337,9 +1319,7 @@ public class MemoryBrowser extends ViewPart
private void releaseTabFolder(final IMemoryBlockRetrieval retrieval) {
final CTabFolder folder = fContextFolders.get(retrieval);
if (folder != null) {
Runnable run = new Runnable() {
@Override
public void run() {
Runnable run = () -> {
for (CTabItem tab : folder.getItems()) {
disposeTab(tab);
}
@ -1349,7 +1329,6 @@ public class MemoryBrowser extends ViewPart
if (fStackLayout.topControl.equals(folder)) {
handleUnsupportedSelection();
}
}
};
runOnUIThread(run);
}

View file

@ -40,8 +40,6 @@ import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
@ -729,9 +727,7 @@ public class FindReplaceDialog extends SelectionDialog {
fFormatDecimalButton.addSelectionListener(nonAsciiListener);
fFormatByteSequenceButton.addSelectionListener(nonAsciiListener);
fStartText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
fStartText.addModifyListener(e -> {
boolean valid = true;
try {
getStartAddress();
@ -743,13 +739,9 @@ public class FindReplaceDialog extends SelectionDialog {
: Display.getDefault().getSystemColor(SWT.COLOR_RED));
validate();
}
});
fEndText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
fEndText.addModifyListener(e -> {
try {
getEndAddress();
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
@ -758,23 +750,11 @@ public class FindReplaceDialog extends SelectionDialog {
}
validate();
}
});
fFindText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
validate();
}
});
fFindText.addModifyListener(e -> validate());
fReplaceText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
validate();
}
});
fReplaceText.addModifyListener(e -> validate());
composite.setTabList(
new Control[] { fFindText, fReplaceText, directionGroup, rangeGroup, formatGroup, optionsGroup, });
@ -1137,10 +1117,7 @@ public class FindReplaceDialog extends SelectionDialog {
final BigInteger finalCurrentPosition = currentPosition;
final BigInteger finalStart = start;
final BigInteger finalEnd = end;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
IMemoryRenderingContainer containers[] = getMemoryView()
.getMemoryRenderingContainers();
for (int i = 0; i < containers.length; i++) {
@ -1149,11 +1126,11 @@ public class FindReplaceDialog extends SelectionDialog {
try {
((IRepositionableMemoryRendering) rendering)
.goToAddress(finalCurrentPosition);
} catch (DebugException e) {
} catch (DebugException e1) {
MemorySearchPlugin.logError(
Messages.getString(
"FindReplaceDialog.RepositioningMemoryViewFailed"), //$NON-NLS-1$
e);
e1);
}
}
if (rendering != null) {
@ -1164,13 +1141,11 @@ public class FindReplaceDialog extends SelectionDialog {
if (m != null)
m.invoke(rendering, finalCurrentPosition,
finalCurrentPosition.add(searchPhraseLength));
} catch (Exception e) {
} catch (Exception e2) {
// do nothing
}
}
}
}
});
fProperties.setProperty(SEARCH_ENABLE_FIND_NEXT, Boolean.TRUE.toString());
@ -1222,12 +1197,9 @@ public class FindReplaceDialog extends SelectionDialog {
};
if (all && replaceData == null) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Display.getDefault().asyncExec(() -> {
NewSearchUI.activateSearchResultView();
NewSearchUI.runQueryInBackground(query);
}
});
} else {
Job job = new Job("Searching memory for " + searchPhrase) { //$NON-NLS-1$

Some files were not shown because too many files have changed in this diff Show more