1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 339931 - Code completion fails in #include statements

This commit is contained in:
Marc-Andre Laperle 2011-03-16 17:10:04 +00:00
parent 0605ef71f9
commit bffecbbf9b

View file

@ -23,6 +23,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy; import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.resources.IResourceProxyVisitor; import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -289,8 +290,10 @@ public class InclusionProposalComputer implements ICompletionProposalComputer {
} }
if (prefixPath.segmentCount() > 0) { if (prefixPath.segmentCount() > 0) {
IPath parentPath = parent.getFullPath().append(prefixPath); IPath parentPath = parent.getFullPath().append(prefixPath);
if (parentPath.segmentCount() > 0) { if (parentPath.segmentCount() > 1) {
parent= parent.getFolder(prefixPath); parent = parent.getFolder(prefixPath);
} else if (parentPath.segmentCount() == 1) {
parent = ResourcesPlugin.getWorkspace().getRoot().getProject(parentPath.lastSegment());
} else { } else {
return; return;
} }