Skip to content
Snippets Groups Projects
Commit 371817e6 authored by Johannes Mey's avatar Johannes Mey
Browse files

fix DrAST (for Java11)

parent 4934af2c
No related branches found
No related tags found
No related merge requests found
No preview for this file type
statemachine.drast/01-initial.png

81.4 KiB

statemachine.drast/02-transformed.png

77.4 KiB

buildscript {
repositories.mavenCentral()
dependencies {
classpath group: 'org.jastadd', name: 'jastaddgradle', version: '1.13.3'
}
}
plugins {
id 'java'
id 'application'
id "idea"
id 'org.openjfx.javafxplugin' version "0.0.8" apply false
}
group 'de.tudresden.inf.st'
version '0.1'
apply plugin: 'java'
apply plugin: 'application'
apply plugin: "idea"
dependencies {
implementation project(':statemachine.solution')
implementation files('../libs/DrAST-1.2.2.jar')
implementation fileTree(dir: "${System.properties['java.home']}", include: '**/jfxrt.jar')
implementation project(':statemachine.solution')
}
sourceSets.main.java.srcDir "src/main/java"
run {
mainClassName = 'de.tudresden.inf.st.statemachine.DrAstRunner'
standardInput = System.in
jvmArgs '-Xmx4096m',
'--add-opens', 'javafx.graphics/javafx.scene.text=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.text=ALL-UNNAMED'
}
run.dependsOn ':statemachine.solution:jar'
run.doFirst { environment 'JAVA_TOOL_OPTIONS', '-Dlog4j2.disableJmx=true' }
task jarDrAst(type: Jar, dependsOn: ':statemachine.base:jar') {
group = "build"
description = 'create a jar to run the DrAST visual debugger tool'
manifest {
attributes 'Implementation-Title': 'DrAST visual debugger tool for StateMachine',
'Implementation-Version': project.version,
'Main-Class': 'de.tudresden.inf.st.statemachine.DrAstRunner'
jar {
apply plugin: 'org.openjfx.javafxplugin'
javafx {
version = "11"
modules = ['javafx.controls', 'javafx.fxml', 'javafx.swing']
}
archivesBaseName = 'drast-statemachine-all'
from { sourceSets.main.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
package de.tudresden.inf.st.statemachine;
import drast.Log;
import drast.model.DrAST;
import drast.model.DrASTSettings;
import drast.model.TreeFilter;
import drast.views.gui.DrASTGUI;
import drast.views.gui.GUIData;
import drast.views.gui.controllers.Controller;
import drast.views.gui.graph.GraphView;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.stage.Screen;
import javafx.stage.Stage;
/**
* Extended runner for DrAST
*
* @author jmey - Initial contribution
*/
public class DrAstRunner extends DrASTGUI {
public class DrAstRunner {
public static void main(String[] args) {
openView();
System.exit(0);
}
private static final GUIData mon = new GUIData();
private static Controller con;
private static boolean guiHasBeenCreated = false;
private static void openView() {
guiHasBeenCreated = true;
DrASTSettings.put(DrASTSettings.PREV_JAR, "../statemachine.solution/build/libs/statemachine.solution-0.1.jar");
DrASTSettings.put(DrASTSettings.PREV_TAIL_ARGS, "-Dlog4j2.disable.jmx=true");
launch();
con.onApplicationClose();
}
public void setRoot(Object root) {
long timeStart = System.currentTimeMillis();
DrAST newAst = new DrAST(root, TreeFilter.readFilter(con.getFilter()));
Log.info("Filter update: done after %d ms", System.currentTimeMillis() - timeStart);
Platform.runLater(() -> {
mon.reset(newAst);
if (guiHasBeenCreated) {
con.onSetRoot();
} else {
openView();
}
});
}
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader();
Parent rootView = loader.load(this.getClass().getResource("/main.fxml").openStream());
con = loader.getController();
mon.setParentStage(stage);
mon.setController(con);
mon.setDrASTUI(this);
mon.setStage(stage);
GraphView graphview = new GraphView(mon);
graphview.setOnMouseClicked((event) -> graphview.getParent().requestFocus());
mon.setGraphView(graphview);
con.init(mon);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
stage.setTitle("Statemachine DrAST 1.2.2");
stage.setScene(new Scene(rootView, primaryScreenBounds.getWidth(), primaryScreenBounds.getHeight() - 100.0D));
stage.show();
ScrollPane center = (ScrollPane)rootView.lookup("#graphViewScrollPane");
center.setContent(graphview);
Platform.runLater(() -> graphview.setPreferredSize((int)center.getWidth(), (int)center.getHeight()));
con.loadPreviousFilter();
DrASTSettings.put(DrASTSettings.PREV_FIRST_ARG, "../statemachine.solution/src/test/resources/empty.sm");
DrASTGUI.main(args);
}
}
......@@ -21,7 +21,11 @@ configurations {
File genSrc = file("src/gen/java")
idea.module.generatedSourceDirs += genSrc
sourceSets.main.java.srcDir genSrc
//jar.manifest.attributes('Main-Class': 'de.tudresden.inf.st.statemachine.Main')
jar {
from { sourceSets.main.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
manifest.attributes('Main-Class': 'de.tudresden.inf.st.statemachine.Main')
}
dependencies {
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "${jackson_version}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment