use of com.android.tools.idea.gradle.structure.model.PsIssue in project android by JetBrains.
the class IssuesRenderer method render.
@NotNull
public String render(@NotNull Collection<PsIssue> issues) {
StringBuilder buffer = new StringBuilder();
buffer.append("<html><body><ol>");
for (PsIssue issue : issues) {
buffer.append("<li>").append(issue.getPath().toText(HTML)).append(": ").append(issue.getText());
PsPath quickFixPath = issue.getQuickFixPath();
if (quickFixPath != null) {
buffer.append(" ").append(quickFixPath.toText(HTML));
}
buffer.append("</li>");
}
buffer.append("</ul></body></html>");
return buffer.toString();
}
use of com.android.tools.idea.gradle.structure.model.PsIssue in project android by JetBrains.
the class IssuesViewer method display.
public void display(@NotNull Collection<PsIssue> issues) {
if (issues.isEmpty()) {
if (myShowEmptyText) {
myEmptyIssuesLabel.setVisible(true);
}
myIssuesPanel1.setVisible(false);
myIssuesPanel2.setVisible(false);
myIssuesPanel3.setVisible(false);
myIssuesPanel4.setVisible(false);
revalidateAndRepaintPanels();
return;
} else {
myEmptyIssuesLabel.setVisible(false);
myIssuesPanel1.setVisible(true);
myIssuesPanel2.setVisible(true);
myIssuesPanel3.setVisible(true);
myIssuesPanel4.setVisible(true);
}
Map<PsIssue.Severity, List<PsIssue>> issuesBySeverity = Maps.newHashMap();
for (PsIssue issue : issues) {
PsIssue.Severity severity = issue.getSeverity();
List<PsIssue> currentIssues = issuesBySeverity.get(severity);
if (currentIssues == null) {
currentIssues = Lists.newArrayList();
issuesBySeverity.put(severity, currentIssues);
}
currentIssues.add(issue);
}
List<PsIssue.Severity> severities = Lists.newArrayList(issuesBySeverity.keySet());
Collections.sort(severities, (t1, t2) -> t1.getPriority() - t2.getPriority());
int typeCount = severities.size();
// There are only 4 types of issues
assert typeCount < 5;
// Start displaying from last to first
int currentIssueIndex = typeCount - 1;
PsIssue.Severity severity = severities.get(currentIssueIndex);
List<PsIssue> group = issuesBySeverity.get(severity);
updateTitle(((CollapsiblePanel) myIssuesPanel4), severity, group);
renderIssues(group, myIssuesView4);
currentIssueIndex--;
if (currentIssueIndex < 0) {
myIssuesPanel1.setVisible(false);
myIssuesPanel2.setVisible(false);
myIssuesPanel3.setVisible(false);
revalidateAndRepaintPanels();
return;
}
severity = severities.get(currentIssueIndex);
group = issuesBySeverity.get(severity);
updateTitle(((CollapsiblePanel) myIssuesPanel3), severity, group);
renderIssues(group, myIssuesView3);
currentIssueIndex--;
if (currentIssueIndex < 0) {
myIssuesPanel1.setVisible(false);
myIssuesPanel2.setVisible(false);
revalidateAndRepaintPanels();
return;
}
severity = severities.get(currentIssueIndex);
group = issuesBySeverity.get(severity);
updateTitle(((CollapsiblePanel) myIssuesPanel2), severity, group);
renderIssues(group, myIssuesView2);
currentIssueIndex--;
if (currentIssueIndex < 0) {
myIssuesPanel1.setVisible(false);
revalidateAndRepaintPanels();
return;
}
severity = severities.get(currentIssueIndex);
group = issuesBySeverity.get(severity);
updateTitle(((CollapsiblePanel) myIssuesPanel1), severity, group);
renderIssues(group, myIssuesView1);
revalidateAndRepaintPanels();
}
use of com.android.tools.idea.gradle.structure.model.PsIssue in project android by JetBrains.
the class SingleModuleIssuesRenderer method render.
@Override
@NotNull
public String render(@NotNull Collection<PsIssue> issues) {
StringBuilder buffer = new StringBuilder();
buffer.append("<html><body><ol>");
for (PsIssue issue : issues) {
buffer.append("<li>").append(issue.getText());
PsPath quickFixPath = issue.getQuickFixPath();
if (quickFixPath != null) {
buffer.append(" ").append(quickFixPath.toText(HTML));
}
String description = issue.getDescription();
if (isNotEmpty(description)) {
buffer.append("<br/><br/>").append(description);
}
buffer.append("</li>");
}
buffer.append("</ol></body></html>");
return buffer.toString();
}
use of com.android.tools.idea.gradle.structure.model.PsIssue in project android by JetBrains.
the class DependencyGraphPanel method updateIssues.
private void updateIssues(@NotNull List<AbstractDependencyNode<? extends PsAndroidDependency>> selection) {
List<PsIssue> issues = Lists.newArrayList();
for (AbstractDependencyNode<? extends PsAndroidDependency> node : selection) {
for (PsAndroidDependency dependency : node.getModels()) {
issues.addAll(myContext.getAnalyzerDaemon().getIssues().findIssues(dependency, null));
}
}
displayIssues(issues);
}
use of com.android.tools.idea.gradle.structure.model.PsIssue in project android by JetBrains.
the class PsModuleCellRenderer method customizeCellRenderer.
@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;
}
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);
}
}
Aggregations