1 package net.sourceforge.phpdt.internal.debug.ui.actions;
3 import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
4 import net.sourceforge.phpdt.internal.debug.ui.properties.PHPBreakpointPropertiesDialog;
6 import org.eclipse.jface.action.IAction;
7 import org.eclipse.jface.viewers.ISelection;
8 import org.eclipse.jface.viewers.IStructuredSelection;
9 import org.eclipse.ui.IViewActionDelegate;
10 import org.eclipse.ui.IViewPart;
13 * Enables the context menu entry if object is of type PHPLineBreakpoint. This
14 * is used for Breakpoint properties menu. Properties menu let you set 'skip
15 * 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(
32 public void selectionChanged(IAction action, ISelection selection) {
33 IStructuredSelection bpSelection;
36 if (selection instanceof IStructuredSelection) {
37 bpSelection = (IStructuredSelection) selection;
39 if (bpSelection.size() == 1) { // Do we have something selected
40 bpObject = bpSelection.getFirstElement(); // Get the selected
43 if (bpObject instanceof PHPLineBreakpoint) { // Is the object
46 fBreakpoint = (PHPLineBreakpoint) bpObject;
47 action.setEnabled(true); // Then enable the context menu
54 action.setEnabled(false); // It isn't a PHPLineBreakpoint, so disable