Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvpunski2010-02-18 11:16:15 +0000
committervpunski2010-02-18 11:16:15 +0000
commita9f11dea1b199a33fa52dd50656b0f009ab983b1 (patch)
tree267ccf118de787bd49702f133061a9c2ef01631d
parent0588f65ca23317776ab48e901248906dd97e4d6d (diff)
downloadorg.eclipse.pdt-20100221-1200.tar.gz
org.eclipse.pdt-20100221-1200.tar.xz
org.eclipse.pdt-20100221-1200.zip
remote debugging automatic files detection from build pathv20100221-1200
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java152
1 files changed, 94 insertions, 58 deletions
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java
index 26456ccd6..a14aaca7b 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java
@@ -190,20 +190,40 @@ public class DebugSearchEngine {
LinkedList<PathEntry> results = new LinkedList<PathEntry>();
IncludePath[] includePaths;
+ IBuildpathEntry[] buildPaths = null;
if (currentProject != null) {
includePaths = PHPSearchEngine
.buildIncludePath(currentProject);
} else {
// Search in the whole workspace:
Set<IncludePath> s = new LinkedHashSet<IncludePath>();
+ Set<IBuildpathEntry> b = new LinkedHashSet<IBuildpathEntry>();
IProject[] projects = ResourcesPlugin.getWorkspace()
.getRoot().getProjects();
for (IProject project : projects) {
if (project.isOpen() && project.isAccessible()) {
+ // get include paths of all projects
PHPSearchEngine.buildIncludePath(project, s);
+
+ // get build paths of all projects
+ IScriptProject scriptProject = DLTKCore
+ .create(project);
+ if (scriptProject != null) {
+ try {
+ IBuildpathEntry[] rawBuildpath = scriptProject
+ .getRawBuildpath();
+ for (IBuildpathEntry pathEntry : rawBuildpath) {
+ b.add(pathEntry);
+ }
+ } catch (ModelException e) {
+ PHPDebugPlugin.log(e);
+ }
+
+ }
}
}
includePaths = s.toArray(new IncludePath[s.size()]);
+ buildPaths = b.toArray(new IBuildpathEntry[b.size()]);
}
// Try to find this file in the Workspace:
@@ -259,6 +279,80 @@ public class DebugSearchEngine {
}
}
}
+
+ // try to find in build paths
+ if (buildPaths != null) {
+ for (IBuildpathEntry entry : buildPaths) {
+
+ IPath entryPath = entry.getPath();
+ if (entry.getEntryKind() == IBuildpathEntry.BPE_LIBRARY) {
+ // We don't support lookup in archive
+ File entryDir = entryPath.toFile();
+ find(entryDir, abstractPath, entry, results);
+ } else if (entry.getEntryKind() == IBuildpathEntry.BPE_PROJECT
+ || entry.getEntryKind() == IBuildpathEntry.BPE_SOURCE) {
+ IResource res = ResourcesPlugin.getWorkspace()
+ .getRoot().findMember(
+ entry.getPath().lastSegment());
+ if (res instanceof IProject) {
+ IProject project = (IProject) res;
+ if (project.isOpen()
+ && project.isAccessible()) {
+ try {
+ find(project, abstractPath, results);
+ } catch (InterruptedException e) {
+ PHPDebugPlugin.log(e);
+ }
+ }
+ }
+ } else if (entry.getEntryKind() == IBuildpathEntry.BPE_VARIABLE) {
+ entryPath = DLTKCore
+ .getResolvedVariablePath(entryPath);
+ if (entryPath != null) {
+ File entryDir = entryPath.toFile();
+ find(entryDir, abstractPath, entry, results);
+ }
+ } else if (entry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
+
+ // TODO fix the CONTAINER case
+ IResource res = ResourcesPlugin.getWorkspace()
+ .getRoot().findMember(
+ entry.getPath().lastSegment());
+
+ if (res == null) {
+ continue;
+ }
+ IProject project = res.getProject();
+
+ IScriptProject scriptProject = DLTKCore
+ .create(project);
+
+ try {
+ IBuildpathContainer buildpathContainer = DLTKCore
+ .getBuildpathContainer(entry
+ .getPath(), scriptProject);
+ if (buildpathContainer != null) {
+ IBuildpathEntry[] buildpathEntries = buildpathContainer
+ .getBuildpathEntries(scriptProject);
+ if (buildpathEntries != null
+ && buildpathEntries.length > 0) {
+ entryPath = EnvironmentPathUtils
+ .getLocalPath(buildpathEntries[0]
+ .getPath());
+ if (entryPath != null) {
+ find(entryPath.toFile(),
+ abstractPath, entry,
+ results);
+ }
+ }
+ }
+ } catch (ModelException e) {
+ PHPDebugPlugin.log(e);
+ }
+
+ }
+ }
+ }
}
// Iterate over all include path, and search for a requested
@@ -271,64 +365,6 @@ public class DebugSearchEngine {
} catch (InterruptedException e) {
PHPDebugPlugin.log(e);
}
- } else if (includePath.getEntry() instanceof IBuildpathEntry) {
- IBuildpathEntry entry = (IBuildpathEntry) includePath
- .getEntry();
- IPath entryPath = entry.getPath();
- if (entry.getEntryKind() == IBuildpathEntry.BPE_LIBRARY) {
- // We don't support lookup in archive
- File entryDir = entryPath.toFile();
- find(entryDir, abstractPath, entry, results);
- } else if (entry.getEntryKind() == IBuildpathEntry.BPE_PROJECT) {
- IResource res = ResourcesPlugin.getWorkspace()
- .getRoot().findMember(
- entry.getPath().lastSegment());
- if (res instanceof IProject) {
- IProject project = (IProject) res;
- if (project.isOpen() && project.isAccessible()) {
- try {
- find(project, abstractPath, results);
- } catch (InterruptedException e) {
- PHPDebugPlugin.log(e);
- }
- }
- }
- } else if (entry.getEntryKind() == IBuildpathEntry.BPE_VARIABLE) {
- entryPath = DLTKCore
- .getResolvedVariablePath(entryPath);
- if (entryPath != null) {
- File entryDir = entryPath.toFile();
- find(entryDir, abstractPath, entry, results);
- }
- } else if (entry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
- IScriptProject project = DLTKCore
- .create(currentProject == null ? includePath
- .getProject()
- : currentProject);
- try {
- IBuildpathContainer buildpathContainer = DLTKCore
- .getBuildpathContainer(entry.getPath(),
- project);
- if (buildpathContainer != null) {
- IBuildpathEntry[] buildpathEntries = buildpathContainer
- .getBuildpathEntries(project);
- if (buildpathEntries != null
- && buildpathEntries.length > 0) {
- entryPath = EnvironmentPathUtils
- .getLocalPath(buildpathEntries[0]
- .getPath());
- if (entryPath != null) {
- find(entryPath.toFile(),
- abstractPath, entry,
- results);
- }
- }
- }
- } catch (ModelException e) {
- PHPDebugPlugin.log(e);
- }
-
- }
}
}

Back to the top