1 package net.sourceforge.phpdt.internal.debug.ui.actions;
3 import org.eclipse.jface.action.IAction;
4 import org.eclipse.jface.viewers.ISelection;
5 import org.eclipse.jface.viewers.IStructuredSelection;
6 import org.eclipse.ui.IViewActionDelegate;
7 import org.eclipse.ui.IViewPart;
9 import net.sourceforge.phpdt.internal.debug.ui.properties.*;
10 import net.sourceforge.phpdt.internal.debug.core.breakpoints.*;
13 * Enables the context menu entry if object is of type PHPLineBreakpoint.
14 * This is used for Breakpoint properties menu.
15 * Properties menu let you set 'skip count' and condition of a PHP breakpoint.
19 public class PHPDebugBreakpointAction implements IViewActionDelegate {
20 protected PHPLineBreakpoint fBreakpoint = null;
22 public void init(IViewPart view) {
26 public void run(IAction action) {
27 PHPBreakpointPropertiesDialog dialog = new PHPBreakpointPropertiesDialog (null, fBreakpoint);
31 public void selectionChanged(IAction action, ISelection selection) {
32 IStructuredSelection bpSelection;
35 if (selection instanceof IStructuredSelection) {
36 bpSelection = (IStructuredSelection) selection;
38 if (bpSelection.size () == 1) { // Do we have something selected
39 bpObject = bpSelection.getFirstElement(); // Get the selected object
41 if (bpObject instanceof PHPLineBreakpoint) { // Is the object of type PHPLineBreakpoint?
42 fBreakpoint = (PHPLineBreakpoint) bpObject;
43 action.setEnabled (true); // Then enable the context menu item
49 action.setEnabled (false); // It isn't a PHPLineBreakpoint, so disable the menu item