当前位置: 首页>>代码示例>>Java>>正文


Java IconLoader类代码示例

本文整理汇总了Java中com.intellij.openapi.util.IconLoader的典型用法代码示例。如果您正苦于以下问题:Java IconLoader类的具体用法?Java IconLoader怎么用?Java IconLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IconLoader类属于com.intellij.openapi.util包,在下文中一共展示了IconLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIcon

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
private Icon getIcon() {
  if (icon == null) {
    String selector;
    if (SystemInfo.isMac) {
      selector = "OSX";
    }
    else if (SystemInfo.isWindows) {
      selector = "Windows";
    }
    else {
      selector = "Linux";
    }
    icon = IconLoader.getIcon("/lafs/" + selector + previewFileName + ".png");
  }
  return icon;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CustomizeUIThemeStepPanel.java

示例2: createWindow

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
public void createWindow(Project project) {
    jFXPanel = new JFXPanel();
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).registerToolWindow("Basis.js", false, ToolWindowAnchor.BOTTOM, false);
    toolWindow.setIcon(IconLoader.getIcon("/icons/basisjs.png"));
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    Content content = contentFactory.createContent(jFXPanel, "inspector", false);
    toolWindow.getContentManager().addContent(content);

    InspectorController sceneInspectorController = new InspectorController();
    FXMLLoader fxmlLoader = new FXMLLoader();
    fxmlLoader.setLocation(getClass().getResource("/com/basisjs/ui/windows/tools/inspector/InspectorScene.fxml"));
    fxmlLoader.setController(sceneInspectorController);

    Platform.setImplicitExit(false);
    PlatformImpl.runLater(() -> {
        try {
            Scene scene = new Scene(fxmlLoader.load());
            jFXPanel.setScene(scene);
            webView = sceneInspectorController.webView;
            webView.setContextMenuEnabled(false);
        } catch (IOException e) {
            e.printStackTrace();
        }
    });
}
 
开发者ID:smelukov,项目名称:intellij-basisjs-plugin,代码行数:26,代码来源:InspectorWindow.java

