mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 15:05:36 +02:00
Work in progress on the IPathEntry
This commit is contained in:
parent
7502088090
commit
c11d57b594
2 changed files with 54 additions and 2 deletions
|
@ -672,7 +672,7 @@ public class CoreModel {
|
||||||
* @see #setPathEntryContainer(IPath, ICProject[], IPathEntryContainer,
|
* @see #setPathEntryContainer(IPath, ICProject[], IPathEntryContainer,
|
||||||
* IProgressMonitor)
|
* IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
public IPathEntryContainer getPathEntryContainer(IPath containerPath, ICProject project) throws CModelException {
|
public static IPathEntryContainer getPathEntryContainer(IPath containerPath, ICProject project) throws CModelException {
|
||||||
return pathEntryManager.getPathEntryContainer(containerPath, project);
|
return pathEntryManager.getPathEntryContainer(containerPath, project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.eclipse.cdt.core.resources.IPathEntryStore;
|
||||||
import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
|
import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
|
||||||
import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent;
|
import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
@ -184,7 +185,10 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list.add(entry);
|
IPathEntry e = getExpandedPathEntry(entry, cproject);
|
||||||
|
if (e != null) {
|
||||||
|
list.add(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entries = new IPathEntry[list.size()];
|
entries = new IPathEntry[list.size()];
|
||||||
|
@ -194,6 +198,54 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IPathEntry getExpandedPathEntry(IPathEntry entry, ICProject cproject) throws CModelException {
|
||||||
|
switch(entry.getEntryKind()) {
|
||||||
|
case IPathEntry.CDT_INCLUDE: {
|
||||||
|
IIncludeEntry includeEntry = (IIncludeEntry)entry;
|
||||||
|
IPath includePath = includeEntry.getIncludePath();
|
||||||
|
IPath refPath = includeEntry.getBaseReference();
|
||||||
|
if (refPath != null && !refPath.isEmpty()) {
|
||||||
|
if (refPath.isAbsolute()) {
|
||||||
|
IResource res = cproject.getCModel().getWorkspace().getRoot().findMember(refPath);
|
||||||
|
if (res != null && res.getType() == IResource.PROJECT) {
|
||||||
|
ICProject refCProject = CoreModel.getDefault().create((IProject)res);
|
||||||
|
if (refCProject != null) {
|
||||||
|
IPathEntry[] entries = getResolvedPathEntries(refCProject);
|
||||||
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||||
|
IIncludeEntry refEntry = (IIncludeEntry)entries[i];
|
||||||
|
if (refEntry.getIncludePath().equals(includePath)) {
|
||||||
|
IPath newBasePath = refEntry.getBasePath();
|
||||||
|
return CoreModel.newIncludeEntry(includeEntry.getPath(), newBasePath, includePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // Container ref
|
||||||
|
IPathEntryContainer container = getPathEntryContainer(refPath, cproject);
|
||||||
|
if (container != null) {
|
||||||
|
IPathEntry[] entries = container.getPathEntries();
|
||||||
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||||
|
IIncludeEntry refEntry = (IIncludeEntry)entries[i];
|
||||||
|
if (refEntry.getIncludePath().equals(includePath)) {
|
||||||
|
IPath newBasePath = refEntry.getBasePath();
|
||||||
|
return CoreModel.newIncludeEntry(includeEntry.getPath(), newBasePath, includePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IPathEntry.CDT_MACRO:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRawPathEntries(ICProject cproject, IPathEntry[] newEntries, IProgressMonitor monitor) throws CModelException {
|
public void setRawPathEntries(ICProject cproject, IPathEntry[] newEntries, IProgressMonitor monitor) throws CModelException {
|
||||||
try {
|
try {
|
||||||
IPathEntry[] oldResolvedEntries = (IPathEntry[]) resolvedMap.get(cproject);
|
IPathEntry[] oldResolvedEntries = (IPathEntry[]) resolvedMap.get(cproject);
|
||||||
|
|
Loading…
Add table
Reference in a new issue