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,14 +88,11 @@ 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 IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages();
public void run() { for (IWorkbenchPage page : pages) {
IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages(); page.closeAllEditors(false);
for (IWorkbenchPage page : pages) { dispatch(0);
page.closeAllEditors(false);
dispatch(0);
}
} }
}); });
@ -141,19 +138,16 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
} }
public void doRunQuickFix() { public void doRunQuickFix() {
Display.getDefault().syncExec(new Runnable() { Display.getDefault().syncExec(() -> {
@Override for (int i = 0; i < markers.length; i++) {
public void run() { IMarker marker = markers[i];
for (int i = 0; i < markers.length; i++) { isApplicableMap.put(marker, quickFix.isApplicable(marker));
IMarker marker = markers[i]; if (quickFix.isApplicable(marker)) {
isApplicableMap.put(marker, quickFix.isApplicable(marker)); quickFix.run(marker);
if (quickFix.isApplicable(marker)) { dispatch(0);
quickFix.run(marker);
dispatch(0);
}
} }
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,18 +34,15 @@ 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 // Install a part listener on currenly open workbench windows.
public void run() { for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
// Install a part listener on currenly open workbench windows. CodanPartListener.installOnWindow(window);
for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
CodanPartListener.installOnWindow(window);
}
// Install a window listener which will be notified of
// new windows opening, and install a part listener on them.
workbench.addWindowListener(new CodanWindowListener());
} }
// Install a window listener which will be notified of
// new windows opening, and install a part listener on them.
workbench.addWindowListener(new CodanWindowListener());
}); });
} }
} }

View file

@ -360,13 +360,10 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
PreferenceManager manager = new PreferenceManager(); 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 dialog.create();
public void run() { dialog.setMessage(targetNode.getLabelText());
dialog.create(); dialog.open();
dialog.setMessage(targetNode.getLabelText());
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,25 +1083,22 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (fStateListeners.isEmpty()) { if (fStateListeners.isEmpty()) {
return; return;
} }
Runnable notify = new Runnable() { Runnable notify = () -> {
@Override fIndexerStateEvent.setState(state);
public void run() { Object[] listeners = fStateListeners.getListeners();
fIndexerStateEvent.setState(state); for (Object listener2 : listeners) {
Object[] listeners = fStateListeners.getListeners(); final IIndexerStateListener listener = (IIndexerStateListener) listener2;
for (Object listener2 : listeners) { SafeRunner.run(new ISafeRunnable() {
final IIndexerStateListener listener = (IIndexerStateListener) listener2; @Override
SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) {
@Override CCorePlugin.log(exception);
public void handleException(Throwable exception) { }
CCorePlugin.log(exception);
}
@Override @Override
public void run() throws Exception { public void run() throws Exception {
listener.indexChanged(fIndexerStateEvent); listener.indexChanged(fIndexerStateEvent);
} }
}); });
}
} }
}; };
scheduleNotification(notify); scheduleNotification(notify);
@ -1127,25 +1118,22 @@ 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 fIndexChangeEvent.setAffectedProject(finalProject, e);
public void run() { Object[] listeners = fChangeListeners.getListeners();
fIndexChangeEvent.setAffectedProject(finalProject, e); for (Object listener2 : listeners) {
Object[] listeners = fChangeListeners.getListeners(); final IIndexChangeListener listener = (IIndexChangeListener) listener2;
for (Object listener2 : listeners) { SafeRunner.run(new ISafeRunnable() {
final IIndexChangeListener listener = (IIndexChangeListener) listener2; @Override
SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) {
@Override CCorePlugin.log(exception);
public void handleException(Throwable exception) { }
CCorePlugin.log(exception);
}
@Override @Override
public void run() throws Exception { public void run() throws Exception {
listener.indexChanged(fIndexChangeEvent); listener.indexChanged(fIndexChangeEvent);
} }
}); });
}
} }
}; };
scheduleNotification(notify); scheduleNotification(notify);
@ -1528,22 +1516,19 @@ 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 for (final IndexerSetupParticipant p : participants) {
public void run() { SafeRunner.run(new ISafeRunnable() {
for (final IndexerSetupParticipant p : participants) { @Override
SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) {
@Override CCorePlugin.log(exception);
public void handleException(Throwable exception) { }
CCorePlugin.log(exception);
}
@Override @Override
public void run() throws Exception { public void run() throws Exception {
p.onIndexerSetup(cproject); p.onIndexerSetup(cproject);
} }
}); });
}
} }
}; };
scheduleNotification(notify); scheduleNotification(notify);

View file

@ -1008,20 +1008,17 @@ 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 if (options.captureDefault == CaptureDefault.BY_COPY) {
public void run() { scribe.printNextToken(Token.tASSIGN, options.fSpaceAfterOpeningParen);
if (options.captureDefault == CaptureDefault.BY_COPY) { } else if (options.captureDefault == CaptureDefault.BY_REFERENCE) {
scribe.printNextToken(Token.tASSIGN, options.fSpaceAfterOpeningParen); scribe.printNextToken(Token.tAMPER, options.fSpaceAfterOpeningParen);
} else if (options.captureDefault == CaptureDefault.BY_REFERENCE) { }
scribe.printNextToken(Token.tAMPER, options.fSpaceAfterOpeningParen);
}
if (options.captureDefault != CaptureDefault.UNSPECIFIED && node.getCaptures().length > 0) { if (options.captureDefault != CaptureDefault.UNSPECIFIED && node.getCaptures().length > 0) {
scribe.printNextToken(Token.tCOMMA, options.fSpaceBeforeSeparator); scribe.printNextToken(Token.tCOMMA, options.fSpaceBeforeSeparator);
if (options.fSpaceAfterSeparator) if (options.fSpaceAfterSeparator)
scribe.space(); scribe.space();
}
} }
}); });

View file

@ -70,22 +70,18 @@ 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 long diff = System.currentTimeMillis() - starttime;
public void run() { while (diff < 10000) {
try {
long diff = System.currentTimeMillis() - starttime; Thread.sleep(10000);
while (diff < 10000) { } catch (InterruptedException e) {
try { break;
Thread.sleep(10000);
} catch (InterruptedException e) {
break;
}
diff = System.currentTimeMillis() - starttime;
} }
stopAddr2Line(); diff = System.currentTimeMillis() - starttime;
} }
stopAddr2Line();
}; };
new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$ new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$
} }

View file

@ -67,22 +67,18 @@ 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 long diff = System.currentTimeMillis() - starttime;
public void run() { while (diff < 10000) {
try {
long diff = System.currentTimeMillis() - starttime; Thread.sleep(10000);
while (diff < 10000) { } catch (InterruptedException e) {
try { break;
Thread.sleep(10000);
} catch (InterruptedException e) {
break;
}
diff = System.currentTimeMillis() - starttime;
} }
stopAddr2Line(); diff = System.currentTimeMillis() - starttime;
} }
stopAddr2Line();
}; };
new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$ new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$
} }

View file

@ -235,21 +235,17 @@ 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 = () -> {
long diff = System.currentTimeMillis() - starttime;
@Override while (diff < 10000) {
public void run() { try {
long diff = System.currentTimeMillis() - starttime; Thread.sleep(10000);
while (diff < 10000) { } catch (InterruptedException e) {
try { break;
Thread.sleep(10000);
} catch (InterruptedException e) {
break;
}
diff = System.currentTimeMillis() - starttime;
} }
stopAddr2Line(); diff = System.currentTimeMillis() - starttime;
} }
stopAddr2Line();
}; };
new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$ new Thread(worker, "Addr2line Reaper").start(); //$NON-NLS-1$
} }

View file

@ -237,21 +237,17 @@ 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 = () -> {
long diff = System.currentTimeMillis() - starttime;
@Override while (diff < 10000) {
public void run() { try {
long diff = System.currentTimeMillis() - starttime; Thread.sleep(10000);
while (diff < 10000) { } catch (InterruptedException e) {
try { break;
Thread.sleep(10000);
} catch (InterruptedException e) {
break;
}
diff = System.currentTimeMillis() - starttime;
} }
stopAddr2Line(); diff = System.currentTimeMillis() - starttime;
} }
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 if (!display.isDisposed())
public void run() { workbench.close();
if (!display.isDisposed())
workbench.close();
}
}); });
} }
} }

View file

@ -265,22 +265,18 @@ 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);
dialog.setBlockOnOpen(true);
CoreFileDialog dialog = new CoreFileDialog(getWindowConfigurer().getWindow().getShell(), if (dialog.open() == IDialogConstants.OK_ID) {
0, executablePath, coreFilePath); CoreFileInfo info2 = dialog.getCoreFileInfo();
dialog.setBlockOnOpen(true); info.setHostPath(info2.getHostPath());
if (dialog.open() == IDialogConstants.OK_ID) { info.setCoreFilePath(info2.getCoreFilePath());
CoreFileInfo info2 = dialog.getCoreFileInfo(); } else {
info.setHostPath(info2.getHostPath()); ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
info.setCoreFilePath(info2.getCoreFilePath()); IStatus.ERROR | IStatus.WARNING);
} else {
ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
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
@ -318,22 +314,18 @@ 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 RemoteExecutableDialog dialog = new RemoteExecutableDialog(
public void run() { getWindowConfigurer().getWindow().getShell(), executablePath, buildLogPath,
addressStr, portStr, attach);
RemoteExecutableDialog dialog = new RemoteExecutableDialog( dialog.setBlockOnOpen(true);
getWindowConfigurer().getWindow().getShell(), executablePath, buildLogPath, if (dialog.open() == IDialogConstants.OK_ID) {
addressStr, portStr, attach); info[0] = dialog.getExecutableInfo();
dialog.setBlockOnOpen(true); } else {
if (dialog.open() == IDialogConstants.OK_ID) { info[0] = null;
info[0] = dialog.getExecutableInfo(); ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
} else { IStatus.ERROR | IStatus.WARNING);
info[0] = null;
ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
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
@ -364,23 +356,19 @@ 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 NewExecutableDialog dialog = new NewExecutableDialog(
public void run() { getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath,
executableArgs);
NewExecutableDialog dialog = new NewExecutableDialog( dialog.setBlockOnOpen(true);
getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath, if (dialog.open() == IDialogConstants.OK_ID) {
executableArgs); NewExecutableInfo info2 = dialog.getExecutableInfo();
dialog.setBlockOnOpen(true); info.setHostPath(info2.getHostPath());
if (dialog.open() == IDialogConstants.OK_ID) { info.setArguments(info2.getArguments());
NewExecutableInfo info2 = dialog.getExecutableInfo(); } else {
info.setHostPath(info2.getHostPath()); ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
info.setArguments(info2.getArguments()); IStatus.ERROR | IStatus.WARNING);
} else {
ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
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
@ -429,24 +417,20 @@ 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 NewExecutableDialog dialog = new NewExecutableDialog(
public void run() { getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath,
executableArgs);
NewExecutableDialog dialog = new NewExecutableDialog( dialog.setBlockOnOpen(true);
getWindowConfigurer().getWindow().getShell(), 0, executablePath, buildLogPath, if (dialog.open() == IDialogConstants.OK_ID) {
executableArgs); NewExecutableInfo info2 = dialog.getExecutableInfo();
dialog.setBlockOnOpen(true); info.setHostPath(info2.getHostPath());
if (dialog.open() == IDialogConstants.OK_ID) { info.setArguments(info2.getArguments());
NewExecutableInfo info2 = dialog.getExecutableInfo(); info.setBuildLog(info2.getBuildLog());
info.setHostPath(info2.getHostPath()); } else {
info.setArguments(info2.getArguments()); ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
info.setBuildLog(info2.getBuildLog()); IStatus.ERROR | IStatus.WARNING);
} else {
ErrorDialog.openError(null, Messages.DebuggerInitializingProblem, null, errorStatus,
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
@ -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,14 +511,11 @@ 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 try {
public void run(IProgressMonitor monitor) { status.merge(ResourcesPlugin.getWorkspace().save(true, monitor));
try { } catch (CoreException e) {
status.merge(ResourcesPlugin.getWorkspace().save(true, monitor)); status.merge(e.getStatus());
} catch (CoreException e) {
status.merge(e.getStatus());
}
} }
}; };
p.run(true, false, runnable); p.run(true, false, runnable);

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,19 +35,16 @@ public class CWatchExpressionDelegate implements IWatchExpressionDelegate {
return; return;
} }
final ICStackFrame frame = (ICStackFrame) context; final ICStackFrame frame = (ICStackFrame) context;
Runnable runnable = new Runnable() { Runnable runnable = () -> {
@Override IValue value = null;
public void run() { DebugException de = null;
IValue value = null; try {
DebugException de = null; value = frame.evaluateExpression(expression);
try { } catch (DebugException e) {
value = frame.evaluateExpression(expression); de = e;
} catch (DebugException e) {
de = e;
}
IWatchExpressionResult result = evaluationComplete(expression, value, de);
listener.watchEvaluationFinished(result);
} }
IWatchExpressionResult result = evaluationComplete(expression, value, de);
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,13 +49,10 @@ 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 for (int i = 0; i < events.length; i++) {
public void run() { if (events[i].getSource() != null) {
for (int i = 0; i < events.length; i++) { doHandleDebugEvent(events[i]);
if (events[i].getSource() != null) {
doHandleDebugEvent(events[i]);
}
} }
} }
}; };

View file

@ -96,15 +96,11 @@ 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(), () -> {
try {
@Override doAction();
public void run() { } catch (DebugException e) {
try { ms.merge(e.getStatus());
doAction();
} catch (DebugException e) {
ms.merge(e.getStatus());
}
} }
}); });
if (!ms.isOK()) { if (!ms.isOK()) {
@ -162,14 +158,10 @@ public abstract class AbstractViewActionDelegate extends ActionDelegate
if (shell == null || shell.isDisposed()) { if (shell == null || shell.isDisposed()) {
return; return;
} }
Runnable r = new Runnable() { Runnable r = () -> {
for (int i = 0; i < events.length; i++) {
@Override if (events[i].getSource() != null) {
public void run() { doHandleDebugEvent(events[i]);
for (int i = 0; i < events.length; i++) {
if (events[i].getSource() != null) {
doHandleDebugEvent(events[i]);
}
} }
} }
}; };

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,16 +236,12 @@ 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(), () -> {
try {
@Override doAction(getCastToArray());
public void run() { setStatus(null);
try { } catch (DebugException e) {
doAction(getCastToArray()); setStatus(e.getStatus());
setStatus(null);
} catch (DebugException e) {
setStatus(e.getStatus());
}
} }
}); });
if (getStatus() != null && !getStatus().isOK()) { if (getStatus() != null && !getStatus().isOK()) {

View file

@ -99,16 +99,12 @@ 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(), () -> {
try {
@Override doAction(getCastToType());
public void run() { setStatus(null);
try { } catch (DebugException e) {
doAction(getCastToType()); setStatus(e.getStatus());
setStatus(null);
} catch (DebugException e) {
setStatus(e.getStatus());
}
} }
}); });
if (getStatus() != null && !getStatus().isOK()) { if (getStatus() != null && !getStatus().isOK()) {

View file

@ -59,14 +59,11 @@ 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 try {
public void run() { doAction(module);
try { } catch (DebugException e) {
doAction(module); failed(e);
} catch (DebugException e) {
failed(e);
}
} }
}); });
} }

