private static boolean isHeadless(List<String> args) {
    if (Boolean.getBoolean(AWT_HEADLESS)) {
      return true;
    }

    if (args.isEmpty()) {
      return false;
    }

    String firstArg = args.get(0);

    List<String> headlessCommands = Arrays.asList(
      "ant", "duplocate", "dataSources", "dump-launch-parameters", "dump-shared-index", "traverseUI", "buildAppcodeCache", "format",
      "keymap", "update", "inspections", "intentions", "rdserver-headless", "thinClient-headless", "installFrontendPlugins", "installPlugins", "dumpActions",
      "cwmHostStatus", "remoteDevStatus", "invalidateCaches", "warmup", "buildEventsScheme", "inspectopedia-generator", "remoteDevShowHelp",
      "installGatewayProtocolHandler", "uninstallGatewayProtocolHandler", "appcodeClangModulesDiff", "appcodeClangModulesPrinter", "exit",
      "qodanaExcludedPlugins", "project-with-shared-caches", "registerBackendLocationForGateway");
    return headlessCommands.contains(firstArg) || firstArg.length() < 20 && firstArg.endsWith("inspect");
  }
private static boolean isHeadless(List<String> args)