for (RepresentableAsGraph r : GraphBasedWindow.this.graphTypes) {
if (r.isAcceptableCode(scriptText)) {
accepted++;
try {
r.createInstanceFromCode(scriptText);
PDFProcessor pdfProcessor = r.generatePDFcode(GeneralDialog.promptForExternalFile(
"TEMP-DIRECTORY",
GlobalVariables.getPrematureParameters().getStdDirectory(),
false).getAbsolutePath());
GlobalVariables.getPrematureParameters().logDebug("I finished creating the graph, now it's the turn of '" + pdfProcessor.getClass().getSimpleName() + "'...");
// if (!graphVizButton.getText().contains("PlainDOT") || GraphViz.class.isAssignableFrom(pdfProcessor.getClass())) {
// graphVizButton.setEnabled(true);
// } else {
// graphVizButton.setEnabled(false);
// }
// Ask for very long graphs.
if (pdfProcessor.getSourceString().length() > pdfProcessor.getCodeSizeToBeConsideredLarge() && !GeneralDialog.yesNoAnswer(
"Large pdf processor code (greater than " + pdfProcessor.getCodeSizeToBeConsideredLarge() + " characters)",
"The current script leads to a " + pdfProcessor.getClass().getSimpleName() + " code that has " + pdfProcessor.getSourceString().length() + " characters.\n"
+ "It might take " + pdfProcessor.getClass().getSimpleName() + " a long time to draw. Proceed?")) {
pdfProcessor = new GraphViz(TEMP_DIR.getAbsolutePath());
pdfProcessor.addln("digraph G {User aborted...}");
}
pdfProcessor.storeAsPDF("graph", GeneralDialog.promptForExternalFile(
"TEMP-DIRECTORY",
GlobalVariables.getPrematureParameters().getStdDirectory(),
false).getAbsolutePath());
JComponent addInfo = r.getAdditionalInfo();
this.addInfo.removeAll();
if (addInfo != null) {
this.addInfo.add(addInfo);
this.addInfo.setVisible(false);
this.addInfo.setVisible(true);
}
GlobalVariables.getPrematureParameters().logDebug(pdfProcessor.getClass().getSimpleName() + " drawing terminated successfully.");
this.graphVizButton.setText("Convert to plain " + pdfProcessor.getClass().getSimpleName());
this.graphVizButton.setBackground(this.buttonAutoScript.getBackground());
this.exceptionThrown = null;
} catch (Exception e) {
GlobalVariables.getPrematureParameters().logDebug(e.toString());
this.graphVizButton.setText("(Could not evaluate)");