1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for 167549, location representation in PDOM.

This commit is contained in:
Markus Schorn 2006-12-13 13:37:11 +00:00
parent 2a9b29e5bf
commit 4adb553d14
2 changed files with 5 additions and 6 deletions

View file

@ -90,6 +90,7 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
// 18 - distinction between c-unions and c-structs. // 18 - distinction between c-unions and c-structs.
// 19 - alter representation of paths in the pdom (162172) // 19 - alter representation of paths in the pdom (162172)
// 20 - add pointer to member types, array types, return types for functions // 20 - add pointer to member types, array types, return types for functions
// 21 - change representation of paths in the pdom (167549)
public static final int LINKAGES = Database.DATA_AREA; public static final int LINKAGES = Database.DATA_AREA;
public static final int FILE_INDEX = Database.DATA_AREA + 4; public static final int FILE_INDEX = Database.DATA_AREA + 4;

View file

@ -25,12 +25,10 @@ import org.eclipse.core.runtime.Path;
* The standard location converter used by the per-project PDOM * The standard location converter used by the per-project PDOM
*/ */
public class PDOMProjectIndexLocationConverter implements IIndexLocationConverter { public class PDOMProjectIndexLocationConverter implements IIndexLocationConverter {
IProject project;
IWorkspaceRoot root; IWorkspaceRoot root;
private static final String EXTERNAL = "<EXT>"; //$NON-NLS-1$ private static final String EXTERNAL = "<EXT>"; //$NON-NLS-1$
public PDOMProjectIndexLocationConverter(IProject project) { public PDOMProjectIndexLocationConverter(IProject project) {
this.project = project;
this.root = ResourcesPlugin.getWorkspace().getRoot(); this.root = ResourcesPlugin.getWorkspace().getRoot();
} }
@ -47,9 +45,9 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
uri = null; uri = null;
} }
} else { } else {
fullPath = "/"+project.getName()+"/"+raw; //$NON-NLS-1$//$NON-NLS-2$ fullPath = raw;
IResource member = project.findMember(raw); IResource member= root.getFile(new Path(raw));
uri = member == null ? null : member.getLocationURI(); uri = member.getLocationURI();
} }
return new IndexFileLocation(uri, fullPath); return new IndexFileLocation(uri, fullPath);
} }
@ -60,7 +58,7 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
public String toInternalFormat(IIndexFileLocation location) { public String toInternalFormat(IIndexFileLocation location) {
String result; String result;
if(location.getFullPath()!=null) { if(location.getFullPath()!=null) {
result = new Path(location.getFullPath()).removeFirstSegments(1).toString(); result = new Path(location.getFullPath()).toString();
} else { } else {
result = EXTERNAL+location.getURI().toString(); result = EXTERNAL+location.getURI().toString();
} }