Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2011-03-01 17:33:55 +0000
committerPawel Piech2011-03-01 17:33:55 +0000
commit831deb77f8e22868c00b49a86a484cd95070991c (patch)
tree70b5944ce40e7f099d2b1b421f57739c404620a6
parentaff000fa3fefc1c65672e38214d11648b82fabaf (diff)
downloadeclipse.platform.debug-831deb77f8e22868c00b49a86a484cd95070991c.tar.gz
eclipse.platform.debug-831deb77f8e22868c00b49a86a484cd95070991c.tar.xz
eclipse.platform.debug-831deb77f8e22868c00b49a86a484cd95070991c.zip
Bug 128066 - [view management] Don't auto-close views that exist in a perspective by default
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
index eb3e44515..c029c2bf5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
@@ -369,6 +369,10 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
* Set of perspectives this view was closed in by the user
*/
private Set fUserClosed = new HashSet();
+ /**
+ * Set of perspectives this view was auto-opened by view management.
+ */
+ private Set fAutoOpened = new HashSet();
public ViewBinding(IConfigurationElement element) {
fElement = element;
@@ -438,6 +442,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
protected void userOpened() {
if (isTrackingViews()) {
String id = getActivePerspective().getId();
+ fAutoOpened.remove(id);
fUserOpened.add(id);
fUserClosed.remove(id);
saveViewBindings();
@@ -447,6 +452,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
protected void userClosed() {
if (isTrackingViews()) {
String id = getActivePerspective().getId();
+ fAutoOpened.remove(id);
fUserClosed.add(id);
fUserOpened.remove(id);
saveViewBindings();
@@ -472,6 +478,11 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
if (isAutoOpen()) {
try {
fIgnoreChanges = true;
+ // Remember whether the view was opened by view management.
+ // (Bug 128065)
+ if (page.findViewReference(getViewId()) == null) {
+ fAutoOpened.add(perspective.getId());
+ }
page.showView(getViewId(), null, IWorkbenchPage.VIEW_CREATE);
} catch (PartInitException e) {
DebugUIPlugin.log(e);
@@ -519,7 +530,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
*/
public void deactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
if (!isUserOpened(perspective)) {
- if (isAutoClose() && !isDefault(perspective)) {
+ if (fAutoOpened.remove(perspective.getId()) && isAutoClose() && !isDefault(perspective)) {
IViewReference reference = page.findViewReference(getViewId());
if (reference != null) {
try {
@@ -933,11 +944,18 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
if (!fIgnoreChanges && page.getWorkbenchWindow().equals(fWindow)) {
if(partRef != null) {
if (IWorkbenchPage.CHANGE_VIEW_SHOW == changeId || IWorkbenchPage.CHANGE_VIEW_HIDE == changeId) {
- Iterator iterator = fContextIdsToBindings.values().iterator();
- while (iterator.hasNext()) {
- DebugContextViewBindings bindings = (DebugContextViewBindings) iterator.next();
- bindings.setViewOpened(IWorkbenchPage.CHANGE_VIEW_SHOW == changeId, partRef.getId());
- }
+ // Update only the contexts which are currently active (Bug 128065)
+ Set activatedContexts = (Set)fPerspectiveToActivatedContexts.get(perspective);
+ if (activatedContexts != null) {
+ Iterator iterator = activatedContexts.iterator();
+ while (iterator.hasNext()) {
+ DebugContextViewBindings bindings =
+ (DebugContextViewBindings)fContextIdsToBindings.get(iterator.next());
+ if (bindings != null) {
+ bindings.setViewOpened(IWorkbenchPage.CHANGE_VIEW_SHOW == changeId, partRef.getId());
+ }
+ }
+ }
}
}
}

Back to the top