First submit for debug plugin
authorfvicente <fvicente>
Wed, 30 Jul 2003 01:36:38 +0000 (01:36 +0000)
committerfvicente <fvicente>
Wed, 30 Jul 2003 01:36:38 +0000 (01:36 +0000)
net.sourceforge.phpeclipse.debug.ui/.classpath
net.sourceforge.phpeclipse.debug.ui/plugin.xml
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugModelPresentation.java [new file with mode: 0644]
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java [new file with mode: 0644]
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerActionDelegate.java [new file with mode: 0644]
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java

index bc6db00..b8be25f 100644 (file)
@@ -35,6 +35,7 @@
     <classpathentry kind="src" path="/net.sourceforge.phpeclipse"/>
     <classpathentry kind="var"
         path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.1.0/boot.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.boot_2.1.0/bootsrc.zip"/>
-    <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
+    <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
+    <classpathentry kind="src" path="/net.sourceforge.phpeclipse.debug.core"/>
     <classpathentry kind="output" path="bin"/>
 </classpath>
index afc5472..3337c36 100644 (file)
       <import plugin="org.eclipse.ui"/>
       <import plugin="org.eclipse.debug.core"/>
       <import plugin="org.eclipse.debug.ui"/>
+      <import plugin="net.sourceforge.phpeclipse.debug.core"/>
       <import plugin="net.sourceforge.phpeclipse.launching"/>
-      <import plugin="org.junit"/>
       <import plugin="net.sourceforge.phpeclipse"/>
    </requires>
 
-
+<!-- Extensions -->
    <extension
          point="org.eclipse.ui.preferencePages">
       <page
             class="net.sourceforge.phpdt.internal.debug.ui.preferences.PHPInterpreterPreferencePage"
             id="net.sourceforge.phpdt.debug.ui.preferences.PreferencePagePHPInterpreter">
       </page>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editorActions">
+      <editorContribution
+            targetID="net.sourceforge.phpeclipse.PHPEditor"
+            id="net.sourceforge.phpdt.internal.debug.ui.actions.BreakpointRulerActions">
+         <action
+               label="%Dummy.label"
+               class="net.sourceforge.phpdt.internal.debug.ui.actions.PHPManageBreakpointRulerActionDelegate"
+               actionID="RulerDoubleClick"
+               id="net.sourceforge.phpdt.internal.debug.ui.actions.ManageBreakpointRulerAction">
+         </action>
+      </editorContribution>
+   </extension>
+   <extension point = "org.eclipse.debug.core.sourceLocators">
+      <sourceLocator
+               id="net.sourceforge.phpdt.debug.ui.PHPSourceLocator"
+               class="net.sourceforge.phpdt.internal.debug.ui.PHPSourceLocator"
+               name="PHPSourceLocator"/>
+   </extension>
 
+<!-- Debug Model -->
+   <extension
+         point="org.eclipse.debug.ui.debugModelPresentations">
+      <debugModelPresentation
+            class="net.sourceforge.phpdt.internal.debug.ui.PHPDebugModelPresentation"
+            id="net.sourceforge.phpeclipse.debug.core">
+      </debugModelPresentation>
    </extension>
+<!-- Launcher extensions -->
    <extension
          point="org.eclipse.debug.ui.launchConfigurationTypeImages">
       <launchConfigurationTypeImage
             id="net.sourceforge.phpdt.debug.ui.applicationshortcut.php">
       </shortcut>
    </extension>