示例3: customize

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
@Override
public void customize(JList list, String value, int index, boolean selected, boolean hasFocus) {
    if ("Camel Icon".equals(value)) {
        this.setIcon(CAMEL_ICON);
    } else if ("Camel Badge Icon".equals(value)) {
        this.setIcon(CAMEL_BADGE_ICON);
    } else {
        String custom = textAccessor.getText();
        if (StringUtils.isNotEmpty(custom)) {
            File file = new File(custom);
            if (file.exists() && file.isFile()) {
                try {
                    URL url = new URL("file:" + custom);
                    Icon icon = IconLoader.findIcon(url, true);
                    if (icon != null) {
                        this.setIcon(icon);
                    }
                } catch (MalformedURLException e) {
                    LOG.warn("Error loading custom icon", e);
                }
            }
        }
    }
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:25,代码来源:CamelChosenIconCellRender.java

示例4: LocalArchivedTemplate

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
public LocalArchivedTemplate(@NotNull URL archivePath,
                             @NotNull ClassLoader classLoader) {
  super(getTemplateName(archivePath), null);

  myArchivePath = archivePath;
  myModuleType = computeModuleType(this);
  String s = readEntry(TEMPLATE_DESCRIPTOR);
  if (s != null) {
    try {
      Element templateElement = JDOMUtil.loadDocument(s).getRootElement();
      populateFromElement(templateElement);
      String iconPath = templateElement.getChildText("icon-path");
      if (iconPath != null) {
        myIcon = IconLoader.findIcon(iconPath, classLoader);
      }
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LocalArchivedTemplate.java

示例5: getSmallApplicationIcon

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
protected static Icon getSmallApplicationIcon() {
  if (ourSmallAppIcon == null) {
    try {
      Icon appIcon = IconLoader.findIcon(ApplicationInfoEx.getInstanceEx().getIconUrl());

      if (appIcon != null) {
        if (appIcon.getIconWidth() == JBUI.scale(16) && appIcon.getIconHeight() == JBUI.scale(16)) {
          ourSmallAppIcon = appIcon;
        } else {
          BufferedImage image = ImageUtil.toBufferedImage(IconUtil.toImage(appIcon));
          image = Scalr.resize(image, Scalr.Method.ULTRA_QUALITY, UIUtil.isRetina() ? 32 : JBUI.scale(16));
          ourSmallAppIcon = toRetinaAwareIcon(image);
        }
      }
    }
    catch (Exception e) {//
    }
    if (ourSmallAppIcon == null) {
      ourSmallAppIcon = EmptyIcon.ICON_16;
    }
  }

  return ourSmallAppIcon;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RecentProjectsManagerBase.java

示例6: editToolbarIcon

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
private void editToolbarIcon(String actionId, DefaultMutableTreeNode node) {
  final AnAction anAction = ActionManager.getInstance().getAction(actionId);
  if (isToolbarAction(node) && anAction.getTemplatePresentation().getIcon() == null) {
    final int exitCode = Messages.showOkCancelDialog(IdeBundle.message("error.adding.action.without.icon.to.toolbar"),
                                                     IdeBundle.message("title.unable.to.add.action.without.icon.to.toolbar"),
                                                     Messages.getInformationIcon());
    if (exitCode == Messages.OK) {
      mySelectedSchema.addIconCustomization(actionId, null);
      anAction.getTemplatePresentation().setIcon(AllIcons.Toolbar.Unknown);
      anAction.getTemplatePresentation().setDisabledIcon(IconLoader.getDisabledIcon(AllIcons.Toolbar.Unknown));
      anAction.setDefaultIcon(false);
      node.setUserObject(Pair.create(actionId, AllIcons.Toolbar.Unknown));
      myActionsTree.repaint();
      CustomActionsSchema.setCustomizationSchemaForCurrentProjects();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CustomizableActionsPanel.java

示例7: setScaleFactor

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
public static void setScaleFactor(float scale) {
  if (SystemProperties.has("hidpi") && !SystemProperties.is("hidpi")) {
    return;
  }

  if (scale < 1.25f) scale = 1.0f;
  else if (scale < 1.5f) scale = 1.25f;
  else if (scale < 1.75f) scale = 1.5f;
  else if (scale < 2f) scale = 1.75f;
  else scale = 2.0f;

  if (SystemInfo.isLinux && scale == 1.25f) {
    //Default UI font size for Unity and Gnome is 15. Scaling factor 1.25f works badly on Linux
    scale = 1f;
  }
  SCALE_FACTOR = scale;
  IconLoader.setScale(scale);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JBUI.java

示例8: customize

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
private boolean customize(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  if (!(value instanceof DefaultMutableTreeNode)) {
    return false;
  }
  final DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
  final Object userObject = node.getUserObject();
  if (!(userObject instanceof NodeDescriptor)) {
    return false;
  }
  final NodeDescriptor descriptor = (NodeDescriptor)userObject;
  final Object element = descriptor.getElement();
  if (!(element instanceof FileElement)) {
    return false;
  }
  final FileElement fileElement = (FileElement)element;
  if (!isExcluded(fileElement)) {
    return false;
  }
  setIcon(IconLoader.getDisabledIcon(descriptor.getIcon()));
  final String text = tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
  append(text, new SimpleTextAttributes(SimpleTextAttributes.STYLE_STRIKEOUT, tree.getForeground()));
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ImportTree.java

示例9: load

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
private static Icon load(String path) {
    try {
        return IconLoader.getIcon(path, PluginIcons.class);
    } catch (IllegalStateException e) {
        return null;
    }
}
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:8,代码来源:PluginIcons.java

示例10: callProtractor

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
private void callProtractor() {
    try {
        Config config = Config.getInstance(project);

        if (config == null) {
            return;
        }

        GeneralCommandLine command = getProtractorRunCommand(config);
        Process p = command.createProcess();

        if (project != null) {
            ToolWindowManager manager = ToolWindowManager.getInstance(project);
            String id = "Gherkin Runner";
            TextConsoleBuilderFactory factory = TextConsoleBuilderFactory.getInstance();
            TextConsoleBuilder builder = factory.createBuilder(project);
            ConsoleView view = builder.getConsole();

            ColoredProcessHandler handler = new ColoredProcessHandler(p, command.getPreparedCommandLine());
            handler.startNotify();
            view.attachToProcess(handler);

            ToolWindow window = manager.getToolWindow(id);
            Icon cucumberIcon = IconLoader.findIcon("/resources/icons/cucumber.png");

            if (window == null) {
                window = manager.registerToolWindow(id, true, ToolWindowAnchor.BOTTOM);
                window.setIcon(cucumberIcon);
            }

            ContentFactory cf = window.getContentManager().getFactory();
            Content c = cf.createContent(view.getComponent(), "Run " + (window.getContentManager().getContentCount() + 1), true);

            window.getContentManager().addContent(c);
        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}
 
开发者ID:KariiO,项目名称:Gherkin-TS-Runner,代码行数:40,代码来源:GherkinIconRenderer.java

示例11: replaceIcons

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
public static void replaceIcons(final Class iconsClass, final String iconsRootPath) {
  // Iterate all fields (which hold icon locations) and patch them if necessary
  for (final Field field : iconsClass.getDeclaredFields()) {
    if (Modifier.isStatic(field.getModifiers())) {
      try {
        // Object should be some kind of javax.swing.Icon
        final Object value = field.get(null);
        final Class byClass = value.getClass();

        if (byClass.getName().endsWith("$ByClass")) {
          StaticPatcher.setFieldValue(value, "myCallerClass", IconReplacer.class);
          StaticPatcher.setFieldValue(value, "myWasComputed", Boolean.FALSE);
          StaticPatcher.setFieldValue(value, "myIcon", null);
        }
        else if (byClass.getName().endsWith("$CachedImageIcon")) {
          final String newPath = patchUrlIfNeeded(value, iconsRootPath);
          if (newPath != null) {
            final Icon newIcon = IconLoader.getIcon(newPath);
            StaticPatcher.setFinalStatic(field, newIcon);
          }
        }
      }
      catch (final Exception e) {
        // suppress
        //          e.printStackTrace();
      }
    }
  }

  // Recurse into nested classes
  for (final Class subClass : iconsClass.getDeclaredClasses()) {
    replaceIcons(subClass, iconsRootPath);
  }
}
 
开发者ID:mallowigi,项目名称:a-file-icon-idea,代码行数:35,代码来源:IconReplacer.java

示例12: loadIcon

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
/**
 * Load the association's icon
 *
 * @param file
 * @param association
 * @return
 */
private Icon loadIcon(final FileInfo file, final Association association) {
  Icon icon = null;

  try {
    if (association instanceof PsiElementAssociation) {
      icon = ((PsiElementAssociation) association).getIconForFile(file);
    } else {
      icon = IconLoader.getIcon(association.getIcon());
    }
  } catch (Exception e) {
    e.printStackTrace();
  }
  return icon;
}
 
开发者ID:mallowigi,项目名称:a-file-icon-idea,代码行数:22,代码来源:FileIconProvider.java

示例13: load

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
public static Icon load(String icon) {
    if (icons.containsKey(icon)) {
        return icons.get(icon);
    }
    try {
        icons.put(icon, IconLoader.findIcon("/icons/" + icon.toLowerCase() + ".png"));
    } catch (Exception e) {
        icons.put(icon, defaultIcon);
    }
    return icons.get(icon);
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:12,代码来源:IconUtils.java

示例14: projectOpened

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
@Override
public void projectOpened() {
    Icon icon = IconLoader.getIcon(ICON_NYANDROID);
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = toolWindowManager.getToolWindow("Logcat");
    if (toolWindow != null) {
        toolWindow.setIcon(icon);
    }
}
 
开发者ID:evant,项目名称:NyandroidRestorer,代码行数:10,代码来源:NyandroidProject.java

示例15: patchRenderer

import com.intellij.openapi.util.IconLoader; //导入依赖的package包/类
private static void patchRenderer(@NotNull ProjectJdkImpl fakeSdk, @NotNull PythonSdkChooserCombo combo) {
  combo.getComboBox().setRenderer(new PySdkListCellRenderer(true) {
    @Override
    public void customize(JList list, Object item, int index, boolean selected, boolean hasFocus) {
      super.customize(list, item, index, selected, hasFocus);
      if (item == fakeSdk) {
        setIcon(IconLoader.getTransparentIcon(PythonIcons.Python.Virtualenv));
      }
    }
  });
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:12,代码来源:PyStudyDirectoryProjectGenerator.java


注:本文中的com.intellij.openapi.util.IconLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。