Search in sources :

Example 1 with SummaryNode

use of org.sonarlint.intellij.ui.nodes.SummaryNode in project sonarlint-intellij by SonarSource.

the class FlowsTreeModelBuilder method setSingleFlow.

private void setSingleFlow(LiveIssue.Flow flow, RangeMarker rangeMarker, @Nullable String message) {
    summary = new SummaryNode();
    LocationNode primaryLocation = new LocationNode(rangeMarker, message);
    primaryLocation.setBold(true);
    summary.add(primaryLocation);
    List<LiveIssue.IssueLocation> reversedLocations = new ArrayList<>(flow.locations());
    Collections.reverse(reversedLocations);
    int i = 1;
    for (LiveIssue.IssueLocation location : reversedLocations) {
        LocationNode locationNode = new LocationNode(i++, location.location(), location.message());
        primaryLocation.add(locationNode);
    }
    model.setRoot(summary);
}
Also used : LiveIssue(org.sonarlint.intellij.issue.LiveIssue) SummaryNode(org.sonarlint.intellij.ui.nodes.SummaryNode) LocationNode(org.sonarlint.intellij.ui.nodes.LocationNode) ArrayList(java.util.ArrayList)

Example 2 with SummaryNode

use of org.sonarlint.intellij.ui.nodes.SummaryNode in project sonarlint-intellij by SonarSource.

the class FlowsTreeModelBuilder method setMultipleFlows.

private void setMultipleFlows(List<LiveIssue.Flow> flows, RangeMarker rangeMarker, @Nullable String message) {
    summary = new SummaryNode();
    LocationNode primaryLocation = new LocationNode(rangeMarker, message);
    summary.add(primaryLocation);
    int i = 1;
    for (LiveIssue.Flow f : flows) {
        LabelNode label = new LabelNode("Flow " + i);
        primaryLocation.add(label);
        List<LiveIssue.IssueLocation> reversedLocations = new ArrayList<>(f.locations());
        Collections.reverse(reversedLocations);
        int j = 1;
        for (LiveIssue.IssueLocation location : reversedLocations) {
            LocationNode locationNode = new LocationNode(j, location.location(), location.message());
            label.add(locationNode);
            j++;
        }
        i++;
    }
    model.setRoot(summary);
}
Also used : LabelNode(org.sonarlint.intellij.ui.nodes.LabelNode) LiveIssue(org.sonarlint.intellij.issue.LiveIssue) SummaryNode(org.sonarlint.intellij.ui.nodes.SummaryNode) LocationNode(org.sonarlint.intellij.ui.nodes.LocationNode) ArrayList(java.util.ArrayList)

Example 3 with SummaryNode

use of org.sonarlint.intellij.ui.nodes.SummaryNode in project sonarlint-intellij by SonarSource.

the class FlowsTreeModelBuilder method setFlatList.

private void setFlatList(List<LiveIssue.Flow> flows, RangeMarker rangeMarker, @Nullable String message) {
    summary = new SummaryNode();
    LocationNode primaryLocation = new LocationNode(rangeMarker, message);
    primaryLocation.setBold(true);
    summary.add(primaryLocation);
    flows.stream().flatMap(flow -> flow.locations().stream()).sorted(Comparator.comparing(i -> i.location().getStartOffset())).forEachOrdered(location -> {
        LocationNode locationNode = new LocationNode(location.location(), location.message());
        primaryLocation.add(locationNode);
    });
    model.setRoot(summary);
}
Also used : SummaryNode(org.sonarlint.intellij.ui.nodes.SummaryNode) LocationNode(org.sonarlint.intellij.ui.nodes.LocationNode)

Example 4 with SummaryNode

use of org.sonarlint.intellij.ui.nodes.SummaryNode in project sonarlint-intellij by SonarSource.

the class FlowsTreeModelBuilder method createModel.

public DefaultTreeModel createModel() {
    summary = new SummaryNode();
    model = new DefaultTreeModel(summary);
    model.setRoot(summary);
    return model;
}
Also used : SummaryNode(org.sonarlint.intellij.ui.nodes.SummaryNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 5 with SummaryNode

use of org.sonarlint.intellij.ui.nodes.SummaryNode in project sonarlint-intellij by SonarSource.

the class IssueTreeModelBuilder method createModel.

/**
 * Creates the model with a basic root
 */
public DefaultTreeModel createModel() {
    summary = new SummaryNode();
    model = new DefaultTreeModel(summary);
    model.setRoot(summary);
    return model;
}
Also used : SummaryNode(org.sonarlint.intellij.ui.nodes.SummaryNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Aggregations

SummaryNode (org.sonarlint.intellij.ui.nodes.SummaryNode)5 LocationNode (org.sonarlint.intellij.ui.nodes.LocationNode)3 ArrayList (java.util.ArrayList)2 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)2 LiveIssue (org.sonarlint.intellij.issue.LiveIssue)2 LabelNode (org.sonarlint.intellij.ui.nodes.LabelNode)1