Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Chuong2011-03-04 11:45:10 -0500
committerPatrick Chuong2011-03-04 11:45:10 -0500
commit38f65aca635aab68958c7998caf750f35fdfa1ce (patch)
treeee5b6c47c960e0a6cbc5b31e5c1224dde86cfc5b /debug/org.eclipse.cdt.debug.ui
parentc57cf3cce366ba1d36b09a95799c1d2cdf5a0038 (diff)
downloadorg.eclipse.cdt-38f65aca635aab68958c7998caf750f35fdfa1ce.tar.gz
org.eclipse.cdt-38f65aca635aab68958c7998caf750f35fdfa1ce.tar.xz
org.eclipse.cdt-38f65aca635aab68958c7998caf750f35fdfa1ce.zip
Bug 338472 - [Pin&Clone] Pinned view should blank out when session terminated
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/DebugContextPinProvider.java32
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/ViewIDCounterManager.java5
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/IPinProvider.java42
3 files changed, 57 insertions, 22 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/DebugContextPinProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/DebugContextPinProvider.java
index 054c68e64a..f0483b110a 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/DebugContextPinProvider.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/DebugContextPinProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************
- * Copyright (c) 2010 Texas Instruments and others
+ * Copyright (c) 2010, 2011 Texas Instruments and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,6 +19,7 @@ import java.util.Set;
import org.eclipse.cdt.debug.ui.IPinProvider;
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle;
+import org.eclipse.cdt.debug.ui.IPinProvider.IPinModelListener;
import org.eclipse.cdt.debug.ui.PinElementHandle;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.ui.contexts.AbstractDebugContextProvider;
@@ -26,11 +27,13 @@ import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextProvider2;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
/**
* Pin debug context provider.
- * It takes a debug context and translate to a handle for pinning purpose.
+ * It takes a debug context and translates it to a handle for pinning purpose.
*/
public class DebugContextPinProvider extends AbstractDebugContextProvider implements IDebugContextProvider2 {
private ISelection fActiveContext;
@@ -50,7 +53,17 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
fPinProvider = new HashMap<IPinElementHandle, IPinProvider>();
fActiveContext = activeContext;
- fPinHandles = pin(part, activeContext);
+ fPinHandles = pin(part, activeContext, new IPinModelListener() {
+ public void modelChanged(int eventType) {
+ // 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;
+ }
+ }
+ });
}
/**
@@ -102,9 +115,10 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
*
* @param part the workbench part where the pin action is requested
* @param selection the debug context selection
+ * @param listener pin model listener
* @return a set of pinned handle
*/
- private Set<IPinElementHandle> pin(IWorkbenchPart part, ISelection selection) {
+ private Set<IPinElementHandle> pin(IWorkbenchPart part, ISelection selection, IPinModelListener listener) {
Set<IPinElementHandle> handles = new HashSet<IPinElementHandle>();
if (selection instanceof IStructuredSelection) {
@@ -115,7 +129,7 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
}
if (pinProvider != null) {
- IPinElementHandle handle = pinProvider.pin(fWorkbenchPart, element);
+ IPinElementHandle handle = pinProvider.pin(fWorkbenchPart, element, listener);
handles.add(handle);
fPinProvider.put(handle, pinProvider);
} else
@@ -132,7 +146,11 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
* @param event debug event
*/
public void delegateEvent(final DebugContextEvent event) {
- fActiveContext = event.getContext();
- fire(event);
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ fActiveContext = event.getContext();
+ fire(event);
+ }
+ });
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/ViewIDCounterManager.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/ViewIDCounterManager.java
index 248a46fd9c..77f191329e 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/ViewIDCounterManager.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/pinclone/ViewIDCounterManager.java
@@ -1,5 +1,5 @@
/*****************************************************************
- * Copyright (c) 2010 Texas Instruments and others
+ * Copyright (c) 2010, 2011 Texas Instruments and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -67,7 +67,8 @@ public final class ViewIDCounterManager {
if (fInitialized) return;
fInitialized = true;
- new WorkbenchJob("Initializing pinnable view") { //$NON-NLS-1$
+ new WorkbenchJob("Initializing pinnable view") { //$NON-NLS-1$
+ { setSystem(true); }
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/IPinProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/IPinProvider.java
index efa8c76d55..e89f52fa22 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/IPinProvider.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/IPinProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************
- * Copyright (c) 2010 Texas Instruments and others
+ * Copyright (c) 2010, 2011 Texas Instruments and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,13 +16,11 @@ import org.eclipse.ui.IWorkbenchPart;
/**
* Debug element that wants to enable pin capability should be adaptable to this interface.
- * If the debug element is not adaptable to this interface, than the default implementation
- * will be provided.
* <br><br>
- * When user press the 'Pin' action in a view that supports debug context pinning, the
+ * When the user presses the 'Pin' action in a view that supports debug context pinning, the
* DebugEventFilterService calls the <code>pin</code> method with the selected debug context.
- * If more than one debug context is selected, than <code>pin</code> is called multiple times.
- * The <code>pin</code> method should returns a handle for the pinned debug context and when
+ * If more than one debug context is selected, the <code>pin</code> method is called multiple times.
+ * The <code>pin</code> method should return a handle for the pinned debug context and when
* there is a debug context change event generated by the debug context manager,
* <code>isPinnedTo</code> will be call by the DebugEventFilterService to determine whether the
* debug context in question is pinned to the handle returned by the <code>pin</code> method.
@@ -60,16 +58,16 @@ public interface IPinProvider {
int BLUE = 2;
/**
- * Returns the overlay pin color. The overlay pin will be used to decorate the debug view for element that
+ * Returns the overlay pin color. The overlay pin will be used to decorate the debug view for an element that
* is pinned to a view.
*
- * @return one of the overlay color
+ * @return one of the overlay colors
*/
int getOverlayColor();
/**
* Returns the toolbar pin action image description to use when the view is pinned, can be <code>null</code>.
- * If <code>null</code>, than the default image description will be use.
+ * If <code>null</code>, then the default image description will be used.
*
* @return the icon descriptor
*/
@@ -88,8 +86,7 @@ public interface IPinProvider {
Object getDebugContext();
/**
- * Returns the label the label will be used to display
- * in the pinned view's descriptor.
+ * Returns the label that will be used in the pinned view's description.
*
* @return the handle label
*/
@@ -104,6 +101,25 @@ public interface IPinProvider {
}
/**
+ * A callback interface that can be used by an IPinProvider to indicate
+ * 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.
+ */
+ 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.
+ */
+ void modelChanged(int eventType);
+ }
+
+ /**
* Returns whether the debug context is pinnable.
*
* @param part the workbench part
@@ -120,7 +136,7 @@ public interface IPinProvider {
* @return a handle for the pinned debug context
*/
- IPinElementHandle pin(IWorkbenchPart part, Object debugContext);
+ IPinElementHandle pin(IWorkbenchPart part, Object debugContext, IPinModelListener listener);
/**
* Unpin the debug context for the given pin handle.
@@ -133,7 +149,7 @@ public interface IPinProvider {
/**
* Returns true if the debug context belongs to the handle. If returning true,
- * than the debug context change event will be delegate to the view.
+ * then the debug context change event will be delegated to the view.
*
* @param debugContext the debug context in question
* @param handle an existing pinned debug context handle

Back to the top