From 2871a5d7eb844382eae6ba18f508ca99b95d094a Mon Sep 17 00:00:00 2001 From: jsurfer Date: Sun, 10 Oct 2004 11:45:25 +0000 Subject: [PATCH] Added "Toggle PHP Breakpoint" to left Editor ruler --- net.sourceforge.phpeclipse.debug.ui/build.xml | 202 --------------- .../plugin.properties | 4 +- net.sourceforge.phpeclipse.debug.ui/plugin.xml | 64 ++++-- .../debug/ui/PHPDebugUiMessages.properties | 5 +- .../ui/actions/ManageBreakpointActionDelegate.java | 256 -------------------- .../ui/actions/PHPManageBreakpointRulerAction.java | 4 +- .../actions/RetargettableActionAdapterFactory.java | 3 +- .../debug/ui/actions/ToggleBreakpointAdapter.java | 13 +- 8 files changed, 64 insertions(+), 487 deletions(-) delete mode 100644 net.sourceforge.phpeclipse.debug.ui/build.xml delete mode 100644 net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ManageBreakpointActionDelegate.java diff --git a/net.sourceforge.phpeclipse.debug.ui/build.xml b/net.sourceforge.phpeclipse.debug.ui/build.xml deleted file mode 100644 index f688a50..0000000 --- a/net.sourceforge.phpeclipse.debug.ui/build.xml +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/net.sourceforge.phpeclipse.debug.ui/plugin.properties b/net.sourceforge.phpeclipse.debug.ui/plugin.properties index 6b3b861..314fb93 100644 --- a/net.sourceforge.phpeclipse.debug.ui/plugin.properties +++ b/net.sourceforge.phpeclipse.debug.ui/plugin.properties @@ -9,7 +9,9 @@ LaunchShortcut.PHP.label=PHP Application DebugActionSet.label=PHP Debug RunMenu.label=&Run -GlobalManageBreakpointAction.label=Add/Remove Brea&kpoint (PHP) +BreakpoingActionSet.label=PHP Breakpoints +# GlobalManageBreakpointAction.label=Toggle Line Breakpoint (PHP) +AddBreakpoint.label=Toggle PHP &Breakpoint Context.Debugging.name=Debugging PHP Context.Debugging.description=Debugging PHP-Scripts diff --git a/net.sourceforge.phpeclipse.debug.ui/plugin.xml b/net.sourceforge.phpeclipse.debug.ui/plugin.xml index b37a70d..f3f7d1c 100644 --- a/net.sourceforge.phpeclipse.debug.ui/plugin.xml +++ b/net.sourceforge.phpeclipse.debug.ui/plugin.xml @@ -103,27 +103,28 @@ id="net.sourceforge.phpeclipse.debug.core.PHPLineBreakpointMarkerProvider"> - - + - - + + - + --> + + + + + + + + + + + - + adaptableType="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"> + - + point="org.eclipse.ui.popupMenus"> + + + id="net.sourceforge.phpdt.internal.debug.ui.actions.PHPManageBreakpointRulerActionDelegate"> - + diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties index 1f09ff1..e6d1827 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties @@ -63,8 +63,9 @@ PHPInterpreterPreferencePage.EditInterpreterDialog.editInterpreter.title=Edit In PHPBasePreferencePage.label=General Properties -PHPManageBreakpointRulerAction.AddBreakpoint=Add Breakpoint -PHPManageBreakpointRulerAction.RemoveBreakpoint=Remove Breakpoint +#PHPManageBreakpointRulerAction.AddBreakpoint=Add Breakpoint +#PHPManageBreakpointRulerAction.RemoveBreakpoint=Remove Breakpoint +PHPManageBreakpointRulerAction.ToggleBreakpoint=Toggle PHP &Breakpoint PHPDebugModelPresentation.= PHPDebugModelPresentation.line=line: diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ManageBreakpointActionDelegate.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ManageBreakpointActionDelegate.java deleted file mode 100644 index 979daa8..0000000 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ManageBreakpointActionDelegate.java +++ /dev/null @@ -1,256 +0,0 @@ -package net.sourceforge.phpdt.internal.debug.ui.actions; -import net.sourceforge.phpdt.debug.core.PHPDebugModel; -import org.eclipse.debug.core.DebugPlugin; -import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.ui.texteditor.IEditorStatusLine; -import org.eclipse.ui.texteditor.ITextEditor; -import org.eclipse.core.resources.IFile; -import org.eclipse.ui.IEditorPart; -import org.eclipse.jface.text.IDocument; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IPartListener; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.core.runtime.CoreException; - -import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin; - -/* (non-Javadoc) - * @see IWorkbenchWindowActionDelegate - */ -public class ManageBreakpointActionDelegate implements IWorkbenchWindowActionDelegate, IPartListener { - - protected boolean fInitialized= false; - private ITextEditor fTextEditor= null; - private IAction fAction= null; - private IFile fFile = null; - private IWorkbenchWindow fWorkbenchWindow= null; - - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart) - */ - public void partActivated( IWorkbenchPart part ) - { - if ( part instanceof ITextEditor ) - { - setTextEditor( (ITextEditor)part ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart) - */ - public void partBroughtToTop( IWorkbenchPart part ) - { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart) - */ - public void partClosed( IWorkbenchPart part ) - { - if ( part == getTextEditor() ) - { - setTextEditor( null ); - if ( getAction() != null ) - { - getAction().setEnabled( false ); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart) - */ - public void partDeactivated( IWorkbenchPart part ) - { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart) - */ - public void partOpened( IWorkbenchPart part ) - { - if ( part instanceof ITextEditor ) - { - if ( getTextEditor() == null ) - { - setTextEditor( (ITextEditor)part ); - } - } - } - - - /** - * Manages a breakpoint. - */ - protected void manageBreakpoint(IEditorInput editorInput) { - ISelectionProvider sp= getTextEditor().getSelectionProvider(); - if (sp == null || getFile() == null) { - report("ManageBreakpointActionDelegate.No_Breakpoint"); //$NON-NLS-1$ - return; - } - report(null); - ISelection selection= sp.getSelection(); - if ( selection instanceof ITextSelection ) { - if ( getFile() == null ) - return; - IDocument document = getTextEditor().getDocumentProvider().getDocument( editorInput ); -// BreakpointLocationVerifier bv = new BreakpointLocationVerifier(); -// int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine()); - int lineNumber = ((ITextSelection)selection).getStartLine() +1; - if ( lineNumber > -1 ) { - - try { - PHPLineBreakpoint breakpoint=PHPDebugModel.lineBreakpointExists(lineNumber); - if (breakpoint==null) - PHPDebugModel.createLineBreakpoint(getFile(), lineNumber, 0, true, null); - else - DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); - - } catch( CoreException ce ) { - PHPDebugUiPlugin.errorDialog( "Cannot add breakpoint", ce ); - } - } - } - } - - public ManageBreakpointActionDelegate() { - } - - /* (non-Javadoc) - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - if ( getTextEditor() != null ) { - update(); - manageBreakpoint( getTextEditor().getEditorInput() ); - } - } - - /* (non-Javadoc) - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - if (!fInitialized) { - initialize(action); - } - } - - protected void update( ISelection selection ) - { - setEnabledState( getTextEditor() ); - } - - protected void initialize(IAction action) { - setAction( action ); - if (getWorkbenchWindow() != null) { - IWorkbenchPage page= getWorkbenchWindow().getActivePage(); - if (page != null) { - IEditorPart part= page.getActiveEditor(); - if (part instanceof ITextEditor) { - setTextEditor((ITextEditor)part); - update( getTextEditor().getSelectionProvider().getSelection() ); - } - } - } - fInitialized= true; - } - - /* (non-Javadoc) - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - getWorkbenchWindow().getPartService().removePartListener( this ); - } - - /* (non-Javadoc) - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - setWorkbenchWindow( window ); - window.getPartService().addPartListener( this ); - } - - protected ITextEditor getTextEditor() { - return fTextEditor; - } - - - protected IAction getAction() { - return fAction; - } - - protected void setAction(IAction action) { - fAction = action; - } - - protected IWorkbenchWindow getWorkbenchWindow() { - return fWorkbenchWindow; - } - - protected void setWorkbenchWindow(IWorkbenchWindow workbenchWindow) { - fWorkbenchWindow = workbenchWindow; - } - - protected IFile getFile() - { - return fFile; - } - - protected void setFile( IFile file ) - { - fFile = file; - } - - protected void setTextEditor(ITextEditor editor) { - fTextEditor = editor; - if ( fTextEditor != null ) { - IEditorInput input = fTextEditor.getEditorInput(); - setFile( ( input != null && input instanceof IFileEditorInput ) ? ((IFileEditorInput)input).getFile() : null ); - } - setEnabledState(editor); - } - protected void setEnabledState(ITextEditor editor) { - if ( getAction() != null ) { - getAction().setEnabled( editor != null ); - } - } - - protected void update() { - IAction action= getAction(); - if (action != null) { - if (getTextEditor() != null) { - breakpointExists(getTextEditor().getEditorInput()); - } - } - } - - protected boolean breakpointExists(IEditorInput editorInput){ - return false; - } - - protected void report(String message) { - if (getTextEditor() != null) { - IEditorStatusLine statusLine= (IEditorStatusLine) getTextEditor().getAdapter(IEditorStatusLine.class); - if (statusLine != null) { - if (message != null) { - statusLine.setMessage(true, message, null); - } else { - statusLine.setMessage(true, null, null); - } - } - } - if (message != null && PHPDebugUiPlugin.getActiveWorkbenchShell() != null) { - PHPDebugUiPlugin.getActiveWorkbenchShell().getDisplay().beep(); - } - } -} diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java index e715589..5504625 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java @@ -56,8 +56,8 @@ public class PHPManageBreakpointRulerAction extends Action implements IUpdate { fRuler= ruler; fTextEditor= editor; fMarkerType= IBreakpoint.BREAKPOINT_MARKER; - fAddLabel= PHPDebugUiMessages.getString("PHPManageBreakpointRulerAction.AddBreakpoint"); //$NON-NLS-1$ - fRemoveLabel= PHPDebugUiMessages.getString("PHPManageBreakpointRulerAction.RemoveBreakpoint"); //$NON-NLS-1$ + fAddLabel= PHPDebugUiMessages.getString("PHPManageBreakpointRulerAction.ToggleBreakpoint"); //$NON-NLS-1$ + fRemoveLabel= PHPDebugUiMessages.getString("PHPManageBreakpointRulerAction.ToggleBreakpoint"); //$NON-NLS-1$ } /** diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java index 06d27a7..865ce08 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java @@ -38,6 +38,7 @@ public class RetargettableActionAdapterFactory implements IAdapterFactory { * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() */ public Class[] getAdapterList() { - return new Class[]{IRunToLineTarget.class, IToggleBreakpointsTarget.class}; + // return new Class[]{IRunToLineTarget.class, IToggleBreakpointsTarget.class}; + return new Class[]{IToggleBreakpointsTarget.class}; } } diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java index d50a217..6fa47db 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java @@ -249,12 +249,13 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) */ public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) { - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection) selection; - return getMethods(ss).length > 0; - } else { - return selection instanceof ITextSelection; - } +// if (selection instanceof IStructuredSelection) { +// IStructuredSelection ss = (IStructuredSelection) selection; +// return getMethods(ss).length > 0; +// } else { +// return selection instanceof ITextSelection; +// } + return false; } protected IMethod[] getMethods(IStructuredSelection selection) { -- 1.7.1