private @NotNull Icon getIcon(@NotNull IdeaPluginDescriptor descriptor, int width, int height) {
    Path path = descriptor.getPluginPath();
    if (path == null) {
      return getDefaultIcon(width, height);
    }

    if (Files.isDirectory(path)) {
      if (System.getProperty(JetBrainsProtocolHandler.REQUIRED_PLUGINS_KEY) != null) {
        Icon icon = tryLoadDirIcon(path.resolve("classes"), width, height);
        if (icon != null) {
          return icon;
        }
      }

      Icon icon = tryLoadDirIcon(path, width, height);
      if (icon != null) {
        return icon;
      }

      Path libFile = path.resolve("lib");
      if (!Files.isDirectory(libFile)) {
        return getDefaultIcon(width, height);
      }

      File[] files = libFile.toFile().listFiles();
      if (ArrayUtil.isEmpty(files)) {
        return getDefaultIcon(width, height);
      }

      for (File file : files) {
        Icon dirIcon = tryLoadDirIcon(file.toPath(), width, height);
        if (dirIcon != null) {
          return dirIcon;
        }

        Icon jarIcon = tryLoadJarIcon(file, width, height);
        if (jarIcon != null) {
          return jarIcon;
        }
      }
    }
    else {
      Icon icon = tryLoadJarIcon(path.toFile(), width, height);
      if (icon != null) {
        return icon;
      }
    }

    return getDefaultIcon(width, height);
  }
private @NotNull Icon getIcon(@NotNull IdeaPluginDescriptor descriptor, int width, int height)