}
}
@Override
public void onNodesRemoved(JsonArray<FileTreeNode> oldNodes) {
RunTarget target = targetPopup.getRunTarget();
// we should clear the current file if the user deleted that one
// we should revert the run target to preview if the user deleted the
// "always run target".
// If this gets more complicated, make it a visitor type thing
boolean isAlwaysRun = target.getRunMode() == RunMode.ALWAYS_RUN;
boolean hasClearedCurrentFile = currentFilePath == null;
boolean hasClearedAlwaysRun = !isAlwaysRun;
PathUtil alwaysRunPath = isAlwaysRun ? new PathUtil(target.getAlwaysRunFilename()) : null;
for (int i = 0; (!hasClearedCurrentFile || !hasClearedAlwaysRun) && i < oldNodes.size();
i++) {
FileTreeNode node = oldNodes.get(i);
if (!hasClearedCurrentFile) {
if (node.getNodePath().containsPath(currentFilePath)) {
updateCurrentFile(null);
hasClearedCurrentFile = true;
}
}
if (!hasClearedAlwaysRun) {
if (node.getNodePath().containsPath(alwaysRunPath)) {
RunTarget newTarget = RunTargetImpl.make().setRunMode(RunMode.PREVIEW_CURRENT_FILE);
updateRunTarget(newTarget);
targetResetTooltip.show(TOOLTIP_DISPLAY_TIMEOUT_MS);
hasClearedAlwaysRun = true;
}