View file

@ -119,23 +119,20 @@ public class MoveToLineActionDelegate implements IEditorActionDelegate, IActionD
if (fAction == null) { if (fAction == null) {
return; return;
} }
Runnable r = new Runnable() { Runnable r = () -> {
@Override boolean enabled = false;
public void run() { if (fPartTarget != null && fTargetElement != null) {
boolean enabled = false; IWorkbenchPartSite site = fActivePart.getSite();
if (fPartTarget != null && fTargetElement != null) { if (site != null) {
IWorkbenchPartSite site = fActivePart.getSite(); ISelectionProvider selectionProvider = site.getSelectionProvider();
if (site != null) { if (selectionProvider != null) {
ISelectionProvider selectionProvider = site.getSelectionProvider(); ISelection selection = selectionProvider.getSelection();
if (selectionProvider != null) { enabled = fTargetElement.isSuspended()
ISelection selection = selectionProvider.getSelection(); && fPartTarget.canMoveToLine(fActivePart, selection, fTargetElement);
enabled = fTargetElement.isSuspended()
&& fPartTarget.canMoveToLine(fActivePart, selection, fTargetElement);
}
} }
} }
fAction.setEnabled(enabled);
} }
fAction.setEnabled(enabled);
}; };
CDebugUIPlugin.getStandardDisplay().asyncExec(r); CDebugUIPlugin.getStandardDisplay().asyncExec(r);
} }

View file

@ -67,14 +67,11 @@ 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 try {
public void run() { moveToLine.moveToLine(path.toPortableString(), lineNumber);
try { } catch (DebugException e) {
moveToLine.moveToLine(path.toPortableString(), lineNumber); failed(e);
} catch (DebugException 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,16 +55,12 @@ 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(), () -> {
try {
@Override doAction(getCastToType());
public void run() { setStatus(null);
try { } catch (DebugException e) {
doAction(getCastToType()); setStatus(e.getStatus());
setStatus(null);
} catch (DebugException e) {
setStatus(e.getStatus());
}
} }
}); });
if (getStatus() != null && !getStatus().isOK()) { if (getStatus() != null && !getStatus().isOK()) {

View file

@ -119,23 +119,20 @@ public class ResumeAtLineActionDelegate implements IEditorActionDelegate, IActio
if (fAction == null) { if (fAction == null) {
return; return;
} }
Runnable r = new Runnable() { Runnable r = () -> {
@Override boolean enabled = false;
public void run() { if (fPartTarget != null && fTargetElement != null) {
boolean enabled = false; IWorkbenchPartSite site = fActivePart.getSite();
if (fPartTarget != null && fTargetElement != null) { if (site != null) {
IWorkbenchPartSite site = fActivePart.getSite(); ISelectionProvider selectionProvider = site.getSelectionProvider();
if (site != null) { if (selectionProvider != null) {
ISelectionProvider selectionProvider = site.getSelectionProvider(); ISelection selection = selectionProvider.getSelection();
if (selectionProvider != null) { enabled = fTargetElement.isSuspended()
ISelection selection = selectionProvider.getSelection(); && fPartTarget.canResumeAtLine(fActivePart, selection, fTargetElement);
enabled = fTargetElement.isSuspended()
&& fPartTarget.canResumeAtLine(fActivePart, selection, fTargetElement);
}
} }
} }
fAction.setEnabled(enabled);
} }
fAction.setEnabled(enabled);
}; };
CDebugUIPlugin.getStandardDisplay().asyncExec(r); CDebugUIPlugin.getStandardDisplay().asyncExec(r);
} }

View file

@ -67,14 +67,11 @@ 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 try {
public void run() { resumeAtLine.resumeAtLine(path.toPortableString(), lineNumber);
try { } catch (DebugException e) {
resumeAtLine.resumeAtLine(path.toPortableString(), lineNumber); failed(e);
} catch (DebugException e) {
failed(e);
}
} }
}; };
runInBackground(r); runInBackground(r);

View file

@ -70,17 +70,13 @@ 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 = () -> {
try {
@Override runToLine.runToLine(path.toPortableString(), lineNumber,
public void run() { DebugUITools.getPreferenceStore().getBoolean(
try { IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE));
runToLine.runToLine(path.toPortableString(), lineNumber, } catch (DebugException e) {
DebugUITools.getPreferenceStore().getBoolean( failed(e);
IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE));
} catch (DebugException e) {
failed(e);
}
} }
}; };
runInBackground(r); runInBackground(r);

View file

@ -68,17 +68,14 @@ 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 String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
public void run() { getPreferenceStore().setValue(key, getValue());
String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$ CDebugUIPlugin.getDefault().savePluginPreferences();
getPreferenceStore().setValue(key, getValue());
CDebugUIPlugin.getDefault().savePluginPreferences();
// 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,15 +43,11 @@ 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(), () -> {
try {
@Override doAction(getSignal());
public void run() { } catch (DebugException e) {
try { ms.merge(e.getStatus());
doAction(getSignal());
} catch (DebugException e) {
ms.merge(e.getStatus());
}
} }
}); });
if (!ms.isOK()) { if (!ms.isOK()) {

View file

@ -50,38 +50,30 @@ 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(() -> {
try {
@Override Boolean enabled = (Boolean) attributes.get(IBreakpoint.ENABLED);
public void run() { breakpoint.setEnabled((enabled != null) ? enabled.booleanValue() : false);
try { Integer ignoreCount = (Integer) attributes.get(ICBreakpoint.IGNORE_COUNT);
Boolean enabled = (Boolean) attributes.get(IBreakpoint.ENABLED); ((ICBreakpoint) breakpoint).setIgnoreCount((ignoreCount != null) ? ignoreCount.intValue() : 0);
breakpoint.setEnabled((enabled != null) ? enabled.booleanValue() : false); String condition = (String) attributes.get(ICBreakpoint.CONDITION);
Integer ignoreCount = (Integer) attributes.get(ICBreakpoint.IGNORE_COUNT); ((ICBreakpoint) breakpoint).setCondition((condition != null) ? condition : ""); //$NON-NLS-1$
((ICBreakpoint) breakpoint).setIgnoreCount((ignoreCount != null) ? ignoreCount.intValue() : 0); } catch (CoreException e) {
String condition = (String) attributes.get(ICBreakpoint.CONDITION); CDebugUIPlugin.log(e.getStatus());
((ICBreakpoint) breakpoint).setCondition((condition != null) ? condition : ""); //$NON-NLS-1$
} catch (CoreException e) {
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(() -> {
for (int i = 0; i < breakpoints.length; ++i) {
@Override try {
public void run() { if (((ICBreakpoint) breakpoints[i]).decrementInstallCount() == 0)
for (int i = 0; i < breakpoints.length; ++i) { DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(breakpoints[i]);
try { } catch (CoreException e) {
if (((ICBreakpoint) breakpoints[i]).decrementInstallCount() == 0) // ensureMarker throws this exception
DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(breakpoints[i]); // if breakpoint has already been deleted
} catch (CoreException e) {
// ensureMarker throws this exception
// 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,12 +617,9 @@ 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 if (isOkToUse(fTableControl)) {
public void run() { selectElements(selection);
if (isOkToUse(fTableControl)) {
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 fActiveContext = event.getContext();
public void run() { fire(event);
fActiveContext = event.getContext();
fire(event);
}
}); });
} }
} }

View file

@ -328,20 +328,16 @@ 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(), () -> {
// Refresh interested views
@Override IWorkbenchWindow[] windows = CDebugUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
public void run() { IWorkbenchPage page = null;
// Refresh interested views for (int i = 0; i < windows.length; i++) {
IWorkbenchWindow[] windows = CDebugUIPlugin.getDefault().getWorkbench().getWorkbenchWindows(); page = windows[i].getActivePage();
IWorkbenchPage page = null; if (page != null) {
for (int i = 0; i < windows.length; i++) { refreshViews(page, IDebugUIConstants.ID_EXPRESSION_VIEW);
page = windows[i].getActivePage(); refreshViews(page, IDebugUIConstants.ID_VARIABLE_VIEW);
if (page != null) { refreshViews(page, IDebugUIConstants.ID_REGISTER_VIEW);
refreshViews(page, IDebugUIConstants.ID_EXPRESSION_VIEW);
refreshViews(page, IDebugUIConstants.ID_VARIABLE_VIEW);
refreshViews(page, IDebugUIConstants.ID_REGISTER_VIEW);
}
} }
} }
}); });

View file

@ -89,14 +89,11 @@ 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 try {
public void run() { module.setSymbolsFileName(path);
try { } catch (DebugException e) {
module.setSymbolsFileName(path); failed(PropertyPageMessages.getString("ModulePropertyPage.15"), e); //$NON-NLS-1$
} catch (DebugException e) {
failed(PropertyPageMessages.getString("ModulePropertyPage.15"), e); //$NON-NLS-1$
}
} }
}); });
} }

