/******************************************************************************* * Copyright (c) 2005, 2009 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 * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Bjorn Freeman-Benson - initial API and implementation * Wind River Systems - adopted to use with DSF *******************************************************************************/ package org.eclipse.cdt.examples.dsf.pda.ui.editor; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.widgets.Event; import org.eclipse.ui.IActionDelegate2; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; public class PopFrameActionDelegate implements IObjectActionDelegate, IActionDelegate2 { //private PDAThread fThread = null; /* (non-Javadoc) * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) */ public void setActivePart(IAction action, IWorkbenchPart targetPart) { } /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run(IAction action) { /* try { fThread.pop(); } catch (DebugException e) { }*/ } /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ public void selectionChanged(IAction action, ISelection selection) { /* if (selection instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) selection; Object element = ss.getFirstElement(); if (element instanceof PDAStackFrame) { PDAStackFrame frame = (PDAStackFrame) element; //#ifdef ex5 //# // TODO: Exercise 5 - enable the action if the frame's thread supports it //#else fThread = (PDAThread) frame.getThread(); try { action.setEnabled(fThread.canPop() && fThread.getTopStackFrame().equals(frame)); } catch (DebugException e) { } return; //#endif } } action.setEnabled(false); */ } /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) */ public void init(IAction action) { } /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#dispose() */ public void dispose() { //fThread = null; } /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) */ public void runWithEvent(IAction action, Event event) { run(action); } }