diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 1bf9a5e9176..a46ead48456 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,5 +1,8 @@ 2005-03-29 Chris Wiebe + prevent duplicate #includes + * src/org/eclipse/cdt/internal/ui/wizards/NewClassCodeGenerator.java +2005-03-29 Chris Wiebe fix PR#87328 by making class wizard page publicly accessible refactored wizard code and added comments * src/org/eclipse/cdt/internal/ui/wizards/AbstractMethodStub.java diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java index 638ea4af09e..99fb023cc1c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java @@ -556,7 +556,7 @@ public class NewClassCodeGenerator { boolean foundPath = false; for (Iterator ipIter = includePaths.iterator(); ipIter.hasNext(); ) { IPath includePath = (IPath) ipIter.next(); - if (includePath.isPrefixOf(folderToAdd)) { + if (includePath.isPrefixOf(folderToAdd) || includePath.equals(folderToAdd)) { foundPath = true; break; } @@ -569,7 +569,9 @@ public class NewClassCodeGenerator { newIter.remove(); } } - newIncludePaths.add(folderToAdd); + if (!newIncludePaths.contains(folderToAdd)) { + newIncludePaths.add(folderToAdd); + } } } } @@ -594,7 +596,10 @@ public class NewClassCodeGenerator { List list = new ArrayList(); for (int i = 0; i < includePaths.length; ++i) { //TODO do we need to canonicalize these paths first? - list.add(new Path(includePaths[i])); + IPath path = new Path(includePaths[i]); + if (!list.contains(path)) { + list.add(path); + } } return list; } @@ -617,7 +622,7 @@ public class NewClassCodeGenerator { if (verifyLocation) { throw new CodeGeneratorException("Could not find base class " + baseClass.toString()); //$NON-NLS-1$ } - } else { + } else if (!list.contains(baseClassLocation)) { list.add(baseClassLocation); } }