View file

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

View file

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

View file

@ -123,26 +123,23 @@ 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 if (isSuccess()) {
public void run() { String[] memorySpaces = getMemorySpaces();
if (isSuccess()) {
String[] memorySpaces = getMemorySpaces();
// We shouldn't be using the custom dialog // We shouldn't be using the custom dialog
// if there are none or only one memory // if there are none or only one memory
// spaces involved. // spaces involved.
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=309032#c50 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=309032#c50
if (memorySpaces.length >= 2) { if (memorySpaces.length >= 2) {
doAddMemoryBlocks(renderingSite, context, msRetrieval, memorySpaces); doAddMemoryBlocks(renderingSite, context, msRetrieval, memorySpaces);
return; return;
}
} }
// If we get here, then the custom dialog isn't
// necessary. Use the standard (platform) one
invokePlatformAction(renderingSite);
} }
// If we get here, then the custom dialog isn't
// necessary. Use the standard (platform) one
invokePlatformAction(renderingSite);
}); });
} }
}); });

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-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() { // Execute a refresh after any pending UI updates.
@Override m_modelChangedListener = (delta, proxy) -> GUIUtils.exec(() -> updateDebugContext());
public void modelChanged(IModelDelta delta, IModelProxy proxy) { m_debugViewSelectionChangedListener = event -> GUIUtils
// Execute a refresh after any pending UI updates. .exec(() -> updateCanvasSelectionFromDebugView());
GUIUtils.exec(new Runnable() {
@Override
public void run() {
// check if we need to update the debug context
updateDebugContext();
}
});
}
};
m_debugViewSelectionChangedListener = new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
// Execute a refresh after any pending UI updates.
GUIUtils.exec(new Runnable() {
@Override
public void run() {
// Update canvas selection to match to dbg view selection
updateCanvasSelectionFromDebugView();
}
});
}
};
m_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 if (m_canvas != null) {
public void run() { m_canvas.setModel(model_f);
if (m_canvas != null) { // Update the canvas's selection from the current workbench selection.
m_canvas.setModel(model_f); updateCanvasSelectionInternal();
// 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. */
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,12 +335,9 @@ 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 if (m_updateTimer != null) {
public void run() { m_updateTimer.start();
if (m_updateTimer != null) {
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 = () -> {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
@Override if (parent != null)
public void run() { MessageDialog.openError(parent, Messages.GdbStatusHandler_Error, status.getMessage());
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
if (parent != null)
MessageDialog.openError(parent, Messages.GdbStatusHandler_Error, status.getMessage());
}
}; };
} else if (status.getSeverity() == IStatus.WARNING) { } else if (status.getSeverity() == IStatus.WARNING) {
runnable = new Runnable() { runnable = () -> {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
@Override if (parent != null)
public void run() { MessageDialog.openWarning(parent, Messages.GdbStatusHandler_Warning, status.getMessage());
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
if (parent != null)
MessageDialog.openWarning(parent, Messages.GdbStatusHandler_Warning, status.getMessage());
}
}; };
} else if (status.getSeverity() == IStatus.INFO) { } else if (status.getSeverity() == IStatus.INFO) {
runnable = new Runnable() { runnable = () -> {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
@Override if (parent != null)
public void run() { MessageDialog.openInformation(parent, Messages.GdbStatusHandler_Information, status.getMessage());
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
if (parent != null)
MessageDialog.openInformation(parent, Messages.GdbStatusHandler_Information,
status.getMessage());
}
}; };
} }
if (runnable != null) if (runnable != null)

View file

@ -212,23 +212,20 @@ 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 // Check that the session is still active when the timeout hits.
public void run() { // If it is not, then everything has been cleaned up already.
// Check that the session is still active when the timeout hits. if (DsfSession.isSessionActive(fSession.getId())) {
// If it is not, then everything has been cleaned up already. DsfSession.removeSessionEndedListener(endedListener);
if (DsfSession.isSessionActive(fSession.getId())) {
DsfSession.removeSessionEndedListener(endedListener);
// Marking the request as cancelled will prevent the removal of // Marking the request as cancelled will prevent the removal of
// the launch from the Debug view in case of "Terminate and Remove". // the launch from the Debug view in case of "Terminate and Remove".
// This is important for multi-process sessions when "Terminate and Remove" // This is important for multi-process sessions when "Terminate and Remove"
// is applied to one of the running processes. In this case the selected // is applied to one of the running processes. In this case the selected
// process will be terminated but the associated launch will not be removed // process will be terminated but the associated launch will not be removed
// from the Debug view. // from the Debug view.
request.setStatus(Status.CANCEL_STATUS); request.setStatus(Status.CANCEL_STATUS);
request.done(); request.done();
}
} }
}, 1, TimeUnit.MINUTES); }, 1, TimeUnit.MINUTES);
} }

View file

@ -161,23 +161,20 @@ 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 // Check that the session is still active when the timeout hits.
public void run() { // If it is not, then everything has been cleaned up already.
// Check that the session is still active when the timeout hits. if (DsfSession.isSessionActive(fSession.getId())) {
// If it is not, then everything has been cleaned up already. DsfSession.removeSessionEndedListener(endedListener);
if (DsfSession.isSessionActive(fSession.getId())) {
DsfSession.removeSessionEndedListener(endedListener);
// Marking the request as cancelled will prevent the removal of // Marking the request as cancelled will prevent the removal of
// the launch from the Debug view in case of "Terminate and Remove". // the launch from the Debug view in case of "Terminate and Remove".
// This is important for multi-process sessions when "Terminate and Remove" // This is important for multi-process sessions when "Terminate and Remove"
// is applied to one of the running processes. In this case the selected // is applied to one of the running processes. In this case the selected
// process will be terminated but the associated launch will not be removed // process will be terminated but the associated launch will not be removed
// from the Debug view. // from the Debug view.
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,17 +175,14 @@ 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 if (fTerminalControl != null && !fTerminalControl.isDisposed()) {
public void run() { fTerminalControl.clearTerminal();
if (fTerminalControl != null && !fTerminalControl.isDisposed()) { fTerminalControl.connectTerminal();
fTerminalControl.clearTerminal();
fTerminalControl.connectTerminal();
// The actual terminal widget initializes its defaults in the line above, // The actual terminal widget initializes its defaults in the line above,
// lets override them with our application defaults right after. // lets override them with our application defaults right after.
setDefaults(); setDefaults();
}
} }
}); });
} }

View file

@ -42,15 +42,12 @@ public interface IGDBDebuggerConsole extends IDebuggerConsole {
} }
} }
session.getExecutor().execute(new Runnable() { session.getExecutor().execute(() -> {
@Override DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
public void run() { IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class);
DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId()); tracker.dispose();
IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class); if (gdbSync != null) {
tracker.dispose(); gdbSync.sessionSelected();
if (gdbSync != null) {
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 if (!c.isDisposed())
public void run() { fUIListener.update();
if (!c.isDisposed())
fUIListener.update();
}
}); });
} }

View file

@ -64,23 +64,19 @@ 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() { IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class);
DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), tracker.dispose();
eventSessionId);
IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class);
tracker.dispose();
if (gdbSync != null) { if (gdbSync != null) {
gdbSync.setFocus(new IDMContext[] { dmc }, new ImmediateRequestMonitor() { gdbSync.setFocus(new IDMContext[] { dmc }, new ImmediateRequestMonitor() {
@Override @Override
protected void handleFailure() { protected void handleFailure() {
// do not set error - it's normal in some cases to fail to switch thread // do not set error - it's normal in some cases to fail to switch thread
// for example in a remote session with the inferior running and in all-stop mode // for example in a remote session with the inferior running and in all-stop mode
} }
}); });
}
} }
}); });
} }

View file

@ -72,12 +72,9 @@ 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 if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
public void debugContextChanged(DebugContextEvent event) { updateDebugContext();
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
updateDebugContext();
}
} }
}; };
@ -461,13 +458,10 @@ 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 if (v != null) {
public void run() { v.fLastRefreshTime = System.currentTimeMillis();
if (v != null) { v.updateUI(data);
v.fLastRefreshTime = System.currentTimeMillis();
v.updateUI(data);
}
} }
}); });
} }
@ -476,12 +470,9 @@ 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 if (v != null) {
public void run() { v.updateUI(message);
if (v != null) {
v.updateUI(message);
}
} }
}); });
} }

View file

@ -119,28 +119,25 @@ 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 final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
public void run() { if (expressionService != null) {
final IExpressions expressionService = getServicesTracker().getService(IExpressions.class); final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(
if (expressionService != null) { getSession().getExecutor(), null) {
final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>( @Override
getSession().getExecutor(), null) { public void handleCompleted() {
@Override if (isSuccess()) {
public void handleCompleted() { request.setSize(getData().getSize());
if (isSuccess()) {
request.setSize(getData().getSize());
}
request.setStatus(getStatus());
request.done();
} }
}; request.setStatus(getStatus());
request.done();
}
};
expressionService.getExpressionAddressData(exprDmc, drm); expressionService.getExpressionAddressData(exprDmc, drm);
} else { } else {
request.setStatus(internalError()); request.setStatus(internalError());
request.done(); request.done();
}
} }
}); });
} else { } else {
@ -161,28 +158,25 @@ 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 final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
public void run() { if (expressionService != null) {
final IExpressions expressionService = getServicesTracker().getService(IExpressions.class); final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(
if (expressionService != null) { getSession().getExecutor(), null) {
final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>( @Override
getSession().getExecutor(), null) { public void handleCompleted() {
@Override if (isSuccess()) {
public void handleCompleted() { request.setCanCreate(getData().getSize() > 0);
if (isSuccess()) {
request.setCanCreate(getData().getSize() > 0);
}
request.setStatus(getStatus());
request.done();
} }
}; request.setStatus(getStatus());
request.done();
}
};
expressionService.getExpressionAddressData(exprDmc, drm); expressionService.getExpressionAddressData(exprDmc, drm);
} else { } else {
request.setStatus(internalError()); request.setStatus(internalError());
request.done(); request.done();
}
} }
}); });
} else { } else {

View file

@ -53,65 +53,60 @@ 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 IDMContext ctx = event.getDMContext();
public void run() {
IDMContext ctx = event.getDMContext();
// Is IGDBFocusChangedEvent pertinent for this VMNode? // Is IGDBFocusChangedEvent pertinent for this VMNode?
if (ctx instanceof IFrameDMContext) { if (ctx instanceof IFrameDMContext) {
IFrameDMContext newFrameFocus = (IFrameDMContext) ctx; IFrameDMContext newFrameFocus = (IFrameDMContext) ctx;
IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(newFrameFocus, IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(newFrameFocus,
IMIExecutionDMContext.class); IMIExecutionDMContext.class);
if (execDmc == null) { if (execDmc == null) {
rm.done(); rm.done();
return; return;
} }
IRunControl runControl = getServicesTracker().getService(IRunControl.class); IRunControl runControl = getServicesTracker().getService(IRunControl.class);
if (runControl == null) { if (runControl == null) {
// Required services have not initialized yet. Ignore the event. // Required services have not initialized yet. Ignore the event.
rm.done(); rm.done();
return; return;
} }
if (runControl.isSuspended(execDmc) || runControl.isStepping(execDmc)) { if (runControl.isSuspended(execDmc) || runControl.isStepping(execDmc)) {
// find the VMC index for the frame that switched, so we can select it correctly. // find the VMC index for the frame that switched, so we can select it correctly.
getVMCIndexForDmc(GdbStackFramesVMNode.this, newFrameFocus, parentDelta, getVMCIndexForDmc(GdbStackFramesVMNode.this, newFrameFocus, parentDelta,
new DataRequestMonitor<Integer>(getExecutor(), rm) { new DataRequestMonitor<Integer>(getExecutor(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
// change to frameOffset // change to frameOffset
final int frameOffset = getData(); final int frameOffset = getData();
// 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), frameOffset,
parentDelta.addNode(data.get(frameOffset), IModelDelta.SELECT | IModelDelta.FORCE);
frameOffset,
IModelDelta.SELECT | IModelDelta.FORCE);
}
rm.done();
} }
})); rm.done();
} }
}); }));
} else { }
// thread is running - no delta to produce for the stack frame node });
rm.done();
}
} else { } else {
// context not a frame - nothing to do here // thread is running - no delta to produce for the stack frame node
rm.done(); rm.done();
} }
} else {
// context not a frame - nothing to do here
rm.done();
} }
}); });
} }