-
+<!-- Breakpoint Image -->
+   <extension point="org.eclipse.ui.markerImageProviders">
+      <imageprovider id="net.sourceforge.phpeclipse.debug.core.PHPLineBreakpointMarkerProvider"
+            markertype="net.sourceforge.phpeclipse.debug.core.phpLineBreakpointMarker"
+               icon="icons/obj16/brkp_obj.gif">
+      </imageprovider>
+   </extension>
 </plugin>
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugModelPresentation.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugModelPresentation.java
new file mode 100644 (file)
index 0000000..bce950a
--- /dev/null
@@ -0,0 +1,200 @@
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+
+Contributors:
+    IBM Corporation - Initial implementation
+    Vicente Fernando - www.alfersoft.com.ar
+**********************************************************************/
+package net.sourceforge.phpdt.internal.debug.ui;
+
+import java.util.HashMap;
+
+import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
+import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
+import net.sourceforge.phpdt.internal.debug.core.model.IPHPDebugTarget;
+import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
+import net.sourceforge.phpdt.internal.debug.core.model.PHPThread;
+import net.sourceforge.phpdt.internal.debug.core.model.PHPVariable;
+import net.sourceforge.phpdt.internal.debug.core.model.PHPValue;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @see IDebugModelPresentation
+ */
+public class PHPDebugModelPresentation extends LabelProvider implements IDebugModelPresentation {
+
+       protected HashMap fAttributes= new HashMap(3);
+
+       public PHPDebugModelPresentation() {
+               super();
+       }
+       /**
+        * @see IDebugModelPresentation#getEditorId(IEditorInput, Object)
+        */
+       public String getEditorId(IEditorInput input, Object inputObject) {
+               IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry();
+               IEditorDescriptor descriptor= registry.getDefaultEditor(input.getName());
+               if (descriptor != null)
+                       return descriptor.getId();
+               
+               return null;
+       }
+       /**
+        * @see IDebugModelPresentation#setAttribute(String, Object)
+        */
+       public void setAttribute(String id, Object value) {
+               if (value == null) {
+                       return;
+               }
+               fAttributes.put(id, value);
+       }
+       
+       /**
+        * @see IDebugModelPresentation#getEditorInput(Object)
+        */
+       public IEditorInput getEditorInput(Object item) {
+
+               if (item instanceof PHPLineBreakpoint) {
+                       IBreakpoint bp= (IBreakpoint)item;
+                       IMarker ma= bp.getMarker();
+                       IFile eclipseFile = PHPDebugUiPlugin.getWorkspace().getRoot().getFileForLocation(ma.getResource().getLocation());
+               if (eclipseFile == null) {
+                               return null;
+                       }
+                       return new FileEditorInput(eclipseFile);
+               }
+               return null;
+       }
+
+       /**
+        * @see IDebugModelPresentation#getImage(Object)
+        */
+       public Image getImage(Object element) {
+               if (element instanceof PHPLineBreakpoint) {
+                       return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
+               } else if (element instanceof IMarker) {
+                       return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
+               } else if (element instanceof PHPStackFrame || element instanceof PHPThread || element instanceof IPHPDebugTarget) {
+                       return getDebugElementImage(element);
+               } else if (element instanceof PHPVariable) {
+                       return getVariableImage((PHPVariable)element);
+               } else if (element instanceof PHPValue) {
+                       return getValueImage((PHPValue)element);
+               }
+               return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
+       }
+
+       private Image getVariableImage(PHPVariable phpVar) {
+               if (phpVar != null) {
+                       if (phpVar.isLocal())
+                               return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
+                       if (phpVar.isHashValue())
+                               return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
+               }
+               return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
+       }
+
+       private Image getValueImage(PHPValue phpVar) {
+               if (phpVar != null) {
+                       return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
+               }
+               return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
+       }
+
+       /**
+        * @see IDebugModelPresentation#getText(Object)
+        */
+       public String getText(Object element) {
+               try {
+                       if (element instanceof PHPLineBreakpoint) {
+                               return getBreakpointText((IBreakpoint)element);
+                       } else if (element instanceof PHPVariable) {
+                               PHPVariable phpVar= (PHPVariable) element;
+                               return phpVar.toString();
+                       }
+               } catch (CoreException e) {
+                       return PHPDebugUiMessages.getString("PHPDebugModelPresentation.<not responding>"); //$NON-NLS-1$
+               }
+               return null;
+       }
+       
+       /**
+        * @see IDebugModelPresentation#computeDetail(IValue, IValueDetailListener)
+        */
+       public void computeDetail(IValue value, IValueDetailListener listener) {
+               return;
+       }
+
+       protected IBreakpoint getBreakpoint(IMarker marker) {
+               return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+       }
+
+       protected String getBreakpointText(IBreakpoint breakpoint) throws CoreException {
+               if (breakpoint instanceof PHPLineBreakpoint) {
+                       return getLineBreakpointText((PHPLineBreakpoint) breakpoint);
+               }
+               return ""; //$NON-NLS-1$
+       }
+       
+       protected String getLineBreakpointText(PHPLineBreakpoint breakpoint) throws CoreException {
+
+               StringBuffer label= new StringBuffer();
+
+               label.append(breakpoint.getMarker().getResource().getFullPath());
+               label.append(" ["); //$NON-NLS-1$
+               label.append(PHPDebugUiMessages.getString("PHPDebugModelPresentation.line")); //$NON-NLS-1$
+               label.append(' ');
+               label.append(breakpoint.getLineNumber());
+               label.append(']');
+               
+               return label.toString();
+       }
+       
+       /**
+        * Returns the image associated with the given element or <code>null</code>
+        * if none is defined.
+        */
+       protected Image getDebugElementImage(Object element) {
+               Image image= null;
+               if (element instanceof PHPThread) {
+                       PHPThread thread = (PHPThread)element;
+                       if (thread.isSuspended()) {
+                               image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED);
+                       } else if (thread.isTerminated()) {
+                               image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED);
+                       } else {
+                               image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING);
+                       }
+               } else if (element instanceof PHPStackFrame) {
+                       image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_STACKFRAME);
+               } else if (element instanceof IPHPDebugTarget) {
+                       IPHPDebugTarget debugTarget=(IPHPDebugTarget) element;
+                       if (debugTarget.isTerminated()) {
+                               image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED);
+                       } else {
+                               image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET);
+                       }
+               }
+               return image;
+       }
+}
index ec9e132..fe37ee0 100644 (file)
@@ -50,3 +50,9 @@ PHPInterpreterPreferencePage.EditInterpreterDialog.addInterpreter.title=Add Inte
 PHPInterpreterPreferencePage.EditInterpreterDialog.editInterpreter.title=Edit Interpreter
 
 PHPBasePreferencePage.label=General Properties
