public static boolean isInstallationHomeOrConfig(
      @NotNull final String installationHome, @NotNull final ConfigImportSettings settings) {
    if (new File(installationHome, OPTIONS_XML).exists()) return true;
    if (new File(installationHome, CONFIG_RELATED_PATH + OPTIONS_XML).exists()) return true;

    if (!new File(installationHome, BIN_FOLDER).exists()) {
      return false;
    }

    File libFolder = new File(installationHome, "lib");
    boolean quickTest = false;
    String[] mainJarNames = settings.getMainJarNames();
    for (String name : mainJarNames) {
      String mainJarName = StringUtil.toLowerCase(name) + ".jar";
      //noinspection HardCodedStringLiteral
      if (new File(libFolder, mainJarName).exists()) {
        quickTest = true;
        break;
      }
    }
    if (!quickTest) return false;

    File[] files = getLaunchFilesCandidates(new File(installationHome), settings);
    for (File file : files) {
      if (file.exists()) return true;
    }

    return false;
  }
  @SuppressWarnings({"HardCodedStringLiteral"})
  private static File[] getLaunchFilesCandidates(
      @NotNull final File instHome, @NotNull final ConfigImportSettings settings) {
    final File bin = new File(instHome, BIN_FOLDER);
    final List<File> files = new ArrayList<File>();
    if (SystemInfo.isMac) {
      // Info.plist
      files.add(new File(new File(instHome, "Contents"), "Info.plist"));

      files.add(new File(new File(new File(bin, "idea.app"), "Contents"), "Info.plist"));
      files.add(new File(new File(new File(instHome, "idea.app"), "Contents"), "Info.plist"));
    }
    // idea.properties
    files.add(new File(bin, "idea.properties"));

    // other binary scripts
    final String executableName = StringUtil.toLowerCase(settings.getExecutableName());
    // * defaults:
    addLaunchExecutableScriptsCandidates(files, executableName, bin);
    // * customized files:
    files.addAll(settings.getCustomLaunchFilesCandidates(instHome, bin));
    // * legacy support:
    if (!"idea".equals(executableName)) {
      // for compatibility with some platform-base IDEs with wrong executable names
      addLaunchExecutableScriptsCandidates(files, "idea", bin);
    }
    return files.toArray(new File[files.size()]);
  }
  @Test
  public void testExternalCopyIsDetected() throws Exception {
    prepareExternal();

    final SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping();
    final List<RootUrlInfo> infos = workingCopies.getAllWcInfos();
    Assert.assertEquals(2, infos.size());
    final Set<String> expectedUrls = new HashSet<String>();
    expectedUrls.add(StringUtil.toLowerCase(myExternalURL));
    expectedUrls.add(StringUtil.toLowerCase(myMainUrl));

    for (RootUrlInfo info : infos) {
      expectedUrls.remove(StringUtil.toLowerCase(info.getAbsoluteUrl()));
    }
    Assert.assertTrue(expectedUrls.isEmpty());
  }
  public void testToLowerCase() {
    assertEquals('/', StringUtil.toLowerCase('/'));
    assertEquals(':', StringUtil.toLowerCase(':'));
    assertEquals('a', StringUtil.toLowerCase('a'));
    assertEquals('a', StringUtil.toLowerCase('A'));
    assertEquals('k', StringUtil.toLowerCase('k'));
    assertEquals('k', StringUtil.toLowerCase('K'));

    assertEquals('\u2567', StringUtil.toUpperCase(Character.toLowerCase('\u2567')));
  }
 private static void attachColorIcon(
     final PsiElement element, AnnotationHolder holder, String attributeValueText) {
   try {
     Color color = null;
     if (attributeValueText.startsWith("#")) {
       color = ColorUtil.fromHex(attributeValueText.substring(1));
     } else {
       final String hexCode =
           ColorMap.getHexCodeForColorName(StringUtil.toLowerCase(attributeValueText));
       if (hexCode != null) {
         color = ColorUtil.fromHex(hexCode);
       }
     }
     if (color != null) {
       final ColorIcon icon = JBUI.scale(new ColorIcon(8, color));
       final Annotation annotation = holder.createInfoAnnotation(element, null);
       annotation.setGutterIconRenderer(new ColorIconRenderer(icon, element));
     }
   } catch (Exception ignored) {
   }
 }
 public MinusculeMatcher(
     @NotNull String pattern, @NotNull NameUtil.MatchingCaseSensitivity options) {
   myOptions = options;
   myPattern = StringUtil.trimEnd(pattern, "* ").toCharArray();
   isLowerCase = new boolean[myPattern.length];
   isUpperCase = new boolean[myPattern.length];
   isWordSeparator = new boolean[myPattern.length];
   toUpperCase = new char[myPattern.length];
   toLowerCase = new char[myPattern.length];
   for (int k = 0; k < myPattern.length; k++) {
     char c = myPattern[k];
     isLowerCase[k] = Character.isLowerCase(c);
     isUpperCase[k] = Character.isUpperCase(c);
     isWordSeparator[k] = isWordSeparator(c);
     toUpperCase[k] = StringUtil.toUpperCase(c);
     toLowerCase[k] = StringUtil.toLowerCase(c);
   }
   int i = 0;
   while (isWildcard(i)) i++;
   myHasHumps = hasFlag(i + 1, isUpperCase) && hasFlag(i, isLowerCase);
   myHasSeparators = hasFlag(i, isWordSeparator);
   myHasDots = hasDots(i);
   myHasWildCards = hasWildCards();
 }