View file

@ -613,24 +613,21 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
}; };
startGdbJob.schedule(); startGdbJob.schedule();
fGDBLaunchMonitor.fTimeoutFuture = getExecutor().schedule(new Runnable() { fGDBLaunchMonitor.fTimeoutFuture = getExecutor().schedule(() -> {
@Override // Only process the event if we have not finished yet (hit
public void run() { // the breakpoint).
// Only process the event if we have not finished yet (hit if (!fGDBLaunchMonitor.fLaunched) {
// the breakpoint). fGDBLaunchMonitor.fTimedOut = true;
if (!fGDBLaunchMonitor.fLaunched) { Thread jobThread = startGdbJob.getThread();
fGDBLaunchMonitor.fTimedOut = true; if (jobThread != null) {
Thread jobThread = startGdbJob.getThread(); jobThread.interrupt();
if (jobThread != null) {
jobThread.interrupt();
}
destroy();
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
DebugException.TARGET_REQUEST_FAILED, "Timed out trying to launch GDB.", null)); //$NON-NLS-1$
requestMonitor.done();
} }
destroy();
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
DebugException.TARGET_REQUEST_FAILED, "Timed out trying to launch GDB.", null)); //$NON-NLS-1$
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,49 +718,44 @@ 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 fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile),
public void run() { new ImmediateDataRequestMonitor<MIInfo>(rm) {
fCommandControl.queueCommand( @Override
fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile), protected void handleCompleted() {
new ImmediateDataRequestMonitor<MIInfo>(rm) { if (!isSuccess()) {
@Override fLoadRequestOngoing = false;
protected void handleCompleted() { rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
if (!isSuccess()) { "Can't get load info for CPU", null)); //$NON-NLS-1$
fLoadRequestOngoing = false; return;
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, }
INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
return;
}
// Success - parse the second set of stat counters and compute loads // Success - parse the second set of stat counters and compute loads
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;
} }
// delete temp file // delete temp file
new File(localFile).delete(); new File(localFile).delete();
// Compute load // Compute load
fCachedLoads = procStatParser.getCpuLoad(); fCachedLoads = procStatParser.getCpuLoad();
processLoads(context, rm, fCachedLoads); processLoads(context, rm, fCachedLoads);
// 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 for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e : fLoadInfoRequestCache
.entrySet()) { .entrySet()) {
processLoads(e.getKey(), e.getValue(), fCachedLoads); processLoads(e.getKey(), e.getValue(), fCachedLoads);
} }
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,29 +771,26 @@ 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 try {
public void run() { procStatParser.parseStatFile(statFile);
try { } catch (Exception e1) {
procStatParser.parseStatFile(statFile); rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
} catch (Exception e) { "Can't get load info for CPU", null)); //$NON-NLS-1$
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
"Can't get load info for CPU", null)); //$NON-NLS-1$
fLoadRequestOngoing = false;
return;
}
// compute load
fCachedLoads = procStatParser.getCpuLoad();
processLoads(context, rm, fCachedLoads);
// done with request
fLoadRequestOngoing = false; fLoadRequestOngoing = false;
// process any queued request return;
for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e : fLoadInfoRequestCache.entrySet()) {
processLoads(e.getKey(), e.getValue(), fCachedLoads);
}
fLoadInfoRequestCache.clear();
} }
// compute load
fCachedLoads = procStatParser.getCpuLoad();
processLoads(context, rm, fCachedLoads);
// done with request
fLoadRequestOngoing = false;
// process any queued request
for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e2 : fLoadInfoRequestCache.entrySet()) {
processLoads(e2.getKey(), e2.getValue(), fCachedLoads);
}
fLoadInfoRequestCache.clear();
}, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS); }, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
} }
} }

View file

@ -553,36 +553,32 @@ 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 if (restart) {
public void run() { // For a restart, remove the old inferior
if (restart) { IProcess[] launchProcesses = launch.getProcesses();
// For a restart, remove the old inferior for (IProcess p : launchProcesses) {
IProcess[] launchProcesses = launch.getProcesses(); // We know there is only one inferior, so just find it.
for (IProcess p : launchProcesses) { if (p instanceof InferiorRuntimeProcess) {
// We know there is only one inferior, so just find it. launch.removeProcess(p);
if (p instanceof InferiorRuntimeProcess) { break;
launch.removeProcess(p);
break;
}
} }
} }
// Add the inferior
// Need to go through DebugPlugin.newProcess so that we can use
// the overrideable process factory to allow others to override.
// First set attribute to specify we want to create an inferior process.
// Bug 210366
Map<String, String> attributes = new HashMap<>();
attributes.put(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR,
IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE);
IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label, attributes);
// Now set the inferior groupId
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR,
MIProcesses.UNIQUE_GROUP_ID);
rm.done();
} }
// Add the inferior
// Need to go through DebugPlugin.newProcess so that we can use
// the overrideable process factory to allow others to override.
// First set attribute to specify we want to create an inferior process.
// Bug 210366
Map<String, String> attributes = new HashMap<>();
attributes.put(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR,
IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE);
IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label, attributes);
// Now set the inferior groupId
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, MIProcesses.UNIQUE_GROUP_ID);
rm.done();
}); });
} }
}); });

View file

@ -1849,23 +1849,20 @@ 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 // Add the inferior
public void run() { // Need to go through DebugPlugin.newProcess so that we can use
// Add the inferior // the overrideable process factory to allow others to override.
// Need to go through DebugPlugin.newProcess so that we can use // First set attribute to specify we want to create an inferior process.
// the overrideable process factory to allow others to override. // Bug 210366
// First set attribute to specify we want to create an inferior process. ILaunch launch = (ILaunch) getSession().getModelAdapter(ILaunch.class);
// Bug 210366 Map<String, String> attributes = new HashMap<>();
ILaunch launch = (ILaunch) getSession().getModelAdapter(ILaunch.class); attributes.put(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR,
Map<String, String> attributes = new HashMap<>(); IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE);
attributes.put(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR, IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label != null ? label : "", //$NON-NLS-1$
IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE); attributes);
IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label != null ? label : "", //$NON-NLS-1$ // Now set the inferior groupId
attributes); runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, groupId);
// Now set the inferior groupId
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, groupId);
}
}); });
} }

View file

@ -804,12 +804,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
// the number of frames collected. Having a small interval of // 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,19 +1761,16 @@ 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 // For every platform breakpoint that has at least one target breakpoint installed
public void run(IProgressMonitor monitor) throws CoreException { // we must decrement the install count, for every target breakpoint.
// For every platform breakpoint that has at least one target breakpoint installed // Note that we cannot simply call resetInstallCount() because another
// we must decrement the install count, for every target breakpoint. // launch may be using the same platform breakpoint.
// Note that we cannot simply call resetInstallCount() because another Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpoints = fPlatformToBPsMaps.get(ctx);
// launch may be using the same platform breakpoint. for (ICBreakpoint breakpoint : breakpoints.keySet()) {
Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpoints = fPlatformToBPsMaps.get(ctx); Vector<IBreakpointDMContext> targetBps = breakpoints.get(breakpoint);
for (ICBreakpoint breakpoint : breakpoints.keySet()) { for (IBreakpointDMContext targetBp : targetBps) {
Vector<IBreakpointDMContext> targetBps = breakpoints.get(breakpoint); decrementInstallCount(targetBp, breakpoint, new RequestMonitor(getExecutor(), null));
for (IBreakpointDMContext targetBp : targetBps) {
decrementInstallCount(targetBp, breakpoint, new RequestMonitor(getExecutor(), null));
}
} }
} }
}; };

View file

@ -52,24 +52,20 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
} }
public static void startup() { public static void startup() {
Runnable r = new Runnable() { Runnable r = () -> {
if (fgManager == null) {
@Override // FindBugs reported that it is unsafe to set s_resources
public void run() { // before we finish to initialize the object, because of
if (fgManager == null) { // multi-threading. This is why we use a temporary variable.
// FindBugs reported that it is unsafe to set s_resources EvaluationContextManager manager = new EvaluationContextManager();
// before we finish to initialize the object, because of IWorkbench workbench = PlatformUI.getWorkbench();
// multi-threading. This is why we use a temporary variable. IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
EvaluationContextManager manager = new EvaluationContextManager(); for (int i = 0; i < windows.length; i++) {
IWorkbench workbench = PlatformUI.getWorkbench(); manager.windowOpened(windows[i]);
IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
for (int i = 0; i < windows.length; i++) {
manager.windowOpened(windows[i]);
}
workbench.addWindowListener(manager);
fgManager = manager;
} }
workbench.addWindowListener(manager);
fgManager = manager;
} }
}; };
Display display = Display.getCurrent(); Display display = Display.getCurrent();

View file

@ -400,18 +400,15 @@ 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 if (!fViewer.getTree().isDisposed()) {
public void run() { TreeSelection selection = (TreeSelection) fViewer.getSelection();
if (!fViewer.getTree().isDisposed()) { if (selection.isEmpty()) {
TreeSelection selection = (TreeSelection) fViewer.getSelection(); selection = new TreeSelection(fViewer.getTopElementPath());
if (selection.isEmpty()) { }
selection = new TreeSelection(fViewer.getTopElementPath()); fViewer.setSelection(selection);
} if (fDetailPane != null) {
fViewer.setSelection(selection); fDetailPane.display(selection);
if (fDetailPane != null) {
fDetailPane.display(selection);
}
} }
} }
}); });

View file

