diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java index 8ec17963a39..551d5618cc6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java @@ -14,10 +14,15 @@ import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.SortedMap; +import java.util.SortedSet; +import java.util.TreeMap; +import java.util.TreeSet; import java.util.Map.Entry; import org.eclipse.core.runtime.CoreException; @@ -97,6 +102,12 @@ public class CreateParserLogAction implements IObjectActionDelegate { } } + private static final Comparator COMP_INSENSITIVE= new Comparator () { + public int compare(String o1, String o2) { + return o1.toUpperCase().compareTo(o2.toUpperCase()); + } + }; + private ISelection fSelection; private IWorkbenchPartSite fSite; @@ -292,7 +303,9 @@ public class CreateParserLogAction implements IObjectActionDelegate { } private void output(PrintStream out, String indent, Map definedSymbols, HashSet reported) { - for (Entry entry : definedSymbols.entrySet()) { + SortedMap sorted= new TreeMap(COMP_INSENSITIVE); + sorted.putAll(definedSymbols); + for (Entry entry : sorted.entrySet()) { final String macro = entry.getKey() + '=' + entry.getValue(); if (reported.add(macro)) { out.println(indent + macro); @@ -301,8 +314,12 @@ public class CreateParserLogAction implements IObjectActionDelegate { } private void output(PrintStream out, String indent, IASTPreprocessorMacroDefinition[] defs, HashSet reported) { + SortedSet macros= new TreeSet(COMP_INSENSITIVE); for (IASTPreprocessorMacroDefinition def : defs) { - String macro= def.toString(); + macros.add(def.toString()); + } + + for (String macro : macros) { if (reported.add(macro)) { out.println(indent + macro); }