Skip to main content
summaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorPatrick Chuong2011-03-11 10:42:02 -0500
committerPatrick Chuong2011-03-11 10:42:02 -0500
commit461e44b498af4b9f1b0102ae9be82635db3fcaf1 (patch)
tree20eb35e0ba265b64e3358e26d920de45be234134 /debug
parent1ba6e16383a82bf25dcdea1ca1b73c2205485160 (diff)
downloadorg.eclipse.cdt-461e44b498af4b9f1b0102ae9be82635db3fcaf1.tar.gz
org.eclipse.cdt-461e44b498af4b9f1b0102ae9be82635db3fcaf1.tar.xz
org.eclipse.cdt-461e44b498af4b9f1b0102ae9be82635db3fcaf1.zip
The last fix didn't cover the case of unpinning a view where there is no active debug context, related to bug 337376.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/PinDebugContextActionDelegate.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/PinDebugContextActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/PinDebugContextActionDelegate.java
index 6c0bf94957..1af96dc6ba 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/PinDebugContextActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/PinDebugContextActionDelegate.java
@@ -39,12 +39,15 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartConstants;
import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.WorkbenchPart;
/**
* Pin the selected debug context for the view.
*/
public class PinDebugContextActionDelegate implements IViewActionDelegate, IActionDelegate2, IDebugContextListener {
private IViewPart fPart;
+ private String fPinnedContextLabel = ""; //$NON-NLS-1$
+ private String fLastKnownDescription = ""; //$NON-NLS-1$
private IAction fAction;
private IPartListener2 fPartListener;
private DebugContextPinProvider fProvider;
@@ -66,14 +69,16 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
if (action.isChecked()) {
fProvider = DebugEventFilterService.getInstance().addDebugEventFilter(fPart, getActiveDebugContext());
if (fProvider != null) {
- updatePinContextColor(fProvider);
- updatePinContextLabel(fProvider);
- }
+ fLastKnownDescription = ((WorkbenchPart) fPart).getContentDescription();
+ fPinnedContextLabel = getPinContextLabel(fProvider);
+ PinCloneUtils.setPartContentDescription(fPart, fPinnedContextLabel);
+ updatePinContextColor(fProvider);
+ }
} else {
fProvider = null;
DebugEventFilterService.getInstance().removeDebugEventFilter(fPart);
updatePinContextColor(fProvider);
- updatePinContextLabel(fProvider);
+ PinCloneUtils.setPartContentDescription(fPart, fLastKnownDescription);
}
}
@@ -105,8 +110,17 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
fPart.addPropertyListener(new IPropertyListener() {
public void propertyChanged(Object source, int propId) {
if (IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION == propId) {
- if (fAction != null && fAction.isChecked())
- updatePinContextLabel(fProvider);
+ // if the content description is not the pinned context label,
+ // then cache it so that we can set it back when the action is unchecked.
+ String desc = ((WorkbenchPart) fPart).getContentDescription();
+ if (!fPinnedContextLabel.equals(desc)) {
+ fLastKnownDescription = desc;
+ }
+
+ // if action is checked, than set it back to the pinned context label.
+ if (fAction != null && fAction.isChecked()) {
+ PinCloneUtils.setPartContentDescription(fPart, fPinnedContextLabel);
+ }
} else if (IWorkbenchPartConstants.PROP_PART_NAME == propId) {
PinCloneUtils.setPartTitle(fPart);
}
@@ -153,7 +167,7 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
return contextService.getActiveContext();
}
- private void updatePinContextLabel(DebugContextPinProvider provider) {
+ private String getPinContextLabel(DebugContextPinProvider provider) {
String description = ""; //$NON-NLS-1$
if (provider != null) {
@@ -174,8 +188,7 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
}
}
}
-
- PinCloneUtils.setPartContentDescription(fPart, description);
+ return description;
}
private String getLabel(IPinElementHandle handle) {

Back to the top