mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
Bug 330259 - [disassembly] debug context is not per workbench window
This commit is contained in:
parent
671675293a
commit
9865f25dbc
1 changed files with 49 additions and 31 deletions
|
@ -9,6 +9,7 @@
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
||||||
* Patrick Chuong (Texas Instruments) - Bug fix (329682)
|
* Patrick Chuong (Texas Instruments) - Bug fix (329682)
|
||||||
|
* Patrick Chuong (Texas Instruments) - bug fix (330259)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||||
|
import org.eclipse.debug.ui.contexts.IDebugContextService;
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.action.GroupMarker;
|
import org.eclipse.jface.action.GroupMarker;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
|
@ -116,7 +118,9 @@ import org.eclipse.jface.text.source.OverviewRuler;
|
||||||
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
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.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
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;
|
||||||
|
@ -713,7 +717,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
protected void setSite(IWorkbenchPartSite site) {
|
protected void setSite(IWorkbenchPartSite site) {
|
||||||
super.setSite(site);
|
super.setSite(site);
|
||||||
site.getPage().addPartListener(fPartListener);
|
site.getPage().addPartListener(fPartListener);
|
||||||
DebugUITools.getDebugContextManager().addDebugContextListener(fDebugContextListener = new IDebugContextListener() {
|
IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
|
||||||
|
contextService.addDebugContextListener(fDebugContextListener = new IDebugContextListener() {
|
||||||
public void debugContextChanged(DebugContextEvent event) {
|
public void debugContextChanged(DebugContextEvent event) {
|
||||||
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
|
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
|
||||||
updateDebugContext();
|
updateDebugContext();
|
||||||
|
@ -1841,7 +1846,13 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateDebugContext() {
|
protected void updateDebugContext() {
|
||||||
IAdaptable context = DebugUITools.getDebugContext();
|
IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow());
|
||||||
|
ISelection activeContext = contextService.getActiveContext();
|
||||||
|
if (activeContext instanceof IStructuredSelection) {
|
||||||
|
Object selectedElement = ((IStructuredSelection) activeContext).getFirstElement();
|
||||||
|
if (selectedElement instanceof IAdaptable) {
|
||||||
|
IAdaptable context = (IAdaptable) selectedElement;
|
||||||
|
|
||||||
final IDisassemblyBackend prevBackend = fBackend;
|
final IDisassemblyBackend prevBackend = fBackend;
|
||||||
fDebugSessionId = null;
|
fDebugSessionId = null;
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
|
@ -1870,6 +1881,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void debugContextChanged() {
|
private void debugContextChanged() {
|
||||||
if (DEBUG) System.out.println("DisassemblyPart.debugContextChanged()"); //$NON-NLS-1$
|
if (DEBUG) System.out.println("DisassemblyPart.debugContextChanged()"); //$NON-NLS-1$
|
||||||
|
@ -1965,6 +1978,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigInteger getTopAddress() {
|
private BigInteger getTopAddress() {
|
||||||
|
if (fViewer != null) {
|
||||||
BigInteger topAddress = getAddressOfLine(fViewer.getTopIndex());
|
BigInteger topAddress = getAddressOfLine(fViewer.getTopIndex());
|
||||||
if (topAddress.equals(fStartAddress)) {
|
if (topAddress.equals(fStartAddress)) {
|
||||||
// in rare cases, the top line can be '...'
|
// in rare cases, the top line can be '...'
|
||||||
|
@ -1972,6 +1986,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
topAddress = getAddressOfLine(fViewer.getTopIndex() + 1);
|
topAddress = getAddressOfLine(fViewer.getTopIndex() + 1);
|
||||||
}
|
}
|
||||||
return topAddress;
|
return topAddress;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return PC_UNKNOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetViewer() {
|
private void resetViewer() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue