Search in sources :

Example 1 with BuckTreeNodeTarget

use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeTarget 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;
}
Also used : CompilerErrorItem(com.facebook.buck.intellij.ideabuck.ui.utils.CompilerErrorItem) ErrorExtractor(com.facebook.buck.intellij.ideabuck.ui.utils.ErrorExtractor) BuckTreeNodeFileError(com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeFileError) BuckTreeNodeTarget(com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeTarget)

Example 2 with BuckTreeNodeTarget

use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeTarget in project buck by facebook.

the class BuckEventsConsumer method displayErrors.

private void displayErrors() {
    if (mErrors.size() > 0) {
        if (!BuckToolWindowFactory.isToolWindowVisible(mProject)) {
            BuckToolWindowFactory.showToolWindow(mProject);
        }
        Set<String> targetsWithErrors = mErrors.keySet();
        for (String target : targetsWithErrors) {
            List<String> errorMessages = mErrors.get(target);
            if (errorMessages.size() > 0) {
                BuckTreeNodeTarget targetNode = buildTargetErrorNode(target, errorMessages);
                mCurrentBuildRootElement.addChild(targetNode);
            }
        }
    }
}
Also used : BuckTreeNodeTarget(com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeTarget)

Aggregations

BuckTreeNodeTarget (com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeTarget)2 BuckTreeNodeFileError (com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeFileError)1 CompilerErrorItem (com.facebook.buck.intellij.ideabuck.ui.utils.CompilerErrorItem)1 ErrorExtractor (com.facebook.buck.intellij.ideabuck.ui.utils.ErrorExtractor)1