When constructing id category, strip additional non-alphanumeric characters.
authorJan Lahoda <jlahoda@netbeans.org>
Wed, 26 Sep 2012 15:49:23 +0200
changeset 882cbe09579995a
parent 881 a38ef7700c71
child 883 da2b1feac144
When constructing id category, strip additional non-alphanumeric characters.
cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java
     1.1 --- a/cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java	Wed Sep 26 13:54:27 2012 +0200
     1.2 +++ b/cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java	Wed Sep 26 15:49:23 2012 +0200
     1.3 @@ -549,13 +549,27 @@
     1.4              idDisplayName = "unknown";
     1.5          }
     1.6  
     1.7 -        idDisplayName = "[" + idDisplayName.replace(' ', '_').replace('.', '_').replace("(", "").replace(")", "") + "] ";
     1.8 +        for (Entry<String, String> remap : toIdRemap.entrySet()) {
     1.9 +            idDisplayName.replace(remap.getKey(), remap.getValue());
    1.10 +        }
    1.11 +
    1.12 +        idDisplayName = "[" + idDisplayName.replaceAll("_+", "_") + "] ";
    1.13  
    1.14          System.out.println(FileUtil.getFileDisplayName(error.getFile()) + ":" + (lineNumber + 1) + ": warning: " + idDisplayName + error.getDescription());
    1.15          System.out.println(line);
    1.16          System.out.println(b);
    1.17      }
    1.18  
    1.19 +    private static final Map<String, String> toIdRemap = new HashMap<String, String>() {{
    1.20 +        put(" ", "_");
    1.21 +        put("-", "_");
    1.22 +        put(".", "_");
    1.23 +        put("(", "");
    1.24 +        put(")", "");
    1.25 +        put("==", "equals");
    1.26 +        put("!=", "not_equals");
    1.27 +    }};
    1.28 +
    1.29      private static void apply(Iterable<? extends HintDescription> descs, Folder[] sourceRoot, ProgressHandleWrapper progress, File out) throws IOException {
    1.30          ProgressHandleWrapper w = progress.startNextPartWithEmbedding(1, 1);
    1.31          BatchResult occurrences = BatchSearch.findOccurrences(descs, Scopes.specifiedFoldersScope(sourceRoot), w);