@ -963,14 +963,11 @@ 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 Shell parent = DsfUIPlugin.getActiveWorkbenchShell();
public void run() { if (parent != null) {
Shell parent = DsfUIPlugin.getActiveWorkbenchShell(); MessageDialog.openInformation(parent, Messages.Information,
if (parent != null) { Messages.RegisterGroupInfo + ": " + message); //$NON-NLS-1$
MessageDialog.openInformation(parent, Messages.Information,
Messages.RegisterGroupInfo + ": " + message); //$NON-NLS-1$
}
} }
}; };

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,17 +382,14 @@ 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 if (address.getSize() * 8 != fCallback.getAddressSize()) {
public void run() { fCallback.addressSizeChanged(address.getSize() * 8);
if (address.getSize() * 8 != fCallback.getAddressSize()) { }
fCallback.addressSizeChanged(address.getSize() * 8); if (frame == 0) {
} fCallback.updatePC(addressValue);
if (frame == 0) { } else {
fCallback.updatePC(addressValue); fCallback.gotoFrame(frame, addressValue);
} else {
fCallback.gotoFrame(frame, addressValue);
}
} }
}); });
} else { } else {
@ -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,152 +558,98 @@ 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() {
final BigInteger finalStartAddress = getData(); final BigInteger finalStartAddress = getData();
if (mixed) { if (mixed) {
final DataRequestMonitor<IMixedInstruction[]> disassemblyRequest = new DataRequestMonitor<IMixedInstruction[]>( final DataRequestMonitor<IMixedInstruction[]> disassemblyRequest = new DataRequestMonitor<IMixedInstruction[]>(
executor, null) { executor, null) {
@Override @Override
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, // retry in non-mixed mode
showSymbols, showDisassembly)) { fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress, linesHint,
// retry in non-mixed mode false, true);
fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress,
linesHint, false, true);
}
}
});
} else {
final IStatus status = getStatus();
if (status != null && !status.isOK()) {
if (file != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.retrieveDisassembly(finalStartAddress,
finalEndAddress, linesHint, true, true);
}
});
} else {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
status.getMessage());
}
});
}
});
}
}
fCallback.setUpdatePending(false);
}
}
};
if (file != null) {
executor.execute(new Runnable() {
@Override
public void run() {
final IDisassembly disassembly = fServicesTracker
.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
disassembly.getMixedInstructions(context, file, lineNumber, lines * 2,
disassemblyRequest);
} }
}); });
} else { } else {
executor.execute(new Runnable() { final IStatus status = getStatus();
@Override if (status != null && !status.isOK()) {
public void run() { if (file != null) {
final IDisassembly disassembly = fServicesTracker fCallback.asyncExec(() -> fCallback.retrieveDisassembly(finalStartAddress,
.getService(IDisassembly.class); finalEndAddress, linesHint, true, true));
if (disassembly == null) { } else {
disassemblyRequest.cancel(); fCallback.asyncExec(() -> fCallback.doScrollLocked(
disassemblyRequest.done(); () -> fCallback.insertError(finalStartAddress, status.getMessage())));
return; }
} }
disassembly.getMixedInstructions(context, finalStartAddress, finalEndAddress, fCallback.setUpdatePending(false);
disassemblyRequest); }
}
};
if (file != null) {
executor.execute(() -> {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
disassembly.getMixedInstructions(context, file, lineNumber, lines * 2, disassemblyRequest);
});
} else {
executor.execute(() -> {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
disassembly.getMixedInstructions(context, finalStartAddress, finalEndAddress,
disassemblyRequest);
});
}
} else {
final DataRequestMonitor<IInstruction[]> disassemblyRequest = new DataRequestMonitor<IInstruction[]>(
executor, null) {
@Override
public void handleCompleted() {
if (!isCanceled() && getData() != null) {
fCallback.asyncExec(() -> {
if (!insertDisassembly(finalStartAddress, finalEndAddress, getData(), showSymbols,
showDisassembly)) {
fCallback.doScrollLocked(() -> fCallback.insertError(finalStartAddress,
DisassemblyMessages.DisassemblyBackendDsf_error_UnableToRetrieveData));
} }
}); });
} else {
final IStatus status = getStatus();
if (status != null && !status.isOK()) {
fCallback.asyncExec(() -> fCallback.doScrollLocked(
() -> fCallback.insertError(finalStartAddress, status.getMessage())));
}
fCallback.setUpdatePending(false);
} }
} else {
final DataRequestMonitor<IInstruction[]> disassemblyRequest = new DataRequestMonitor<IInstruction[]>(
executor, null) {
@Override
public void handleCompleted() {
if (!isCanceled() && getData() != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
if (!insertDisassembly(finalStartAddress, finalEndAddress, getData(),
showSymbols, showDisassembly)) {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
DisassemblyMessages.DisassemblyBackendDsf_error_UnableToRetrieveData);
}
});
}
}
});
} else {
final IStatus status = getStatus();
if (status != null && !status.isOK()) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
fCallback.insertError(finalStartAddress,
status.getMessage());
}
});
}
});
}
fCallback.setUpdatePending(false);
}
}
};
executor.execute(new Runnable() {
@Override
public void run() {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
disassembly.getInstructions(context, finalStartAddress, finalEndAddress,
disassemblyRequest);
}
});
} }
} };
}); executor.execute(() -> {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
disassembly.getInstructions(context, finalStartAddress, finalEndAddress, 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,13 +1114,10 @@ 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(null, endAddress, data, showSymbols, showDisassembly)) {
public void run() { // retry in non-mixed mode
if (!insertDisassembly(null, endAddress, data, showSymbols, showDisassembly)) { retrieveDisassembly(file, lines, endAddress, false, showSymbols, showDisassembly);
// retry in non-mixed mode
retrieveDisassembly(file, lines, endAddress, false, showSymbols, showDisassembly);
}
} }
}); });
} else { } else {
@ -1211,17 +1131,14 @@ 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 final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
public void run() { if (disassembly == null) {
final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class); disassemblyRequest.cancel();
if (disassembly == null) { disassemblyRequest.done();
disassemblyRequest.cancel(); return;
disassemblyRequest.done();
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,25 +771,17 @@ public abstract class DisassemblyPart extends WorkbenchPart
hookContextMenu(); hookContextMenu();
contributeToActionBars(); contributeToActionBars();
fViewer.getTextWidget().addVerifyKeyListener(new VerifyKeyListener() { fViewer.getTextWidget().addVerifyKeyListener(event -> {
@Override switch (event.keyCode) {
public void verifyKey(VerifyEvent event) { case SWT.PAGE_UP:
switch (event.keyCode) { case SWT.PAGE_DOWN:
case SWT.PAGE_UP: case SWT.ARROW_UP:
case SWT.PAGE_DOWN: case SWT.ARROW_DOWN:
case SWT.ARROW_UP: event.doit = !keyScroll(event.keyCode);
case SWT.ARROW_DOWN:
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,12 +817,9 @@ 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 if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
public void debugContextChanged(DebugContextEvent event) { updateDebugContext();
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
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 fGotoFramePending = false;
public void run() { fGotoAddressPending = PC_UNKNOWN;
fGotoFramePending = false; gotoAddress(addr);
fGotoAddressPending = PC_UNKNOWN;
gotoAddress(addr);
}
}); });
} }
} }
@ -1560,15 +1527,12 @@ 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 if (updateCount == fUpdateCount) {
public void run() { assert fUpdatePending;
if (updateCount == fUpdateCount) { if (fUpdatePending) {
assert fUpdatePending; fUpdatePending = false;
if (fUpdatePending) { updateVisibleArea();
fUpdatePending = false;
updateVisibleArea();
}
} }
} }
}); });
@ -1767,13 +1731,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
if (fDebugSessionId == null) { if (fDebugSessionId == null) {
return; return;
} }
startUpdate(new Runnable() { startUpdate(() -> {
@Override if (DEBUG)
public void run() { System.out.println("retrieveDisassembly " + file); //$NON-NLS-1$
if (DEBUG) fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
System.out.println("retrieveDisassembly " + file); //$NON-NLS-1$
fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
}
}); });
} }
@ -2002,12 +1963,7 @@ public abstract class DisassemblyPart extends WorkbenchPart
prevBackend.dispose(); prevBackend.dispose();
} }
if (needUpdate && fViewer != null) { if (needUpdate && fViewer != null) {
startUpdate(new Runnable() { startUpdate(() -> debugContextChanged());
@Override
public void run() {
debugContextChanged();
}
});
} }
} }
@ -2107,45 +2063,37 @@ 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 fRefreshViewPending = false;
public void run() { long now = System.currentTimeMillis();
fRefreshViewPending = false; if (now >= refreshViewScheduled) {
long now = System.currentTimeMillis(); if (DEBUG)
if (now >= refreshViewScheduled) { System.err.println("*** refreshing view ***"); //$NON-NLS-1$
if (DEBUG)
System.err.println("*** refreshing view ***"); //$NON-NLS-1$
// save viewport position and frame info // save viewport position and frame info
BigInteger topAddress = getTopAddress(); BigInteger topAddress = getTopAddress();
int targetFrame = fTargetFrame; int targetFrame = fTargetFrame;
BigInteger frameAddress = fFrameAddress; BigInteger frameAddress = fFrameAddress;
BigInteger pcAddress = fPCAddress; BigInteger pcAddress = fPCAddress;
// clear viewer // clear viewer
resetViewer(); resetViewer();
if (fScrollPos != null) { if (fScrollPos != null) {
fScrollPos.isDeleted = true; fScrollPos.isDeleted = true;
}
// restore frame info and viewport
fPCAnnotationUpdatePending = true;
fTargetFrame = targetFrame;
fFrameAddress = frameAddress;
fPCAddress = pcAddress;
gotoAddress(topAddress);
} else {
refreshView((int) (refreshViewScheduled - now));
} }
// restore frame info and viewport
fPCAnnotationUpdatePending = true;
fTargetFrame = targetFrame;
fFrameAddress = frameAddress;
fPCAddress = pcAddress;
gotoAddress(topAddress);
} else {
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 doPending();
public void run() { fDoPendingPosted = false;
doPending();
fDoPendingPosted = false;
}
}); });
} }
} }
@ -2678,12 +2623,9 @@ 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 if (updateCount == fUpdateCount) {
public void run() { doScrollLocked(null);
if (updateCount == fUpdateCount) {
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 updatePC(PC_UNKNOWN);
public void run() { firePropertyChange(PROP_SUSPENDED);
updatePC(PC_UNKNOWN);
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 updatePC(PC_RUNNING);
public void run() { firePropertyChange(PROP_SUSPENDED);
updatePC(PC_RUNNING);
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 fDebugSessionId = null;
public void run() { startUpdate(() -> debugContextChanged());
fDebugSessionId = null;
startUpdate(new Runnable() {
@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,12 +336,9 @@ 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 if (fViewer != null) {
public void run() { fViewer.invalidateTextPresentation();
if (fViewer != null) {
fViewer.invalidateTextPresentation();
}
} }
}); });
} else { } else {

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 synchronized (fRunnableLock) {
public void run() { fIsRunnablePosted = false;
synchronized (fRunnableLock) {
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 if (fCachedTextViewer != null)
public void paintControl(PaintEvent event) { doubleBufferPaint(event.gc);
if (fCachedTextViewer != null)
doubleBufferPaint(event.gc);
}
}); });
fCanvas.addDisposeListener(new DisposeListener() { fCanvas.addDisposeListener(e -> {
@Override handleDispose();
public void widgetDisposed(DisposeEvent e) { fCachedTextViewer = null;
handleDispose(); fCachedTextWidget = null;
fCachedTextViewer = 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 enableLineBackgroundPainter();
public void run() { fIPManager.removeAllAnnotations();
enableLineBackgroundPainter();
fIPManager.removeAllAnnotations();
}
}); });
} }
} }
@ -997,20 +994,17 @@ 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 Object context = DebugUITools.getDebugContext();
public void run() { if (context instanceof IDMVMContext) {
Object context = DebugUITools.getDebugContext(); final IDMContext dmc = ((IDMVMContext) context).getDMContext();
if (context instanceof IDMVMContext) { if (dmc instanceof IFrameDMContext && DMContexts.isAncestorOf(dmc, e.getDMContext())) {
final IDMContext dmc = ((IDMVMContext) context).getDMContext(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (dmc instanceof IFrameDMContext && DMContexts.isAncestorOf(dmc, e.getDMContext())) { doDisplaySource((IFrameDMContext) dmc, page, false, true);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); return;
doDisplaySource((IFrameDMContext) dmc, page, false, true);
return;
}
} }
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,15 +111,12 @@ 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 if (isDisposed())
public void run() { return;
if (isDisposed())
return;
for (final DebugEvent event : events) { for (final DebugEvent event : events) {
handleEvent(event); handleEvent(event);
}
} }
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
@ -175,15 +167,12 @@ 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 // trigger full stack frame update
public void run() { ScheduledFuture<?> future = fRefreshStackFramesFutures.get(exeContext);
// trigger full stack frame update if (future != null && !isDisposed()) {
ScheduledFuture<?> future = fRefreshStackFramesFutures.get(exeContext); fRefreshStackFramesFutures.remove(exeContext);
if (future != null && !isDisposed()) { handleEvent(new FullStackRefreshEvent(exeContext, suspendEvent), null);
fRefreshStackFramesFutures.remove(exeContext);
handleEvent(new FullStackRefreshEvent(exeContext, suspendEvent), null);
}
} }
}); });
} }
@ -259,16 +248,13 @@ 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 if (isDisposed())
public void run() { return;
if (isDisposed())
return;
IRootVMNode rootLayoutNode = getRootVMNode(); IRootVMNode rootLayoutNode = getRootVMNode();
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) {

View file

@ -418,15 +418,12 @@ public class VariableVMNode extends AbstractExpressionVMNode
DebugUITools.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener); DebugUITools.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
} }
fPreferenceChangeListener = new IPropertyChangeListener() { fPreferenceChangeListener = event -> {
@Override if (event.getProperty().equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND)) {
public void propertyChange(PropertyChangeEvent event) { columnIdValueBackground.setBackground(
if (event.getProperty().equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND)) { DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
columnIdValueBackground.setBackground( columnNoColumnsBackground.setBackground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB()); DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
columnNoColumnsBackground.setBackground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
}
} }
}; };
@ -865,22 +862,19 @@ 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 final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
public void run() { if (expressionService != null) {
final IExpressions expressionService = getServicesTracker().getService(IExpressions.class); IExpressionDMContext expressionDMC = createExpression(expressionService,
if (expressionService != null) { createCompositeDMVMContext(update), update.getExpression().getExpressionText());
IExpressionDMContext expressionDMC = createExpression(expressionService,
createCompositeDMVMContext(update), update.getExpression().getExpressionText());
VariableExpressionVMC variableVmc = (VariableExpressionVMC) createVMContext(expressionDMC); VariableExpressionVMC variableVmc = (VariableExpressionVMC) createVMContext(expressionDMC);
variableVmc.setExpression(update.getExpression()); variableVmc.setExpression(update.getExpression());
update.setExpressionElement(variableVmc); update.setExpressionElement(variableVmc);
update.done(); update.done();
} else { } else {
handleFailedUpdate(update); handleFailedUpdate(update);
}
} }
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {

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,12 +76,9 @@ 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 if (event.type == SWT.Dispose) {
public void handleEvent(Event event) { DisplayDsfExecutor.super.shutdownNow();
if (event.type == SWT.Dispose) {
DisplayDsfExecutor.super.shutdownNow();
}
} }
}); });
} }
@ -120,14 +115,11 @@ 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 try {
public void run() { v[0] = callable.call();
try { } catch (Throwable exception) {
v[0] = callable.call(); e[0] = exception;
} catch (Throwable exception) {
e[0] = exception;
}
} }
}); });
} catch (SWTException swtException) { } catch (SWTException swtException) {
@ -164,20 +156,12 @@ public class DisplayDsfExecutor extends DefaultDsfExecutor {
((DsfExecutable) runnable).setSubmitted(); ((DsfExecutable) runnable).setSubmitted();
} }
return new Runnable() { return () -> {
@Override try {
public void run() { fDisplay.syncExec(() -> runnable.run());
try { } catch (SWTException swtException) {
fDisplay.syncExec(new Runnable() { if (swtException.code == SWT.ERROR_DEVICE_DISPOSED) {
@Override DisplayDsfExecutor.super.shutdownNow();
public void run() {
runnable.run();
}
});
} catch (SWTException swtException) {
if (swtException.code == SWT.ERROR_DEVICE_DISPOSED) {
DisplayDsfExecutor.super.shutdownNow();
}
} }
} }
}; };

