From acccb6c4a41ce4bd5f58ce3f050c8884e11e4a2f Mon Sep 17 00:00:00 2001 From: Darin Wright Date: Fri, 11 Jun 2010 14:26:40 +0000 Subject: [r352] Bug 316514 - Debug context activation causes expressions view updates when hidden if selection is empty --- .../ui/viewers/model/provisional/ViewerInputService.java | 16 ++++++++++++++-- .../internal/ui/views/expression/ExpressionView.java | 12 +++++++++--- .../debug/internal/ui/views/variables/VariablesView.java | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java index 4da98b87c..ac39b8397 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2010 IBM Corporation 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 @@ -24,6 +24,18 @@ import org.eclipse.debug.internal.ui.viewers.model.ViewerInputUpdate; */ public class ViewerInputService { + /** + * An input object which will yield a null input element. + * + * @since 3.6 + */ + public final static Object NULL_INPUT = new IViewerInputProvider() { + public void update(IViewerInputUpdate update) { + update.setInputElement(null); + update.done(); + } + }; + // previous update request, cancelled when a new request comes in private IViewerInputUpdate fPendingUpdate = null; @@ -70,7 +82,7 @@ public class ViewerInputService { } if (provdier == null) { fPendingUpdate.setInputElement(source); - fRequestor.viewerInputComplete(fPendingUpdate); + fPendingUpdate.done(); } else { provdier.update(fPendingUpdate); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java index 0b6db0ec9..8483bd737 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation 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 @@ -14,6 +14,7 @@ package org.eclipse.debug.internal.ui.views.expression; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IExpressionManager; import org.eclipse.debug.core.ILaunch; @@ -37,6 +38,7 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.DND; @@ -95,8 +97,11 @@ public class ExpressionView extends VariablesView { * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#contextActivated(org.eclipse.jface.viewers.ISelection) */ protected void contextActivated(ISelection selection) { + if (!isAvailable() || !isVisible()) { + return; + } if (selection == null || selection.isEmpty()) { - setViewerInput(DebugPlugin.getDefault().getExpressionManager()); + super.contextActivated(new StructuredSelection(DebugPlugin.getDefault().getExpressionManager())); } else { super.contextActivated(selection); } @@ -109,7 +114,8 @@ public class ExpressionView extends VariablesView { * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#viewerInputUpdateComplete(IViewerInputUpdate) */ protected void viewerInputUpdateComplete(IViewerInputUpdate update) { - if (update.getElement() != null) { + IStatus status = update.getStatus(); + if ( (status == null || status.isOK()) && update.getElement() != null) { setViewerInput(update.getInputElement()); } else { setViewerInput(DebugPlugin.getDefault().getExpressionManager()); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java index 9d1a63216..67cf78bad 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation 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 @@ -1084,7 +1084,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis * @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden() */ protected void becomesHidden() { - fInputService.resolveViewerInput(null); + fInputService.resolveViewerInput(ViewerInputService.NULL_INPUT); super.becomesHidden(); } -- cgit v1.2.3