+
+PHPManageBreakpointRulerAction.AddBreakpoint=Add Breakpoint
+PHPManageBreakpointRulerAction.RemoveBreakpoint=Remove Breakpoint
+
+PHPDebugModelPresentation.<not responding>=<not responding>
+PHPDebugModelPresentation.line=line:
index fd31b85..8ff3848 100644 (file)
@@ -2,7 +2,7 @@ package net.sourceforge.phpdt.internal.debug.ui;
 
 import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
+import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IStatus;
@@ -49,15 +49,14 @@ public class PHPSourceLocator implements IPersistableSourceLocator, ISourcePrese
    * @see org.eclipse.debug.core.model.ISourceLocator#getSourceElement(IStackFrame)
    */
   public Object getSourceElement(IStackFrame stackFrame) {
-    return null;
-    //return ((PHPStackFrame) stackFrame).getFileName();
+       return ((PHPStackFrame) stackFrame).getFileName();
   }
 
   /**
    * @see org.eclipse.debug.ui.ISourcePresentation#getEditorId(IEditorInput, Object)
    */
   public String getEditorId(IEditorInput input, Object element) {
-    return PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor((String) element).getId();
+    return PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor((String)element).getId();
   }
 
   /**
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
new file mode 100644 (file)
index 0000000..c284e8e
--- /dev/null
@@ -0,0 +1,275 @@
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+
+Contributors:
+    IBM Corporation - Initial implementation
+    Vicente Fernando - www.alfersoft.com.ar
+**********************************************************************/
+package net.sourceforge.phpdt.internal.debug.ui.actions;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import net.sourceforge.phpdt.debug.core.PHPDebugModel;
+import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.IUpdate;
+
+public class PHPManageBreakpointRulerAction extends Action implements IUpdate {        
+       
+       private IVerticalRulerInfo fRuler;
+       private ITextEditor fTextEditor;
+       private String fMarkerType;
+       private List fMarkers;
+
+       private String fAddLabel;
+       private String fRemoveLabel;
+       
+       public PHPManageBreakpointRulerAction(IVerticalRulerInfo ruler, ITextEditor editor) {
+               fRuler= ruler;
+               fTextEditor= editor;
+               fMarkerType= IBreakpoint.BREAKPOINT_MARKER;
+               fAddLabel= PHPDebugUiMessages.getString("PHPManageBreakpointRulerAction.AddBreakpoint"); //$NON-NLS-1$
+               fRemoveLabel= PHPDebugUiMessages.getString("PHPManageBreakpointRulerAction.RemoveBreakpoint"); //$NON-NLS-1$
+       }
+       
+       /** 
+        * Returns the resource for which to create the marker, 
+        * or <code>null</code> if there is no applicable resource.
+        *
+        * @return the resource for which to create the marker or <code>null</code>
+        */
+       protected IResource getResource() {
+               IEditorInput input= fTextEditor.getEditorInput();
+               
+               IResource resource= (IResource) input.getAdapter(IFile.class);
+               
+               if (resource == null) {
+                       resource= (IResource) input.getAdapter(IResource.class);
+               }
+                       
+               return resource;
+       }
+       
+       /**
+        * Checks whether a position includes the ruler's line of activity.
+        *
+        * @param position the position to be checked
+        * @param document the document the position refers to
+        * @return <code>true</code> if the line is included by the given position
+        */
+       protected boolean includesRulerLine(Position position, IDocument document) {
+
+               if (position != null) {
+                       try {
+                               int markerLine= document.getLineOfOffset(position.getOffset());
+                               int line= fRuler.getLineOfLastMouseButtonActivity();
+                               if (line == markerLine) {
+                                       return true;
+                               }
+                       } catch (BadLocationException x) {
+                       }
+               }
+               
+               return false;
+       }
+       
+       /**
+        * Returns this action's vertical ruler info.
+        *
+        * @return this action's vertical ruler
+        */
+       protected IVerticalRulerInfo getVerticalRulerInfo() {
+               return fRuler;
+       }
+       
+       /**
+        * Returns this action's editor.
+        *
+        * @return this action's editor
+        */
+       protected ITextEditor getTextEditor() {
+               return fTextEditor;
+       }
+       
+       /**
+        * Returns the <code>AbstractMarkerAnnotationModel</code> of the editor's input.
+        *
+        * @return the marker annotation model
+        */
+       protected AbstractMarkerAnnotationModel getAnnotationModel() {
+               IDocumentProvider provider= fTextEditor.getDocumentProvider();
+               IAnnotationModel model= provider.getAnnotationModel(fTextEditor.getEditorInput());
+               if (model instanceof AbstractMarkerAnnotationModel) {
+                       return (AbstractMarkerAnnotationModel) model;
+               }
+               return null;
+       }
+
+       /**
+        * Returns the <code>IDocument</code> of the editor's input.
+        *
+        * @return the document of the editor's input
+        */
+       protected IDocument getDocument() {
+               IDocumentProvider provider= fTextEditor.getDocumentProvider();
+               return provider.getDocument(fTextEditor.getEditorInput());
+       }
+       
+       /**
+        * @see IUpdate#update()
+        */
+       public void update() {
+               fMarkers= getMarkers();
+               setText(fMarkers.isEmpty() ? fAddLabel : fRemoveLabel);
+       }
+
+       /**
+        * @see Action#run()
+        */
+       public void run() {
+               if (fMarkers.isEmpty()) {
+                       addMarker();
+               } else {
+                       removeMarkers(fMarkers);
+               }
+       }
+       
+       protected List getMarkers() {
+
+               List breakpoints= new ArrayList();
+               
+               IResource resource= getResource();
+               IDocument document= getDocument();
+               AbstractMarkerAnnotationModel model= getAnnotationModel();
+               
+               if (model != null) {
+                       try {
+                               
+                               IMarker[] markers= null;
+                               if (resource instanceof IFile)
+                                       markers= resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
+                               else {
+                                       IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
+                                       markers= root.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
+                               }
+                               
+                               if (markers != null) {
+                                       IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
+                                       int iFe =0;
+                                       for (iFe= 0; iFe < markers.length; iFe++) {
+                                               IBreakpoint breakpoint= breakpointManager.getBreakpoint(markers[iFe]);
+                                               if (breakpoint != null && breakpointManager.isRegistered(breakpoint) && 
+                                                               includesRulerLine(model.getMarkerPosition(markers[iFe]), document))
+                                                       breakpoints.add(markers[iFe]);
+                                       }
+                               }
+                       } catch (CoreException x) {
+                               System.out.println(x.getStatus());
+//                             JDIDebugUIPlugin.log(x.getStatus());
+                       }
+               }
+               return breakpoints;
+       }
+       
+       protected void addMarker() {
+
+               //IResource resource= getResource();
+               IEditorInput editorInput= getTextEditor().getEditorInput();     
+               IDocument document= getDocument();
+               //IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
+
+               int rulerLine= getVerticalRulerInfo().getLineOfLastMouseButtonActivity();
+               // create the marker
+               try {
+                       // Falta verificar si la ubicación del Breakpoint es válida
+                       int lineNumber= rulerLine + 1; 
+
+                       if (lineNumber > 0) {
+                               if (!PHPDebugModel.lineBreakpointExists(lineNumber)) {
+                                       Map attributes = new HashMap(10);
+                                       IRegion line= document.getLineInformation(lineNumber - 1);              
+                                       int start= line.getOffset();
+                                       int lenline= line.getLength();
+                                       //int end= start + ((lenline > 0)?lenline:0);
+                                       int end= start + lenline;
+                                       
+                                       //PHPDebugModel.createLineBreakpoint(getResource(), lineNumber, start, end, 0, true, attributes);
+                                       PHPDebugModel.createLineBreakpoint(((IFileEditorInput) editorInput).getFile(), lineNumber, start, end, 0, true, attributes);
+                                       
+                               }
+                       }
+               } catch (DebugException e) {
+                       System.out.println("Error");
+//                     JDIDebugUIPlugin.errorDialog(ActionMessages.getString("ManageBreakpointRulerAction.error.adding.message1"), e); //$NON-NLS-1$
+               } catch (CoreException e) {
+                       System.out.println("Error");
+//                     JDIDebugUIPlugin.errorDialog(ActionMessages.getString("ManageBreakpointRulerAction.error.adding.message1"), e); //$NON-NLS-1$
+               } catch (BadLocationException e) {
+                       System.out.println("Error");
+//                     JDIDebugUIPlugin.errorDialog(ActionMessages.getString("ManageBreakpointRulerAction.error.adding.message1"), e); //$NON-NLS-1$
+               }
+       }
+       
+       protected void removeMarkers(List markers) {
+               IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
+               try {
+                       Iterator e= markers.iterator();
+                       while (e.hasNext()) {
+                               IBreakpoint breakpoint= breakpointManager.getBreakpoint((IMarker) e.next());
+                               breakpointManager.removeBreakpoint(breakpoint, true);
+                       }
+               } catch (CoreException e) {
+               }
+       }
+
+       public IResource getUnderlyingResource(String fName) {
+               IResource parentResource = getResource(); //fParent.getUnderlyingResource();
+               if (parentResource == null) {
+                       return null;
+               }
+               int type = parentResource.getType();
+               if (type == IResource.FOLDER || type == IResource.PROJECT) {
+                       IContainer folder = (IContainer) parentResource;
+                       IResource resource = folder.findMember(fName);
+                       if (resource == null) {
+                               //throw newNotPresentException();
+                               return null;
+                       } else {
+                               return resource;
+                       }
+               } else {
+                       return parentResource;
+               }
+       }
+
+}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerActionDelegate.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerActionDelegate.java
new file mode 100644 (file)
index 0000000..f374e92
--- /dev/null
@@ -0,0 +1,27 @@
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+
+Contributors:
+    IBM Corporation - Initial implementation
+    Vicente Fernando - www.alfersoft.com.ar
+**********************************************************************/
+package net.sourceforge.phpdt.internal.debug.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class PHPManageBreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
+
+       /**
+        * @see AbstractRulerActionDelegate#createAction()
+        */
+       protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
+               return new PHPManageBreakpointRulerAction(rulerInfo, editor);
+       }
+}
index 7ba79ba..d96b9f6 100644 (file)
@@ -79,10 +79,10 @@ public class PHPArgumentsTab extends AbstractLaunchConfigurationTab {
        }
 
        public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
-               setUseDefaultWorkingDirectory(true);
+               //setUseDefaultWorkingDirectory(true);
                configuration.setAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, PHPDebugUiConstants.DEFAULT_WORKING_DIRECTORY);
                // set hidden attribute
-               //configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "net.sourceforge.phpdt.internal.debug.ui.PHPSourceLocator") ;
+               configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "net.sourceforge.phpdt.debug.ui.PHPSourceLocator") ;
        }
 
        public void initializeFrom(ILaunchConfiguration configuration) {