View file

@ -78,12 +78,7 @@ public class SimpleDisplayExecutor implements Executor {
final boolean needsPosting = enqueue(command); 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,16 +150,13 @@ 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 if (updates instanceof IHasChildrenUpdate[]) {
public void run() { provider.update((IHasChildrenUpdate[]) updates);
if (updates instanceof IHasChildrenUpdate[]) { } else if (updates instanceof IChildrenCountUpdate[]) {
provider.update((IHasChildrenUpdate[]) updates); provider.update((IChildrenCountUpdate[]) updates);
} else if (updates instanceof IChildrenCountUpdate[]) { } else if (updates instanceof IChildrenUpdate[]) {
provider.update((IChildrenCountUpdate[]) updates); provider.update((IChildrenUpdate[]) updates);
} else if (updates instanceof IChildrenUpdate[]) {
provider.update((IChildrenUpdate[]) updates);
}
} }
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {

View file

@ -50,13 +50,10 @@ 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 if (DsfSession.isSessionActive(getSession().getId())) {
public void run() { getSession().addServiceEventListener(AbstractDMVMAdapter.this, null);
if (DsfSession.isSessionActive(getSession().getId())) { fRegisteredAsEventListener = true;
getSession().addServiceEventListener(AbstractDMVMAdapter.this, null);
fRegisteredAsEventListener = true;
}
} }
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
@ -67,12 +64,9 @@ 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 if (fRegisteredAsEventListener && getSession().isActive()) {
public void run() { fSession.removeServiceEventListener(AbstractDMVMAdapter.this);
if (fRegisteredAsEventListener && getSession().isActive()) {
fSession.removeServiceEventListener(AbstractDMVMAdapter.this);
}
} }
}); });
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {

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,14 +217,11 @@ 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 try {
public void run() { createBlocksFromConfiguration(memoryCtx, memento);
try { } catch (CoreException e) {
createBlocksFromConfiguration(memoryCtx, memento); DsfPlugin.getDefault().getLog().log(e.getStatus());
} catch (CoreException e) {
DsfPlugin.getDefault().getLog().log(e.getStatus());
}
} }
}); });
} }

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,26 +977,22 @@ 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 connection.removeImageListener(containerTab);
public void run() { ArrayList<String> imageNames = new ArrayList<>();
connection.removeImageListener(containerTab); displayedImages = new ArrayList<>();
ArrayList<String> imageNames = new ArrayList<>(); for (IDockerImage image : finalList) {
displayedImages = new ArrayList<>(); java.util.List<String> tags = image.repoTags();
for (IDockerImage image : finalList) { if (tags != null) {
java.util.List<String> tags = image.repoTags(); for (String tag : tags) {
if (tags != null) { imageNames.add(tag);
for (String tag : tags) { displayedImages.add(image);
imageNames.add(tag);
displayedImages.add(image);
}
} }
} }
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(containerTab);
} }
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(containerTab);
}); });
} }
} }

View file

@ -736,24 +736,20 @@ 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 connection.removeImageListener(containerTab);
public void run() { ArrayList<String> imageNames = new ArrayList<>();
connection.removeImageListener(containerTab); for (IDockerImage image : finalList) {
ArrayList<String> imageNames = new ArrayList<>(); java.util.List<String> tags = image.repoTags();
for (IDockerImage image : finalList) { if (tags != null) {
java.util.List<String> tags = image.repoTags(); for (String tag : tags) {
if (tags != null) { imageNames.add(tag);
for (String tag : tags) {
imageNames.add(tag);
}
} }
} }
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(containerTab);
} }
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(containerTab);
}); });
} }
} }

View file

