From 1f345a378dda34dbf08fc5fd2b04b335aff32695 Mon Sep 17 00:00:00 2001 From: robekras Date: Sun, 11 Dec 2005 15:37:22 +0000 Subject: [PATCH] 1) Action for breakpoint properties menu. --- .../debug/ui/actions/PHPDebugBreakpointAction.java | 51 ++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) create mode 100644 net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPDebugBreakpointAction.java 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 + } +} -- 1.7.1