use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeFileError in project buck by facebook.
the class BuckEventsConsumer method buildTargetErrorNode.
private BuckTreeNodeTarget buildTargetErrorNode(String target, List<String> errorMessages) {
BuckTreeNodeTarget targetNode = new BuckTreeNodeTarget(mCurrentBuildRootElement, target);
for (String currentError : errorMessages) {
ErrorExtractor errorExtractor = new ErrorExtractor(currentError);
ImmutableList<CompilerErrorItem> errorItems = errorExtractor.getErrors();
BuckTreeNodeFileError currentFileErrorNode = null;
String currentFilePath = "";
for (CompilerErrorItem currentErrorItem : errorItems) {
if (!currentErrorItem.getFilePath().equals(currentFilePath)) {
if (currentFileErrorNode != null) {
// Add to parent
targetNode.addFileError(currentFileErrorNode);
}
// Create the new node, for the new file
currentFileErrorNode = new BuckTreeNodeFileError(targetNode, currentErrorItem.getFilePath(), currentErrorItem);
currentFilePath = currentErrorItem.getFilePath();
} else {
currentFileErrorNode.addError(currentErrorItem);
}
}
if (currentFileErrorNode != null) {
// Add the leftovers
targetNode.addFileError(currentFileErrorNode);
}
}
return targetNode;
}
use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeFileError in project buck by facebook.
the class BuckToolWindowFactory method handleClickOnError.
private void handleClickOnError(BuckTreeNodeDetailError node) {
TreeNode parentNode = node.getParent();
if (parentNode instanceof BuckTreeNodeFileError) {
BuckTreeNodeFileError buckParentNode = (BuckTreeNodeFileError) parentNode;
DataContext dataContext = DataManager.getInstance().getDataContext();
Project project = DataKeys.PROJECT.getData(dataContext);
String relativePath = buckParentNode.getFilePath().replace(project.getBasePath(), "");
VirtualFile virtualFile = project.getBaseDir().findFileByRelativePath(relativePath);
OpenFileDescriptor openFileDescriptor = new OpenFileDescriptor(project, virtualFile, node.getLine() - 1, node.getColumn() - 1);
openFileDescriptor.navigate(true);
}
}
use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeFileError in project buck by facebook.
the class FileErrorNodeRenderer method render.
@Override
public Component render(Object value) {
JBLabel result = new JBLabel(((BuckTreeNodeFileError) value).getFilePath(), AllIcons.Ide.Warning_notifications, SwingConstants.HORIZONTAL);
BuckTreeNodeFileError buckNode = (BuckTreeNodeFileError) value;
for (int i = 0; i < buckNode.getChildCount(); i++) {
BuckTreeNodeDetail childNode = (BuckTreeNodeDetail) buckNode.getChildAt(i);
if (childNode.getType() == BuckTreeNodeDetail.DetailType.ERROR) {
result.setIcon(AllIcons.Ide.Error);
result.setForeground(Color.RED);
break;
}
}
return result;
}
Aggregations