1
/*******************************************************************************
2
* Copyright (c) 2007, 2011 Wind River Systems and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Wind River Systems - initial API and implementation
10
* Texas Instruments - Bug 340478
11
*******************************************************************************/
12
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions;
14
import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.AbstractVMProviderActionDelegate;
15
import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.VMHandlerUtils;
16
import org.eclipse.cdt.dsf.ui.viewmodel.IVMProvider;
17
import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider;
18
import org.eclipse.debug.ui.contexts.DebugContextEvent;
19
import org.eclipse.jface.action.IAction;
20
import org.eclipse.jface.viewers.ISelection;
21
import org.eclipse.ui.IViewPart;
26
public class RefreshActionDelegate extends AbstractVMProviderActionDelegate {
28
public void run(IAction action) {
29
IVMProvider provider = VMHandlerUtils.getVMProviderForPart(getView());
30
if (provider instanceof ICachingVMProvider) {
31
((ICachingVMProvider)provider).refresh();
36
public void init(IViewPart view) {
38
IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
39
getAction().setEnabled(vp instanceof ICachingVMProvider);
43
public void debugContextChanged(DebugContextEvent event) {
44
super.debugContextChanged(event);
45
IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
46
getAction().setEnabled(vp instanceof ICachingVMProvider);
50
public void selectionChanged(IAction action, ISelection selection) {
51
super.selectionChanged(action, selection);
52
IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
53
getAction().setEnabled(vp instanceof ICachingVMProvider);