mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +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;
|
||||
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
|
||||
switch (eventType) {
|
||||
case IPinModelListener.EXITED:
|
||||
case IPinModelListener.RESUMED:
|
||||
delegateEvent(new DebugContextEvent(DebugContextPinProvider.this, new StructuredSelection(), DebugContextEvent.ACTIVATED));
|
||||
break;
|
||||
}
|
||||
delegateEvent(new DebugContextEvent(DebugContextPinProvider.this,
|
||||
selection == null ? new StructuredSelection() : selection,
|
||||
DebugContextEvent.ACTIVATED));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -118,8 +115,8 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
|
|||
* @param listener pin model listener
|
||||
* @return a set of pinned handle
|
||||
*/
|
||||
private Set<IPinElementHandle> pin(IWorkbenchPart part, ISelection selection, IPinModelListener listener) {
|
||||
Set<IPinElementHandle> handles = new HashSet<IPinElementHandle>();
|
||||
private Set<IPinElementHandle> pin(IWorkbenchPart part, ISelection selection, IPinModelListener listener) {
|
||||
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
for (Object element : ((IStructuredSelection)selection).toList()) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.debug.ui;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
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
|
||||
* 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 {
|
||||
static final int RESUMED = 0;
|
||||
static final int EXITED = 1;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return a handle for the pinned debug context
|
||||
*/
|
||||
|
||||
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.jobs.Job;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
|
@ -278,7 +279,7 @@ public class GdbPinProvider implements IPinProvider {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dispatch the change event for the given DM context.
|
||||
*
|
||||
|
@ -341,20 +342,20 @@ public class GdbPinProvider implements IPinProvider {
|
|||
|
||||
@DsfServiceEventHandler
|
||||
public void handleEvent(final ICommandControlShutdownDMEvent event) {
|
||||
doHandleEvent(event, IPinModelListener.EXITED);
|
||||
handleInvalidModelContext(event);
|
||||
}
|
||||
|
||||
@DsfServiceEventHandler
|
||||
public void handleEvent(final IExitedDMEvent event) {
|
||||
doHandleEvent(event, IPinModelListener.EXITED);
|
||||
handleInvalidModelContext(event);
|
||||
}
|
||||
|
||||
@DsfServiceEventHandler
|
||||
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();
|
||||
for (final Entry<IPinElementHandle, IPinModelListener> e : entries) {
|
||||
final IPinModelListener listener = e.getValue();
|
||||
|
@ -375,7 +376,7 @@ public class GdbPinProvider implements IPinProvider {
|
|||
if (execEventDmc != null && execHandleDmc != null) {
|
||||
// It is a thread event, but is it the same as the pin handle?
|
||||
if (execEventDmc.equals(execHandleDmc)) {
|
||||
fireModleChangeEvent(listener, notificationId);
|
||||
fireModleChangeEvent(listener, null);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -386,14 +387,14 @@ public class GdbPinProvider implements IPinProvider {
|
|||
IMIContainerDMContext procHandleDmc = DMContexts.getAncestorOfType(handleDmc, IMIContainerDMContext.class);
|
||||
if (procEventDmc != null && procHandleDmc != null) {
|
||||
if (procEventDmc.equals(procHandleDmc)) {
|
||||
fireModleChangeEvent(listener, notificationId);
|
||||
fireModleChangeEvent(listener, null);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we got a shutdown event
|
||||
if (eventDmc instanceof ICommandControlDMContext) {
|
||||
fireModleChangeEvent(listener, notificationId);
|
||||
fireModleChangeEvent(listener, null);
|
||||
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$
|
||||
{ setSystem(true); }
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor arg0) {
|
||||
listener.modelChanged(notificationId);
|
||||
listener.modelChanged(selection);
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}.schedule();
|
||||
|
|
Loading…
Add table
Reference in a new issue