Java Code Examples for com.intellij.openapi.util.IconLoader#getIcon()

The following examples show how to use com.intellij.openapi.util.IconLoader#getIcon() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomIconLoader.java    From intellij-extra-icons-plugin with MIT License 5 votes vote down vote up
public static Icon getIcon(Model model) {
    if (model.getIconType() == IconType.PATH) {
        return IconLoader.getIcon(model.getIcon());
    }
    if (model.getIconType() == IconType.ICON) {
        return model.getIntelliJIcon();
    }
    ImageWrapper fromBase64 = fromBase64(model.getIcon(), model.getIconType());
    if (fromBase64 == null) {
        return null;
    }
    return IconUtil.createImageIcon(fromBase64.getImage());
}
 
Example 2
Source File: DarculaLaf.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected Object parseValue(String key, @Nonnull String value) {
  if (key.endsWith("Insets") || key.endsWith("padding")) {
    final List<String> numbers = StringUtil.split(value, ",");
    return new InsetsUIResource(Integer.parseInt(numbers.get(0)),
                                Integer.parseInt(numbers.get(1)),
                                Integer.parseInt(numbers.get(2)),
                                Integer.parseInt(numbers.get(3)));
  } else if (key.endsWith(".border")) {
    try {
      return Class.forName(value).newInstance();
    } catch (Exception e) {log(e);}
  } else {
    final Color color = parseColor(value);
    final Integer invVal = getInteger(value);
    final Boolean boolVal = "true".equals(value) ? Boolean.TRUE : "false".equals(value) ? Boolean.FALSE : null;
    Icon icon = value.startsWith("AllIcons.") ? IconLoader.getIcon(value) : null;
    if (icon == null && (value.endsWith(".png") || value.endsWith(".svg"))) {
      icon = IconLoader.findIcon(value, getClass(), true);
    }
    if (color != null) {
      return  new ColorUIResource(color);
    } else if (invVal != null) {
      return invVal;
    } else if (icon != null) {
      return new IconUIResource(icon);
    } else if (boolVal != null) {
      return boolVal;
    }
  }
  return value;
}
 
Example 3
Source File: Icons.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static Icon getToolWindow() {
	// IntelliJ 2018.2+ has monochrome icons for tool windows so let's use one too
	if (ApplicationInfo.getInstance().getBuild().getBaselineVersion() >= 182) {
		return IconLoader.getIcon("/icons/org/antlr/intellij/plugin/toolWindowAntlr.svg");
	}

	return IconLoader.getIcon("/icons/org/antlr/intellij/plugin/antlr.png");
}
 
Example 4
Source File: SlingMavenModuleBuilder.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
@Override
public Icon getNodeIcon() {
    return IconLoader.getIcon("/images/sling.gif");
}
 
Example 5
Source File: CrudIcons.java    From crud-intellij-plugin with Apache License 2.0 4 votes vote down vote up
private static Icon load(String path) {
    return IconLoader.getIcon(path, CrudIcons.class);
}
 
Example 6
Source File: IdeaIDEBridge.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public Icon loadIcon(@Nonnull final String path, @Nonnull final Class<?> klazz) {
  return IconLoader.getIcon(path, klazz);
}
 
Example 7
Source File: DWFrameworkSupportProvider.java    From intellij-demandware with MIT License 4 votes vote down vote up
@Nullable
@Override
public Icon getIcon() {
    return IconLoader.getIcon("/icons/demandware.png");
}
 
Example 8
Source File: SqliteMagicIcons.java    From sqlitemagic with Apache License 2.0 4 votes vote down vote up
private static Icon load(String path) {
  return IconLoader.getIcon(path, SqliteMagicIcons.class);
}
 
Example 9
Source File: LombokIcons.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static Icon load(String path) {
  return IconLoader.getIcon(path, LombokIcons.class);
}
 
Example 10
Source File: CompleteReviewAction.java    From Crucible4IDEA with MIT License 4 votes vote down vote up
public CompleteReviewAction(@NotNull final Review review, @NotNull final String description) {
  super(description, description, IconLoader.getIcon("/images/complete.png"));
  myReview = review;
}
 
