use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeDetail in project buck by facebook.
the class BuckEventsConsumer method consumeBuildEnd.
@Override
public void consumeBuildEnd(final long timestamp) {
mMainBuildEndTimestamp = timestamp;
float duration = (mMainBuildEndTimestamp - mMainBuildStartTimestamp) / 1000;
final String message = "Build ended, took " + duration + " seconds!";
int errors = 0;
int warnings = 0;
for (String cTarget : mErrors.keySet()) {
List<String> currentErrorMessages = mErrors.get(cTarget);
for (String currentErrorMessage : currentErrorMessages) {
ErrorExtractor errorExtractor = new ErrorExtractor(currentErrorMessage);
for (CompilerErrorItem currentErrorItem : errorExtractor.getErrors()) {
if (currentErrorItem.getType() == CompilerErrorItem.Type.ERROR) {
errors++;
} else {
warnings++;
}
}
}
}
String errorsMessage = "";
if (errors != 0) {
errorsMessage = "Found " + errors + " errors";
}
if (warnings != 0) {
if (errors != 0) {
errorsMessage += " and " + warnings + " warnings";
} else {
errorsMessage = "Found " + warnings + " warnings";
}
}
if (errorsMessage.length() > 0) {
errorsMessage += "!";
}
final String errorsMessageToUse = errorsMessage;
//set progress to 100%
consumeBuckBuildProgressUpdate(timestamp, 1f);
if (errorsMessageToUse.length() > 0) {
clearDisplay();
BuckTreeNodeDetail errorsMessageNode = new BuckTreeNodeDetail(BuckEventsConsumer.this.mCurrentBuildRootElement, BuckTreeNodeDetail.DetailType.ERROR, errorsMessageToUse);
BuckEventsConsumer.this.mCurrentBuildRootElement.addChild(errorsMessageNode);
// Display errors
BuckEventsConsumer.this.displayErrors();
}
BuckEventsConsumer.this.mBuildProgress.setDetail(message);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
BuckEventsConsumer.this.mTreeModel.reload();
}
});
}
use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeDetail in project buck by facebook.
the class BuckEventsConsumer method consumeBuckProjectGenerationStarted.
@Override
public void consumeBuckProjectGenerationStarted(long timestamp) {
mProjectGenerationStartTimestamp = timestamp;
// start may be called before of after progress update
if (BuckEventsConsumer.this.mProjectGenerationProgress == null) {
BuckEventsConsumer.this.mProjectGenerationProgress = new BuckTreeNodeDetail(BuckEventsConsumer.this.mCurrentBuildRootElement, BuckTreeNodeDetail.DetailType.INFO, "Current project generation progress: " + Math.round(BuckEventsConsumer.this.mProjectGenerationProgressValue * 100) + "%");
BuckEventsConsumer.this.mCurrentBuildRootElement.addChild(mProjectGenerationProgress);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
BuckEventsConsumer.this.mTreeModel.reload();
}
});
}
}
use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeDetail in project buck by facebook.
the class BuckEventsConsumer method consumeTestRunStarted.
@Override
public void consumeTestRunStarted(long timestamp) {
mTestingStartTimestamp = timestamp;
// start may be called before of after progress update
if (BuckEventsConsumer.this.mTestResults == null) {
BuckEventsConsumer.this.mTestResults = new BuckTreeNodeDetail(mCurrentBuildRootElement, BuckTreeNodeDetail.DetailType.INFO, "Running tests");
BuckEventsConsumer.this.mCurrentBuildRootElement.addChild(mTestResults);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
BuckEventsConsumer.this.mTreeModel.reload();
}
});
}
}
use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeDetail in project buck by facebook.
the class BuckEventsConsumer method consumeConsoleEvent.
@Override
public void consumeConsoleEvent(final String message) {
if (!BuckToolWindowFactory.isToolWindowInstantiated(mProject)) {
return;
}
if (!BuckToolWindowFactory.isToolWindowVisible(mProject)) {
BuckToolWindowFactory.showToolWindow(mProject);
}
if (mCurrentBuildRootElement == null) {
return;
}
mCurrentBuildRootElement.addChild(new BuckTreeNodeDetail(mCurrentBuildRootElement, BuckTreeNodeDetail.DetailType.ERROR, message));
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
BuckEventsConsumer.this.mTreeModel.reload();
}
});
}
use of com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeDetail in project buck by facebook.
the class BuckToolWindowFactory method createBuildInfoPanel.
private JComponent createBuildInfoPanel(Project project) {
Tree result = new Tree(BuckUIManager.getInstance(project).getTreeModel());
result.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
Tree tree = (Tree) e.getComponent();
int selRow = tree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
if (selRow != -1 && e.getClickCount() == 2) {
TreeNode node = (TreeNode) selPath.getLastPathComponent();
if (node.isLeaf()) {
BuckTreeNodeDetail buckNode = (BuckTreeNodeDetail) node;
if (buckNode instanceof BuckTreeNodeDetailError) {
BuckToolWindowFactory.this.handleClickOnError((BuckTreeNodeDetailError) buckNode);
}
}
}
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
result.setCellRenderer(new BuckTreeCellRenderer());
result.setShowsRootHandles(false);
result.setRowHeight(0);
JBScrollPane treeView = new JBScrollPane(result);
return treeView;
}
Aggregations