mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 01:45:33 +02:00
The IncludeEntry LibraryEntry getFullIncludePath()
was returning the wrong values sometimes. * model/org/eclipse/cdt/internal/core/model/IncludeEntry.java * model/org/eclipse/cdt/internal/core/model/LibraryEntry.java * model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
This commit is contained in:
parent
0abdb4a482
commit
79438408a9
4 changed files with 81 additions and 25 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-06-11 Alain Magloire
|
||||
|
||||
The IncludeEntry LibraryEntry getFullIncludePath()
|
||||
was returning the wrong values sometimes.
|
||||
|
||||
* model/org/eclipse/cdt/internal/core/model/IncludeEntry.java
|
||||
* model/org/eclipse/cdt/internal/core/model/LibraryEntry.java
|
||||
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
|
||||
|
||||
2004-06-10 Hoda Amer
|
||||
Fix for PR 65970: [Outline View] Contents of Includes displayed in Outline for STRUCTURAL_PARSE mode
|
||||
|
||||
|
|
|
@ -83,16 +83,33 @@ public class IncludeEntry extends APathEntry implements IIncludeEntry {
|
|||
* @see org.eclipse.cdt.core.model.IIncludeEntry#getFullIncludePath()
|
||||
*/
|
||||
public IPath getFullIncludePath() {
|
||||
IPath p = (!basePath.isEmpty()) ? basePath.append(includePath) : includePath;
|
||||
if (p.isAbsolute()) {
|
||||
IPath p;
|
||||
IPath inc = getIncludePath();
|
||||
if (!basePath.isEmpty()) {
|
||||
IPath loc = basePath;
|
||||
if (!loc.isAbsolute()) {
|
||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(loc);
|
||||
if (res != null) {
|
||||
loc = res.getLocation();
|
||||
}
|
||||
}
|
||||
p = loc.append(inc);
|
||||
return p;
|
||||
}
|
||||
IPath resPath = getPath();
|
||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath);
|
||||
if (res != null) {
|
||||
IPath location = res.getLocation();
|
||||
if (location != null) {
|
||||
p = location.append(p);
|
||||
|
||||
p = inc;
|
||||
|
||||
if (!p.isAbsolute()) {
|
||||
IPath resPath = getPath();
|
||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath);
|
||||
if (res != null) {
|
||||
if (res.getType() == IResource.FILE) {
|
||||
res = res.getParent();
|
||||
}
|
||||
IPath location = res.getLocation();
|
||||
if (location != null) {
|
||||
p = location.append(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
return p;
|
||||
|
|
|
@ -134,21 +134,35 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
|
|||
}
|
||||
|
||||
public IPath getFullLibraryPath() {
|
||||
IPath p;
|
||||
IPath lib = getLibraryPath();
|
||||
IPath p = (!basePath.isEmpty()) ? basePath.append(lib) : lib;
|
||||
if (p.isAbsolute()) {
|
||||
if (!basePath.isEmpty()) {
|
||||
IPath loc = basePath;
|
||||
if (!loc.isAbsolute()) {
|
||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(loc);
|
||||
if (res != null) {
|
||||
loc = res.getLocation();
|
||||
}
|
||||
}
|
||||
p = loc.append(lib);
|
||||
return p;
|
||||
} else {
|
||||
p = lib;
|
||||
}
|
||||
IPath resPath = getPath();
|
||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath);
|
||||
if (res != null) {
|
||||
IPath location = res.getLocation();
|
||||
if (location != null) {
|
||||
p = location.append(p);
|
||||
if (!p.isAbsolute()) {
|
||||
IPath resPath = getPath();
|
||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath);
|
||||
if (res != null) {
|
||||
if (res.getType() == IResource.FILE) {
|
||||
res = res.getParent();
|
||||
}
|
||||
IPath location = res.getLocation();
|
||||
if (location != null) {
|
||||
p = location.append(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
return p;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -223,11 +223,19 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
|||
if (refEntry.getIncludePath().equals(includePath)) {
|
||||
IPath newBasePath = refEntry.getBasePath();
|
||||
// If the includePath is relative give a new basepath if none
|
||||
if (newBasePath.isEmpty() && !includePath.isAbsolute()) {
|
||||
IPath refResPath = refEntry.getPath();
|
||||
IResource refRes = cproject.getCModel().getWorkspace().getRoot().findMember(refResPath);
|
||||
if (!newBasePath.isAbsolute() && !includePath.isAbsolute()) {
|
||||
IResource refRes;
|
||||
if (!newBasePath.isEmpty()) {
|
||||
refRes = cproject.getCModel().getWorkspace().getRoot().findMember(newBasePath);
|
||||
} else {
|
||||
IPath refResPath = refEntry.getPath();
|
||||
refRes = cproject.getCModel().getWorkspace().getRoot().findMember(refResPath);
|
||||
}
|
||||
if (refRes != null) {
|
||||
newBasePath = refRes.getLocation();
|
||||
if (refRes.getType() == IResource.FILE) {
|
||||
refRes = refRes.getParent();
|
||||
}
|
||||
newBasePath = refRes.getLocation().append(newBasePath);
|
||||
}
|
||||
}
|
||||
return CoreModel.newIncludeEntry(includeEntry.getPath(),
|
||||
|
@ -320,11 +328,19 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
|||
if (refEntry.getLibraryPath().equals(libraryPath)) {
|
||||
IPath newBasePath = refEntry.getBasePath();
|
||||
// If the libraryPath is relative give a new basepath if none
|
||||
if (newBasePath.isEmpty() && !libraryPath.isAbsolute()) {
|
||||
IPath refResPath = refEntry.getPath();
|
||||
IResource refRes = cproject.getCModel().getWorkspace().getRoot().findMember(refResPath);
|
||||
if (!newBasePath.isAbsolute() && !libraryPath.isAbsolute()) {
|
||||
IResource refRes;
|
||||
if (!newBasePath.isEmpty()) {
|
||||
refRes = cproject.getCModel().getWorkspace().getRoot().findMember(newBasePath);
|
||||
} else {
|
||||
IPath refResPath = refEntry.getPath();
|
||||
refRes = cproject.getCModel().getWorkspace().getRoot().findMember(refResPath);
|
||||
}
|
||||
if (refRes != null) {
|
||||
newBasePath = refRes.getLocation();
|
||||
if (refRes.getType() == IResource.FILE) {
|
||||
refRes = refRes.getParent();
|
||||
}
|
||||
newBasePath = refRes.getLocation().append(newBasePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue