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


Java GuiUtils.colorToHex方法代码示例

本文整理汇总了Java中com.intellij.ui.GuiUtils.colorToHex方法的典型用法代码示例。如果您正苦于以下问题:Java GuiUtils.colorToHex方法的具体用法?Java GuiUtils.colorToHex怎么用?Java GuiUtils.colorToHex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.GuiUtils的用法示例。


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

示例1: generateDoc

import com.intellij.ui.GuiUtils; //导入方法依赖的package包/类
public String generateDoc(final PsiElement element, @Nullable final PsiElement originalElement) {
  if (element instanceof IProperty) {
    IProperty property = (IProperty)element;
    String text = property.getDocCommentText();

    @NonNls String info = "";
    if (text != null) {
      TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(PropertiesHighlighter.PROPERTY_COMMENT).clone();
      Color background = attributes.getBackgroundColor();
      if (background != null) {
        info +="<div bgcolor=#"+ GuiUtils.colorToHex(background)+">";
      }
      String doc = StringUtil.join(StringUtil.split(text, "\n"), "<br>");
      info += "<font color=#" + GuiUtils.colorToHex(attributes.getForegroundColor()) + ">" + doc + "</font>\n<br>";
      if (background != null) {
        info += "</div>";
      }
    }
    info += "\n<b>" + property.getName() + "</b>=\"" + renderPropertyValue(((IProperty)element)) + "\"";
    info += getLocationString(element);
    return info;
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:PropertiesDocumentationProvider.java

示例2: generateDoc

import com.intellij.ui.GuiUtils; //导入方法依赖的package包/类
public String generateDoc(final PsiElement element, @Nullable final PsiElement originalElement) {
  if (element instanceof DylanDefinition) {
    DylanDefinition definition = (DylanDefinition)element;
    String text = "Not supported yet";

    @NonNls String info = "";
    if (text != null) {
      TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DylanSyntaxHighlighterColors.COMMENT).clone();
      Color background = attributes.getBackgroundColor();
      if (background != null) {
        info +="<div bgcolor=#"+ GuiUtils.colorToHex(background)+">";
      }
      String doc = StringUtil.join(StringUtil.split(text, "\n"), "<br>");
      info += "<font color=#" + GuiUtils.colorToHex(attributes.getForegroundColor()) + ">" + doc + "</font>\n<br>";
      if (background != null) {
        info += "</div>";
      }
    }
    info += "\n<b>" + definition.getName() + "</b>";
    info += getLocationString(element);
    return info;
  }
  return null;
}
 
开发者ID:dylan-foundry,项目名称:DeftIDEA,代码行数:25,代码来源:DylanDefinitionDocumentationProvider.java

示例3: generateDoc

import com.intellij.ui.GuiUtils; //导入方法依赖的package包/类
public String generateDoc(final PsiElement element, @Nullable final PsiElement originalElement) {
  if (element instanceof IProperty) {
    IProperty property = (IProperty)element;
    String text = property.getDocCommentText();

    @NonNls String info = "";
    if (text != null) {
      TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(PropertiesHighlighter.PROPERTY_COMMENT).clone();
      Color background = attributes.getBackgroundColor();
      if (background != null) {
        info +="<div bgcolor=#"+ GuiUtils.colorToHex(background)+">";
      }
      String doc = StringUtil.join(ContainerUtil.map(StringUtil.split(text, "\n"), new Function<String, String>() {
        @Override
        public String fun(String s) {
          return StringUtil.trimStart(StringUtil.trimStart(s, "#"), "!").trim();
        }
      }), "<br>");
      info += "<font color=#" + GuiUtils.colorToHex(attributes.getForegroundColor()) + ">" + doc + "</font>\n<br>";
      if (background != null) {
        info += "</div>";
      }
    }
    info += "\n<b>" + property.getName() + "</b>=\"" + renderPropertyValue(((IProperty)element)) + "\"";
    info += getLocationString(element);
    return info;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PropertiesDocumentationProvider.java

示例4: createIndex

import com.intellij.ui.GuiUtils; //导入方法依赖的package包/类
@NotNull
private String createIndex(Color borderColor) {
    if(borderColor == null) {
        final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
        borderColor = globalScheme.getDefaultForeground();
    }
    return "<div style=\"border-bottom: 1px outset "+ GuiUtils.colorToHex(borderColor)+"; padding: 0 2px 8px 0; margin-bottom: 16px; text-align: right;\">Index: "+ getTypeHyperLink("Query", "Queries") + " - "+ getTypeHyperLink("Mutation", "Mutations")+"</div>";
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:9,代码来源:JSGraphQLDocumentationProvider.java

示例5: updatePopup

import com.intellij.ui.GuiUtils; //导入方法依赖的package包/类
private void updatePopup(@NotNull JPopupMenu popupMenu, @NotNull String typedStr) {
    popupMenu.removeAll();
    Collection<ActionInfo> foundActions = ActionFinder.findActions(typedStr);
    EditorColorsScheme currScheme = EditorColorsManager.getInstance().getGlobalScheme();
    Color backgroundColor = currScheme.getColor(EditorColors.NOTIFICATION_BACKGROUND);
    Color foregroundColor = currScheme.getDefaultForeground();
    if (backgroundColor == null) backgroundColor = currScheme.getDefaultBackground();
    Color shortcutColor = getShortcutColor(backgroundColor, foregroundColor);
    String shortcutStyle = "color:#" + GuiUtils.colorToHex(shortcutColor);
    String abbrStyle = "font-family:" + currScheme.getConsoleFontName() + ";font-style:oblique;";
    for (ActionInfo actionInfo: foundActions) {
        AnAction action = actionInfo.getAction();
        if (action != null) {
            Presentation presentation = actionInfo.getAction().getTemplatePresentation();
            StringBuilder sb = new StringBuilder();
            sb
                    .append("<html><span style='").append(abbrStyle).append("'>")
                    .append(fillString(actionInfo.getAbbreviation(), ABBR_FIELD_SIZE))
                    .append("</span>");
            String desc = presentation.getDescription();
            if (desc != null && !desc.isEmpty()) {
                sb.append(desc);
            } else {
                String text = presentation.getText();
                if (text != null && !text.isEmpty()) {
                    sb.append(text);
                }
            }
            Shortcut[] shortcuts = action.getShortcutSet().getShortcuts();
            if (shortcuts.length > 0) {
                sb.append("&nbsp;&nbsp;<i style='").append(shortcutStyle).append("'>");
                for (Shortcut shortcut : action.getShortcutSet().getShortcuts()) {
                    if (shortcut != shortcuts[0]) {
                        sb.append(", ");
                    }
                    sb.append(KeymapUtil.getShortcutText(shortcut));
                }
                sb.append("</i>");
            }
            sb.append("</html>");
            JMenuItem menuItem = new JMenuItem(sb.toString());
            menuItem.setForeground(foregroundColor);
            menuItem.setBackground(backgroundColor);
            popupMenu.add(menuItem);
        }
    }
}
 
开发者ID:dyadix,项目名称:typengo,代码行数:48,代码来源:CommandInputForm.java

示例6: getSection

import com.intellij.ui.GuiUtils; //导入方法依赖的package包/类
@NotNull
private String getSection(Color borderColor, String label) {
    return "<div style=\"margin-bottom: 8px; border-bottom: 1px solid; padding-bottom: 4px; "+ GuiUtils.colorToHex(borderColor)+";\">"+label+"</div>";
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:5,代码来源:JSGraphQLDocumentationProvider.java


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