1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +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 @Override
public void tearDown() throws Exception { public void tearDown() throws Exception {
Display.getDefault().syncExec(new Runnable() { Display.getDefault().syncExec(() -> {
@Override
public void run() {
IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages(); IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages();
for (IWorkbenchPage page : pages) { for (IWorkbenchPage page : pages) {
page.closeAllEditors(false); page.closeAllEditors(false);
dispatch(0); dispatch(0);
} }
}
}); });
super.tearDown(); super.tearDown();
@ -141,9 +138,7 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
} }
public void doRunQuickFix() { public void doRunQuickFix() {
Display.getDefault().syncExec(new Runnable() { Display.getDefault().syncExec(() -> {
@Override
public void run() {
for (int i = 0; i < markers.length; i++) { for (int i = 0; i < markers.length; i++) {
IMarker marker = markers[i]; IMarker marker = markers[i];
isApplicableMap.put(marker, quickFix.isApplicable(marker)); isApplicableMap.put(marker, quickFix.isApplicable(marker));
@ -153,7 +148,6 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
} }
} }
PlatformUI.getWorkbench().saveAllEditors(false); 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.Status;
import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
@ -256,12 +253,7 @@ public class ControlFlowGraphView extends ViewPart {
private void hookContextMenu() { private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true); menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() { menuMgr.addMenuListener(manager -> ControlFlowGraphView.this.fillContextMenu(manager));
@Override
public void menuAboutToShow(IMenuManager manager) {
ControlFlowGraphView.this.fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl()); Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu); viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer); getSite().registerContextMenu(menuMgr, viewer);
@ -334,13 +326,7 @@ public class ControlFlowGraphView extends ViewPart {
} }
}; };
ast.accept(visitor); ast.accept(visitor);
viewer.getControl().getDisplay().asyncExec(new Runnable() { viewer.getControl().getDisplay().asyncExec(() -> viewer.setInput(functions));
@Override
public void run() {
// TODO Auto-generated method stub
viewer.setInput(functions);
}
});
} }
/** /**
@ -406,11 +392,6 @@ public class ControlFlowGraphView extends ViewPart {
} }
private void hookSingleClickAction() { private void hookSingleClickAction() {
viewer.addSelectionChangedListener(new ISelectionChangedListener() { viewer.addSelectionChangedListener(event -> new ASTHighlighterAction(null).run());
@Override
public void selectionChanged(SelectionChangedEvent event) {
new ASTHighlighterAction(null).run();
}
});
} }
} }

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.ui.cxx;singleton:=true 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-Activator: org.eclipse.cdt.codan.internal.ui.cxx.Activator
Bundle-Vendor: %Bundle-Vendor Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -237,10 +237,7 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
addr2line = getAddr2line(); addr2line = getAddr2line();
if (addr2line != null) { if (addr2line != null) {
starttime = System.currentTimeMillis(); starttime = System.currentTimeMillis();
Runnable worker = new Runnable() { Runnable worker = () -> {
@Override
public void run() {
long diff = System.currentTimeMillis() - starttime; long diff = System.currentTimeMillis() - starttime;
while (diff < 10000) { while (diff < 10000) {
try { try {
@ -251,7 +248,6 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
diff = System.currentTimeMillis() - starttime; diff = System.currentTimeMillis() - starttime;
} }
stopAddr2Line(); stopAddr2Line();
}
}; };
new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$ 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 IWorkbench workbench = PlatformUI.getWorkbench();
final Display display = workbench.getDisplay(); final Display display = workbench.getDisplay();
fInstanceLoc.release(); fInstanceLoc.release();
display.syncExec(new Runnable() { display.syncExec(() -> {
@Override
public void run() {
if (!display.isDisposed()) if (!display.isDisposed())
workbench.close(); workbench.close();
}
}); });
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -96,16 +96,12 @@ public abstract class AbstractViewActionDelegate extends ActionDelegate
public void run(IAction action) { public void run(IAction action) {
final MultiStatus ms = new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "", //$NON-NLS-1$ final MultiStatus ms = new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "", //$NON-NLS-1$
null); null);
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { BusyIndicator.showWhile(Display.getCurrent(), () -> {
@Override
public void run() {
try { try {
doAction(); doAction();
} catch (DebugException e) { } catch (DebugException e) {
ms.merge(e.getStatus()); ms.merge(e.getStatus());
} }
}
}); });
if (!ms.isOK()) { if (!ms.isOK()) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
@ -162,16 +158,12 @@ public abstract class AbstractViewActionDelegate extends ActionDelegate
if (shell == null || shell.isDisposed()) { if (shell == null || shell.isDisposed()) {
return; return;
} }
Runnable r = new Runnable() { Runnable r = () -> {
@Override
public void run() {
for (int i = 0; i < events.length; i++) { for (int i = 0; i < events.length; i++) {
if (events[i].getSource() != null) { if (events[i].getSource() != null) {
doHandleDebugEvent(events[i]); doHandleDebugEvent(events[i]);
} }
} }
}
}; };
shell.getDisplay().asyncExec(r); 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.jface.window.Window;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator; 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.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
@ -153,23 +151,11 @@ public class CastToArrayActionHandler extends AbstractHandler {
ActionMessages.getString("CastToArrayActionDelegate.1")); //$NON-NLS-1$ ActionMessages.getString("CastToArrayActionDelegate.1")); //$NON-NLS-1$
((GridData) label.getLayoutData()).horizontalSpan = 3; ((GridData) label.getLayoutData()).horizontalSpan = 3;
fFirstIndexText = ControlFactory.createTextField(composite); fFirstIndexText = ControlFactory.createTextField(composite);
fFirstIndexText.addModifyListener(new ModifyListener() { fFirstIndexText.addModifyListener(e -> validateInput());
@Override
public void modifyText(ModifyEvent e) {
validateInput();
}
});
label = ControlFactory.createLabel(composite, ActionMessages.getString("CastToArrayActionDelegate.2")); //$NON-NLS-1$ label = ControlFactory.createLabel(composite, ActionMessages.getString("CastToArrayActionDelegate.2")); //$NON-NLS-1$
((GridData) label.getLayoutData()).horizontalSpan = 3; ((GridData) label.getLayoutData()).horizontalSpan = 3;
fLengthText = ControlFactory.createTextField(composite); fLengthText = ControlFactory.createTextField(composite);
fLengthText.addModifyListener(new ModifyListener() { fLengthText.addModifyListener(e -> validateInput());
@Override
public void modifyText(ModifyEvent e) {
validateInput();
}
});
} }
protected void validateInput() { protected void validateInput() {
@ -250,17 +236,13 @@ public class CastToArrayActionHandler extends AbstractHandler {
if (getCastToArray() == null || getCastToArray().length == 0) if (getCastToArray() == null || getCastToArray().length == 0)
return null; return null;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { BusyIndicator.showWhile(Display.getCurrent(), () -> {
@Override
public void run() {
try { try {
doAction(getCastToArray()); doAction(getCastToArray());
setStatus(null); setStatus(null);
} catch (DebugException e) { } catch (DebugException e) {
setStatus(e.getStatus()); setStatus(e.getStatus());
} }
}
}); });
if (getStatus() != null && !getStatus().isOK()) { if (getStatus() != null && !getStatus().isOK()) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -65,12 +65,7 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
* @param status * @param status
*/ */
protected void handleError(final IStatus status) { protected void handleError(final IStatus status) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, status)); //$NON-NLS-1$
@Override
public void run() {
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 * @param event debug event
*/ */
public void delegateEvent(final DebugContextEvent event) { public void delegateEvent(final DebugContextEvent event) {
Display.getDefault().syncExec(new Runnable() { Display.getDefault().syncExec(() -> {
@Override
public void run() {
fActiveContext = event.getContext(); fActiveContext = event.getContext();
fire(event); fire(event);
}
}); });
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui;singleton:=true 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-Activator: org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui, 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.SuspendCommandAction;
import org.eclipse.debug.internal.ui.commands.actions.TerminateCommandAction; 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.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.viewers.model.provisional.TreeModelViewer;
import org.eclipse.debug.internal.ui.views.launch.LaunchView; import org.eclipse.debug.internal.ui.views.launch.LaunchView;
import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.DebugUITools;
@ -833,32 +831,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
if (m_debugViewer == null) { if (m_debugViewer == null) {
m_debugViewer = DebugViewUtils.getDebugViewer(); m_debugViewer = DebugViewUtils.getDebugViewer();
if (m_debugViewer != null) { if (m_debugViewer != null) {
m_modelChangedListener = new IModelChangedListener() {
@Override
public void modelChanged(IModelDelta delta, IModelProxy proxy) {
// Execute a refresh after any pending UI updates. // Execute a refresh after any pending UI updates.
GUIUtils.exec(new Runnable() { m_modelChangedListener = (delta, proxy) -> GUIUtils.exec(() -> updateDebugContext());
@Override m_debugViewSelectionChangedListener = event -> GUIUtils
public void run() { .exec(() -> updateCanvasSelectionFromDebugView());
// 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_debugViewer.addModelChangedListener(m_modelChangedListener); m_debugViewer.addModelChangedListener(m_modelChangedListener);
m_debugViewer.addSelectionChangedListener(m_debugViewSelectionChangedListener); m_debugViewer.addSelectionChangedListener(m_debugViewSelectionChangedListener);
} }
@ -1128,27 +1104,18 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
/** Sets canvas model. (Also updates canvas selection.) */ /** Sets canvas model. (Also updates canvas selection.) */
protected void setCanvasModel(VisualizerModel model) { protected void setCanvasModel(VisualizerModel model) {
final VisualizerModel model_f = model; final VisualizerModel model_f = model;
GUIUtils.exec(new Runnable() { GUIUtils.exec(() -> {
@Override
public void run() {
if (m_canvas != null) { if (m_canvas != null) {
m_canvas.setModel(model_f); m_canvas.setModel(model_f);
// Update the canvas's selection from the current workbench selection. // Update the canvas's selection from the current workbench selection.
updateCanvasSelectionInternal(); updateCanvasSelectionInternal();
} }
}
}); });
} }
/** Updates canvas selection from current workbench selection. */ /** Updates canvas selection from current workbench selection. */
protected void updateCanvasSelection() { protected void updateCanvasSelection() {
GUIUtils.exec(new Runnable() { GUIUtils.exec(() -> updateCanvasSelectionInternal());
@Override
public void run() {
// Update the canvas's selection from the current workbench selection.
updateCanvasSelectionInternal();
}
});
} }
/** Updates canvas selection from current workbench selection. /** Updates canvas selection from current workbench selection.
@ -1481,12 +1448,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
if (session != null) { if (session != null) {
DsfExecutor executor = session.getExecutor(); DsfExecutor executor = session.getExecutor();
if (executor != null) { if (executor != null) {
executor.execute(new Runnable() { executor.execute(() -> updateLoads(fDataModel));
@Override
public void run() {
updateLoads(fDataModel);
}
});
} }
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -71,12 +71,7 @@ public class GdbSaveTraceDataCommand extends AbstractDebugCommand implements ISa
} }
final String[] fileName = new String[1]; final String[] fileName = new String[1];
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { PlatformUI.getWorkbench().getDisplay().syncExec(() -> fileName[0] = promptForFileName());
@Override
public void run() {
fileName[0] = promptForFileName();
}
});
if (fileName[0] != null) { if (fileName[0] != null) {
Query<Object> saveTraceDataQuery = new Query<Object>() { 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 // Must use syncExec because the logic within must complete before the rest
// of the class methods (specifically getProcess()) is called // of the class methods (specifically getProcess()) is called
fMainComposite.getDisplay().syncExec(new Runnable() { fMainComposite.getDisplay().syncExec(() -> {
@Override
public void run() {
if (fTerminalControl != null && !fTerminalControl.isDisposed()) { if (fTerminalControl != null && !fTerminalControl.isDisposed()) {
fTerminalControl.clearTerminal(); fTerminalControl.clearTerminal();
fTerminalControl.connectTerminal(); fTerminalControl.connectTerminal();
@ -186,7 +184,6 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
// lets override them with our application defaults right after. // lets override them with our application defaults right after.
setDefaults(); setDefaults();
} }
}
}); });
} }

View file

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

View file

@ -53,12 +53,7 @@ public class ConsoleSaveAction extends Action {
return; return;
} }
Runnable saveJob = new Runnable() { Runnable saveJob = () -> saveContent(fileName);
@Override
public void run() {
saveContent(fileName);
}
};
BusyIndicator.showWhile(Display.getCurrent(), saveJob); 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, // async/job runnables, like perspective switch runnable using during debug launch,
// causing launch to be stuck at random point. // causing launch to be stuck at random point.
// //
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(() -> {
@Override
public void run() {
if (!c.isDisposed()) if (!c.isDisposed())
fUIListener.update(); fUIListener.update();
}
}); });
} }

View file

@ -64,11 +64,8 @@ public class GdbDebugContextSyncManager implements IDebugContextListener {
DsfSession session = DsfSession.getSession(eventSessionId); DsfSession session = DsfSession.getSession(eventSessionId);
// order GDB to switch thread // order GDB to switch thread
session.getExecutor().execute(new Runnable() { session.getExecutor().execute(() -> {
@Override DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), eventSessionId);
public void run() {
DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(),
eventSessionId);
IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class); IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class);
tracker.dispose(); 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 volatile ITraceTargetDMContext fTargetContext;
private TraceControlView fTraceControlView; private TraceControlView fTraceControlView;
private IDebugContextListener fDebugContextListener = new IDebugContextListener() { private IDebugContextListener fDebugContextListener = event -> {
@Override
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) { if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
updateDebugContext(); updateDebugContext();
} }
}
}; };
TraceControlModel(TraceControlView view) { TraceControlModel(TraceControlView view) {
@ -461,14 +458,11 @@ public class TraceControlModel {
private void notifyUI(final ITraceStatusDMData2 data) { private void notifyUI(final ITraceStatusDMData2 data) {
final TraceControlView v = fTraceControlView; final TraceControlView v = fTraceControlView;
if (v != null) { if (v != null) {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(() -> {
@Override
public void run() {
if (v != null) { if (v != null) {
v.fLastRefreshTime = System.currentTimeMillis(); v.fLastRefreshTime = System.currentTimeMillis();
v.updateUI(data); v.updateUI(data);
} }
}
}); });
} }
} }
@ -476,13 +470,10 @@ public class TraceControlModel {
private void notifyUI(final String message) { private void notifyUI(final String message) {
final TraceControlView v = fTraceControlView; final TraceControlView v = fTraceControlView;
if (v != null) { if (v != null) {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(() -> {
@Override
public void run() {
if (v != null) { if (v != null) {
v.updateUI(message); v.updateUI(message);
} }
}
}); });
} }
} }

View file

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

View file

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

View file

@ -613,9 +613,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
}; };
startGdbJob.schedule(); startGdbJob.schedule();
fGDBLaunchMonitor.fTimeoutFuture = getExecutor().schedule(new Runnable() { fGDBLaunchMonitor.fTimeoutFuture = getExecutor().schedule(() -> {
@Override
public void run() {
// Only process the event if we have not finished yet (hit // Only process the event if we have not finished yet (hit
// the breakpoint). // the breakpoint).
if (!fGDBLaunchMonitor.fLaunched) { 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$ DebugException.TARGET_REQUEST_FAILED, "Timed out trying to launch GDB.", null)); //$NON-NLS-1$
requestMonitor.done(); requestMonitor.done();
} }
}
}, fGDBLaunchTimeout, TimeUnit.SECONDS); }, 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, public <V extends ICommandResult> ICommandToken queueCommand(final ICommand<V> command,
DataRequestMonitor<V> rm) { DataRequestMonitor<V> rm) {
final ICommandToken token = new ICommandToken() { final ICommandToken token = () -> command;
@Override
public ICommand<? extends ICommandResult> getCommand() {
return command;
}
};
// The class does not buffer commands itself, but sends them directly to the real // 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 // 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 // delete temp file
new File(localFile).delete(); new File(localFile).delete();
getExecutor().schedule(new Runnable() { getExecutor().schedule(() -> fCommandControl.queueCommand(
@Override
public void run() {
fCommandControl.queueCommand(
fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile), fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile),
new ImmediateDataRequestMonitor<MIInfo>(rm) { new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override @Override
protected void handleCompleted() { protected void handleCompleted() {
if (!isSuccess()) { if (!isSuccess()) {
fLoadRequestOngoing = false; fLoadRequestOngoing = false;
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$ "Can't get load info for CPU", null)); //$NON-NLS-1$
return; return;
} }
@ -742,8 +734,8 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
try { try {
procStatParser.parseStatFile(localFile); procStatParser.parseStatFile(localFile);
} catch (Exception e) { } catch (Exception e) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$ "Can't get load info for CPU", null)); //$NON-NLS-1$
fLoadRequestOngoing = false; fLoadRequestOngoing = false;
return; return;
} }
@ -763,9 +755,7 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
} }
fLoadInfoRequestCache.clear(); fLoadInfoRequestCache.clear();
} }
}); }), LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
}
}, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
} }
}); });
// Local debugging? Then we can read /proc/stat directly // 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 // Read /proc/stat file again after a delay
getExecutor().schedule(new Runnable() { getExecutor().schedule(() -> {
@Override
public void run() {
try { try {
procStatParser.parseStatFile(statFile); procStatParser.parseStatFile(statFile);
} catch (Exception e) { } catch (Exception e1) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
"Can't get load info for CPU", null)); //$NON-NLS-1$ "Can't get load info for CPU", null)); //$NON-NLS-1$
fLoadRequestOngoing = false; fLoadRequestOngoing = false;
@ -799,11 +787,10 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
// done with request // done with request
fLoadRequestOngoing = false; fLoadRequestOngoing = false;
// process any queued request // process any queued request
for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e : fLoadInfoRequestCache.entrySet()) { for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e2 : fLoadInfoRequestCache.entrySet()) {
processLoads(e.getKey(), e.getValue(), fCachedLoads); processLoads(e2.getKey(), e2.getValue(), fCachedLoads);
} }
fLoadInfoRequestCache.clear(); fLoadInfoRequestCache.clear();
}
}, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS); }, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
} }
} }

View file

@ -553,9 +553,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
// Add the inferior to the launch. // Add the inferior to the launch.
// This cannot be done on the executor or things deadlock. // This cannot be done on the executor or things deadlock.
DebugPlugin.getDefault().asyncExec(new Runnable() { DebugPlugin.getDefault().asyncExec(() -> {
@Override
public void run() {
if (restart) { if (restart) {
// For a restart, remove the old inferior // For a restart, remove the old inferior
IProcess[] launchProcesses = launch.getProcesses(); IProcess[] launchProcesses = launch.getProcesses();
@ -578,11 +576,9 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE); IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE);
IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label, attributes); IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label, attributes);
// Now set the inferior groupId // Now set the inferior groupId
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, MIProcesses.UNIQUE_GROUP_ID);
MIProcesses.UNIQUE_GROUP_ID);
rm.done(); 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) { private void addProcessToLaunch(Process inferior, String groupId, String label) {
// Add the inferior to the launch. // Add the inferior to the launch.
// This cannot be done on the executor or things deadlock. // This cannot be done on the executor or things deadlock.
DebugPlugin.getDefault().asyncExec(new Runnable() { DebugPlugin.getDefault().asyncExec(() -> {
@Override
public void run() {
// Add the inferior // Add the inferior
// Need to go through DebugPlugin.newProcess so that we can use // Need to go through DebugPlugin.newProcess so that we can use
// the overrideable process factory to allow others to override. // the overrideable process factory to allow others to override.
@ -1865,7 +1863,6 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IGDBProcesse
attributes); attributes);
// Now set the inferior groupId // Now set the inferior groupId
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, 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 // the number of frames collected. Having a small interval of
// stale data is currently not a big deal, and not user-visible. // stale data is currently not a big deal, and not user-visible.
// Bug 353034 // Bug 353034
getExecutor().schedule(new Runnable() { getExecutor().schedule(() -> fTraceStatusCache.reset(context), 300, TimeUnit.MILLISECONDS);
@Override
public void run() {
fTraceStatusCache.reset(context);
}
}, 300, TimeUnit.MILLISECONDS);
fTraceStatusCache.execute(fCommandFactory.createMITraceStatus(context), fTraceStatusCache.execute(fCommandFactory.createMITraceStatus(context),
new DataRequestMonitor<MITraceStatusInfo>(getExecutor(), rm) { new DataRequestMonitor<MITraceStatusInfo>(getExecutor(), rm) {

View file

@ -453,10 +453,8 @@ public class MIBreakpointsManager extends AbstractDsfService
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
// Submit the runnable to plant the breakpoints on dispatch thread. // Submit the runnable to plant the breakpoints on dispatch thread.
getExecutor().submit(new Runnable() { getExecutor().submit(
@Override () -> installInitialBreakpoints(dmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
public void run() {
installInitialBreakpoints(dmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
// Notify breakpoints tracking listeners that the tracking is started. // Notify breakpoints tracking listeners that the tracking is started.
@ -465,9 +463,7 @@ public class MIBreakpointsManager extends AbstractDsfService
} }
rm.done(); rm.done();
} }
}); }));
}
});
return Status.OK_STATUS; return Status.OK_STATUS;
} }
@ -1765,9 +1761,7 @@ public class MIBreakpointsManager extends AbstractDsfService
* @param bps * @param bps
*/ */
private void clearBreakpointStatus(final ICBreakpoint[] bps, final IBreakpointsTargetDMContext ctx) { private void clearBreakpointStatus(final ICBreakpoint[] bps, final IBreakpointsTargetDMContext ctx) {
IWorkspaceRunnable wr = new IWorkspaceRunnable() { IWorkspaceRunnable wr = monitor -> {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
// For every platform breakpoint that has at least one target breakpoint installed // For every platform breakpoint that has at least one target breakpoint installed
// we must decrement the install count, for every target breakpoint. // we must decrement the install count, for every target breakpoint.
// Note that we cannot simply call resetInstallCount() because another // 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)); decrementInstallCount(targetBp, breakpoint, new RequestMonitor(getExecutor(), null));
} }
} }
}
}; };
// Create the scheduling rule to clear all bp planted. // 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() { public static void startup() {
Runnable r = new Runnable() { Runnable r = () -> {
@Override
public void run() {
if (fgManager == null) { if (fgManager == null) {
// FindBugs reported that it is unsafe to set s_resources // FindBugs reported that it is unsafe to set s_resources
// before we finish to initialize the object, because of // before we finish to initialize the object, because of
@ -70,7 +67,6 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
fgManager = manager; fgManager = manager;
} }
}
}; };
Display display = Display.getCurrent(); Display display = Display.getCurrent();
if (display == null) if (display == null)

View file

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

View file

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

View file

@ -353,12 +353,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (canDisassemble()) { if (canDisassemble()) {
final BigInteger address = getLastKnownAddress(); final BigInteger address = getLastKnownAddress();
if (address != null && !UNKNOWN_ADDRESS.equals(address)) { if (address != null && !UNKNOWN_ADDRESS.equals(address)) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> fCallback.updatePC(address));
@Override
public void run() {
fCallback.updatePC(address);
}
});
} }
} }
} }
@ -387,9 +382,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (DEBUG) if (DEBUG)
System.out System.out
.println("retrieveFrameAddress done " + DisassemblyUtils.getAddressText(addressValue)); //$NON-NLS-1$ .println("retrieveFrameAddress done " + DisassemblyUtils.getAddressText(addressValue)); //$NON-NLS-1$
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> {
@Override
public void run() {
if (address.getSize() * 8 != fCallback.getAddressSize()) { if (address.getSize() * 8 != fCallback.getAddressSize()) {
fCallback.addressSizeChanged(address.getSize() * 8); fCallback.addressSizeChanged(address.getSize() * 8);
} }
@ -398,7 +391,6 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} else { } else {
fCallback.gotoFrame(frame, addressValue); fCallback.gotoFrame(frame, addressValue);
} }
}
}); });
} else { } else {
final IStatus status = getStatus(); final IStatus status = getStatus();
@ -474,12 +466,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} }
final IExecutionDMContext context = event.getDMContext(); final IExecutionDMContext context = event.getDMContext();
if (context.equals(fTargetContext) || DMContexts.isAncestorOf(fTargetContext, context)) { if (context.equals(fTargetContext) || DMContexts.isAncestorOf(fTargetContext, context)) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> fCallback.handleTargetEnded());
@Override
public void run() {
fCallback.handleTargetEnded();
}
});
} }
} }
@ -571,10 +558,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
final IDisassemblyDMContext context = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class); final IDisassemblyDMContext context = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
// align the start address first (bug 328168) // align the start address first (bug 328168)
executor.execute(new Runnable() { executor.execute(() -> alignOpCodeAddress(startAddress, new DataRequestMonitor<BigInteger>(executor, null) {
@Override
public void run() {
alignOpCodeAddress(startAddress, new DataRequestMonitor<BigInteger>(executor, null) {
@Override @Override
public void handleCompleted() { public void handleCompleted() {
@ -586,41 +570,23 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
public void handleCompleted() { public void handleCompleted() {
final IMixedInstruction[] data = getData(); final IMixedInstruction[] data = getData();
if (!isCanceled() && data != null) { if (!isCanceled() && data != null) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> {
@Override if (!insertDisassembly(finalStartAddress, finalEndAddress, data, showSymbols,
public void run() { showDisassembly)) {
if (!insertDisassembly(finalStartAddress, finalEndAddress, data,
showSymbols, showDisassembly)) {
// retry in non-mixed mode // retry in non-mixed mode
fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress, fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress, linesHint,
linesHint, false, true); false, true);
}
} }
}); });
} else { } else {
final IStatus status = getStatus(); final IStatus status = getStatus();
if (status != null && !status.isOK()) { if (status != null && !status.isOK()) {
if (file != null) { if (file != null) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> fCallback.retrieveDisassembly(finalStartAddress,
@Override finalEndAddress, linesHint, true, true));
public void run() {
fCallback.retrieveDisassembly(finalStartAddress,
finalEndAddress, linesHint, true, true);
}
});
} else { } else {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> fCallback.doScrollLocked(
@Override () -> fCallback.insertError(finalStartAddress, status.getMessage())));
public void run() {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
status.getMessage());
}
});
}
});
} }
} }
fCallback.setUpdatePending(false); fCallback.setUpdatePending(false);
@ -628,26 +594,18 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} }
}; };
if (file != null) { if (file != null) {
executor.execute(new Runnable() { executor.execute(() -> {
@Override final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
public void run() {
final IDisassembly disassembly = fServicesTracker
.getService(IDisassembly.class);
if (disassembly == null) { if (disassembly == null) {
disassemblyRequest.cancel(); disassemblyRequest.cancel();
disassemblyRequest.done(); disassemblyRequest.done();
return; return;
} }
disassembly.getMixedInstructions(context, file, lineNumber, lines * 2, disassembly.getMixedInstructions(context, file, lineNumber, lines * 2, disassemblyRequest);
disassemblyRequest);
}
}); });
} else { } else {
executor.execute(new Runnable() { executor.execute(() -> {
@Override final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
public void run() {
final IDisassembly disassembly = fServicesTracker
.getService(IDisassembly.class);
if (disassembly == null) { if (disassembly == null) {
disassemblyRequest.cancel(); disassemblyRequest.cancel();
disassemblyRequest.done(); disassemblyRequest.done();
@ -655,7 +613,6 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} }
disassembly.getMixedInstructions(context, finalStartAddress, finalEndAddress, disassembly.getMixedInstructions(context, finalStartAddress, finalEndAddress,
disassemblyRequest); disassemblyRequest);
}
}); });
} }
} else { } else {
@ -664,59 +621,35 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
@Override @Override
public void handleCompleted() { public void handleCompleted() {
if (!isCanceled() && getData() != null) { if (!isCanceled() && getData() != null) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> {
@Override if (!insertDisassembly(finalStartAddress, finalEndAddress, getData(), showSymbols,
public void run() { showDisassembly)) {
if (!insertDisassembly(finalStartAddress, finalEndAddress, getData(), fCallback.doScrollLocked(() -> fCallback.insertError(finalStartAddress,
showSymbols, showDisassembly)) { DisassemblyMessages.DisassemblyBackendDsf_error_UnableToRetrieveData));
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
DisassemblyMessages.DisassemblyBackendDsf_error_UnableToRetrieveData);
}
});
}
} }
}); });
} else { } else {
final IStatus status = getStatus(); final IStatus status = getStatus();
if (status != null && !status.isOK()) { if (status != null && !status.isOK()) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> fCallback.doScrollLocked(
@Override () -> fCallback.insertError(finalStartAddress, status.getMessage())));
public void run() {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
status.getMessage());
}
});
}
});
} }
fCallback.setUpdatePending(false); fCallback.setUpdatePending(false);
} }
} }
}; };
executor.execute(new Runnable() { executor.execute(() -> {
@Override
public void run() {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class); final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) { if (disassembly == null) {
disassemblyRequest.cancel(); disassemblyRequest.cancel();
disassemblyRequest.done(); disassemblyRequest.done();
return; return;
} }
disassembly.getInstructions(context, finalStartAddress, finalEndAddress, disassembly.getInstructions(context, finalStartAddress, finalEndAddress, disassemblyRequest);
disassemblyRequest);
}
}); });
} }
} }
}); }));
}
});
} }
private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IInstruction[] instructions, private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IInstruction[] instructions,
@ -1039,12 +972,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
protected void handleSuccess() { protected void handleSuccess() {
final BigInteger address = getData(); final BigInteger address = getData();
if (address != null) { if (address != null) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> fCallback.gotoAddress(address));
@Override
public void run() {
fCallback.gotoAddress(address);
}
});
} }
} }
}); });
@ -1090,12 +1018,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
final IAddress address = data.getAddress(); final IAddress address = data.getAddress();
if (address != null && address != IExpressionDMLocation.INVALID_ADDRESS) { if (address != null && address != IExpressionDMLocation.INVALID_ADDRESS) {
final BigInteger addressValue = address.getValue(); final BigInteger addressValue = address.getValue();
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> fCallback.gotoAddress(addressValue));
@Override
public void run() {
fCallback.gotoAddress(addressValue);
}
});
rm.setData(addressValue); rm.setData(addressValue);
rm.done(); rm.done();
} else { } else {
@ -1191,14 +1114,11 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
public void handleCompleted() { public void handleCompleted() {
final IMixedInstruction[] data = getData(); final IMixedInstruction[] data = getData();
if (!isCanceled() && data != null) { if (!isCanceled() && data != null) {
fCallback.asyncExec(new Runnable() { fCallback.asyncExec(() -> {
@Override
public void run() {
if (!insertDisassembly(null, endAddress, data, showSymbols, showDisassembly)) { if (!insertDisassembly(null, endAddress, data, showSymbols, showDisassembly)) {
// retry in non-mixed mode // retry in non-mixed mode
retrieveDisassembly(file, lines, endAddress, false, showSymbols, showDisassembly); retrieveDisassembly(file, lines, endAddress, false, showSymbols, showDisassembly);
} }
}
}); });
} else { } else {
final IStatus status = getStatus(); final IStatus status = getStatus();
@ -1211,9 +1131,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
}; };
assert !fCallback.getUpdatePending(); assert !fCallback.getUpdatePending();
fCallback.setUpdatePending(true); fCallback.setUpdatePending(true);
executor.execute(new Runnable() { executor.execute(() -> {
@Override
public void run() {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class); final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) { if (disassembly == null) {
disassemblyRequest.cancel(); disassemblyRequest.cancel();
@ -1221,7 +1139,6 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
return; return;
} }
disassembly.getMixedInstructions(context, finalFile, 1, lines, disassemblyRequest); 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.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.util.SafeRunnable; 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.SWT;
import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSource; import org.eclipse.swt.dnd.DragSource;
import org.eclipse.swt.dnd.DropTarget; 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.dnd.Transfer;
import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.FontData;
@ -580,12 +576,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
} else if (Control.class.equals(required)) { } else if (Control.class.equals(required)) {
return fViewer != null ? (T) fViewer.getTextWidget() : null; return fViewer != null ? (T) fViewer.getTextWidget() : null;
} else if (IGotoMarker.class.equals(required)) { } else if (IGotoMarker.class.equals(required)) {
return (T) new IGotoMarker() { return (T) (IGotoMarker) marker -> DisassemblyPart.this.gotoMarker(marker);
@Override
public void gotoMarker(IMarker marker) {
DisassemblyPart.this.gotoMarker(marker);
}
};
} else if (IColumnSupport.class.equals(required)) { } else if (IColumnSupport.class.equals(required)) {
if (fColumnSupport == null) if (fColumnSupport == null)
fColumnSupport = createColumnSupport(); fColumnSupport = createColumnSupport();
@ -780,9 +771,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
hookContextMenu(); hookContextMenu();
contributeToActionBars(); contributeToActionBars();
fViewer.getTextWidget().addVerifyKeyListener(new VerifyKeyListener() { fViewer.getTextWidget().addVerifyKeyListener(event -> {
@Override
public void verifyKey(VerifyEvent event) {
switch (event.keyCode) { switch (event.keyCode) {
case SWT.PAGE_UP: case SWT.PAGE_UP:
case SWT.PAGE_DOWN: case SWT.PAGE_DOWN:
@ -790,15 +779,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
case SWT.ARROW_DOWN: case SWT.ARROW_DOWN:
event.doit = !keyScroll(event.keyCode); event.doit = !keyScroll(event.keyCode);
} }
}
}); });
fViewer.addSelectionChangedListener(new ISelectionChangedListener() { fViewer.addSelectionChangedListener(event -> updateSelectionDependentActions());
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateSelectionDependentActions();
}
});
fErrorColor = EditorsUI.getSharedTextColors().getColor( fErrorColor = EditorsUI.getSharedTextColors().getColor(
PreferenceConverter.getColor(getPreferenceStore(), DisassemblyPreferenceConstants.ERROR_COLOR)); PreferenceConverter.getColor(getPreferenceStore(), DisassemblyPreferenceConstants.ERROR_COLOR));
@ -834,13 +817,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
protected void setSite(IWorkbenchPartSite site) { protected void setSite(IWorkbenchPartSite site) {
super.setSite(site); super.setSite(site);
site.getPage().addPartListener(fPartListener); site.getPage().addPartListener(fPartListener);
fDebugContextListener = new IDebugContextListener() { fDebugContextListener = event -> {
@Override
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) { if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
updateDebugContext(); updateDebugContext();
} }
}
}; };
DebugUITools.addPartDebugContextListener(site, fDebugContextListener); DebugUITools.addPartDebugContextListener(site, fDebugContextListener);
} }
@ -1198,12 +1178,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
String id = "#DisassemblyPartContext"; //$NON-NLS-1$ String id = "#DisassemblyPartContext"; //$NON-NLS-1$
MenuManager menuMgr = new MenuManager(id, id); MenuManager menuMgr = new MenuManager(id, id);
menuMgr.setRemoveAllWhenShown(true); menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() { menuMgr.addMenuListener(manager -> DisassemblyPart.this.fillContextMenu(manager));
@Override
public void menuAboutToShow(IMenuManager manager) {
DisassemblyPart.this.fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(fViewer.getTextWidget()); Menu menu = menuMgr.createContextMenu(fViewer.getTextWidget());
fViewer.getTextWidget().setMenu(menu); fViewer.getTextWidget().setMenu(menu);
getSite().registerContextMenu(id, menuMgr, fViewer); getSite().registerContextMenu(id, menuMgr, fViewer);
@ -1213,12 +1188,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
String id = "#DisassemblyPartRulerContext"; //$NON-NLS-1$ String id = "#DisassemblyPartRulerContext"; //$NON-NLS-1$
MenuManager menuMgr = new MenuManager(id, id); MenuManager menuMgr = new MenuManager(id, id);
menuMgr.setRemoveAllWhenShown(true); menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() { menuMgr.addMenuListener(manager -> DisassemblyPart.this.fillRulerContextMenu(manager));
@Override
public void menuAboutToShow(IMenuManager manager) {
DisassemblyPart.this.fillRulerContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(fVerticalRuler.getControl()); Menu menu = menuMgr.createContextMenu(fVerticalRuler.getControl());
fVerticalRuler.getControl().setMenu(menu); fVerticalRuler.getControl().setMenu(menu);
getSite().registerContextMenu(id, menuMgr, fViewer); getSite().registerContextMenu(id, menuMgr, fViewer);
@ -1442,13 +1412,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
assert isGuiThread(); assert isGuiThread();
if (address != null) { if (address != null) {
final BigInteger addr = address.getValue(); final BigInteger addr = address.getValue();
startUpdate(new Runnable() { startUpdate(() -> {
@Override
public void run() {
fGotoFramePending = false; fGotoFramePending = false;
fGotoAddressPending = PC_UNKNOWN; fGotoAddressPending = PC_UNKNOWN;
gotoAddress(addr); gotoAddress(addr);
}
}); });
} }
} }
@ -1560,9 +1527,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
&& !fRefreshViewPending && fFocusAddress != PC_UNKNOWN) { && !fRefreshViewPending && fFocusAddress != PC_UNKNOWN) {
fUpdatePending = true; fUpdatePending = true;
final int updateCount = fUpdateCount; final int updateCount = fUpdateCount;
invokeLater(new Runnable() { invokeLater(() -> {
@Override
public void run() {
if (updateCount == fUpdateCount) { if (updateCount == fUpdateCount) {
assert fUpdatePending; assert fUpdatePending;
if (fUpdatePending) { if (fUpdatePending) {
@ -1570,7 +1535,6 @@ public abstract class DisassemblyPart extends WorkbenchPart
updateVisibleArea(); updateVisibleArea();
} }
} }
}
}); });
} }
} }
@ -1767,13 +1731,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
if (fDebugSessionId == null) { if (fDebugSessionId == null) {
return; return;
} }
startUpdate(new Runnable() { startUpdate(() -> {
@Override
public void run() {
if (DEBUG) if (DEBUG)
System.out.println("retrieveDisassembly " + file); //$NON-NLS-1$ System.out.println("retrieveDisassembly " + file); //$NON-NLS-1$
fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly); fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
}
}); });
} }
@ -2002,12 +1963,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
prevBackend.dispose(); prevBackend.dispose();
} }
if (needUpdate && fViewer != null) { if (needUpdate && fViewer != null) {
startUpdate(new Runnable() { startUpdate(() -> debugContextChanged());
@Override
public void run() {
debugContextChanged();
}
});
} }
} }
@ -2107,9 +2063,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
fRunnableQueue.clear(); fRunnableQueue.clear();
fRefreshViewPending = true; fRefreshViewPending = true;
final long refreshViewScheduled = System.currentTimeMillis() + delay; final long refreshViewScheduled = System.currentTimeMillis() + delay;
final Runnable refresh = new Runnable() { final Runnable refresh = () -> {
@Override
public void run() {
fRefreshViewPending = false; fRefreshViewPending = false;
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if (now >= refreshViewScheduled) { if (now >= refreshViewScheduled) {
@ -2137,15 +2091,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
} else { } else {
refreshView((int) (refreshViewScheduled - now)); refreshView((int) (refreshViewScheduled - now));
} }
}
}; };
if (delay > 0) { if (delay > 0) {
invokeLater(delay, new Runnable() { invokeLater(delay, () -> doScrollLocked(refresh));
@Override
public void run() {
doScrollLocked(refresh);
}
});
} else { } else {
doScrollLocked(refresh); doScrollLocked(refresh);
} }
@ -2610,12 +2558,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
private void scheduleDoPending() { private void scheduleDoPending() {
if (!fUpdatePending && !fDoPendingPosted) { if (!fUpdatePending && !fDoPendingPosted) {
fDoPendingPosted = true; fDoPendingPosted = true;
invokeLater(new Runnable() { invokeLater(() -> {
@Override
public void run() {
doPending(); doPending();
fDoPendingPosted = false; fDoPendingPosted = false;
}
}); });
} }
} }
@ -2678,13 +2623,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
final int updateCount = fUpdateCount; final int updateCount = fUpdateCount;
if (fUpdatePending) { if (fUpdatePending) {
if (fRunnableQueue.size() == 1) { if (fRunnableQueue.size() == 1) {
Runnable doitlater = new Runnable() { Runnable doitlater = () -> {
@Override
public void run() {
if (updateCount == fUpdateCount) { if (updateCount == fUpdateCount) {
doScrollLocked(null); doScrollLocked(null);
} }
}
}; };
invokeLater(doitlater); invokeLater(doitlater);
} }
@ -3113,12 +3055,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
*/ */
@Override @Override
public void handleTargetSuspended() { public void handleTargetSuspended() {
asyncExec(new Runnable() { asyncExec(() -> {
@Override
public void run() {
updatePC(PC_UNKNOWN); updatePC(PC_UNKNOWN);
firePropertyChange(PROP_SUSPENDED); firePropertyChange(PROP_SUSPENDED);
}
}); });
} }
@ -3127,12 +3066,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
*/ */
@Override @Override
public void handleTargetResumed() { public void handleTargetResumed() {
asyncExec(new Runnable() { asyncExec(() -> {
@Override
public void run() {
updatePC(PC_RUNNING); updatePC(PC_RUNNING);
firePropertyChange(PROP_SUSPENDED); firePropertyChange(PROP_SUSPENDED);
}
}); });
} }
@ -3141,17 +3077,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
*/ */
@Override @Override
public void handleTargetEnded() { public void handleTargetEnded() {
asyncExec(new Runnable() { asyncExec(() -> {
@Override
public void run() {
fDebugSessionId = null; fDebugSessionId = null;
startUpdate(new Runnable() { startUpdate(() -> debugContextChanged());
@Override
public void run() {
debugContextChanged();
}
});
}
}); });
} }

View file

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

View file

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

View file

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

View file

@ -83,12 +83,7 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
store.getInt(IDsfDebugUIConstants.PREF_STACK_FRAME_LIMIT)); store.getInt(IDsfDebugUIConstants.PREF_STACK_FRAME_LIMIT));
} }
fPreferencesListener = new IPropertyChangeListener() { fPreferencesListener = event -> handlePropertyChanged(store, event);
@Override
public void propertyChange(final PropertyChangeEvent event) {
handlePropertyChanged(store, event);
}
};
store.addPropertyChangeListener(fPreferencesListener); store.addPropertyChangeListener(fPreferencesListener);
final IPreferenceStore cStore = CDebugUIPlugin.getDefault().getPreferenceStore(); 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 // We're in session's executor thread. Re-dispatch to our executor thread
// and then call root layout node. // and then call root layout node.
try { try {
getExecutor().execute(new Runnable() { getExecutor().execute(() -> {
@Override
public void run() {
if (isDisposed()) if (isDisposed())
return; return;
for (final DebugEvent event : events) { for (final DebugEvent event : events) {
handleEvent(event); handleEvent(event);
} }
}
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
// Ignore. This exception could be thrown if the provider is being // Ignore. This exception could be thrown if the provider is being
@ -175,16 +167,13 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
@Override @Override
public void run() { public void run() {
if (getSession().isActive()) { if (getSession().isActive()) {
getExecutor().execute(new Runnable() { getExecutor().execute(() -> {
@Override
public void run() {
// trigger full stack frame update // trigger full stack frame update
ScheduledFuture<?> future = fRefreshStackFramesFutures.get(exeContext); ScheduledFuture<?> future = fRefreshStackFramesFutures.get(exeContext);
if (future != null && !isDisposed()) { if (future != null && !isDisposed()) {
fRefreshStackFramesFutures.remove(exeContext); fRefreshStackFramesFutures.remove(exeContext);
handleEvent(new FullStackRefreshEvent(exeContext, suspendEvent), null); 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 // We're in session's executor thread. Re-dispach to our executor thread
// and then call root layout node. // and then call root layout node.
try { try {
getExecutor().execute(new Runnable() { getExecutor().execute(() -> {
@Override
public void run() {
if (isDisposed()) if (isDisposed())
return; return;
@ -269,7 +256,6 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
if (rootLayoutNode != null && rootLayoutNode.getDeltaFlags(event) != IModelDelta.NO_CHANGE) { if (rootLayoutNode != null && rootLayoutNode.getDeltaFlags(event) != IModelDelta.NO_CHANGE) {
handleEvent(event); handleEvent(event);
} }
}
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
// Ignore. This exception could be thrown if the provider is being // 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); DebugUITools.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
} }
fPreferenceChangeListener = new IPropertyChangeListener() { fPreferenceChangeListener = event -> {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND)) { if (event.getProperty().equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND)) {
columnIdValueBackground.setBackground( columnIdValueBackground.setBackground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB()); DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
columnNoColumnsBackground.setBackground( columnNoColumnsBackground.setBackground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB()); DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
} }
}
}; };
DebugUITools.getPreferenceStore().addPropertyChangeListener(fPreferenceChangeListener); DebugUITools.getPreferenceStore().addPropertyChangeListener(fPreferenceChangeListener);
@ -865,9 +862,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
@Override @Override
public void update(final IExpressionUpdate update) { public void update(final IExpressionUpdate update) {
try { try {
getSession().getExecutor().execute(new Runnable() { getSession().getExecutor().execute(() -> {
@Override
public void run() {
final IExpressions expressionService = getServicesTracker().getService(IExpressions.class); final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
if (expressionService != null) { if (expressionService != null) {
IExpressionDMContext expressionDMC = createExpression(expressionService, IExpressionDMContext expressionDMC = createExpression(expressionService,
@ -881,7 +876,6 @@ public class VariableVMNode extends AbstractExpressionVMNode
} else { } else {
handleFailedUpdate(update); handleFailedUpdate(update);
} }
}
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
handleFailedUpdate(update); handleFailedUpdate(update);

View file

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

View file

@ -78,12 +78,7 @@ public class SimpleDisplayExecutor implements Executor {
final boolean needsPosting = enqueue(command); final boolean needsPosting = enqueue(command);
if (needsPosting) { if (needsPosting) {
try { try {
fDisplay.asyncExec(new Runnable() { fDisplay.asyncExec(() -> runInSwtThread());
@Override
public void run() {
runInSwtThread();
}
});
} catch (final SWTException e) { } catch (final SWTException e) {
if (e.code == SWT.ERROR_DEVICE_DISPOSED) { if (e.code == SWT.ERROR_DEVICE_DISPOSED) {
throw new RejectedExecutionException("Display " + fDisplay + " is disposed", e); //$NON-NLS-1$ //$NON-NLS-2$ 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) { for (final IVMProvider provider : providers) {
try { try {
provider.getExecutor().execute(new Runnable() { provider.getExecutor().execute(() -> provider.dispose());
@Override
public void run() {
provider.dispose();
}
});
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
// Not much we can do at this point. // 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) { private void updateProvider(final IVMProvider provider, final IViewerUpdate[] updates) {
try { try {
provider.getExecutor().execute(new Runnable() { provider.getExecutor().execute(() -> {
@Override
public void run() {
if (updates instanceof IHasChildrenUpdate[]) { if (updates instanceof IHasChildrenUpdate[]) {
provider.update((IHasChildrenUpdate[]) updates); provider.update((IHasChildrenUpdate[]) updates);
} else if (updates instanceof IChildrenCountUpdate[]) { } else if (updates instanceof IChildrenCountUpdate[]) {
@ -165,7 +158,6 @@ abstract public class AbstractVMAdapter implements IVMAdapter {
} else if (updates instanceof IChildrenUpdate[]) { } else if (updates instanceof IChildrenUpdate[]) {
provider.update((IChildrenUpdate[]) updates); provider.update((IChildrenUpdate[]) updates);
} }
}
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
for (IViewerUpdate update : updates) { for (IViewerUpdate update : updates) {

View file

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

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf;singleton:=true 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-Activator: org.eclipse.cdt.dsf.internal.DsfPlugin
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime, 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 { private class RequestCanceledListener implements RequestMonitor.ICanceledListener {
@Override @Override
public void requestCanceled(final RequestMonitor canceledRm) { public void requestCanceled(final RequestMonitor canceledRm) {
fExecutor.getDsfExecutor().execute(new Runnable() { fExecutor.getDsfExecutor().execute(() -> handleCanceledRm(canceledRm));
@Override
public void run() {
handleCanceledRm(canceledRm);
}
});
} }
} }

View file

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

View file

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

View file

@ -217,15 +217,12 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
DEFAULT_ATTR_DEBUGGER_MEMORY_BLOCKS_VALUE); DEFAULT_ATTR_DEBUGGER_MEMORY_BLOCKS_VALUE);
if (memento != null && memento.trim().length() != 0) { if (memento != null && memento.trim().length() != 0) {
// Submit the runnable to install the monitors on dispatch thread. // Submit the runnable to install the monitors on dispatch thread.
getExecutor().submit(new Runnable() { getExecutor().submit(() -> {
@Override
public void run() {
try { try {
createBlocksFromConfiguration(memoryCtx, memento); createBlocksFromConfiguration(memoryCtx, memento);
} catch (CoreException e) { } catch (CoreException e) {
DsfPlugin.getDefault().getLog().log(e.getStatus()); DsfPlugin.getDefault().getLog().log(e.getStatus());
} }
}
}); });
} }
} catch (CoreException e) { } 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. // Submit the runnable to plant the breakpoints on dispatch thread.
getExecutor().submit(new Runnable() { getExecutor().submit(() -> installInitialBreakpoints(breakpointsDmc, initialPlatformBPs, rm));
@Override
public void run() {
installInitialBreakpoints(breakpointsDmc, initialPlatformBPs, rm);
}
});
return Status.OK_STATUS; 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) { public void listChanged(IDockerConnection c, java.util.List<IDockerImage> list) {
final IDockerImage[] finalList = list.toArray(new IDockerImage[0]); final IDockerImage[] finalList = list.toArray(new IDockerImage[0]);
if (c.getName().equals(connection.getName())) { if (c.getName().equals(connection.getName())) {
Display.getDefault().syncExec(new Runnable() { Display.getDefault().syncExec(() -> {
@Override
public void run() {
connection.removeImageListener(containerTab); connection.removeImageListener(containerTab);
ArrayList<String> imageNames = new ArrayList<>(); ArrayList<String> imageNames = new ArrayList<>();
displayedImages = new ArrayList<>(); displayedImages = new ArrayList<>();
@ -995,8 +993,6 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
if (!imageCombo.isDisposed()) if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0])); imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(containerTab); connection.addImageListener(containerTab);
}
}); });
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.memorybrowser;singleton:=true 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-Activator: org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowserPlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin 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.debug.ui.memory.IRepositionableMemoryRendering;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.MenuManager;
@ -575,26 +574,18 @@ public class MemoryBrowser extends ViewPart
renderingFinal.goToAddress(newBase); renderingFinal.goToAddress(newBase);
} }
runOnUIThread(new Runnable() { runOnUIThread(() -> {
@Override
public void run() {
CTabItem selection = activeFolder.getSelection(); CTabItem selection = activeFolder.getSelection();
selection.setData(KEY_EXPRESSION, expression); selection.setData(KEY_EXPRESSION, expression);
selection.setData(KEY_EXPRESSION_ADDRESS, newBase); selection.setData(KEY_EXPRESSION_ADDRESS, newBase);
fGotoAddressBar.handleExpressionStatus(Status.OK_STATUS); fGotoAddressBar.handleExpressionStatus(Status.OK_STATUS);
updateLabel(selection, renderingFinal); updateLabel(selection, renderingFinal);
}
}); });
} catch (final DebugException e1) { } catch (final DebugException e1) {
// widgets update require Display // widgets update require Display
runOnUIThread(new Runnable() { runOnUIThread(() -> fGotoAddressBar
@Override .handleExpressionStatus(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
public void run() { Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1)));
fGotoAddressBar.handleExpressionStatus(
new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1)); //$NON-NLS-1$
}
});
} }
} }
}.start(); }.start();
@ -769,12 +760,7 @@ public class MemoryBrowser extends ViewPart
private void hookContextMenu() { private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true); menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() { menuMgr.addMenuListener(manager -> MemoryBrowser.this.fillContextMenu(manager));
@Override
public void menuAboutToShow(IMenuManager manager) {
MemoryBrowser.this.fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(getControl()); Menu menu = menuMgr.createContextMenu(getControl());
getControl().setMenu(menu); getControl().setMenu(menu);
} }
@ -1097,9 +1083,7 @@ public class MemoryBrowser extends ViewPart
*/ */
private void updateTab(final IMemoryBlockRetrieval retrieval, final Object context, final String[] memorySpaces) { private void updateTab(final IMemoryBlockRetrieval retrieval, final Object context, final String[] memorySpaces) {
// GUI activity must be on the main thread // GUI activity must be on the main thread
runOnUIThread(new Runnable() { runOnUIThread(() -> {
@Override
public void run() {
if (fGotoAddressBarControl.isDisposed() || fGotoMemorySpaceControl.isDisposed()) { if (fGotoAddressBarControl.isDisposed() || fGotoMemorySpaceControl.isDisposed()) {
return; return;
} }
@ -1159,8 +1143,7 @@ public class MemoryBrowser extends ViewPart
// says it requires a memory space ID in all cases // says it requires a memory space ID in all cases
boolean addNA = true; boolean addNA = true;
if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) {
addNA = !((IMemorySpaceAwareMemoryBlockRetrieval) retrieval) addNA = !((IMemorySpaceAwareMemoryBlockRetrieval) retrieval).creatingBlockRequiresMemorySpaceID();
.creatingBlockRequiresMemorySpaceID();
} }
if (addNA) { if (addNA) {
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0); fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0);
@ -1176,7 +1159,6 @@ public class MemoryBrowser extends ViewPart
fGotoMemorySpaceControl.isVisible() ? fGotoMemorySpaceControl.getText() : null); fGotoMemorySpaceControl.isVisible() ? fGotoMemorySpaceControl.getText() : null);
fStackLayout.topControl.getParent().layout(true); fStackLayout.topControl.getParent().layout(true);
}
}); });
} }
@ -1337,9 +1319,7 @@ public class MemoryBrowser extends ViewPart
private void releaseTabFolder(final IMemoryBlockRetrieval retrieval) { private void releaseTabFolder(final IMemoryBlockRetrieval retrieval) {
final CTabFolder folder = fContextFolders.get(retrieval); final CTabFolder folder = fContextFolders.get(retrieval);
if (folder != null) { if (folder != null) {
Runnable run = new Runnable() { Runnable run = () -> {
@Override
public void run() {
for (CTabItem tab : folder.getItems()) { for (CTabItem tab : folder.getItems()) {
disposeTab(tab); disposeTab(tab);
} }
@ -1349,7 +1329,6 @@ public class MemoryBrowser extends ViewPart
if (fStackLayout.topControl.equals(folder)) { if (fStackLayout.topControl.equals(folder)) {
handleUnsupportedSelection(); handleUnsupportedSelection();
} }
}
}; };
runOnUIThread(run); 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.ISearchResult;
import org.eclipse.search.ui.NewSearchUI; import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.swt.SWT; 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.SelectionEvent;
import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormAttachment;
@ -729,9 +727,7 @@ public class FindReplaceDialog extends SelectionDialog {
fFormatDecimalButton.addSelectionListener(nonAsciiListener); fFormatDecimalButton.addSelectionListener(nonAsciiListener);
fFormatByteSequenceButton.addSelectionListener(nonAsciiListener); fFormatByteSequenceButton.addSelectionListener(nonAsciiListener);
fStartText.addModifyListener(new ModifyListener() { fStartText.addModifyListener(e -> {
@Override
public void modifyText(ModifyEvent e) {
boolean valid = true; boolean valid = true;
try { try {
getStartAddress(); getStartAddress();
@ -743,13 +739,9 @@ public class FindReplaceDialog extends SelectionDialog {
: Display.getDefault().getSystemColor(SWT.COLOR_RED)); : Display.getDefault().getSystemColor(SWT.COLOR_RED));
validate(); validate();
}
}); });
fEndText.addModifyListener(new ModifyListener() { fEndText.addModifyListener(e -> {
@Override
public void modifyText(ModifyEvent e) {
try { try {
getEndAddress(); getEndAddress();
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
@ -758,23 +750,11 @@ public class FindReplaceDialog extends SelectionDialog {
} }
validate(); validate();
}
}); });
fFindText.addModifyListener(new ModifyListener() { fFindText.addModifyListener(e -> validate());
@Override
public void modifyText(ModifyEvent e) {
validate();
}
});
fReplaceText.addModifyListener(new ModifyListener() { fReplaceText.addModifyListener(e -> validate());
@Override
public void modifyText(ModifyEvent e) {
validate();
}
});
composite.setTabList( composite.setTabList(
new Control[] { fFindText, fReplaceText, directionGroup, rangeGroup, formatGroup, optionsGroup, }); new Control[] { fFindText, fReplaceText, directionGroup, rangeGroup, formatGroup, optionsGroup, });
@ -1137,10 +1117,7 @@ public class FindReplaceDialog extends SelectionDialog {
final BigInteger finalCurrentPosition = currentPosition; final BigInteger finalCurrentPosition = currentPosition;
final BigInteger finalStart = start; final BigInteger finalStart = start;
final BigInteger finalEnd = end; final BigInteger finalEnd = end;
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(() -> {
@Override
public void run() {
IMemoryRenderingContainer containers[] = getMemoryView() IMemoryRenderingContainer containers[] = getMemoryView()
.getMemoryRenderingContainers(); .getMemoryRenderingContainers();
for (int i = 0; i < containers.length; i++) { for (int i = 0; i < containers.length; i++) {
@ -1149,11 +1126,11 @@ public class FindReplaceDialog extends SelectionDialog {
try { try {
((IRepositionableMemoryRendering) rendering) ((IRepositionableMemoryRendering) rendering)
.goToAddress(finalCurrentPosition); .goToAddress(finalCurrentPosition);
} catch (DebugException e) { } catch (DebugException e1) {
MemorySearchPlugin.logError( MemorySearchPlugin.logError(
Messages.getString( Messages.getString(
"FindReplaceDialog.RepositioningMemoryViewFailed"), //$NON-NLS-1$ "FindReplaceDialog.RepositioningMemoryViewFailed"), //$NON-NLS-1$
e); e1);
} }
} }
if (rendering != null) { if (rendering != null) {
@ -1164,13 +1141,11 @@ public class FindReplaceDialog extends SelectionDialog {
if (m != null) if (m != null)
m.invoke(rendering, finalCurrentPosition, m.invoke(rendering, finalCurrentPosition,
finalCurrentPosition.add(searchPhraseLength)); finalCurrentPosition.add(searchPhraseLength));
} catch (Exception e) { } catch (Exception e2) {
// do nothing // do nothing
} }
} }
} }
}
}); });
fProperties.setProperty(SEARCH_ENABLE_FIND_NEXT, Boolean.TRUE.toString()); fProperties.setProperty(SEARCH_ENABLE_FIND_NEXT, Boolean.TRUE.toString());
@ -1222,12 +1197,9 @@ public class FindReplaceDialog extends SelectionDialog {
}; };
if (all && replaceData == null) { if (all && replaceData == null) {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(() -> {
@Override
public void run() {
NewSearchUI.activateSearchResultView(); NewSearchUI.activateSearchResultView();
NewSearchUI.runQueryInBackground(query); NewSearchUI.runQueryInBackground(query);
}
}); });
} else { } else {
Job job = new Job("Searching memory for " + searchPhrase) { //$NON-NLS-1$ 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