mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
[Pin&Clone] Pinned view not update when stepping/running
This commit is contained in:
parent
331fa00081
commit
ceb8b9b40b
3 changed files with 21 additions and 25 deletions
|
@ -54,14 +54,11 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
|
||||||
|
|
||||||
fActiveContext = activeContext;
|
fActiveContext = activeContext;
|
||||||
fPinHandles = pin(part, activeContext, new IPinModelListener() {
|
fPinHandles = pin(part, activeContext, new IPinModelListener() {
|
||||||
public void modelChanged(int eventType) {
|
public void modelChanged(ISelection selection) {
|
||||||
// send a change notification for the view to update
|
// send a change notification for the view to update
|
||||||
switch (eventType) {
|
delegateEvent(new DebugContextEvent(DebugContextPinProvider.this,
|
||||||
case IPinModelListener.EXITED:
|
selection == null ? new StructuredSelection() : selection,
|
||||||
case IPinModelListener.RESUMED:
|
DebugContextEvent.ACTIVATED));
|
||||||
delegateEvent(new DebugContextEvent(DebugContextPinProvider.this, new StructuredSelection(), DebugContextEvent.ACTIVATED));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -118,8 +115,8 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
|
||||||
* @param listener pin model listener
|
* @param listener pin model listener
|
||||||
* @return a set of pinned handle
|
* @return a set of pinned handle
|
||||||
*/
|
*/
|
||||||
private Set<IPinElementHandle> pin(IWorkbenchPart part, ISelection selection, IPinModelListener listener) {
|
|
||||||
Set<IPinElementHandle> handles = new HashSet<IPinElementHandle>();
|
Set<IPinElementHandle> handles = new HashSet<IPinElementHandle>();
|
||||||
|
private Set<IPinElementHandle> pin(IWorkbenchPart part, ISelection selection, IPinModelListener listener) {
|
||||||
|
|
||||||
if (selection instanceof IStructuredSelection) {
|
if (selection instanceof IStructuredSelection) {
|
||||||
for (Object element : ((IStructuredSelection)selection).toList()) {
|
for (Object element : ((IStructuredSelection)selection).toList()) {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.debug.ui;
|
package org.eclipse.cdt.debug.ui;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,18 +106,16 @@ public interface IPinProvider {
|
||||||
* that the model has changed for a pinned view and that the view must be
|
* that the model has changed for a pinned view and that the view must be
|
||||||
* refreshed.
|
* refreshed.
|
||||||
*
|
*
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IPinModelListener {
|
public interface IPinModelListener {
|
||||||
static final int RESUMED = 0;
|
|
||||||
static final int EXITED = 1;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model changed handler that will cause the view to update.
|
* Model changed handler that will cause the view to update.
|
||||||
*
|
*
|
||||||
* @param eventType one of the event type.
|
* @param newSelection the new selection, if {@code null} the view will blank out.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
void modelChanged(int eventType);
|
void modelChanged(ISelection newSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,7 +134,6 @@ public interface IPinProvider {
|
||||||
* @param debugContext the debug context to pin to
|
* @param debugContext the debug context to pin to
|
||||||
* @return a handle for the pinned debug context
|
* @return a handle for the pinned debug context
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IPinElementHandle pin(IWorkbenchPart part, Object debugContext, IPinModelListener listener);
|
IPinElementHandle pin(IWorkbenchPart part, Object debugContext, IPinModelListener listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.eclipse.core.runtime.IStatus;
|
||||||
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.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -278,7 +279,7 @@ public class GdbPinProvider implements IPinProvider {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch the change event for the given DM context.
|
* Dispatch the change event for the given DM context.
|
||||||
*
|
*
|
||||||
|
@ -341,20 +342,20 @@ public class GdbPinProvider implements IPinProvider {
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void handleEvent(final ICommandControlShutdownDMEvent event) {
|
public void handleEvent(final ICommandControlShutdownDMEvent event) {
|
||||||
doHandleEvent(event, IPinModelListener.EXITED);
|
handleInvalidModelContext(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void handleEvent(final IExitedDMEvent event) {
|
public void handleEvent(final IExitedDMEvent event) {
|
||||||
doHandleEvent(event, IPinModelListener.EXITED);
|
handleInvalidModelContext(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void handleEvent(final IResumedDMEvent event) {
|
public void handleEvent(final IResumedDMEvent event) {
|
||||||
doHandleEvent(event, IPinModelListener.RESUMED);
|
handleInvalidModelContext(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doHandleEvent(IDMEvent<?> event, final int notificationId) {
|
private void handleInvalidModelContext(IDMEvent<?> event) {
|
||||||
Set<Entry<IPinElementHandle, IPinModelListener>> entries = gsPinnedHandles.entrySet();
|
Set<Entry<IPinElementHandle, IPinModelListener>> entries = gsPinnedHandles.entrySet();
|
||||||
for (final Entry<IPinElementHandle, IPinModelListener> e : entries) {
|
for (final Entry<IPinElementHandle, IPinModelListener> e : entries) {
|
||||||
final IPinModelListener listener = e.getValue();
|
final IPinModelListener listener = e.getValue();
|
||||||
|
@ -375,7 +376,7 @@ public class GdbPinProvider implements IPinProvider {
|
||||||
if (execEventDmc != null && execHandleDmc != null) {
|
if (execEventDmc != null && execHandleDmc != null) {
|
||||||
// It is a thread event, but is it the same as the pin handle?
|
// It is a thread event, but is it the same as the pin handle?
|
||||||
if (execEventDmc.equals(execHandleDmc)) {
|
if (execEventDmc.equals(execHandleDmc)) {
|
||||||
fireModleChangeEvent(listener, notificationId);
|
fireModleChangeEvent(listener, null);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -386,14 +387,14 @@ public class GdbPinProvider implements IPinProvider {
|
||||||
IMIContainerDMContext procHandleDmc = DMContexts.getAncestorOfType(handleDmc, IMIContainerDMContext.class);
|
IMIContainerDMContext procHandleDmc = DMContexts.getAncestorOfType(handleDmc, IMIContainerDMContext.class);
|
||||||
if (procEventDmc != null && procHandleDmc != null) {
|
if (procEventDmc != null && procHandleDmc != null) {
|
||||||
if (procEventDmc.equals(procHandleDmc)) {
|
if (procEventDmc.equals(procHandleDmc)) {
|
||||||
fireModleChangeEvent(listener, notificationId);
|
fireModleChangeEvent(listener, null);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we got a shutdown event
|
// If we got a shutdown event
|
||||||
if (eventDmc instanceof ICommandControlDMContext) {
|
if (eventDmc instanceof ICommandControlDMContext) {
|
||||||
fireModleChangeEvent(listener, notificationId);
|
fireModleChangeEvent(listener, null);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,12 +402,12 @@ public class GdbPinProvider implements IPinProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireModleChangeEvent(final IPinModelListener listener, final int notificationId) {
|
private void fireModleChangeEvent(final IPinModelListener listener, final ISelection selection) {
|
||||||
new Job("Model Changed") { //$NON-NLS-1$
|
new Job("Model Changed") { //$NON-NLS-1$
|
||||||
{ setSystem(true); }
|
{ setSystem(true); }
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor arg0) {
|
protected IStatus run(IProgressMonitor arg0) {
|
||||||
listener.modelChanged(notificationId);
|
listener.modelChanged(selection);
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
}.schedule();
|
}.schedule();
|
||||||
|
|
Loading…
Add table
Reference in a new issue