use of org.sonarlint.intellij.ui.nodes.IssueNode in project sonarlint-intellij by SonarSource.
the class IssueTree method navigate.
@CheckForNull
private OpenFileDescriptor navigate() {
DefaultMutableTreeNode node = getSelectedNode();
if (!(node instanceof IssueNode)) {
return null;
}
LiveIssue issue = ((IssueNode) node).issue();
if (!issue.isValid()) {
return null;
}
int offset;
RangeMarker range = issue.getRange();
if (range != null) {
offset = range.getStartOffset();
} else {
offset = 0;
}
return new OpenFileDescriptor(project, issue.psiFile().getVirtualFile(), offset);
}
use of org.sonarlint.intellij.ui.nodes.IssueNode in project sonarlint-intellij by SonarSource.
the class IssueTreeModelBuilder method setIssues.
private static void setIssues(FileNode node, Iterable<LiveIssue> issuePointers) {
node.removeAllChildren();
// 15ms for 500 issues -> to improve?
TreeSet<LiveIssue> set = new TreeSet<>(ISSUE_COMPARATOR);
for (LiveIssue issue : issuePointers) {
set.add(issue);
}
for (LiveIssue issue : set) {
IssueNode iNode = new IssueNode(issue);
node.add(iNode);
}
}
use of org.sonarlint.intellij.ui.nodes.IssueNode in project sonarlint-intellij by SonarSource.
the class AbstractIssuesPanel method hasPreviousOccurence.
@Override
public boolean hasPreviousOccurence() {
TreePath path = tree.getSelectionPath();
if (path == null) {
return false;
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
return (node instanceof IssueNode) && !isFirst(node);
}
use of org.sonarlint.intellij.ui.nodes.IssueNode in project sonarlint-intellij by SonarSource.
the class AbstractIssuesPanel method hasNextOccurence.
@Override
public boolean hasNextOccurence() {
// relies on the assumption that a TreeNodes will always be the last row in the table view of the tree
TreePath path = tree.getSelectionPath();
if (path == null) {
return false;
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
if (node instanceof IssueNode) {
return tree.getRowCount() != tree.getRowForPath(path) + 1;
} else {
return node.getChildCount() > 0;
}
}
use of org.sonarlint.intellij.ui.nodes.IssueNode in project sonarlint-intellij by SonarSource.
the class AbstractIssuesPanel method issueTreeSelectionChanged.
protected void issueTreeSelectionChanged() {
IssueNode[] selectedNodes = tree.getSelectedNodes(IssueNode.class, null);
if (selectedNodes.length > 0) {
LiveIssue issue = selectedNodes[0].issue();
rulePanel.setRuleKey(issue);
if (issue.getRange() != null) {
highlighting.highlightFlowsWithHighlightersUtil(issue.getRange(), issue.getMessage(), issue.flows());
}
flowsTree.getEmptyText().setText("Selected issue doesn't have flows");
flowsTreeBuilder.setFlows(issue.flows(), issue.getRange(), issue.getMessage());
flowsTree.expandAll();
} else {
flowsTreeBuilder.clearFlows();
flowsTree.getEmptyText().setText("No issue selected");
rulePanel.setRuleKey(null);
highlighting.removeHighlightingFlows();
}
}
Aggregations