Example usage for com.intellij.openapi.ui MasterDetailsComponent.MyNode getDisplayName

List of usage examples for com.intellij.openapi.ui MasterDetailsComponent.MyNode getDisplayName

Introduction

In this page you can find the example usage for com.intellij.openapi.ui MasterDetailsComponent.MyNode getDisplayName.

Prototype

@Nls(capitalization = Nls.Capitalization.Title)
@Contract(pure = true)
String getDisplayName();

Source Link

Document

Returns the visible name of the configurable component.

Usage

From source file:com.android.tools.idea.gradle.structure.configurables.PsModuleCellRenderer.java

License:Apache License

@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    if (value instanceof MasterDetailsComponent.MyNode) {
        MasterDetailsComponent.MyNode node = (MasterDetailsComponent.MyNode) value;

        NamedConfigurable namedConfigurable = node.getConfigurable();
        if (namedConfigurable == null) {
            return;
        }/*w ww . j ava2  s .c om*/

        setIcon(namedConfigurable.getIcon(expanded));
        setToolTipText(null);
        setFont(getTreeFont());

        SimpleTextAttributes textAttributes = REGULAR_ATTRIBUTES;
        if (node.isDisplayInBold()) {
            textAttributes = REGULAR_BOLD_ATTRIBUTES;
        } else if (namedConfigurable instanceof BaseNamedConfigurable) {
            PsModule module = ((BaseNamedConfigurable) namedConfigurable).getEditableObject();
            List<PsIssue> issues = myContext.getAnalyzerDaemon().getIssues().findIssues(module,
                    IssuesByTypeAndTextComparator.INSTANCE);
            setToolTipText(getTooltipText(issues, true));

            if (!issues.isEmpty()) {
                PsIssue issue = issues.get(0);
                Color waveColor = issue.getSeverity().getColor();
                textAttributes = textAttributes.derive(STYLE_WAVED, null, null, waveColor);
            }
        }

        append(node.getDisplayName(), textAttributes);
    }
}