Java Code Examples for com.intellij.ui.SimpleColoredComponent#setIcon()

The following examples show how to use com.intellij.ui.SimpleColoredComponent#setIcon() . 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: VirtualFileCellRenderer.java    From intellij-reference-diagram with Apache License 2.0 6 votes vote down vote up
public static void render(SimpleColoredComponent renderer, FileFQNReference ref, Project project) {
    VirtualFile virtualFile = ref.getPsiElement().getContainingFile().getVirtualFile();
    PsiJavaFile psiFile = (PsiJavaFile) PsiManager.getInstance(project).findFile(virtualFile);
    int style = SimpleTextAttributes.STYLE_PLAIN;
    Color color = SimpleTextAttributes.LINK_BOLD_ATTRIBUTES.getFgColor();
    Icon icon = getIcon(virtualFile);
    String comment = null;
    if (!virtualFile.isValid()) style |= SimpleTextAttributes.STYLE_STRIKEOUT;
    boolean fileHidden = isFileHidden(virtualFile);
    if (fileHidden) {
        color = HIDDEN;
    } ;
    renderer.setIcon(!fileHidden || icon == null ? icon : getTransparentIcon(icon));
    SimpleTextAttributes attributes = new SimpleTextAttributes(style, color);
    renderer.append(psiFile.getPackageName() + "." + psiFile.getName(), attributes);
    renderer.append(" " + ref.toUsageString(), new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, SimpleTextAttributes.GRAY_ATTRIBUTES.getFgColor()));
    if (comment != null) renderer.append(comment, attributes);
}
 
Example 2
Source File: ShowUsagesTableCellRenderer.java    From dagger-intellij-plugin with Apache License 2.0 6 votes vote down vote up
private void appendGroupText(final GroupNode node, JPanel panel, Color fileBgColor) {
  UsageGroup group = node == null ? null : node.getGroup();
  if (group == null) return;
  GroupNode parentGroup = (GroupNode) node.getParent();
  appendGroupText(parentGroup, panel, fileBgColor);
  if (node.canNavigateToSource()) {
    SimpleColoredComponent renderer = new SimpleColoredComponent();

    renderer.setIcon(group.getIcon(false));
    SimpleTextAttributes attributes =
        deriveAttributesWithColor(SimpleTextAttributes.REGULAR_ATTRIBUTES, fileBgColor);
    renderer.append(group.getText(myUsageView), attributes);
    renderer.append(" ", attributes);
    renderer.setIpad(new Insets(0, 0, 0, 0));
    renderer.setBorder(null);
    panel.add(renderer);
  }
}
 
