Search in sources :

Example 1 with UsageGroup

use of com.intellij.usages.UsageGroup in project intellij-community by JetBrains.

the class UsageNodeTreeBuilder method appendUsage.

UsageNode appendUsage(@NotNull Usage usage, @NotNull Consumer<Node> edtInsertedUnderQueue, boolean filterDuplicateLines) {
    if (!isVisible(usage))
        return null;
    final boolean dumb = DumbService.isDumb(myProject);
    GroupNode groupNode = myRoot;
    for (int i = 0; i < myGroupingRules.length; i++) {
        UsageGroupingRule rule = myGroupingRules[i];
        if (dumb && !DumbService.isDumbAware(rule))
            continue;
        UsageGroup group = rule instanceof UsageGroupingRuleEx ? ((UsageGroupingRuleEx) rule).groupUsage(usage, myTargets) : rule.groupUsage(usage);
        if (group != null) {
            groupNode = groupNode.addOrGetGroup(group, i, edtInsertedUnderQueue);
        }
    }
    return groupNode.addUsage(usage, edtInsertedUnderQueue, filterDuplicateLines);
}
Also used : UsageGroupingRule(com.intellij.usages.rules.UsageGroupingRule) UsageGroup(com.intellij.usages.UsageGroup) UsageGroupingRuleEx(com.intellij.usages.rules.UsageGroupingRuleEx)

Example 2 with UsageGroup

use of com.intellij.usages.UsageGroup in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoFileStructureGroupRuleTest method getGroupElement.

@NotNull
private PsiElement getGroupElement() {
    UsageGroup group = GoFileStructureGroupRuleProvider.USAGE_GROUPING_RULE.groupUsage(findSingleUsage());
    assertNotNull(group);
    assertInstanceOf(group, PsiElementUsageGroupBase.class);
    return ((PsiElementUsageGroupBase) group).getElement();
}
Also used : PsiElementUsageGroupBase(com.intellij.usages.PsiElementUsageGroupBase) UsageGroup(com.intellij.usages.UsageGroup) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with UsageGroup

use of com.intellij.usages.UsageGroup in project intellij-community by JetBrains.

the class ShowUsagesTableCellRenderer method appendGroupText.

private void appendGroupText(JTable table, final GroupNode node, JPanel panel, Color fileBgColor, boolean isSelected) {
    UsageGroup group = node == null ? null : node.getGroup();
    if (group == null)
        return;
    GroupNode parentGroup = (GroupNode) node.getParent();
    appendGroupText(table, parentGroup, panel, fileBgColor, isSelected);
    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.setBorder(null);
        SpeedSearchUtil.applySpeedSearchHighlighting(table, renderer, false, isSelected);
        panel.add(renderer);
    }
}
Also used : UsageGroup(com.intellij.usages.UsageGroup) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes) GroupNode(com.intellij.usages.impl.GroupNode) SimpleColoredComponent(com.intellij.ui.SimpleColoredComponent)

Aggregations

UsageGroup (com.intellij.usages.UsageGroup)3 SimpleColoredComponent (com.intellij.ui.SimpleColoredComponent)1 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)1 PsiElementUsageGroupBase (com.intellij.usages.PsiElementUsageGroupBase)1 GroupNode (com.intellij.usages.impl.GroupNode)1 UsageGroupingRule (com.intellij.usages.rules.UsageGroupingRule)1 UsageGroupingRuleEx (com.intellij.usages.rules.UsageGroupingRuleEx)1 NotNull (org.jetbrains.annotations.NotNull)1