Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormspector2007-06-10 16:26:33 +0000
committermspector2007-06-10 16:26:33 +0000
commit8f54ead904e2e8b6ed2a7ca80a5fa730b5e59e9a (patch)
tree0dede26886776ea9c9a243fe2dd1aa821ab88a27
parentbad1dfad5a44d9257d45e5adf58b55bce0b9cade (diff)
downloadorg.eclipse.pdt-8f54ead904e2e8b6ed2a7ca80a5fa730b5e59e9a.tar.gz
org.eclipse.pdt-8f54ead904e2e8b6ed2a7ca80a5fa730b5e59e9a.tar.xz
org.eclipse.pdt-8f54ead904e2e8b6ed2a7ca80a5fa730b5e59e9a.zip
- Revert to usage of FileStoreEditorInput
- Proper usage of external files in debugger
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/IPHPConstants.java31
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/BreakpointSet.java59
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPDebugTarget.java13
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPLineBreakpoint.java2
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/sourcelookup/PHPSourceLookupParticipant.java45
5 files changed, 69 insertions, 81 deletions
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/IPHPConstants.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/IPHPConstants.java
index 0eb88a381..8674487fa 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/IPHPConstants.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/IPHPConstants.java
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.php.internal.debug.core;
+import org.eclipse.php.internal.ui.containers.LocalFileStorageEditorInput;
+import org.eclipse.ui.IURIEditorInput;
+
/**
* Constants for the PHP debugger.
*/
@@ -30,13 +33,27 @@ public interface IPHPConstants {
public static final String PHPProcessType = ID_PHP_DEBUG_CORE + ".launching.PHPProcess";
public static final String RUN_WITH_DEBUG_INFO = ID_PHP_DEBUG_CORE + ".RunWithDebugInfo";
public static final String OPEN_IN_BROWSER = ID_PHP_DEBUG_CORE + ".OpenInBrowser";
- public static final String Include_Storage = ID_PHP_DEBUG_CORE + ".Include_Storage";
- public static final String Include_Storage_type = ID_PHP_DEBUG_CORE + ".Include_Storage_Type";
- public static final String Include_Storage_zip = ID_PHP_DEBUG_CORE + ".zip";
- public static final String Include_Storage_LFile = ID_PHP_DEBUG_CORE + ".lfile";
- public static final String Include_Storage_RFile = ID_PHP_DEBUG_CORE + ".rfile";
- public static final String Include_Storage_Project = ID_PHP_DEBUG_CORE + ".project";
- public static final String Non_Workspace_Breakpoint = ID_PHP_DEBUG_CORE + ".Non_Workspace_Breakpoint";
+
+ public static final String STORAGE_TYPE = ID_PHP_DEBUG_CORE + ".Storage_Type";
+
+ /** File from include path ({@link LocalFileStorageEditorInput}) */
+ public static final String STORAGE_TYPE_INCLUDE = ID_PHP_DEBUG_CORE + ".Include";
+
+ /** Remote file */
+ public static final String STORAGE_TYPE_REMOTE = ID_PHP_DEBUG_CORE + ".Remote";
+
+ /** External file ({@link IURIEditorInput}) */
+ public static final String STORAGE_TYPE_EXTERNAL = ID_PHP_DEBUG_CORE + ".External";
+
+ /** File resource for storage (if available) */
+ public static final String STORAGE_FILE = ID_PHP_DEBUG_CORE + ".Storage_File";
+
+ /** Project resource for storage (if available) */
+ public static final String STORAGE_PROJECT = ID_PHP_DEBUG_CORE + ".Project";
+
+ /** Include path base directory for storage (if available) */
+ public static final String STORAGE_INC_BASEDIR = ID_PHP_DEBUG_CORE + ".Include_Path_Basedir";
+
public static final String Default_Server_Name = "Default PHP Web Server";
public static final String PHPEXELaunchType = "org.eclipse.php.debug.core.launching.PHPExeLaunchConfigurationType";
public static final String PHPServerLaunchType = "org.eclipse.php.debug.core.launching.webPageLaunch";
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/BreakpointSet.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/BreakpointSet.java
index ae6fff5e9..a33779c5b 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/BreakpointSet.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/BreakpointSet.java
@@ -17,34 +17,28 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.php.internal.core.project.IIncludePathEntry;
import org.eclipse.php.internal.core.project.options.PHPProjectOptions;
import org.eclipse.php.internal.debug.core.IPHPConstants;
import org.eclipse.php.internal.debug.core.debugger.RemoteDebugger;
-import org.eclipse.wst.sse.ui.internal.StructuredResourceMarkerAnnotationModel;
public class BreakpointSet {
private IProject fProject;
- private ArrayList fZips;
private ArrayList fDirectories;
private ArrayList fProjects;
- private boolean fIsPHPCGI;
+
+// private boolean fIsPHPCGI;
public BreakpointSet(IProject project, boolean isPHPCGI) {
fProject = project;
- fIsPHPCGI = isPHPCGI;
- fZips = new ArrayList();
+// fIsPHPCGI = isPHPCGI;
fDirectories = new ArrayList();
fProjects = new ArrayList();
- if (project == null)
- ;
PHPProjectOptions options = PHPProjectOptions.forProject(project);
if (options != null) {
IIncludePathEntry[] entries = options.readRawIncludePath();
@@ -54,11 +48,7 @@ public class BreakpointSet {
if (entries[i].getEntryKind() == IIncludePathEntry.IPE_LIBRARY) {
IPath path = entries[i].getPath();
File file = new File(path.toString());
- if (entries[i].getContentKind() == IIncludePathEntry.K_BINARY) {
- fZips.add(RemoteDebugger.convertToSystemIndependentFileName(file.getAbsolutePath()));
- } else {
- fDirectories.add(RemoteDebugger.convertToSystemIndependentFileName(file.getAbsolutePath()));
- }
+ fDirectories.add(RemoteDebugger.convertToSystemIndependentFileName(file.getAbsolutePath()));
} else if (entries[i].getEntryKind() == IIncludePathEntry.IPE_PROJECT) {
IResource includeResource = entries[i].getResource();
if (includeResource instanceof IProject) {
@@ -71,11 +61,6 @@ public class BreakpointSet {
if (file != null) {
if (file.isDirectory()) {
fDirectories.add(RemoteDebugger.convertToSystemIndependentFileName(file.getAbsolutePath()));
- } else {
- String fileName = file.getName();
- if (fileName.toLowerCase().endsWith(".zip")) { //$NON-NLS-1$
- fZips.add(RemoteDebugger.convertToSystemIndependentFileName(file.getAbsolutePath()));
- }
}
}
}
@@ -101,32 +86,18 @@ public class BreakpointSet {
}
if (resource instanceof IWorkspaceRoot) {
- try {
- if (marker.getAttribute(IPHPConstants.Non_Workspace_Breakpoint) == Boolean.TRUE) {
- // The breakpoint was set on an external file (out of the workspace).
- // Return true to support this breakpoint.
- return true;
- }
- } catch (CoreException e) {
- }
- String includeType = marker.getAttribute(IPHPConstants.Include_Storage_type, "");
- String id = marker.getAttribute(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, "");
- Path idPath = new Path(id);
- String base = idPath.removeLastSegments(1).toString();
- if (includeType.equals(IPHPConstants.Include_Storage_zip)) {
- Object[] zips = fZips.toArray();
- for (int i = 0; i < zips.length; i++) {
- if (base.equals((String) zips[i]))
- return true;
- }
- return false;
- } else if (includeType.equals(IPHPConstants.Include_Storage_LFile)) {
- Object[] dirs = fDirectories.toArray();
- for (int i = 0; i < dirs.length; i++) {
- if (base.equals((String) dirs[i]))
- return true;
+ String storageType = marker.getAttribute(IPHPConstants.STORAGE_TYPE, "");
+
+ if (storageType.equals(IPHPConstants.STORAGE_TYPE_INCLUDE)) {
+ String includeBasedir = (String) marker.getAttribute(IPHPConstants.STORAGE_INC_BASEDIR, "");
+ if (!"".equals(includeBasedir)) {
+ Object[] dirs = fDirectories.toArray();
+ for (int i = 0; i < dirs.length; i++) {
+ if (includeBasedir.equals((String) dirs[i]))
+ return true;
+ }
+ return false;
}
- return false;
}
return true;
} else {
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPDebugTarget.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPDebugTarget.java
index 67d55b868..05925a6b1 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPDebugTarget.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPDebugTarget.java
@@ -546,11 +546,11 @@ public class PHPDebugTarget extends PHPDebugElement implements IDebugTarget, IBr
String fileName;
if (!fIsPHPCGI) {
if (resource instanceof IWorkspaceRoot) {
- if (IPHPConstants.Include_Storage_RFile.equals(marker.getAttribute(IPHPConstants.Include_Storage_type))) {
- fileName = (String) marker.getAttribute(IPHPConstants.Include_Storage);
+ if (IPHPConstants.STORAGE_TYPE_REMOTE.equals(marker.getAttribute(IPHPConstants.STORAGE_TYPE))) {
+ fileName = (String) marker.getAttribute(IPHPConstants.STORAGE_FILE);
fileName = marker.getAttribute(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, fileName);
} else {
- fileName = fHTDocs + '/' + (String) marker.getAttribute(IPHPConstants.Include_Storage);
+ fileName = fHTDocs + '/' + (String) marker.getAttribute(IPHPConstants.STORAGE_FILE);
}
} else {
if (fHTDocs == null || fHTDocs.length() == 0) {
@@ -567,8 +567,11 @@ public class PHPDebugTarget extends PHPDebugElement implements IDebugTarget, IBr
} else {
// If the breakpoint was set on a non-workspace file, make sure that the file name for the breakpoint
// is taken correctly.
- if (IPHPConstants.Include_Storage_LFile.equals(marker.getAttribute(IPHPConstants.Include_Storage_type))) {
- fileName = marker.getAttribute(IPHPConstants.Include_Storage, "");
+ if (resource instanceof IWorkspaceRoot) {
+ fileName = (String) marker.getAttribute(IPHPConstants.STORAGE_FILE);
+ if (IPHPConstants.STORAGE_TYPE_INCLUDE.equals(marker.getAttribute(IPHPConstants.STORAGE_TYPE))) {
+ fileName = marker.getAttribute(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, fileName);
+ }
} else {
fileName = (resource.getRawLocation()).toString();
}
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPLineBreakpoint.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPLineBreakpoint.java
index 83120263b..25c995c06 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPLineBreakpoint.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/model/PHPLineBreakpoint.java
@@ -86,7 +86,7 @@ public class PHPLineBreakpoint extends LineBreakpoint {
IResource resource = marker.getResource();
String fileName = "";
if (resource instanceof IWorkspaceRoot) {
- fileName = (String)marker.getAttribute(IPHPConstants.Include_Storage);
+ fileName = (String)marker.getAttribute(IPHPConstants.STORAGE_FILE);
}else {
IFile file = (IFile) resource;
IPath path = file.getFullPath();
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/sourcelookup/PHPSourceLookupParticipant.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/sourcelookup/PHPSourceLookupParticipant.java
index ae1b34acb..80e61123c 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/sourcelookup/PHPSourceLookupParticipant.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/sourcelookup/PHPSourceLookupParticipant.java
@@ -15,8 +15,6 @@ import java.io.File;
import org.eclipse.core.internal.filesystem.local.LocalFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
-import org.eclipse.php.internal.core.containers.LocalFileStorage;
-import org.eclipse.php.internal.core.resources.ExternalFilesRegistry;
import org.eclipse.php.internal.debug.core.model.PHPStackFrame;
/**
@@ -35,33 +33,32 @@ public class PHPSourceLookupParticipant extends AbstractSourceLookupParticipant
}
public Object[] findSourceElements(Object object) throws CoreException {
+ Object[] sourceElements = EMPTY;
try {
- Object[] sourceElements = super.findSourceElements(object);
- if (sourceElements == EMPTY) {
- // If the lookup returned an empty elements array, check if the source is outside the workspace.
- if (object instanceof PHPStackFrame) {
- PHPStackFrame stackFrame = (PHPStackFrame) object;
- String fileName = stackFrame.getAbsoluteFileName();
- File file = new File(fileName);
- if (!file.exists()) {
- return EMPTY;
- }
- if (ExternalFilesRegistry.getInstance().isEntryExist(fileName)) {
- LocalFileStorage storage = new LocalFileStorage(new File(fileName));
- if (storage != null) {
- return new Object[] { storage };
- } else {
- return EMPTY;
- }
- }
+ sourceElements = super.findSourceElements(object);
+ } catch (Throwable e) {
+ // Check if the lookup failed because the source is outside the workspace.
+ }
+ if (sourceElements == EMPTY) {
+ // If the lookup returned an empty elements array, check if the source is outside the workspace.
+ if (object instanceof PHPStackFrame) {
+ PHPStackFrame stackFrame = (PHPStackFrame) object;
+ String fileName = stackFrame.getAbsoluteFileName();
+ File file = new File(fileName);
+ if (!file.exists()) {
+ return EMPTY;
+ }
+
+ LocalFile storage = new LocalFile(file);
+ if (storage != null) {
+ return new Object[] { storage };
+ } else {
+ return EMPTY;
}
}
- return sourceElements;
- } catch (CoreException ce) {
- // Check if the lookup failed because the source is outside the workspace.
- return EMPTY;
}
+ return sourceElements;
}
}

Back to the top