Example 3
Source File: SetValueInplaceEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
private SetValueInplaceEditor(final XValueNodeImpl node, @Nonnull final String nodeName) {
  super(node, "setValue");
  myValueNode = node;
  myModifier = myValueNode.getValueContainer().getModifier();

  SimpleColoredComponent nameLabel = new SimpleColoredComponent();
  nameLabel.getIpad().right = 0;
  nameLabel.getIpad().left = 0;
  nameLabel.setIcon(myNode.getIcon());
  nameLabel.append(nodeName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
  XValuePresentation presentation = node.getValuePresentation();
  if (presentation != null) {
    XValuePresentationUtil.appendSeparator(nameLabel, presentation.getSeparator());
  }
  myNameOffset = nameLabel.getPreferredSize().width;
  myEditorPanel = JBUI.Panels.simplePanel(myExpressionEditor.getComponent());
}
 
Example 4
Source File: ShowUsagesTableCellRenderer.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void appendGroupText(final GroupNode node, JPanel panel, Color fileBgColor) {
  UsageGroup group = node == null ? null : node.getGroup();
  if (group == null) return;
  GroupNode parentGroup = (GroupNode)node.getParent();
  appendGroupText(parentGroup, panel, fileBgColor);
  if (node.canNavigateToSource()) {
    SimpleColoredComponent renderer = new SimpleColoredComponent();

    renderer.setIcon(group.getIcon());
    SimpleTextAttributes attributes = deriveAttributesWithColor(SimpleTextAttributes.REGULAR_ATTRIBUTES, fileBgColor);
    renderer.append(group.getText(myUsageView), attributes);
    renderer.append(" ", attributes);
    renderer.setIpad(new Insets(0,0,0,0));
    renderer.setBorder(null);
    panel.add(renderer);
  }
}
 
Example 5
Source File: ShowUsagesTableCellRenderer.java    From otto-intellij-plugin with Apache License 2.0 6 votes vote down vote up
private void appendGroupText(final GroupNode node, JPanel panel, Color fileBgColor) {
  UsageGroup group = node == null ? null : node.getGroup();
  if (group == null) return;
  GroupNode parentGroup = (GroupNode)node.getParent();
  appendGroupText(parentGroup, panel, fileBgColor);
  if (node.canNavigateToSource()) {
    SimpleColoredComponent renderer = new SimpleColoredComponent();

    renderer.setIcon(group.getIcon(false));
    SimpleTextAttributes attributes = deriveAttributesWithColor(SimpleTextAttributes.REGULAR_ATTRIBUTES, fileBgColor);
    renderer.append(group.getText(myUsageView), attributes);
    renderer.append(" ", attributes);
    renderer.setIpad(new Insets(0,0,0,0));
    renderer.setBorder(null);
    panel.add(renderer);
  }
}
 
Example 6
Source File: CSharpMemberChooseObject.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Override
@RequiredUIAccess
public void renderTreeNode(SimpleColoredComponent component, JTree tree)
{
	component.setIcon(IconDescriptorUpdaters.getIcon(myDeclaration, Iconable.ICON_FLAG_VISIBILITY));
	component.append(getPresentationText());
}
 
Example 7
Source File: LiteralChooserObject.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void renderTreeNode(SimpleColoredComponent component, JTree tree) {
	String literal = getText();
	SimpleTextAttributes attributes =
		new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, tree.getForeground());
	component.append(literal, attributes);
	component.setIcon(icon);
}
 
Example 8
Source File: CompositeAppearance.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void customize(@Nonnull SimpleColoredComponent component) {
  synchronized (mySections) {
    for (TextSection section : mySections) {
      final TextAttributes attributes = section.getTextAttributes();
      component.append(section.getText(), SimpleTextAttributes.fromTextAttributes(attributes));
    }
    component.setIcon(myIcon);
  }
}
 
Example 9
Source File: BaseTextCommentCellAppearance.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void customize(@Nonnull final SimpleColoredComponent component) {
  component.setIcon(getIcon());
  component.append(getPrimaryText(), myTextAttributes);
  final String secondaryText = getSecondaryText();
  if (!StringUtil.isEmptyOrSpaces(secondaryText)) {
    component.append(" (" + secondaryText + ")", myCommentAttributes);
  }
}
 
Example 10
Source File: XBreakpointItem.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void setupGenericRenderer(SimpleColoredComponent renderer, boolean plainView) {
  if (plainView) {
    renderer.setIcon(getIcon());
  }
  final SimpleTextAttributes attributes = myBreakpoint.isEnabled() ? SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES;
  renderer.append(StringUtil.notNullize(getDisplayText()), attributes);
  String description = getUserDescription();
  if (!StringUtil.isEmpty(description)) {
    renderer.append(" (" + description + ")", SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES);
  }
}
 
Example 11
Source File: AbstractSlingServerNodeDescriptor.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
public void customize(@NotNull SimpleColoredComponent component) {
    getHighlightedText().customize(component);
    component.setIcon(getIcon());
    String toolTipText = getTooltipText();
    component.setToolTipText(toolTipText);
}
 
Example 12
Source File: SimpleTextCellAppearance.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void customize(@Nonnull final SimpleColoredComponent component) {
  component.setIcon(myIcon);
  component.append(myText, myTextAttributes);
}
 
Example 13
Source File: MemberChooserObjectBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void renderTreeNode(SimpleColoredComponent component, JTree tree) {
  SpeedSearchUtil.appendFragmentsForSpeedSearch(tree, getText(), getTextAttributes(tree), false, component);
  component.setIcon(myIcon);
}
 
Example 14
Source File: RunAnythingItemBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setupIcon(@Nonnull SimpleColoredComponent component, @Nullable Image icon) {
  component.setIcon(ObjectUtils.notNull(icon, Image.empty(16)));
  component.setIpad(JBUI.insets(0, 10, 0, 0));
}