Search in sources :

Example 11 with SimpleTextAttributes

use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.

the class ExternalSystemNode method prepareAttributes.

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);
}
Also used : JBColor(com.intellij.ui.JBColor) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes)

Example 12 with SimpleTextAttributes

use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.

the class ExternalSystemNode method setNameAndTooltip.

protected void setNameAndTooltip(String name, @Nullable String tooltip, @Nullable String hint) {
    final boolean ignored = isIgnored();
    final SimpleTextAttributes textAttributes = ignored ? SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES : getPlainAttributes();
    setNameAndTooltip(name, tooltip, textAttributes);
    if (!StringUtil.isEmptyOrSpaces(hint)) {
        addColoredFragment(" (" + hint + ")", ignored ? SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
}
Also used : SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes)

Example 13 with SimpleTextAttributes

use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.

the class NavBarItem method update.

void update() {
    clear();
    setIcon(myIcon);
    final boolean focused = isFocusedOrPopupElement();
    final boolean selected = isSelected();
    setFocusBorderAroundIcon(false);
    setBackground(myUI.getBackground(selected, focused));
    Color fg = myUI.getForeground(selected, focused, isInactive());
    if (fg == null)
        fg = myAttributes.getFgColor();
    final Color bg = getBackground();
    append(myText, new SimpleTextAttributes(bg, fg, myAttributes.getWaveColor(), myAttributes.getStyle()));
//repaint();
}
Also used : SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes)

Example 14 with SimpleTextAttributes

use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.

the class ContentEntryTreeCellRenderer method customizeCellRenderer.

@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    super.customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);
    final ContentEntryEditor editor = myTreeEditor.getContentEntryEditor();
    if (editor != null) {
        final Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
        if (userObject instanceof NodeDescriptor) {
            final Object element = ((NodeDescriptor) userObject).getElement();
            if (element instanceof FileElement) {
                final VirtualFile file = ((FileElement) element).getFile();
                if (file != null && file.isDirectory()) {
                    final ContentEntry contentEntry = editor.getContentEntry();
                    if (contentEntry != null) {
                        final String prefix = getPresentablePrefix(contentEntry, file);
                        if (!prefix.isEmpty()) {
                            append(" (" + prefix + ")", new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, JBColor.GRAY));
                        }
                        setIcon(updateIcon(contentEntry, file, getIcon()));
                    }
                }
            }
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ContentEntry(com.intellij.openapi.roots.ContentEntry) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes) NodeDescriptor(com.intellij.ide.util.treeView.NodeDescriptor) FileElement(com.intellij.openapi.fileChooser.FileElement)

Example 15 with SimpleTextAttributes

use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.

the class FileEncodingConfigurable method renderValue.

@Override
protected void renderValue(@Nullable Object target, @NotNull Charset t, @NotNull ColoredTextContainer renderer) {
    VirtualFile file = target instanceof VirtualFile ? (VirtualFile) target : null;
    Pair<Charset, String> check = file == null || file.isDirectory() ? null : EncodingUtil.checkSomeActionEnabled(file);
    String failReason = check == null ? null : check.second;
    String encodingText = t.displayName();
    SimpleTextAttributes attributes = failReason == null ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES;
    renderer.append(encodingText + (failReason == null ? "" : " (" + failReason + ")"), attributes);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes) Charset(java.nio.charset.Charset)

Aggregations

SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)87 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)15 JBColor (com.intellij.ui.JBColor)11 NotNull (org.jetbrains.annotations.NotNull)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 SimpleColoredComponent (com.intellij.ui.SimpleColoredComponent)7 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)7 TextAttributesKey (com.intellij.openapi.editor.colors.TextAttributesKey)6 TextRange (com.intellij.openapi.util.TextRange)6 NodeDescriptor (com.intellij.ide.util.treeView.NodeDescriptor)5 ItemPresentation (com.intellij.navigation.ItemPresentation)4 FileStatus (com.intellij.openapi.vcs.FileStatus)4 PresentationData (com.intellij.ide.projectView.PresentationData)3 PsiElement (com.intellij.psi.PsiElement)3 SimpleColoredText (com.intellij.ui.SimpleColoredText)3 List (java.util.List)3 PsIssue (com.android.tools.idea.gradle.structure.model.PsIssue)2 PTableItem (com.android.tools.idea.uibuilder.property.ptable.PTableItem)2 HighlightDisplayLevel (com.intellij.codeHighlighting.HighlightDisplayLevel)2 RefEntity (com.intellij.codeInspection.reference.RefEntity)2