From: robekras Date: Sun, 11 Dec 2005 15:37:22 +0000 (+0000) Subject: 1) Action for breakpoint properties menu. X-Git-Url: http://git.phpeclipse.com 1) Action for breakpoint properties menu. --- diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPDebugBreakpointAction.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPDebugBreakpointAction.java new file mode 100644 index 0000000..28d4954 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPDebugBreakpointAction.java @@ -0,0 +1,51 @@ +package net.sourceforge.phpdt.internal.debug.ui.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +import net.sourceforge.phpdt.internal.debug.ui.properties.*; +import net.sourceforge.phpdt.internal.debug.core.breakpoints.*; + +/** + * Enables the context menu entry if object is of type PHPLineBreakpoint. + * This is used for Breakpoint properties menu. + * Properties menu let you set 'skip count' and condition of a PHP breakpoint. + * + */ + +public class PHPDebugBreakpointAction implements IViewActionDelegate { + protected PHPLineBreakpoint fBreakpoint = null; + + public void init(IViewPart view) { + + } + + public void run(IAction action) { + PHPBreakpointPropertiesDialog dialog = new PHPBreakpointPropertiesDialog (null, fBreakpoint); + dialog.open(); + } + + public void selectionChanged(IAction action, ISelection selection) { + IStructuredSelection bpSelection; + Object bpObject; + + if (selection instanceof IStructuredSelection) { + bpSelection = (IStructuredSelection) selection; + + if (bpSelection.size () == 1) { // Do we have something selected + bpObject = bpSelection.getFirstElement(); // Get the selected object + + if (bpObject instanceof PHPLineBreakpoint) { // Is the object of type PHPLineBreakpoint? + fBreakpoint = (PHPLineBreakpoint) bpObject; + action.setEnabled (true); // Then enable the context menu item + return; + } + } + } + + action.setEnabled (false); // It isn't a PHPLineBreakpoint, so disable the menu item + } +}