Example 11
Source File: JSGraphQLIcons.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
private static Icon load(String path) {
    return IconLoader.getIcon(path, JSGraphQLIcons.class);
}
 
Example 12
Source File: CustomizableActionsPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected boolean doSetIcon(DefaultMutableTreeNode node, @Nullable String path, Component component) {
  if (StringUtil.isNotEmpty(path) && !new File(path).isFile()) {
    Messages
      .showErrorDialog(component, IdeBundle.message("error.file.not.found.message", path), IdeBundle.message("title.choose.action.icon"));
    return false;
  }

  String actionId = getActionId(node);
  if (actionId == null) return false;

  final AnAction action = ActionManager.getInstance().getAction(actionId);
  if (action != null && action.getTemplatePresentation() != null) {
    if (StringUtil.isNotEmpty(path)) {
      Image image = null;
      try {
        image = ImageLoader.loadFromStream(VfsUtil.convertToURL(VfsUtil.pathToUrl(path.replace(File.separatorChar,
                                                                                               '/'))).openStream());
      }
      catch (IOException e) {
        LOG.debug(e);
      }
      Icon icon = new File(path).exists() ? IconLoader.getIcon(image) : null;
      if (icon != null) {
        if (icon.getIconWidth() >  EmptyIcon.ICON_18.getIconWidth() || icon.getIconHeight() > EmptyIcon.ICON_18.getIconHeight()) {
          Messages.showErrorDialog(component, IdeBundle.message("custom.icon.validation.message"), IdeBundle.message("title.choose.action.icon"));
          return false;
        }
        node.setUserObject(Pair.create(actionId, icon));
        mySelectedSchema.addIconCustomization(actionId, path);
      }
    }
    else {
      node.setUserObject(Pair.create(actionId, null));
      mySelectedSchema.removeIconCustomization(actionId);
      final DefaultMutableTreeNode nodeOnToolbar = findNodeOnToolbar(actionId);
      if (nodeOnToolbar != null){
        editToolbarIcon(actionId, nodeOnToolbar);
        node.setUserObject(nodeOnToolbar.getUserObject());
      }
    }
    return true;
  }
  return false;
}
 
Example 13
Source File: AEMPluginConfiguration.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
public Icon getIcon() {
    return IconLoader.getIcon("/images/hw.gif");
}
 
Example 14
Source File: SlackStorage.java    From SlackStorm with GNU General Public License v2.0 4 votes vote down vote up
public static Icon getSlackIcon() {
    return IconLoader.getIcon("/icons/slack.png");
}
 
Example 15
Source File: GoogleTranslation.java    From GoogleTranslation with Apache License 2.0 4 votes vote down vote up
public GoogleTranslation() {
    super(IconLoader.getIcon("/icons/translate.png"));
}
 
Example 16
Source File: PluginIcons.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static Icon intellijLoad(String path) {
    return IconLoader.getIcon(path, AllIcons.class);
}
 
Example 17
Source File: GitlabIcons.java    From IDEA-GitLab-Integration with MIT License 4 votes vote down vote up
private static Icon load(String path) {
    return IconLoader.getIcon(path, GitlabIcons.class);
}
 
Example 18
Source File: QuarkusLibraryType.java    From intellij-quarkus with Eclipse Public License 2.0 4 votes vote down vote up
@NotNull
@Override
public Icon getLibraryTypeIcon() {
    return IconLoader.getIcon("/quarkus_icon_rgb_16px_default.png", QuarkusLibraryType.class);
}
 
Example 19
Source File: ExternalSystemIcons.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static Image load(String path) {
  return IconLoader.getIcon(path, ExternalSystemIcons.class);
}
 
Example 20
Source File: DWModuleType.java    From intellij-demandware with MIT License 4 votes vote down vote up
@Override
public Icon getBigIcon() {
    return IconLoader.getIcon("/icons/demandware.png");
}