mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 10:45:37 +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
|
2004-06-10 Hoda Amer
|
||||||
Fix for PR 65970: [Outline View] Contents of Includes displayed in Outline for STRUCTURAL_PARSE mode
|
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()
|
* @see org.eclipse.cdt.core.model.IIncludeEntry#getFullIncludePath()
|
||||||
*/
|
*/
|
||||||
public IPath getFullIncludePath() {
|
public IPath getFullIncludePath() {
|
||||||
IPath p = (!basePath.isEmpty()) ? basePath.append(includePath) : includePath;
|
IPath p;
|
||||||
if (p.isAbsolute()) {
|
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;
|
return p;
|
||||||
}
|
}
|
||||||
IPath resPath = getPath();
|
|
||||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath);
|
p = inc;
|
||||||
if (res != null) {
|
|
||||||
IPath location = res.getLocation();
|
if (!p.isAbsolute()) {
|
||||||
if (location != null) {
|
IPath resPath = getPath();
|
||||||
p = location.append(p);
|
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;
|
return p;
|
||||||
|
|
|
@ -134,21 +134,35 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPath getFullLibraryPath() {
|
public IPath getFullLibraryPath() {
|
||||||
|
IPath p;
|
||||||
IPath lib = getLibraryPath();
|
IPath lib = getLibraryPath();
|
||||||
IPath p = (!basePath.isEmpty()) ? basePath.append(lib) : lib;
|
if (!basePath.isEmpty()) {
|
||||||
if (p.isAbsolute()) {
|
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;
|
return p;
|
||||||
|
} else {
|
||||||
|
p = lib;
|
||||||
}
|
}
|
||||||
IPath resPath = getPath();
|
if (!p.isAbsolute()) {
|
||||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath);
|
IPath resPath = getPath();
|
||||||
if (res != null) {
|
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath);
|
||||||
IPath location = res.getLocation();
|
if (res != null) {
|
||||||
if (location != null) {
|
if (res.getType() == IResource.FILE) {
|
||||||
p = location.append(p);
|
res = res.getParent();
|
||||||
|
}
|
||||||
|
IPath location = res.getLocation();
|
||||||
|
if (location != null) {
|
||||||
|
p = location.append(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -223,11 +223,19 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
if (refEntry.getIncludePath().equals(includePath)) {
|
if (refEntry.getIncludePath().equals(includePath)) {
|
||||||
IPath newBasePath = refEntry.getBasePath();
|
IPath newBasePath = refEntry.getBasePath();
|
||||||
// If the includePath is relative give a new basepath if none
|
// If the includePath is relative give a new basepath if none
|
||||||
if (newBasePath.isEmpty() && !includePath.isAbsolute()) {
|
if (!newBasePath.isAbsolute() && !includePath.isAbsolute()) {
|
||||||
IPath refResPath = refEntry.getPath();
|
IResource refRes;
|
||||||
IResource refRes = cproject.getCModel().getWorkspace().getRoot().findMember(refResPath);
|
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) {
|
if (refRes != null) {
|
||||||
newBasePath = refRes.getLocation();
|
if (refRes.getType() == IResource.FILE) {
|
||||||
|
refRes = refRes.getParent();
|
||||||
|
}
|
||||||
|
newBasePath = refRes.getLocation().append(newBasePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CoreModel.newIncludeEntry(includeEntry.getPath(),
|
return CoreModel.newIncludeEntry(includeEntry.getPath(),
|
||||||
|
@ -320,11 +328,19 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
if (refEntry.getLibraryPath().equals(libraryPath)) {
|
if (refEntry.getLibraryPath().equals(libraryPath)) {
|
||||||
IPath newBasePath = refEntry.getBasePath();
|
IPath newBasePath = refEntry.getBasePath();
|
||||||
// If the libraryPath is relative give a new basepath if none
|
// If the libraryPath is relative give a new basepath if none
|
||||||
if (newBasePath.isEmpty() && !libraryPath.isAbsolute()) {
|
if (!newBasePath.isAbsolute() && !libraryPath.isAbsolute()) {
|
||||||
IPath refResPath = refEntry.getPath();
|
IResource refRes;
|
||||||
IResource refRes = cproject.getCModel().getWorkspace().getRoot().findMember(refResPath);
|
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) {
|
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