Java 类com.intellij.ui.SimpleTextAttributes 实例源码

项目:SearchResourcePlugin    文件:ResultElementListCellRenderer.java   
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
    Color bgColor = UIUtil.getListBackground();
    setPaintFocusBorder(hasFocus && UIUtil.isToUseDottedCellBorder());

    if (value instanceof SearchResultElement) {
        SearchResultElement element = (SearchResultElement) value;
        String stringKeyText = "(" + element.getName() + ")";
        String text = new StringEllipsisPolicy().ellipsizeText(element.getValue(), matcher);

        SimpleTextAttributes nameAttributes = new SimpleTextAttributes(Font.PLAIN, list.getForeground());
        SpeedSearchUtil.appendColoredFragmentForMatcher(text, this, nameAttributes, matcher, bgColor, selected);
        append(" " + stringKeyText, new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
    }

    setBackground(selected ? UIUtil.getListSelectionBackground() : bgColor);
}
项目:intellij-ce-playground    文件:MavenProjectsStructure.java   
@Override
protected SimpleTextAttributes getPlainAttributes() {
  SimpleTextAttributes original = super.getPlainAttributes();

  int style = original.getStyle();
  Color color = original.getFgColor();
  boolean custom = false;

  if ("test".equals(myGoal) && MavenRunner.getInstance(myProject).getSettings().isSkipTests()) {
    color = SimpleTextAttributes.GRAYED_ATTRIBUTES.getFgColor();
    style |= SimpleTextAttributes.STYLE_STRIKEOUT;
    custom = true;
  }
  if (myGoal.equals(myMavenProject.getDefaultGoal())) {
    style |= SimpleTextAttributes.STYLE_BOLD;
    custom = true;
  }
  if (custom) return original.derive(style, color, null, null);
  return original;
}
项目:intellij-ce-playground    文件:RadGridLayoutComponent.java   
@Override
public void decorateTree(SimpleColoredComponent renderer, AttributeWrapper wrapper) {
  XmlTag tag = getTag();
  StringBuilder value = new StringBuilder(" (");

  String namespace = getGridLayoutNamespace(this);

  String rowCount = tag.getAttributeValue(ATTR_ROW_COUNT, namespace);
  value.append(StringUtil.isEmpty(rowCount) ? "?" : rowCount).append(", ");

  String columnCount = tag.getAttributeValue(ATTR_COLUMN_COUNT, namespace);
  value.append(StringUtil.isEmpty(columnCount) ? "?" : columnCount).append(", ");

  value.append(isHorizontal() ? VALUE_HORIZONTAL : VALUE_VERTICAL);

  renderer.append(value.append(")").toString(), wrapper.getAttribute(SimpleTextAttributes.REGULAR_ATTRIBUTES));
}
项目:intellij-ce-playground    文件:OrderEntryAppearanceServiceImpl.java   
@NotNull
private static CellAppearanceEx formatRelativePath(@NotNull final ContentFolder folder, @NotNull final Icon icon) {
  LightFilePointer folderFile = new LightFilePointer(folder.getUrl());
  VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(folder.getContentEntry().getUrl());
  if (file == null) return FileAppearanceService.getInstance().forInvalidUrl(folderFile.getPresentableUrl());

  String contentPath = file.getPath();
  String relativePath;
  SimpleTextAttributes textAttributes;
  VirtualFile folderFileFile = folderFile.getFile();
  if (folderFileFile == null) {
    String absolutePath = folderFile.getPresentableUrl();
    relativePath = absolutePath.startsWith(contentPath) ? absolutePath.substring(contentPath.length()) : absolutePath;
    textAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
  }
  else {
    relativePath = VfsUtilCore.getRelativePath(folderFileFile, file, File.separatorChar);
    textAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
  }

  relativePath = StringUtil.isEmpty(relativePath) ? "." + File.separatorChar : relativePath;
  return new SimpleTextCellAppearance(relativePath, icon, textAttributes);
}
项目:intellij-ce-playground    文件:LanguageLevelCombo.java   
public LanguageLevelCombo(String defaultItem) {
  myDefaultItem = defaultItem;
  for (LanguageLevel level : LanguageLevel.values()) {
    addItem(level);
  }
  setRenderer(new ColoredListCellRendererWrapper() {
    @Override
    protected void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      if (value instanceof LanguageLevel) {
        append(((LanguageLevel)value).getPresentableText());
      }
      else if (value instanceof String) {    // default for SDK or project
        append((String)value);
        LanguageLevel defaultLevel = getDefaultLevel();
        if (defaultLevel != null) {
          append(" (" + defaultLevel.getPresentableText() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
        }
      }
    }
  });
}
项目:intellij-ce-playground    文件:LibrarySourceItem.java   
@Override
public void render(@NotNull PresentationData presentationData, SimpleTextAttributes mainAttributes,
                   SimpleTextAttributes commentAttributes) {
  final String name = myLibrary.getName();
  if (name != null) {
    presentationData.setIcon(PlatformIcons.LIBRARY_ICON);
    presentationData.addText(name, mainAttributes);
    presentationData.addText(LibraryElementPresentation.getLibraryTableComment(myLibrary), commentAttributes);
  }
  else {
    if (((LibraryEx)myLibrary).isDisposed()) {
      //todo[nik] disposed library should not be shown in the tree
      presentationData.addText("Invalid Library", SimpleTextAttributes.ERROR_ATTRIBUTES);
      return;
    }
    final VirtualFile[] files = myLibrary.getFiles(OrderRootType.CLASSES);
    if (files.length > 0) {
      final VirtualFile file = files[0];
      presentationData.setIcon(VirtualFilePresentation.getIcon(file));
      presentationData.addText(file.getName(), mainAttributes);
    }
    else {
      presentationData.addText("Empty Library", SimpleTextAttributes.ERROR_ATTRIBUTES);
    }
  }
}
项目:intellij-ce-playground    文件:LayoutEditorFixture.java   
private void describe(@NotNull SimpleColoredRenderer renderer,
                      @NotNull AttributeWrapper wrapper,
                      @NotNull RadComponent component,
                      boolean showSelected,
                      int depth) {
  SimpleTextAttributes style = wrapper.getAttribute(SimpleTextAttributes.REGULAR_ATTRIBUTES);
  for (int i = 0; i < depth; i++) {
    renderer.append("    ", style);
  }

  if (showSelected && myPanel.getSurfaceArea().isSelected(component)) {
    renderer.append("*");
  }
  myPanel.getTreeDecorator().decorate(component, renderer, wrapper, true);
  renderer.append("\n", style);

  for (RadComponent child : component.getChildren()) {
    describe(renderer, wrapper, child, showSelected, depth + 1);
  }
}
项目:intellij-ce-playground    文件:ComponentRenderer.java   
@NotNull
@Override
public JComponent getComponent(@Nullable PropertiesContainer container,
                               PropertyContext context,
                               @Nullable Object object,
                               boolean selected,
                               boolean hasFocus) {
  clear();
  PropertyTable.updateRenderer(this, selected);

  String value = (String)object;
  RadComponent idComponent = container instanceof RadComponent ? getComponentById((RadComponent)container, value) : null;

  if (idComponent != null) {
    renderComponent(idComponent);
  }
  else if (!StringUtil.isEmpty(value)) {
    append("<not found>", SimpleTextAttributes.ERROR_ATTRIBUTES);
  }

  return this;
}
项目:intellij    文件:BlazeJavaSyncStatusClassNodeDecorator.java   
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
  if (!(node instanceof ClassTreeNode)) {
    return;
  }
  PsiClass psiClass = ((ClassTreeNode) node).getPsiClass();
  if (psiClass == null) {
    return;
  }
  PsiFile psiFile = psiClass.getContainingFile();
  if (psiFile == null) {
    return;
  }
  VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile == null) {
    return;
  }

  Project project = node.getProject();
  if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
    data.clearText();
    data.addText(psiClass.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
    data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
项目:intellij-ce-playground    文件:XValueGroupNodeImpl.java   
public XValueGroupNodeImpl(XDebuggerTree tree, XDebuggerTreeNode parent, @NotNull XValueGroup group) {
  super(tree, parent, group);
  setLeaf(false);
  setIcon(group.getIcon());
  myText.append(group.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
  String comment = group.getComment();
  if (comment != null) {
    XValuePresentationUtil.appendSeparator(myText, group.getSeparator());
    myText.append(comment, SimpleTextAttributes.GRAY_ATTRIBUTES);
  }

  if (group.isAutoExpand()) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        if (!isObsolete()) {
          myTree.expandPath(getPath());
        }
      }
    });
  }
  myTree.nodeLoaded(this, group.getName());
}
项目:intellij-ce-playground    文件:UsageInfo2UsageAdapter.java   
@NotNull
private TextChunk[] initChunks() {
  PsiFile psiFile = getPsiFile();
  Document document = psiFile == null ? null : PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
  TextChunk[] chunks;
  if (document == null) {
    // element over light virtual file
    PsiElement element = getElement();
    if (element == null) {
      chunks = new TextChunk[]{new TextChunk(SimpleTextAttributes.ERROR_ATTRIBUTES.toTextAttributes(), UsageViewBundle.message("node.invalid"))};
    }
    else {
      chunks = new TextChunk[] {new TextChunk(new TextAttributes(), element.getText())};
    }
  }
  else {
    chunks = ChunkExtractor.extractChunks(psiFile, this);
  }

  myTextChunks = new SoftReference<TextChunk[]>(chunks);
  return chunks;
}
项目:intellij-ce-playground    文件:MessageTreeNode.java   
public static MessageTreeNode createInfoMessage(XDebuggerTree tree, @NotNull String message, @Nullable HyperlinkListener hyperlinkListener) {
  Matcher matcher = MessageTreeNodeWithLinks.HREF_PATTERN.matcher(message);
  if (hyperlinkListener == null || !matcher.find()) {
    return new MessageTreeNode(tree, null, message, SimpleTextAttributes.REGULAR_ATTRIBUTES,
                               XDebuggerUIConstants.INFORMATION_MESSAGE_ICON);
  }

  List<Object> objects = new ArrayList<Object>();
  int prev = 0;
  do {
    if (matcher.start() != prev) {
      objects.add(message.substring(prev, matcher.start()));
    }
    objects.add(new HyperlinkListenerDelegator(matcher.group(2), matcher.group(1), hyperlinkListener));
    prev = matcher.end();
  }
  while (matcher.find());

  if (prev < message.length()) {
    objects.add(message.substring(prev));
  }
  return new MessageTreeNodeWithLinks(tree, objects);
}
项目:intellij-ce-playground    文件:ValidExcludeListItem.java   
@Override
public void renderItem(ColoredListCellRenderer renderer) {
  if (myFrameworkType != null) {
    renderer.setIcon(myFrameworkType.getIcon());
    renderer.append(myFrameworkType.getPresentableName());
    if (myFile != null) {
      renderer.append(" in " + myFile.getName());
      renderer.append(" (" + myFile.getPresentableUrl() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
  else {
    renderer.setIcon(VirtualFilePresentation.getIcon(myFile));
    renderer.append(myFile.getName());
    renderer.append(" (" + myFile.getPresentableUrl() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
项目:intellij-ce-playground    文件:DomElementsGroupNode.java   
@Override
protected void doUpdate() {
  setUniformIcon(getNodeIcon());

  clearColoredText();

  final boolean showErrors = hasErrors();
  final int childrenCount = getChildren().length;

  if (childrenCount > 0) {
    final SimpleTextAttributes textAttributes =
      showErrors ? getWavedAttributes(SimpleTextAttributes.STYLE_BOLD) :  new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, SimpleTextAttributes.REGULAR_ATTRIBUTES.getFgColor());

    addColoredFragment(getNodeName(), textAttributes);
    addColoredFragment(" (" + childrenCount + ')', showErrors ? IdeBundle.message("dom.elements.tree.childs.contain.errors") : null,
                       SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);
  }
  else {
    addColoredFragment(getNodeName(), SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
  }
}
项目:intellij-ce-playground    文件:PythonDocumentationConfigurable.java   
public PythonDocumentationPanel() {
  super(ourModel, new ArrayList<PythonDocumentationMap.Entry>());
  setRenderer(1, new ColoredTableCellRenderer() {
    @Override
    protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
      String text = value == null ? "" : (String) value;
      int pos = 0;
      while(pos < text.length()) {
        int openBrace = text.indexOf('{', pos);
        if (openBrace == -1) openBrace = text.length();
        append(text.substring(pos, openBrace));
        int closeBrace = text.indexOf('}', openBrace);
        if (closeBrace == -1)
          closeBrace = text.length();
        else
          closeBrace++;
        append(text.substring(openBrace, closeBrace), new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, JBColor.BLUE.darker()));
        pos = closeBrace;
      }
    }
  });
}
项目:intellij-ce-playground    文件:SpeedSearchUtil.java   
public static void appendColoredFragmentForMatcher(@NotNull String text,
                                                   SimpleColoredComponent component,
                                                   @NotNull final SimpleTextAttributes attributes,
                                                   Matcher matcher,
                                                   Color selectedBg,
                                                   boolean selected) {
  if (!(matcher instanceof MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) {
    component.append(text, attributes);
    return;
  }

  final Iterable<TextRange> iterable = ((MinusculeMatcher)matcher).matchingFragments(text);
  if (iterable != null) {
    final Color fg = attributes.getFgColor();
    final int style = attributes.getStyle();
    final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
    final SimpleTextAttributes highlighted = new SimpleTextAttributes(selectedBg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
    appendColoredFragments(component, text, iterable, plain, highlighted);
  }
  else {
    component.append(text, attributes);
  }
}
项目:intellij-ce-playground    文件:DirectoryChooserModuleTreeView.java   
@Override
public void customizeCellRenderer(JTree tree, Object nodeValue, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  final Object value = ((DefaultMutableTreeNode)nodeValue).getUserObject();
  if (value instanceof DirectoryChooser.ItemWrapper) {
    DirectoryChooser.ItemWrapper wrapper = (DirectoryChooser.ItemWrapper)value;
    DirectoryChooser.PathFragment[] fragments = wrapper.getFragments();
    for (DirectoryChooser.PathFragment fragment : fragments) {
      append(fragment.getText(),
             fragment.isCommon() ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
    }
    setIcon(wrapper.getIcon(myFileIndex));
  }
  else if (value instanceof Module) {
    final Module module = (Module)value;
    append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    setIcon(ModuleType.get(module).getIcon());
  } else if (value instanceof ModuleGroup) {
    append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    setIcon(PlatformIcons.CLOSED_MODULE_GROUP_ICON);
  }
}
项目:intellij    文件:BlazeCppSyncStatusFileNodeDecorator.java   
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
  if (!(node instanceof PsiFileNode)) {
    return;
  }
  PsiFile psiFile = ((PsiFileNode) node).getValue();
  if (!(psiFile instanceof OCFile)) {
    return;
  }
  VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile == null) {
    return;
  }
  Project project = node.getProject();
  if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
    data.clearText();
    data.addText(psiFile.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
    data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
项目:intellij-ce-playground    文件:DeviceChooser.java   
@Override
protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
  if (!(value instanceof LaunchCompatibility)) {
    return;
  }

  LaunchCompatibility compatibility = (LaunchCompatibility)value;
  ThreeState compatible = compatibility.isCompatible();
  if (compatible == ThreeState.YES) {
    append("Yes");
  } else {
    if (compatible == ThreeState.NO) {
      append("No", SimpleTextAttributes.ERROR_ATTRIBUTES);
    } else {
      append("Maybe");
    }
    String reason = compatibility.getReason();
    if (reason != null) {
      append(", ");
      append(reason);
    }
  }
}
项目:intellij-ce-playground    文件:ConfigurationSettingsEditor.java   
public RunnersEditorComponent() {
  myRunnerPanel.setLayout(myLayout);
  myRunnerPanel.add(myNoRunner, NO_RUNNER_COMPONENT);
  myRunnersList.setModel(myListModel);
  myRunnersList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      updateRunnerComponent();
    }
  });
  updateRunnerComponent();
  myRunnersList.setCellRenderer(new ColoredListCellRenderer() {
    @Override
    protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      Executor executor = (Executor)value;
      setIcon(executor.getIcon());
      append(executor.getId(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }
  });
}
项目:logviewer    文件:ClientCellRenderer.java   
/**
 * Render the given {@link LogProcess} object
 */
private void renderClient(@NotNull LogProcess c, ColoredTextContainer container) {
    String name = c.getProcessName();
    if (name != null) {
        Pair<String, String> app = splitApplicationName(name);
        container.append(app.getFirst(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
        container.append(app.getSecond(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);

        if (c.getProcessID() != 0) {
            container.append(String.format(" (%1$d)", c.getProcessID()), SimpleTextAttributes.GRAY_ATTRIBUTES);
        }
    }
}
项目:logviewer    文件:ClientCellRenderer.java   
/**
 * Gets called to render an item
 */
protected void customizeCellRenderer(@NotNull JList list, Object value, int index, boolean selected, boolean hasFocus) {
    if (value instanceof LogProcess) {
        renderClient((LogProcess) value, this);
    } else if (value == null) {
        this.append(this.myEmptyText, SimpleTextAttributes.ERROR_ATTRIBUTES);
    } else {
        this.append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }

}
项目:logviewer    文件:LogSourcePanel.java   
static void renderDeviceName(@NotNull IDevice d, @NotNull ColoredTextContainer component) {
    component.setIcon(d.isEmulator() ? AndroidIcons.Ddms.Emulator2 : AndroidIcons.Ddms.RealDevice);
    String name;
    if (d.isEmulator()) {
        String avdName = d.getAvdName();
        if (avdName == null) {
            avdName = "unknown";
        }

        name = String.format(" %1$s %2$s ", "Emulator", avdName);
    } else {
        name = String.format(" %1$s ", DevicePropertyUtil.getModel(d, ""));
    }

    component.append(d.getSerialNumber(), SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
    component.append(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);

    IDevice.DeviceState deviceState = d.getState();
    if (deviceState != IDevice.DeviceState.ONLINE) {
        String state = String.format("[%1$s] ", d.getState());
        component.append(state, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
    }


    if (deviceState != IDevice.DeviceState.DISCONNECTED && deviceState != IDevice.DeviceState.OFFLINE) {
        component.append(DevicePropertyUtil.getBuild(d), SimpleTextAttributes.GRAY_ATTRIBUTES);
    }

}
项目:logviewer    文件:LogSourcePanel.java   
protected void customizeCellRenderer(@NotNull JList list, Object value, int index, boolean selected, boolean hasFocus) {
    if (value instanceof String) {
        this.append((String) value, SimpleTextAttributes.ERROR_ATTRIBUTES);
    } else if (value instanceof IDevice) {
        renderDeviceName((IDevice) value, this);
    } else if (value == null) {
        this.append(this.myEmptyText, SimpleTextAttributes.ERROR_ATTRIBUTES);
    }

}
项目:hybris-integration-intellij-idea-plugin    文件:HybrisProjectView.java   
private void appendParentNameToOnlyChildName(
    @NotNull final PsiDirectoryNode parentPsiDirectoryNode,
    @NotNull final VirtualFile parentVirtualFile,
    @NotNull final PsiDirectoryNode onlyChildPsiDirectoryNode,
    @NotNull final VirtualFile onlyChildVirtualFile
) {
    Validate.notNull(parentPsiDirectoryNode);
    Validate.notNull(parentVirtualFile);
    Validate.notNull(onlyChildPsiDirectoryNode);
    Validate.notNull(onlyChildVirtualFile);

    if (CollectionUtils.isEmpty(parentPsiDirectoryNode.getPresentation().getColoredText())) {
        onlyChildPsiDirectoryNode.getPresentation().addText(new ColoredFragment(
            parentVirtualFile.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES
        ));
    } else {
        for (ColoredFragment coloredFragment : parentPsiDirectoryNode.getPresentation().getColoredText()) {
            onlyChildPsiDirectoryNode.getPresentation().addText(coloredFragment);
        }
    }

    onlyChildPsiDirectoryNode.getPresentation().addText(new ColoredFragment(
        File.separator, SimpleTextAttributes.REGULAR_ATTRIBUTES
    ));

    onlyChildPsiDirectoryNode.getPresentation().addText(new ColoredFragment(
        onlyChildVirtualFile.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES
    ));
}
项目:hybris-integration-intellij-idea-plugin    文件:JunkProjectViewNode.java   
@Override
public void update(final PresentationData presentation) {
    presentation.setIcon(AllIcons.Modules.ExcludedGeneratedRoot);
    presentation.addText(new ColoredFragment(
        HybrisI18NBundleUtils.message("hybris.project.view.junk.directory.name"),
        SimpleTextAttributes.EXCLUDED_ATTRIBUTES
    ));
}
项目:educational-plugin    文件:StudyDirectoryNode.java   
protected static void updatePresentation(PresentationData data, String name, JBColor color, Icon icon, @Nullable String additionalInfo) {
  data.clearText();
  data.addText(name, new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, color));
  if (additionalInfo != null) {
    data.addText(" (" + additionalInfo + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
  }
  data.setIcon(icon);
}
项目:educational-plugin    文件:EduAnswerPlaceholderPainter.java   
public static void drawAnswerPlaceholderFromPrevStep(@NotNull Editor editor, int start, int end) {
  EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  Color color = scheme.getColor(EditorColors.TEARLINE_COLOR);
  SimpleTextAttributes attributes = SimpleTextAttributes.GRAY_ATTRIBUTES;
  final TextAttributes textAttributes = new TextAttributes(attributes.getFgColor(), color, null,
                                                           null, attributes.getFontStyle());

  drawAnswerPlaceholder(editor, start, end, textAttributes, HighlighterLayer.LAST);
}
项目:intellij-plugin    文件:SeedStackSimpleNode.java   
protected void setNameAndTooltip(String name, @Nullable String tooltip, @Nullable String hint) {
    setNameAndTooltip(name, tooltip, getPlainAttributes());
    if (structure.showDescriptions() && !StringUtil.isEmptyOrSpaces(hint)) {
        getTemplatePresentation().clearText();
        getTemplatePresentation().addText(new ColoredFragment(" (" + hint + ")", SimpleTextAttributes.GRAY_ATTRIBUTES));
    }
}
项目:intellij-plugin    文件:SeedStackSimpleNode.java   
private SimpleTextAttributes prepareAttributes(SimpleTextAttributes from) {
    ErrorLevel level = getTotalErrorLevel();
    Color waveColor = level == ErrorLevel.NONE ? null : JBColor.RED;
    int style = from.getStyle();
    if (waveColor != null) style |= SimpleTextAttributes.STYLE_WAVED;
    return new SimpleTextAttributes(from.getBgColor(), from.getFgColor(), waveColor, style);
}
项目:intellij-ce-playground    文件:RunConfigurationBeforeRunProvider.java   
@Override
protected JComponent createCenterPanel() {
  myJBList = new JBList(mySettings);
  myJBList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myJBList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      Object selectedValue = myJBList.getSelectedValue();
      if (selectedValue instanceof RunnerAndConfigurationSettings) {
        mySelectedSettings = (RunnerAndConfigurationSettings)selectedValue;
      }
      else {
        mySelectedSettings = null;
      }
      setOKActionEnabled(mySelectedSettings != null);
    }
  });
  myJBList.setCellRenderer(new ColoredListCellRenderer() {
    @Override
    protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      if (value instanceof RunnerAndConfigurationSettings) {
        RunnerAndConfigurationSettings settings = (RunnerAndConfigurationSettings)value;
        RunManagerEx runManager = RunManagerEx.getInstanceEx(myProject);
        setIcon(runManager.getConfigurationIcon(settings));
        RunConfiguration configuration = settings.getConfiguration();
        append(configuration.getName(), settings.isTemporary()
                                        ? SimpleTextAttributes.GRAY_ATTRIBUTES
                                        : SimpleTextAttributes.REGULAR_ATTRIBUTES);
      }
    }
  });
  return new JBScrollPane(myJBList);
}
项目:mule-intellij-plugins    文件:GlobalConfigsTreeStructure.java   
private void updatePresentation() {
    String connectorType = myTag.getName();

    PresentationData presentation = getPresentation();
    presentation.clear();
    presentation.addText(myName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
    presentation.addText("  (" + connectorType + ")", SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES);
    update(presentation);
}
项目:intellij-ce-playground    文件:ChangesBrowserModuleNode.java   
@Override
public void render(final ChangesBrowserNodeRenderer renderer, final boolean selected, final boolean expanded, final boolean hasFocus) {
  final Module module = (Module)userObject;

  renderer.append(module.isDisposed() ? "" : module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
  appendCount(renderer);
  if (module.isDisposed()) {
    renderer.setIcon(ModuleType.EMPTY.getIcon());
  } else {
    renderer.setIcon(ModuleType.get(module).getIcon());
  }
}
项目:intellij-ce-playground    文件:TestsPresentationUtilTest.java   
public void testFormatTestProxyTest_StartedAndPaused() {
  //paused
  final MyRenderer pausedRenderer = new MyRenderer(true, myFragContainer = new UITestUtil.FragmentsContainer());

  mySimpleTest.setStarted();
  TestsPresentationUtil.formatTestProxy(mySimpleTest, pausedRenderer);

  assertEquals(AllIcons.RunConfigurations.TestPaused, pausedRenderer.getIcon());
  assertEquals(1, myFragContainer.getFragments().size());
  assertEquals(FAKE_TEST_NAME, myFragContainer.getTextAt(0));
  assertEquals(SimpleTextAttributes.REGULAR_ATTRIBUTES, myFragContainer.getAttribsAt(0));
}
项目:intellij-ce-playground    文件:ExternalSystemNode.java   
private SimpleTextAttributes prepareAttributes(SimpleTextAttributes from) {
  ExternalProjectsStructure.ErrorLevel level = getTotalErrorLevel();
  Color waveColor = level == ExternalProjectsStructure.ErrorLevel.NONE ? null : JBColor.RED;
  int style = from.getStyle();
  if (waveColor != null) style |= SimpleTextAttributes.STYLE_WAVED;
  return new SimpleTextAttributes(from.getBgColor(), from.getFgColor(), waveColor, style);
}
项目:intellij-ce-playground    文件:RadCustomViewComponent.java   
@Override
public void decorateTree(SimpleColoredComponent renderer, AttributeWrapper wrapper) {
  String viewClass = getViewClass();
  if (viewClass != null) {
    renderer.append(" - " + viewClass, wrapper.getAttribute(SimpleTextAttributes.REGULAR_ATTRIBUTES));
  }
}
项目:intellij-ce-playground    文件:XDebuggerTreeRenderer.java   
@Override
public void append(@NotNull String fragment, @NotNull SimpleTextAttributes attributes, Object tag) {
  if (tag instanceof XDebuggerTreeNodeHyperlink && ((XDebuggerTreeNodeHyperlink)tag).alwaysOnScreen()) {
    myHaveLink = true;
    myLink.append(fragment, attributes, tag);
  }
  else {
    super.append(fragment, attributes, tag);
  }
}
项目:intellij-ce-playground    文件:JavaLanguageInjectionSupport.java   
@Override
public void setupPresentation(final BaseInjection injection, final SimpleColoredText presentation, final boolean isSelected) {
  final Matcher matcher = ourPresentationPattern.matcher(injection.getDisplayName());
  if (matcher.matches()) {
    presentation.append(matcher.group(1), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    presentation.append(matcher.group(2), isSelected ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
  else {
    super.setupPresentation(injection, presentation, isSelected);
  }
}
项目:intellij-ce-playground    文件:OrderEntryAppearanceServiceImpl.java   
@NotNull
@Override
public CellAppearanceEx forJdk(@Nullable final Sdk jdk, final boolean isInComboBox, final boolean selected, final boolean showVersion) {
  if (jdk == null) {
    return FileAppearanceService.getInstance().forInvalidUrl(NO_JDK);
  }

  String name = jdk.getName();
  CompositeAppearance appearance = new CompositeAppearance();
  SdkType sdkType = (SdkType)jdk.getSdkType();
  appearance.setIcon(sdkType.getIcon());
  SimpleTextAttributes attributes = getTextAttributes(sdkType.sdkHasValidPath(jdk), selected);
  CompositeAppearance.DequeEnd ending = appearance.getEnding();
  ending.addText(name, attributes);

  if (showVersion) {
    String versionString = jdk.getVersionString();
    if (versionString != null && !versionString.equals(name)) {
      SimpleTextAttributes textAttributes = isInComboBox && !selected ? SimpleTextAttributes.SYNTHETIC_ATTRIBUTES :
                                            SystemInfo.isMac && selected ? new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, 
                                                                                                    Color.WHITE): SimpleTextAttributes.GRAY_ATTRIBUTES;
      ending.addComment(versionString, textAttributes);
    }
  }

  return ending.getAppearance();
}
项目:intellij-ce-playground    文件:ColorRenderer.java   
private void prepareComponent(final ColorDescriptor value, final boolean selected) {
  myColorDescriptor = value;
  clear();
  setIcon(UIDesignerIcons.Empty);
  setBackground(selected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground());
  if (myColorDescriptor != null) {
    append(myColorDescriptor.toString(),
           selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES);
  }
}