sandbox = new Sandbox(parser, this, this);
setTitle("JITWatch Sandbox");
splitEditorPanes = new SplitPane();
splitEditorPanes.setOrientation(Orientation.HORIZONTAL);
SplitPane splitVertical = new SplitPane();
splitVertical.setOrientation(Orientation.VERTICAL);
taLog = new TextArea();
String style = "-fx-font-family:monospace; -fx-font-size:12px; -fx-background-color:white;";
taLog.setStyle(style);
Button btnNewEditor = new Button("New Editor");
btnNewEditor.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
addEditor(null);
}
});
btnSandboxConfig = new Button("Configure Sandbox");
btnSandboxConfig.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
sandboxConfigStage = new SandboxConfigStage(SandboxStage.this, parser.getConfig());
StageManager.addAndShow(sandboxConfigStage);
btnSandboxConfig.setDisable(true);
}
});
Button btnResetSandbox = new Button("Reset Sandbox");
btnResetSandbox.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
Response resp = Dialogs.showYesNoDialog(SandboxStage.this, "Reset Sandbox?",
"Delete all modified Sandbox sources and classes?");
if (resp == Response.YES)
{
initialiseLog();
sandbox.reset();
loadDefaultEditors();
}
}
});
comboBoxVMLanguage.valueProperty().addListener(new ChangeListener<String>()
{
@Override
public void changed(ObservableValue<? extends String> ov, String oldVal, String newVal)
{
if (newVal != null)
{
log("Changed language to " + newVal);
}
}
});
HBox hBoxTools = new HBox();
hBoxTools.setSpacing(10);
hBoxTools.setPadding(new Insets(10));
hBoxTools.getChildren().add(btnNewEditor);
hBoxTools.getChildren().add(btnSandboxConfig);
hBoxTools.getChildren().add(btnResetSandbox);
hBoxTools.getChildren().add(comboBoxVMLanguage);
splitVertical.getItems().add(splitEditorPanes);
splitVertical.getItems().add(taLog);
splitVertical.setDividerPositions(0.75, 0.25);
VBox vBoxMain = new VBox();
vBoxMain.getChildren().add(hBoxTools);
vBoxMain.getChildren().add(splitVertical);