Пример #1
0
 private static String[] getJavaLikeExtensions() {
   char[][] exts = Util.getJavaLikeExtensions();
   if (exts != null && exts.length > 0) {
     String[] extStrs = new String[exts.length];
     for (int i = 0; i < exts.length; i++) {
       extStrs[i] = "*." + String.valueOf(exts[i]);
     }
     return extStrs;
   } else {
     return new String[] {"*.java"};
   }
 }
Пример #2
0
  private static void initJavaLikeButNotGroovyLikeExtensions() {
    char[][] javaLikeExtensions = Util.getJavaLikeExtensions();
    char[][] groovyLikeExtensiosn = getGroovyLikeExtensions();
    List<char[]> interestingExtensions = new ArrayList<char[]>();
    for (char[] javaLike : javaLikeExtensions) {
      boolean found = false;
      for (char[] groovyLike : groovyLikeExtensiosn) {
        if (Arrays.equals(javaLike, groovyLike)) {
          found = true;
          break;
        }
      }
      if (!found) {
        interestingExtensions.add(javaLike);
      }
    }
    JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS =
        interestingExtensions.toArray(new char[interestingExtensions.size()][]);

    // ensure "java" is first
    int javaIndex = 0;
    char[] javaArr = "java".toCharArray();
    while (javaIndex < JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS.length) {
      if (Arrays.equals(javaArr, JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS[javaIndex])) {
        break;
      }
      javaIndex++;
    }
    if (javaIndex < JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS.length) {
      JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS[javaIndex] =
          JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS[0];
      JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS[0] = javaArr;
    } else {
      Util.log(null, "'java' not registered as a java-like extension");
    }
  }