コード例 #1
0
  @Override
  public void customize(JList list, Object item, int index, boolean selected, boolean hasFocus) {
    if (item instanceof Sdk) {
      Sdk sdk = (Sdk) item;
      final PythonSdkFlavor flavor =
          PythonSdkFlavor.getPlatformIndependentFlavor(sdk.getHomePath());
      final Icon icon = flavor != null ? flavor.getIcon() : ((SdkType) sdk.getSdkType()).getIcon();

      String name;
      if (mySdkModifiers != null && mySdkModifiers.containsKey(sdk)) {
        name = mySdkModifiers.get(sdk).getName();
      } else {
        name = sdk.getName();
      }
      if (name.startsWith("Remote")) {
        final String trimmedRemote = StringUtil.trim(name.substring("Remote".length()));
        if (!trimmedRemote.isEmpty()) name = trimmedRemote;
      }
      final String flavorName = flavor == null ? "Python" : flavor.getName();
      if (name.startsWith(flavorName)) name = StringUtil.trim(name.substring(flavorName.length()));

      if (isShortVersion) {
        name = shortenName(name);
      }

      if (PythonSdkType.isInvalid(sdk)) {
        setText("[invalid] " + name);
        setIcon(wrapIconWithWarningDecorator(icon));
      } else if (PythonSdkType.isIncompleteRemote(sdk)) {
        setText("[incomplete] " + name);
        setIcon(wrapIconWithWarningDecorator(icon));
      } else if (sdk instanceof PyDetectedSdk) {
        setText(name);
        setIcon(IconLoader.getTransparentIcon(icon));
      } else {
        setText(name);
        setIcon(icon);
      }
    } else if (SEPARATOR.equals(item)) setSeparator();
    else if (item == null) setText(myNullText);
  }
コード例 #2
0
 private TokenAuth(@NotNull String token) {
   myToken = StringUtil.trim(token);
 }