@ -467,15 +467,8 @@ public class LaunchShortcut implements ILaunchShortcut {
} }
// issue error message if no connections exist // 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,24 +273,20 @@ 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 connection.removeImageListener(wizardPage);
public void run() { ArrayList<String> imageNames = new ArrayList<>();
connection.removeImageListener(wizardPage); for (IDockerImage image : finalList) {
ArrayList<String> imageNames = new ArrayList<>(); java.util.List<String> tags = image.repoTags();
for (IDockerImage image : finalList) { if (tags != null) {
java.util.List<String> tags = image.repoTags(); for (String tag : tags) {
if (tags != null) { imageNames.add(tag);
for (String tag : tags) {
imageNames.add(tag);
}
} }
} }
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(wizardPage);
} }
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(wizardPage);
}); });
} }
} }

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-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,49 +117,37 @@ 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 if (event.getProperty().equals(IInternalDebugUIConstants.FONT_NAME)) {
public void propertyChange(PropertyChangeEvent event) { FPRendering.this.fRendering
if (event.getProperty().equals(IInternalDebugUIConstants.FONT_NAME)) { .handleFontPreferenceChange(JFaceResources.getFont(IInternalDebugUIConstants.FONT_NAME));
FPRendering.this.fRendering
.handleFontPreferenceChange(JFaceResources.getFont(IInternalDebugUIConstants.FONT_NAME));
}
} }
}); });
this.addPropertyChangeListener(new IPropertyChangeListener() { this.addPropertyChangeListener(event -> {
@Override IMemoryRendering sourceRendering = (IMemoryRendering) event.getSource();
public void propertyChange(PropertyChangeEvent event) { if (!sourceRendering.getMemoryBlock().equals(getMemoryBlock()))
IMemoryRendering sourceRendering = (IMemoryRendering) event.getSource(); return;
if (!sourceRendering.getMemoryBlock().equals(getMemoryBlock()))
return;
Object address = event.getNewValue(); Object address = event.getNewValue();
if (event.getProperty().equals(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS) if (event.getProperty().equals(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS)
&& 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 disposeColors();
public void propertyChange(PropertyChangeEvent event) { allocateColors();
disposeColors(); applyPreferences();
allocateColors();
applyPreferences();
}
}); });
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(event -> {
@Override if (event.getProperty().equals(IDebugUIConstants.PREF_PADDED_STR)) {
public void propertyChange(PropertyChangeEvent event) { if (FPRendering.this.fRendering != null) {
if (event.getProperty().equals(IDebugUIConstants.PREF_PADDED_STR)) { setRenderingPadding((String) event.getNewValue());
if (FPRendering.this.fRendering != null) { FPRendering.this.fRendering.redrawPanes();
setRenderingPadding((String) event.getNewValue());
FPRendering.this.fRendering.redrawPanes();
}
} }
} }
}); });
@ -221,13 +205,10 @@ 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 if (fModel != null) {
public void run() { fModel.removeModelChangedListener(FPRendering.this);
if (fModel != null) { fModel.dispose();
fModel.removeModelChangedListener(FPRendering.this);
fModel.dispose();
}
} }
}); });
@ -246,29 +227,26 @@ 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
* to represent it. The Platform memory subsystem provides a way to create one without a viewewr. * to represent it. The Platform memory subsystem provides a way to create one without a viewewr.
*/ */
IMemoryRenderingSite site = container.getMemoryRenderingSite(); IMemoryRenderingSite site = container.getMemoryRenderingSite();
MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container, MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container,
FPRendering.this); FPRendering.this);
/*
* Get a new proxy and perform the initialization sequence so we are known the
* the model provider.
*/
fModel = factory.createModelProxy(block, context);
if (fModel != null) {
fModel.installed(null);
fModel.addModelChangedListener(FPRendering.this);
}
/*
* Get a new proxy and perform the initialization sequence so we are known the
* the model provider.
*/
fModel = factory.createModelProxy(block, context);
if (fModel != null) {
fModel.installed(null);
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,21 +605,18 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
{ {
@Override @Override
public void run() { public void run() {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(() -> {
@Override // For compatibility with DSF update modes (hopefully this will either be replaced
public void run() { // by an enhanced platform interface or the caching will move out of the data layer)
// 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)
try { try {
Method m = fRendering.getMemoryBlock().getClass().getMethod("clearCache", new Class[0]); //$NON-NLS-1$ Method m = fRendering.getMemoryBlock().getClass().getMethod("clearCache", new Class[0]); //$NON-NLS-1$
if (m != null) if (m != null)
m.invoke(fRendering.getMemoryBlock(), new Object[0]); m.invoke(fRendering.getMemoryBlock(), new Object[0]);
} catch (Exception e) { } catch (Exception e) {
}
FPRendering.this.fRendering.refresh();
} }
FPRendering.this.fRendering.refresh();
}); });
} }
}; };
@ -826,24 +792,20 @@ 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 -> {
{ try {
@Override int index = Integer.parseInt(input);
public String isValid(String input) {
try {
int index = Integer.parseInt(input);
if (index <= 0) if (index <= 0)
return "Please enter a positive integer"; //$NON-NLS-1$
if (index > 200)
return "Please enter a positive integer not greater than 200"; //$NON-NLS-1$
} catch (NumberFormatException x) {
return "Please enter a positive integer"; //$NON-NLS-1$ return "Please enter a positive integer"; //$NON-NLS-1$
}
return null; if (index > 200)
return "Please enter a positive integer not greater than 200"; //$NON-NLS-1$
} catch (NumberFormatException x) {
return "Please enter a positive integer"; //$NON-NLS-1$
} }
return null;
}); });
if (inputDialog.open() != Window.OK) { if (inputDialog.open() != Window.OK) {
@ -927,104 +889,101 @@ 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 manager.add(new Separator());
public void menuAboutToShow(IMenuManager manager) {
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$
sub = new MenuManager(FPRenderingMessages.getString("FPRendering.ENDIAN")); //$NON-NLS-1$ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.ENDIAN")); //$NON-NLS-1$
sub.add(actionDisplayBigEndian); sub.add(actionDisplayBigEndian);
sub.add(actionDisplayLittleEndian); sub.add(actionDisplayLittleEndian);
manager.add(sub); manager.add(sub);
sub = new MenuManager(FPRenderingMessages.getString("FPRendering.NUMBER_TYPE")); //$NON-NLS-1$ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.NUMBER_TYPE")); //$NON-NLS-1$
sub.add(actionFloatingPoint32); sub.add(actionFloatingPoint32);
sub.add(actionFloatingPoint64); sub.add(actionFloatingPoint64);
manager.add(sub); manager.add(sub);
sub = new MenuManager(FPRenderingMessages.getString("FPRendering.PRECISION")); //$NON-NLS-1$ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.PRECISION")); //$NON-NLS-1$
sub.add(actionDisplay4Digits); sub.add(actionDisplay4Digits);
sub.add(actionDisplay8Digits); sub.add(actionDisplay8Digits);
sub.add(actionDisplay16Digits); sub.add(actionDisplay16Digits);
manager.add(sub); manager.add(sub);
// TODO: Add separator for FP group here: manager.add(new Separator()); // TODO: Add separator for FP group here: manager.add(new Separator());
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)
sub.add(displayColumnCountCustomValue); sub.add(displayColumnCountCustomValue);
sub.add(displayColumnCountCustom); sub.add(displayColumnCountCustom);
manager.add(sub); manager.add(sub);
// Update modes // Update modes
int updateMode = getRMCvalue(IFPRConstants.UPDATEMODE_KEY); int updateMode = getRMCvalue(IFPRConstants.UPDATEMODE_KEY);
final Action updateAlwaysAction = new Action(FPRenderingMessages.getString("FPRendering.UPDATE_ALWAYS"), //$NON-NLS-1$ final Action updateAlwaysAction = new Action(FPRenderingMessages.getString("FPRendering.UPDATE_ALWAYS"), //$NON-NLS-1$
IAction.AS_RADIO_BUTTON) { IAction.AS_RADIO_BUTTON) {
@Override @Override
public void run() { public void run() {
fRendering.setUpdateMode(Rendering.UPDATE_ALWAYS); fRendering.setUpdateMode(Rendering.UPDATE_ALWAYS);
setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_ALWAYS); setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_ALWAYS);
} }
}; };
updateAlwaysAction.setChecked(updateMode == Rendering.UPDATE_ALWAYS); updateAlwaysAction.setChecked(updateMode == Rendering.UPDATE_ALWAYS);
final Action updateOnBreakpointAction = new Action( final Action updateOnBreakpointAction = new Action(
FPRenderingMessages.getString("FPRendering.UPDATE_ON_BREAKPOINT"), IAction.AS_RADIO_BUTTON) //$NON-NLS-1$ FPRenderingMessages.getString("FPRendering.UPDATE_ON_BREAKPOINT"), IAction.AS_RADIO_BUTTON) //$NON-NLS-1$
{ {
@Override @Override
public void run() { public void run() {
fRendering.setUpdateMode(Rendering.UPDATE_ON_BREAKPOINT); fRendering.setUpdateMode(Rendering.UPDATE_ON_BREAKPOINT);
setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_ON_BREAKPOINT); setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_ON_BREAKPOINT);
} }
}; };
updateOnBreakpointAction.setChecked(updateMode == Rendering.UPDATE_ON_BREAKPOINT); updateOnBreakpointAction.setChecked(updateMode == Rendering.UPDATE_ON_BREAKPOINT);
final Action updateManualAction = new Action(FPRenderingMessages.getString("FPRendering.UPDATE_MANUAL"), //$NON-NLS-1$ final Action updateManualAction = new Action(FPRenderingMessages.getString("FPRendering.UPDATE_MANUAL"), //$NON-NLS-1$
IAction.AS_RADIO_BUTTON) { IAction.AS_RADIO_BUTTON) {
@Override @Override
public void run() { public void run() {
fRendering.setUpdateMode(Rendering.UPDATE_MANUAL); fRendering.setUpdateMode(Rendering.UPDATE_MANUAL);
setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_MANUAL); setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_MANUAL);
} }
}; };
updateManualAction.setChecked(updateMode == Rendering.UPDATE_MANUAL); updateManualAction.setChecked(updateMode == Rendering.UPDATE_MANUAL);
// Add menu // Add menu
sub = new MenuManager(FPRenderingMessages.getString("FPRendering.UPDATEMODE")); //$NON-NLS-1$ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.UPDATEMODE")); //$NON-NLS-1$
sub.add(updateAlwaysAction); sub.add(updateAlwaysAction);
sub.add(updateOnBreakpointAction); sub.add(updateOnBreakpointAction);
sub.add(updateManualAction); sub.add(updateManualAction);
manager.add(sub); manager.add(sub);
manager.add(new Separator()); manager.add(new Separator());
BigInteger start = fRendering.getSelection().getStart(); BigInteger start = fRendering.getSelection().getStart();
BigInteger end = fRendering.getSelection().getEnd(); BigInteger end = fRendering.getSelection().getEnd();
copyAction.setEnabled(start != null && end != null); copyAction.setEnabled(start != null && end != null);
manager.add(copyAction); manager.add(copyAction);
manager.add(copyAddressAction); manager.add(copyAddressAction);
manager.add(gotoBaseAddressAction); manager.add(gotoBaseAddressAction);
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 // update UI asynchronously
public void update() { Display display = FPRenderingPlugin.getDefault().getWorkbench().getDisplay();
// update UI asynchronously display.asyncExec(() -> {
Display display = FPRenderingPlugin.getDefault().getWorkbench().getDisplay(); try {
display.asyncExec(new Runnable() { if (fBigBaseAddress != FPRendering.this.fRendering.getMemoryBlock().getBigBaseAddress()) {
@Override fBigBaseAddress = FPRendering.this.fRendering.getMemoryBlock().getBigBaseAddress();
public void run() { FPRendering.this.fRendering.gotoAddress(fBigBaseAddress);
try {
if (fBigBaseAddress != FPRendering.this.fRendering.getMemoryBlock()
.getBigBaseAddress()) {
fBigBaseAddress = FPRendering.this.fRendering.getMemoryBlock()
.getBigBaseAddress();
FPRendering.this.fRendering.gotoAddress(fBigBaseAddress);
}
FPRendering.this.fRendering.refresh();
} catch (DebugException e) {
}
} }
}); FPRendering.this.fRendering.refresh();
} } catch (DebugException e) {
}
});
}; };
} }

View file

