diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java index 7b862713b65..ce48fc4470a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java @@ -414,7 +414,7 @@ public class AddIncludeOnSelectionAction extends Action implements IUpdate { isSystemIncludePath = true; } else if (projectLocation.isPrefixOf(typeLocation) && projectLocation.isPrefixOf(headerLocation)) { - includePath = PathUtil.makeRelativePath(typeLocation, headerLocation); + includePath = PathUtil.makeRelativePath(typeLocation, headerLocation.removeLastSegments(1)); } if (includePath == null) includePath = typeLocation; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java index 28d6d26c4de..826e08fc59e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java @@ -926,7 +926,7 @@ public class NewClassWizardPage extends WizardPage implements Listener { systemIncludePath = true; } else { if (projectPath.isPrefixOf(location.getPath()) && projectPath.isPrefixOf(header.getPath())) - relativePath = location.getRelativePath(header.getPath()); + relativePath = location.getRelativePath(header.getPath().removeLastSegments(1)); } baseClassFileName = relativePath.toString(); }