diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java index b3ea0580088..b9080de1bb1 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java @@ -982,6 +982,14 @@ public class CompletionTests extends AbstractContentAssistTest { "\"sub1/inc11.h" }; assertCompletionResults(fCursorOffset+=4, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); + + // bug 278967 + getDocument().replace(fCursorOffset-5, 5, "../"); + expected= new String[] { + "\"../h1/", + "\"../h2/", + }; + assertCompletionResults(fCursorOffset-=2, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); } finally { deleteDir(tempDir); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java index db1ec7b27da..05dd50d1e8f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -279,12 +279,16 @@ public class InclusionProposalComputer implements ICompletionProposalComputer { } else if (prefixPath.hasTrailingSeparator()) { namePrefix= ""; //$NON-NLS-1$ prefixPath= prefixPath.removeTrailingSeparator(); - parent= parent.getFolder(prefixPath); } else { namePrefix= prefixPath.lastSegment(); prefixPath= prefixPath.removeLastSegments(1); - if (prefixPath.segmentCount() > 0) { + } + if (prefixPath.segmentCount() > 0) { + IPath parentPath = parent.getFullPath().append(prefixPath); + if (parentPath.segmentCount() > 0) { parent= parent.getFolder(prefixPath); + } else { + return; } } if (!parent.exists()) {