1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

Bug 340478 - Variables/Registers/Expressions view refresh button enable/disable state gets messed up if the view is pinned

This commit is contained in:
Patrick Chuong 2011-04-01 13:42:32 +00:00
parent ffd5ae3839
commit 818e571ee9

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems and others. * Copyright (c) 2007, 2011 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,10 +7,12 @@
* *
* Contributors: * Contributors:
* Wind River Systems - initial API and implementation * Wind River Systems - initial API and implementation
* Texas Instruments - Bug 340478
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions; package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.AbstractVMProviderActionDelegate; import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.AbstractVMProviderActionDelegate;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.VMHandlerUtils;
import org.eclipse.cdt.dsf.ui.viewmodel.IVMProvider; import org.eclipse.cdt.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider; import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider;
import org.eclipse.debug.ui.contexts.DebugContextEvent; import org.eclipse.debug.ui.contexts.DebugContextEvent;
@ -24,7 +26,7 @@ import org.eclipse.ui.IViewPart;
public class RefreshActionDelegate extends AbstractVMProviderActionDelegate { public class RefreshActionDelegate extends AbstractVMProviderActionDelegate {
public void run(IAction action) { public void run(IAction action) {
IVMProvider provider = getVMProvider(); IVMProvider provider = VMHandlerUtils.getVMProviderForPart(getView());
if (provider instanceof ICachingVMProvider) { if (provider instanceof ICachingVMProvider) {
((ICachingVMProvider)provider).refresh(); ((ICachingVMProvider)provider).refresh();
} }
@ -33,18 +35,21 @@ public class RefreshActionDelegate extends AbstractVMProviderActionDelegate {
@Override @Override
public void init(IViewPart view) { public void init(IViewPart view) {
super.init(view); super.init(view);
getAction().setEnabled(getVMProvider() instanceof ICachingVMProvider); IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
getAction().setEnabled(vp instanceof ICachingVMProvider);
} }
@Override @Override
public void debugContextChanged(DebugContextEvent event) { public void debugContextChanged(DebugContextEvent event) {
super.debugContextChanged(event); super.debugContextChanged(event);
getAction().setEnabled(getVMProvider() instanceof ICachingVMProvider); IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
getAction().setEnabled(vp instanceof ICachingVMProvider);
} }
@Override @Override
public void selectionChanged(IAction action, ISelection selection) { public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection); super.selectionChanged(action, selection);
getAction().setEnabled(getVMProvider() instanceof ICachingVMProvider); IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
getAction().setEnabled(vp instanceof ICachingVMProvider);
} }
} }