@ -36,12 +36,7 @@ public class FPRenderingPreferenceAction extends ActionDelegate implements IView
} }
protected void showPreferencePage(String id, IPreferencePage page) { 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 pe.gc.setBackground(Rendering.this.getFPRendering().getColorBackground());
public void paintControl(PaintEvent pe) { pe.gc.fillRectangle(0, 0, Rendering.this.getBounds().width, Rendering.this.getBounds().height);
pe.gc.setBackground(Rendering.this.getFPRendering().getColorBackground());
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 archiveDeltas();
public void run() { refresh();
archiveDeltas();
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,205 +846,202 @@ 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 // Generate deltas
public void run() {
// Generate deltas
for (int historyIndex = 0; historyIndex < getHistoryDepth(); historyIndex++) { for (int historyIndex = 0; historyIndex < getHistoryDepth(); historyIndex++) {
if (fHistoryCache[historyIndex] != null && fHistoryCache[historyIndex].isValid()) { if (fHistoryCache[historyIndex] != null && fHistoryCache[historyIndex].isValid()) {
BigInteger maxStart = startAddress.max(fHistoryCache[historyIndex].start); BigInteger maxStart = startAddress.max(fHistoryCache[historyIndex].start);
BigInteger minEnd = endAddress.min(fHistoryCache[historyIndex].end) BigInteger minEnd = endAddress.min(fHistoryCache[historyIndex].end)
.subtract(BigInteger.ONE); .subtract(BigInteger.ONE);
BigInteger overlapLength = minEnd.subtract(maxStart); BigInteger overlapLength = minEnd.subtract(maxStart);
if (overlapLength.compareTo(BigInteger.valueOf(0)) > 0) { if (overlapLength.compareTo(BigInteger.valueOf(0)) > 0) {
// there is overlap // there is overlap
int offsetIntoOld = maxStart.subtract(fHistoryCache[historyIndex].start).intValue(); int offsetIntoOld = maxStart.subtract(fHistoryCache[historyIndex].start).intValue();
int offsetIntoNew = maxStart.subtract(startAddress).intValue(); int offsetIntoNew = maxStart.subtract(startAddress).intValue();
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
// cell is edited the font color changes appropriately. The following code deals with the different cases. // cell is edited the font color changes appropriately. The following code deals with the different cases.
if (historyIndex != 0) if (historyIndex != 0)
continue; continue;
int dataStart = fCache.start.intValue(); int dataStart = fCache.start.intValue();
int dataEnd = fCache.end.intValue(); int dataEnd = fCache.end.intValue();
int dataLength = fCache.bytes.length; int dataLength = fCache.bytes.length;
int historyStart = fHistoryCache[0].start.intValue(); int historyStart = fHistoryCache[0].start.intValue();
int historyEnd = fHistoryCache[0].end.intValue(); int historyEnd = fHistoryCache[0].end.intValue();
int historyLength = fHistoryCache[0].bytes.length; int historyLength = fHistoryCache[0].bytes.length;
// Case 1: The data cache is smaller than the history cache; the data cache's // Case 1: The data cache is smaller than the history cache; the data cache's
// address range is fully covered by the history cache. Do nothing. // address range is fully covered by the history cache. Do nothing.
if ((dataStart >= historyStart) && (dataEnd <= historyEnd)) if ((dataStart >= historyStart) && (dataEnd <= historyEnd))
continue; continue;
// Case 2: The data and history cache's do not overlap at all // Case 2: The data and history cache's do not overlap at all
if (((dataStart < historyStart) && (dataEnd < historyStart)) if (((dataStart < historyStart) && (dataEnd < historyStart))
|| (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;
} }
// Case 3: The data cache starts at a lower address than the history cache, but overlaps the history cache // Case 3: The data cache starts at a lower address than the history cache, but overlaps the history cache
if ((dataStart < historyStart) if ((dataStart < historyStart)
&& ((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;
} }
// Case 4: The data cache starts at a higher address than the history cache // Case 4: The data cache starts at a higher address than the history cache
if (((dataStart >= historyStart) && (dataStart <= historyEnd)) if (((dataStart >= historyStart) && (dataStart <= historyEnd))
&& (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;
continue;
} }
}
// Case 5 - The data cache is greater than the history cache and fully covers it fHistoryCache[0] = newHistoryCache3;
if (dataStart < historyStart && dataEnd > historyEnd) {
int start = 0;
int end = 0;
// Create a new history cache to reflect the entire data cache
MemoryUnit newHistoryCache = new MemoryUnit();
newHistoryCache.start = fCache.start;
newHistoryCache.end = fCache.end;
int newHistoryCacheSize = fCache.bytes.length;
newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
int topByteCount = historyStart - dataStart;
int bottomByteCount = dataEnd - historyEnd;
// Copy the bytes from the beginning of the data cache to the new history cache
for (int index = 0; index < topByteCount; index++)
newHistoryCache.bytes[index] = new FPMemoryByte(
fCache.bytes[index].getValue());
// Copy the old history cache bytes to the new history cache
start = topByteCount;
end = topByteCount + historyLength;
for (int index = start; index < end; index++)
newHistoryCache.bytes[index] = new FPMemoryByte(
fCache.bytes[index].getValue());
// Copy the bytes from the end of the data cache to the new history cache
start = topByteCount + historyLength;
end = topByteCount + historyLength + bottomByteCount;
for (int index = start; index < end; index++)
newHistoryCache.bytes[index] = new FPMemoryByte(
fCache.bytes[index].getValue());
fHistoryCache[0] = newHistoryCache;
continue; continue;
} }
} }
// Case 5 - The data cache is greater than the history cache and fully covers it
if (dataStart < historyStart && dataEnd > historyEnd) {
int start = 0;
int end = 0;
// Create a new history cache to reflect the entire data cache
MemoryUnit newHistoryCache4 = new MemoryUnit();
newHistoryCache4.start = fCache.start;
newHistoryCache4.end = fCache.end;
int newHistoryCacheSize4 = fCache.bytes.length;
newHistoryCache4.bytes = new FPMemoryByte[newHistoryCacheSize4];
int topByteCount = historyStart - dataStart;
int bottomByteCount = dataEnd - historyEnd;
// Copy the bytes from the beginning of the data cache to the new history cache
for (int index5 = 0; index5 < topByteCount; index5++)
newHistoryCache4.bytes[index5] = new FPMemoryByte(
fCache.bytes[index5].getValue());
// Copy the old history cache bytes to the new history cache
start = topByteCount;
end = topByteCount + historyLength;
for (int index6 = start; index6 < end; index6++)
newHistoryCache4.bytes[index6] = new FPMemoryByte(
fCache.bytes[index6].getValue());
// Copy the bytes from the end of the data cache to the new history cache
start = topByteCount + historyLength;
end = topByteCount + historyLength + bottomByteCount;
for (int index7 = start; index7 < end; index7++)
newHistoryCache4.bytes[index7] = new FPMemoryByte(
fCache.bytes[index7].getValue());
fHistoryCache[0] = newHistoryCache4;
continue;
}
} }
} }
// If the history does not exist, populate the history with the just populated
// cache. This solves the use case of (1) connect to target; (2) edit memory
// before the first suspend debug event; (3) paint differences in changed color.
if (fHistoryCache[0] == null)
fHistoryCache[0] = fCache.clone();
Rendering.this.redrawPanes();
} }
// If the history does not exist, populate the history with the just populated
// cache. This solves the use case of (1) connect to target; (2) edit memory
// before the first suspend debug event; (3) paint differences in changed color.
if (fHistoryCache[0] == null)
fHistoryCache[0] = fCache.clone();
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 fireSettingsChanged();
public void run() { layoutPanes();
fireSettingsChanged();
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 CTabItem selection = activeFolder.getSelection();
public void run() { selection.setData(KEY_EXPRESSION, expression);
CTabItem selection = activeFolder.getSelection(); selection.setData(KEY_EXPRESSION_ADDRESS, newBase);
selection.setData(KEY_EXPRESSION, expression); fGotoAddressBar.handleExpressionStatus(Status.OK_STATUS);
selection.setData(KEY_EXPRESSION_ADDRESS, newBase); updateLabel(selection, renderingFinal);
fGotoAddressBar.handleExpressionStatus(Status.OK_STATUS);
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,86 +1083,82 @@ 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 if (fGotoAddressBarControl.isDisposed() || fGotoMemorySpaceControl.isDisposed()) {
public void run() { return;
if (fGotoAddressBarControl.isDisposed() || fGotoMemorySpaceControl.isDisposed()) { }
return;
fGotoAddressBarControl.setVisible(true);
// If we've already created a tab folder for this retrieval
// object, bring it to the forefront. Otherwise create the
// folder.
CTabFolder tabFolder = fContextFolders.get(retrieval);
if (tabFolder != null) {
fStackLayout.topControl = tabFolder;
CTabItem tabItem = tabFolder.getSelection();
if (tabItem != null) {
getSite().getSelectionProvider()
.setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
} }
handleTabActivated(tabItem);
} else {
tabFolder = createTabFolder(fRenderingsComposite);
tabFolder.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
fGotoAddressBarControl.setVisible(true); @Override
public void widgetSelected(SelectionEvent e) {
// If we've already created a tab folder for this retrieval CTabItem tabItem = (CTabItem) e.item;
// object, bring it to the forefront. Otherwise create the updateMemorySpaceControlSelection(tabItem);
// folder. fGotoAddressBar.loadSavedExpressions(context,
CTabFolder tabFolder = fContextFolders.get(retrieval); fGotoMemorySpaceControl.isVisible() ? fGotoMemorySpaceControl.getText() : null);
if (tabFolder != null) {
fStackLayout.topControl = tabFolder;
CTabItem tabItem = tabFolder.getSelection();
if (tabItem != null) {
getSite().getSelectionProvider() getSite().getSelectionProvider()
.setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING))); .setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
handleTabActivated(tabItem);
} }
handleTabActivated(tabItem); });
} else {
tabFolder = createTabFolder(fRenderingsComposite);
tabFolder.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
@Override tabFolder.setData(KEY_RETRIEVAL, retrieval);
public void widgetSelected(SelectionEvent e) { fContextFolders.put(retrieval, tabFolder);
CTabItem tabItem = (CTabItem) e.item; fStackLayout.topControl = tabFolder;
updateMemorySpaceControlSelection(tabItem);
fGotoAddressBar.loadSavedExpressions(context,
fGotoMemorySpaceControl.isVisible() ? fGotoMemorySpaceControl.getText() : null);
getSite().getSelectionProvider()
.setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
handleTabActivated(tabItem);
}
});
tabFolder.setData(KEY_RETRIEVAL, retrieval);
fContextFolders.put(retrieval, tabFolder);
fStackLayout.topControl = tabFolder;
}
// update debug context to the new selection
tabFolder.setData(KEY_CONTEXT, context);
final CTabFolder activeFolder = tabFolder;
if (!activeFolder.equals(tabFolder)) {
return;
}
// Don't expose the memory spaces widget if there are none or
// only one memory space involved.
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=309032#c50
if (memorySpaces.length >= 2) {
fGotoMemorySpaceControl.setItems(memorySpaces);
// Add the '----' (N/A) entry unless the retrieval object
// says it requires a memory space ID in all cases
boolean addNA = true;
if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) {
addNA = !((IMemorySpaceAwareMemoryBlockRetrieval) retrieval)
.creatingBlockRequiresMemorySpaceID();
}
if (addNA) {
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0);
}
setMemorySpaceControlVisible(true);
} else {
fGotoMemorySpaceControl.setItems(new String[0]);
setMemorySpaceControlVisible(false);
}
updateMemorySpaceControlSelection(activeFolder.getSelection());
fGotoAddressBar.loadSavedExpressions(context,
fGotoMemorySpaceControl.isVisible() ? fGotoMemorySpaceControl.getText() : null);
fStackLayout.topControl.getParent().layout(true);
} }
// update debug context to the new selection
tabFolder.setData(KEY_CONTEXT, context);
final CTabFolder activeFolder = tabFolder;
if (!activeFolder.equals(tabFolder)) {
return;
}
// Don't expose the memory spaces widget if there are none or
// only one memory space involved.
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=309032#c50
if (memorySpaces.length >= 2) {
fGotoMemorySpaceControl.setItems(memorySpaces);
// Add the '----' (N/A) entry unless the retrieval object
// says it requires a memory space ID in all cases
boolean addNA = true;
if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) {
addNA = !((IMemorySpaceAwareMemoryBlockRetrieval) retrieval).creatingBlockRequiresMemorySpaceID();
}
if (addNA) {
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0);
}
setMemorySpaceControlVisible(true);
} else {
fGotoMemorySpaceControl.setItems(new String[0]);
setMemorySpaceControlVisible(false);
}
updateMemorySpaceControlSelection(activeFolder.getSelection());
fGotoAddressBar.loadSavedExpressions(context,
fGotoMemorySpaceControl.isVisible() ? fGotoMemorySpaceControl.getText() : null);
fStackLayout.topControl.getParent().layout(true);
}); });
} }
@ -1337,18 +1319,15 @@ 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 for (CTabItem tab : folder.getItems()) {
public void run() { disposeTab(tab);
for (CTabItem tab : folder.getItems()) { }
disposeTab(tab); fContextFolders.remove(retrieval);
} folder.dispose();
fContextFolders.remove(retrieval);
folder.dispose();
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,52 +727,34 @@ 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 boolean valid = true;
public void modifyText(ModifyEvent e) { try {
boolean valid = true; getStartAddress();
try { } catch (Exception ex) {
getStartAddress(); valid = false;
} catch (Exception ex) {
valid = false;
}
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK)
: Display.getDefault().getSystemColor(SWT.COLOR_RED));
validate();
} }
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK)
: Display.getDefault().getSystemColor(SWT.COLOR_RED));
validate();
}); });
fEndText.addModifyListener(new ModifyListener() { fEndText.addModifyListener(e -> {
@Override try {
public void modifyText(ModifyEvent e) { getEndAddress();
try { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
getEndAddress(); } catch (Exception ex) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
} catch (Exception ex) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
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,40 +1117,35 @@ 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(() -> {
IMemoryRenderingContainer containers[] = getMemoryView()
@Override .getMemoryRenderingContainers();
public void run() { for (int i = 0; i < containers.length; i++) {
IMemoryRenderingContainer containers[] = getMemoryView() IMemoryRendering rendering = containers[i].getActiveRendering();
.getMemoryRenderingContainers(); if (rendering instanceof IRepositionableMemoryRendering) {
for (int i = 0; i < containers.length; i++) { try {
IMemoryRendering rendering = containers[i].getActiveRendering(); ((IRepositionableMemoryRendering) rendering)
if (rendering instanceof IRepositionableMemoryRendering) { .goToAddress(finalCurrentPosition);
try { } catch (DebugException e1) {
((IRepositionableMemoryRendering) rendering) MemorySearchPlugin.logError(
.goToAddress(finalCurrentPosition); Messages.getString(
} catch (DebugException e) { "FindReplaceDialog.RepositioningMemoryViewFailed"), //$NON-NLS-1$
MemorySearchPlugin.logError( e1);
Messages.getString(
"FindReplaceDialog.RepositioningMemoryViewFailed"), //$NON-NLS-1$
e);
}
} }
if (rendering != null) { }
// Temporary, until platform accepts/adds new interface for setting the selection if (rendering != null) {
try { // Temporary, until platform accepts/adds new interface for setting the selection
Method m = rendering.getClass().getMethod("setSelection", //$NON-NLS-1$ try {
new Class[] { BigInteger.class, BigInteger.class }); Method m = rendering.getClass().getMethod("setSelection", //$NON-NLS-1$
if (m != null) new Class[] { BigInteger.class, BigInteger.class });
m.invoke(rendering, finalCurrentPosition, if (m != null)
finalCurrentPosition.add(searchPhraseLength)); m.invoke(rendering, finalCurrentPosition,
} catch (Exception e) { finalCurrentPosition.add(searchPhraseLength));
// do nothing } catch (Exception e2) {
} // 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 NewSearchUI.activateSearchResultView();
public void run() { NewSearchUI.runQueryInBackground(query);
NewSearchUI.activateSearchResultView();
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