Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
sarah.grebing
ProofScriptParser
Commits
30714eee
Commit
30714eee
authored
Jul 09, 2017
by
Alexander Weigl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A lot of simplifications
parent
2a2cdfb5
Pipeline
#11955
failed with stage
in 1 minute and 21 seconds
Changes
19
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
601 additions
and
588 deletions
+601
-588
src/main/java/edu/kit/formal/gui/ProofScriptDebugger.java
src/main/java/edu/kit/formal/gui/ProofScriptDebugger.java
+7
-1
src/main/java/edu/kit/formal/gui/controller/ContractChooser.java
...n/java/edu/kit/formal/gui/controller/ContractChooser.java
+6
-0
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
...t/formal/gui/controller/DebuggerMainWindowController.java
+209
-176
src/main/java/edu/kit/formal/gui/controller/ListGoalView.java
...main/java/edu/kit/formal/gui/controller/ListGoalView.java
+0
-66
src/main/java/edu/kit/formal/gui/controls/InspectionView.java
...main/java/edu/kit/formal/gui/controls/InspectionView.java
+2
-19
src/main/java/edu/kit/formal/gui/controls/InspectionViewsController.java
...du/kit/formal/gui/controls/InspectionViewsController.java
+20
-8
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
+37
-13
src/main/java/edu/kit/formal/gui/controls/ScriptController.java
...in/java/edu/kit/formal/gui/controls/ScriptController.java
+31
-100
src/main/java/edu/kit/formal/gui/controls/Utils.java
src/main/java/edu/kit/formal/gui/controls/Utils.java
+168
-0
src/main/java/edu/kit/formal/gui/controls/WelcomePane.java
src/main/java/edu/kit/formal/gui/controls/WelcomePane.java
+13
-2
src/main/java/edu/kit/formal/gui/model/InspectionModel.java
src/main/java/edu/kit/formal/gui/model/InspectionModel.java
+27
-0
src/main/java/edu/kit/formal/gui/model/RootModel.java
src/main/java/edu/kit/formal/gui/model/RootModel.java
+0
-152
src/main/java/edu/kit/formal/interpreter/InterpretingService.java
.../java/edu/kit/formal/interpreter/InterpretingService.java
+2
-2
src/main/java/edu/kit/formal/interpreter/graphs/ProofTreeController.java
...du/kit/formal/interpreter/graphs/ProofTreeController.java
+8
-3
src/main/resources/edu/kit/formal/gui/controls/InspectionView.fxml
...resources/edu/kit/formal/gui/controls/InspectionView.fxml
+0
-0
src/main/resources/edu/kit/formal/gui/controls/InspectionViewTabPane.fxml
...es/edu/kit/formal/gui/controls/InspectionViewTabPane.fxml
+1
-1
src/main/resources/edu/kit/formal/gui/controls/WelcomePane.fxml
...in/resources/edu/kit/formal/gui/controls/WelcomePane.fxml
+37
-37
src/main/resources/edu/kit/formal/gui/debugger-ui.less
src/main/resources/edu/kit/formal/gui/debugger-ui.less
+9
-0
src/main/resources/log4j2.properties
src/main/resources/log4j2.properties
+24
-8
No files found.
src/main/java/edu/kit/formal/gui/ProofScriptDebugger.java
View file @
30714eee
...
...
@@ -8,6 +8,7 @@ package edu.kit.formal.gui;
import
de.uka.ilkd.key.util.KeYConstants
;
import
javafx.application.Application
;
import
javafx.application.Platform
;
import
javafx.fxml.FXMLLoader
;
import
javafx.scene.Parent
;
import
javafx.scene.Scene
;
...
...
@@ -39,6 +40,7 @@ public class ProofScriptDebugger extends Application {
Parent
root
=
fxmlLoader
.
load
();
//DebuggerMainWindowController controller = fxmlLoader.<DebuggerMainWindowController>getController();
Scene
scene
=
new
Scene
(
root
);
primaryStage
.
setOnCloseRequest
(
event
->
Platform
.
exit
());
scene
.
getStylesheets
().
addAll
(
getClass
().
getResource
(
"debugger-ui.css"
).
toExternalForm
(),
DockNode
.
class
.
getResource
(
"default.css"
).
toExternalForm
()
...
...
@@ -55,10 +57,14 @@ public class ProofScriptDebugger extends Application {
logger
.
info
(
"KeY Internal: "
+
KeYConstants
.
INTERNAL_VERSION
);
//logger.error("sfklsajflksajfsdajfsdalfjsdaf", new IllegalAccessError("dlfsdalfjsadflj"));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
stop
()
throws
Exception
{
System
.
exit
(
0
);
//needed, else non-termination of process
}
}
src/main/java/edu/kit/formal/gui/controller/ContractChooser.java
View file @
30714eee
...
...
@@ -12,6 +12,7 @@ import javafx.stage.Modality;
import
lombok.Getter
;
import
java.awt.event.KeyEvent
;
import
java.util.List
;
/**
* A Contract Chooser is a modal dialog, which shows a list of contracts and lets the user select one.
...
...
@@ -66,6 +67,11 @@ public class ContractChooser extends Dialog<Contract> {
listOfContractsView
.
itemsProperty
().
bind
(
contracts
);
}
public
ContractChooser
(
Services
service
,
List
<
Contract
>
contracts
)
{
this
(
service
);
listOfContractsView
.
itemsProperty
().
get
().
setAll
(
contracts
);
}
public
MultipleSelectionModel
<
Contract
>
getSelectionModel
()
{
return
selectionModel
;
}
...
...
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
View file @
30714eee
This diff is collapsed.
Click to expand it.
src/main/java/edu/kit/formal/gui/controller/ListGoalView.java
deleted
100644 → 0
View file @
2a2cdfb5
package
edu.kit.formal.gui.controller
;
import
edu.kit.formal.gui.controls.Utils
;
import
edu.kit.formal.gui.model.RootModel
;
import
edu.kit.formal.interpreter.data.GoalNode
;
import
edu.kit.formal.interpreter.data.KeyData
;
import
javafx.beans.property.SimpleListProperty
;
import
javafx.fxml.FXML
;
import
javafx.fxml.FXMLLoader
;
import
javafx.scene.control.ListCell
;
import
javafx.scene.control.ListView
;
import
javafx.scene.control.TextArea
;
import
javafx.scene.layout.VBox
;
import
java.io.IOException
;
/**
* Created by sarah on 5/27/17.
*/
public
class
ListGoalView
extends
VBox
{
protected
SimpleListProperty
<
GoalNode
<
KeyData
>>
localGoalListProperty
=
new
SimpleListProperty
<>();
@FXML
private
ListView
<
GoalNode
<
KeyData
>>
listOfGoalsView
;
@FXML
private
TextArea
goalNodeView
;
private
RootModel
rootModel
;
public
ListGoalView
()
{
Utils
.
createWithFXML
(
this
);
listOfGoalsView
.
setCellFactory
(
list
->
new
GoalNodeCell
());
}
public
void
setRootModel
(
RootModel
rootModel
)
{
this
.
rootModel
=
rootModel
;
}
/**
* Set Bindings and listener
*/
/* public void init() {
listOfGoalsView.itemsProperty().bind(this.rootModel.currentGoalNodesProperty());
listOfGoalsView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<GoalNode<KeyData>>() {
@Override
public void changed(ObservableValue<? extends GoalNode<KeyData>> observable, GoalNode<KeyData> oldValue, GoalNode<KeyData> newValue) {
goalNodeView.setText(newValue.toCellTextForKeYData());
}
});
}
*/
private
static
class
GoalNodeCell
extends
ListCell
<
GoalNode
<
KeyData
>>
{
@Override
protected
void
updateItem
(
GoalNode
<
KeyData
>
item
,
boolean
empty
)
{
super
.
updateItem
(
item
,
empty
);
if
(
item
!=
null
)
{
setText
(
item
.
toListLabelForKeYData
());
}
}
}
}
src/main/java/edu/kit/formal/gui/controls/InspectionView
Tab
.java
→
src/main/java/edu/kit/formal/gui/controls/InspectionView.java
View file @
30714eee
package
edu.kit.formal.gui.controls
;
import
edu.kit.formal.gui.model.InspectionModel
;
import
edu.kit.formal.gui.model.RootModel
;
import
edu.kit.formal.interpreter.data.GoalNode
;
import
edu.kit.formal.interpreter.data.KeyData
;
import
javafx.beans.Observable
;
...
...
@@ -20,7 +19,7 @@ import javafx.scene.layout.BorderPane;
*
* @author S. Grebing
*/
public
class
InspectionView
Tab
extends
BorderPane
{
public
class
InspectionView
extends
BorderPane
{
public
GoalOptionsMenu
goalOptionsMenu
=
new
GoalOptionsMenu
();
@FXML
...
...
@@ -33,8 +32,7 @@ public class InspectionViewTab extends BorderPane {
new
InspectionModel
()
);
public
InspectionViewTab
()
{
super
();
public
InspectionView
()
{
Utils
.
createWithFXML
(
this
);
model
.
get
().
selectedGoalNodeToShowProperty
().
bind
(
...
...
@@ -85,21 +83,6 @@ public class InspectionViewTab extends BorderPane {
goalOptionsMenu
.
show
(
n
,
actionEvent
.
getScreenX
(),
actionEvent
.
getScreenY
());
}
public
void
refresh
(
RootModel
model
)
{
/* IProgramMethod method = (IProgramMethod) model.getChosenContract().getTarget();
StringWriter writer = new StringWriter();
ProgramPrinter pp = new ProgramPrinter(writer);
try {
pp.printFullMethodSignature(method);
pp.printStatementBlock(method.getBody());
writer.flush();
} catch (IOException e) {
e.printStackTrace();
}
*/
}
/**
* Cells for GoalView
*/
...
...
src/main/java/edu/kit/formal/gui/controls/InspectionViewsController.java
View file @
30714eee
package
edu.kit.formal.gui.controls
;
import
edu.kit.formal.gui.model.RootModel
;
import
javafx.beans.property.SimpleMapProperty
;
import
javafx.collections.FXCollections
;
import
javafx.collections.ObservableMap
;
import
org.dockfx.DockNode
;
/**
* TabPane on the right side of the GUI containing the inspection view as tabs
* This controller manages a list of {@link InspectionView} and the associated {@link DockNode}s.
*
* Espeically, this class holds the active tab, which is connected with the {@link edu.kit.formal.interpreter.graphs.ProofTreeController},
* and shows the current interpreter state.
*
* @author weigl
*/
public
class
InspectionViewsController
{
...
...
@@ -16,23 +20,31 @@ public class InspectionViewsController {
* This tab can be changed and later on in this tab it should be possible to select proof commands
* All other tabs are only post morten tabs which cannot be shown
*/
private
final
InspectionView
Tab
activeInterpreterTab
=
new
InspectionView
Tab
();
private
final
InspectionView
activeInterpreterTab
=
new
InspectionView
();
private
final
DockNode
activeInterpreterTabDock
=
new
DockNode
(
activeInterpreterTab
,
"Active"
);
private
final
ObservableMap
<
InspectionView
,
DockNode
>
inspectionViews
=
new
SimpleMapProperty
<>(
FXCollections
.
observableHashMap
());
private
final
ObservableMap
<
InspectionViewTab
,
DockNode
>
inspectionViews
=
new
SimpleMapProperty
<>(
FXCollections
.
observableHashMap
());
public
InspectionViewTab
getActiveInspectionViewTab
()
{
public
InspectionView
getActiveInspectionViewTab
()
{
return
this
.
activeInterpreterTab
;
}
public
DockNode
getActiveInterpreterTabDock
()
{
return
activeInterpreterTabDock
;
}
public
void
connectActiveView
(
RootModel
model
)
{
public
DockNode
newPostMortemInspector
()
{
InspectionView
iv
=
new
InspectionView
();
DockNode
dn
=
new
DockNode
(
iv
,
"post mortem: "
);
inspectionViews
.
put
(
iv
,
dn
);
return
dn
;
}
/*public void connectActiveView(DebuggerModel model) {
getActiveInspectionViewTab().getGoalView().itemsProperty().bind(model.currentGoalNodesProperty());
model.currentSelectedGoalNodeProperty().addListener((p, old, fresh) -> {
getActiveInspectionViewTab().getGoalView().getSelectionModel().select(fresh);
});
}
}
*/
}
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
View file @
30714eee
...
...
@@ -34,6 +34,8 @@ import lombok.RequiredArgsConstructor;
import
org.antlr.v4.runtime.CharStream
;
import
org.antlr.v4.runtime.CharStreams
;
import
org.antlr.v4.runtime.Token
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.controlsfx.control.PopOver
;
import
org.fxmisc.richtext.CharacterHit
;
import
org.fxmisc.richtext.CodeArea
;
...
...
@@ -49,19 +51,26 @@ import java.util.*;
import
java.util.function.IntFunction
;
/**
* ScriptArea is the textarea on the left side of the GUI.
* ScriptArea is the {@link CodeArea} for writing Proof Scripts.
* <p>
* It displays the script code and allows highlighting of lines and setting of breakpoints
*/
public
class
ScriptArea
extends
CodeArea
{
private
final
ObjectProperty
<
File
>
filePath
=
new
SimpleObjectProperty
<>();
private
static
final
Logger
LOGGER
=
LogManager
.
getLogger
(
ScriptArea
.
class
);
/**
* Underlying filepath, should not be null
*/
private
final
ObjectProperty
<
File
>
filePath
=
new
SimpleObjectProperty
<>(
new
File
(
Utils
.
getRandomName
()));
/**
* If true, the content was changed since last save.
*/
private
final
BooleanProperty
dirty
=
new
SimpleBooleanProperty
(
this
,
"dirty"
,
false
);
/**
*
Lines to highlight?
*
CSS classes for regions, used for "manually" highlightning. e.g. debugging marker
*/
private
final
SetProperty
<
RegionStyle
>
markedRegions
=
new
SimpleSetProperty
<>(
FXCollections
.
observableSet
());
private
final
SetProperty
<
RegionStyle
>
markedRegions
=
new
SimpleSetProperty
<>(
FXCollections
.
observableSet
());
/**
* set by {@link ScriptController}
*/
...
...
@@ -71,7 +80,7 @@ public class ScriptArea extends CodeArea {
private
ANTLR4LexerHighlighter
highlighter
;
private
ListProperty
<
LintProblem
>
problems
=
new
SimpleListProperty
<>(
FXCollections
.
observableArrayList
());
private
SimpleObjectProperty
<
CharacterHit
>
currentMouseOver
=
new
SimpleObjectProperty
<>();
private
ScriptAreaContextMenu
contextMenu
;
private
ScriptAreaContextMenu
contextMenu
=
new
ScriptAreaContextMenu
()
;
public
ScriptArea
()
{
...
...
@@ -84,8 +93,11 @@ public class ScriptArea extends CodeArea {
highlighter
=
new
ANTLR4LexerHighlighter
(
(
String
val
)
->
new
ScriptLanguageLexer
(
CharStreams
.
fromString
(
val
)));
this
.
setParagraphGraphicFactory
(
gutter
);
//getStylesheets().add(getClass().getResource("script-keywords.css").toExternalForm());
getStyleClass
().
add
(
"script-area"
);
installPopup
();
setOnMouseClicked
(
this
::
showContextMenu
);
textProperty
().
addListener
((
prop
,
oldValue
,
newValue
)
->
{
dirty
.
set
(
true
);
updateMainScriptMarker
();
...
...
@@ -105,8 +117,6 @@ public class ScriptArea extends CodeArea {
return Optional.empty();
}
}).subscribe(s -> setStyleSpans(0, s));*/
getStyleClass
().
add
(
"script-area"
);
installPopup
();
this
.
addEventHandler
(
MouseEvent
.
MOUSE_PRESSED
,
(
MouseEvent
e
)
->
{
...
...
@@ -118,10 +128,20 @@ public class ScriptArea extends CodeArea {
this
.
moveTo
(
characterPosition
,
NavigationActions
.
SelectionPolicy
.
CLEAR
);
});
mainScript
.
addListener
((
observable
)
->
updateMainScriptMarker
());
mainScript
.
addListener
((
observable
)
->
updateMainScriptMarker
());
}
public
void
showContextMenu
(
MouseEvent
mouseEvent
)
{
if
(
contextMenu
.
isShowing
())
contextMenu
.
hide
();
if
(
mouseEvent
.
getButton
()
==
MouseButton
.
SECONDARY
)
{
contextMenu
.
setAutoHide
(
true
);
contextMenu
.
show
(
this
,
mouseEvent
.
getScreenX
(),
mouseEvent
.
getScreenY
());
mouseEvent
.
consume
();
}
else
{
contextMenu
=
new
ScriptAreaContextMenu
();
}
}
private
void
updateHighlight
()
{
...
...
@@ -517,7 +537,7 @@ public class ScriptArea extends CodeArea {
}
public
void
setMainScript
(
ActionEvent
event
)
{
System
.
out
.
println
(
"ScriptAreaContextMenu.setMainScript"
);
LOGGER
.
debug
(
"ScriptAreaContextMenu.setMainScript"
);
List
<
ProofScript
>
ast
=
Facade
.
getAST
(
getText
());
int
pos
=
currentMouseOver
.
get
().
getInsertionIndex
();
ast
.
stream
().
filter
(
ps
->
...
...
@@ -531,6 +551,10 @@ public class ScriptArea extends CodeArea {
}
public
void
showPostMortem
(
ActionEvent
event
)
{
LOGGER
.
debug
(
"ScriptAreaContextMenu.showPostMortem "
+
event
);
//TODO forward to ProofTreeController, it jumps to the node and this should be done via the callbacks.
/*ScriptArea area = ScriptArea.this;
...
...
src/main/java/edu/kit/formal/gui/controls/ScriptController.java
View file @
30714eee
...
...
@@ -13,6 +13,8 @@ import javafx.beans.value.ChangeListener;
import
javafx.beans.value.ObservableValue
;
import
javafx.collections.FXCollections
;
import
javafx.collections.ObservableMap
;
import
org.antlr.v4.runtime.CharStream
;
import
org.antlr.v4.runtime.CharStreams
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -34,8 +36,8 @@ public class ScriptController {
public
static
final
String
LINE_HIGHLIGHT_POSTMORTEM
=
"line-highlight-postmortem"
;
private
static
Logger
logger
=
LogManager
.
getLogger
(
ScriptController
.
class
);
private
final
DockPane
parent
;
private
ObjectProperty
<
MainScriptIdentifier
>
mainScript
=
new
SimpleObjectProperty
<>();
private
final
ObservableMap
<
ScriptArea
,
DockNode
>
openScripts
=
FXCollections
.
observableMap
(
new
HashMap
<>());
private
ObjectProperty
<
MainScriptIdentifier
>
mainScript
=
new
SimpleObjectProperty
<>();
private
ScriptArea
lastScriptArea
;
private
ASTNodeHighlighter
postMortemHighlighter
=
new
ASTNodeHighlighter
(
LINE_HIGHLIGHT_POSTMORTEM
);
...
...
@@ -59,7 +61,7 @@ public class ScriptController {
return
openScripts
.
get
(
editor
);
}
public
ScriptArea
createNewTab
(
File
filePath
)
{
public
ScriptArea
createNewTab
(
File
filePath
)
throws
IOException
{
filePath
=
filePath
.
getAbsoluteFile
();
if
(
findEditor
(
filePath
)
==
null
)
{
ScriptArea
area
=
new
ScriptArea
();
...
...
@@ -67,6 +69,16 @@ public class ScriptController {
area
.
setFilePath
(
filePath
);
DockNode
dockNode
=
createDockNode
(
area
);
openScripts
.
put
(
area
,
dockNode
);
if
(
filePath
.
exists
())
{
String
code
=
FileUtils
.
readFileToString
(
filePath
,
"utf-8"
);
if
(!
area
.
textProperty
().
getValue
().
isEmpty
())
{
area
.
deleteText
(
0
,
area
.
textProperty
().
getValue
().
length
());
}
area
.
setText
(
code
);
}
return
area
;
}
else
{
logger
.
info
(
"File already exists. Will not load it again"
);
...
...
@@ -90,7 +102,7 @@ public class ScriptController {
area
.
dirtyProperty
().
addListener
(
new
ChangeListener
<
Boolean
>()
{
@Override
public
void
changed
(
ObservableValue
<?
extends
Boolean
>
observable
,
Boolean
oldValue
,
Boolean
newValue
)
{
if
(
newValue
)
if
(
newValue
)
dockNode
.
setGraphic
(
new
MaterialDesignIconView
(
MaterialDesignIcon
.
FILE_DOCUMENT
));
else
dockNode
.
setGraphic
(
new
MaterialDesignIconView
(
MaterialDesignIcon
.
FILE_DOCUMENT_BOX
));
...
...
@@ -107,7 +119,6 @@ public class ScriptController {
return
dockNode
;
}
public
Set
<
Breakpoint
>
getBreakpoints
()
{
HashSet
<
Breakpoint
>
breakpoints
=
new
HashSet
<>();
openScripts
.
keySet
().
forEach
(
tab
->
...
...
@@ -125,7 +136,6 @@ public class ScriptController {
.
orElse
(
null
);
}
public
void
saveCurrentScriptAs
(
File
scriptFile
)
throws
IOException
{
for
(
ScriptArea
area
:
openScripts
.
keySet
())
{
if
(
area
.
isFocused
())
{
...
...
@@ -139,101 +149,16 @@ public class ScriptController {
public
List
<
ProofScript
>
getCombinedAST
()
{
ArrayList
<
ProofScript
>
all
=
new
ArrayList
<>();
for
(
ScriptArea
area
:
openScripts
.
keySet
())
{
all
.
addAll
(
Facade
.
getAST
(
area
.
getText
()));
//absolute path important to find area later by token
CharStream
stream
=
CharStreams
.
fromString
(
area
.
getText
(),
area
.
getFilePath
().
getAbsolutePath
());
all
.
addAll
(
Facade
.
getAST
(
stream
));
}
return
all
;
}
private
String
[]
ADJECTIVES
=
(
"abandoned,able,absolute,adorable,adventurous,academic,acceptable,acclaimed,accomplished,accurate,aching,acidic,acrobatic,active,actual,adept,admirable,admired,"
+
"adolescent,adorable,adored,advanced,afraid,affectionate,aged,aggravating,aggressive,agile,agitated,agonizing,agreeable,ajar,alarmed,alarming,alert,"
+
"alienated,alive,all,altruistic,amazing,ambitious,ample,amused,amusing,anchored,ancient,angelic,angry,anguished,animated,annual,another,antique,anxious,"
+
"any,apprehensive,appropriate,apt,arctic,arid,aromatic,artistic,ashamed,assured,astonishing,athletic,attached,attentive,attractive,austere,authentic,authorized,"
+
"automatic,avaricious,average,aware,awesome,awful,awkward,babyish,bad,back,baggy,bare,barren,basic,beautiful,belated,beloved,beneficial,better,best,bewitched,"
+
"big,big-hearted,biodegradable,bite-sized,bitter,black,black-and-white,bland,blank,blaring,bleak,blind,blissful,blond,blue,blushing,bogus,boiling,bold,bony,"
+
"boring,bossy,both,bouncy,bountiful,bowed,brave,breakable,brief,bright,brilliant,brisk,broken,bronze,brown,bruised,bubbly,bulky,bumpy,buoyant,burdensome,burly,"
+
"bustling,busy,buttery,buzzing,calculating,calm,candid,canine,capital,carefree,careful,careless,caring,cautious,cavernous,celebrated,charming,cheap,cheerful,"
+
"cheery,chief,chilly,chubby,circular,classic,clean,clear,clear-cut,clever,close,closed,cloudy,clueless,clumsy,cluttered,coarse,cold,colorful,colorless,"
+
"colossal,comfortable,common,compassionate,competent,complete,complex,complicated,composed,concerned,concrete,confused,conscious,considerate,constant,content,"
+
"conventional,cooked,cool,cooperative,coordinated,corny,corrupt,costly,courageous,courteous,crafty,crazy,creamy,creative,creepy,criminal,crisp,critical,"
+
"crooked,crowded,cruel,crushing,cuddly,cultivated,cultured,cumbersome,curly,curvy,cute,cylindrical,damaged,damp,dangerous,dapper,daring,darling,dark,dazzling"
+
",dead,deadly,deafening,dear,dearest,decent,decimal,decisive,deep,defenseless,defensive,defiant,deficient,definite,definitive,delayed,delectable,delicious,"
+
"delightful,delirious,demanding,dense,dental,dependable,dependent,descriptive,deserted,detailed,determined,devoted,different,difficult,digital,diligent,dim,"
+
"dimpled,dimwitted,direct,disastrous,discrete,disfigured,disgusting,disloyal,dismal,distant,downright,dreary,dirty,disguised,dishonest,dismal,distant,distinct,"
+
"distorted,dizzy,dopey,doting,double,downright,drab,drafty,dramatic,dreary,droopy,dry,dual,dull,dutiful,each,eager,earnest,early,easy,easy-going,ecstatic,edible"
+
",educated,elaborate,elastic,elated,elderly,electric,elegant,elementary,elliptical,embarrassed,embellished,eminent,emotional,empty,enchanted,enchanting,energetic,"
+
"enlightened,enormous,enraged,entire,envious,equal,equatorial,essential,esteemed,ethical,euphoric,even,evergreen,everlasting,every,evil,exalted,excellent,exemplary"
+
",exhausted,excitable,excited,exciting,exotic,expensive,experienced,expert,extraneous,extroverted,extra-large,extra-small,fabulous,failing,faint,fair,faithful,fake"
+
",false,familiar,famous,fancy,fantastic,far,faraway,far-flung,far-off,fast,fat,fatal,fatherly,favorable,favorite,fearful,fearless,feisty,feline,female,feminine,few,"
+
"fickle,filthy,fine,finished,firm,first,firsthand,fitting,fixed,flaky,flamboyant,flashy,flat,flawed,flawless,flickering,flimsy,flippant,flowery,fluffy,fluid,"
+
"flustered,focused,fond,foolhardy,foolish,forceful,forked,formal,forsaken,forthright,fortunate,fragrant,frail,frank,frayed,free,French,fresh,frequent,friendly,"
+
"frightened,frightening,frigid,frilly,frizzy,frivolous,front,frosty,frozen,frugal,fruitful,full,fumbling,functional,funny,fussy,fuzzy,gargantuan,gaseous,general"
+
",generous,gentle,genuine,giant,giddy,gigantic,gifted,giving,glamorous,glaring,glass,gleaming,gleeful,glistening,glittering,gloomy,glorious,glossy,glum,golden,"
+
"good,good-natured,gorgeous,graceful,gracious,grand,grandiose,granular,grateful,grave,gray,great,greedy,green,gregarious,grim,grimy,gripping,grizzled,gross"
+
",grotesque,grouchy,grounded,growing,growling,grown,grubby,gruesome,grumpy,guilty,gullible,gummy,hairy,half,handmade,handsome,handy,happy,happy-go-lucky,hard,"
+
"harmful,harmless,harmonious,harsh,hasty,hateful,haunting,healthy,heartfelt,hearty,heavenly,heavy,hefty,helpful,helpless,hidden,hideous,high,high-level,hilarious,"
+
"hoarse,hollow,homely,honest,honorable,honored,hopeful,horrible,hospitable,hot,huge,humble,humiliating,humming,humongous,hungry,hurtful,husky,icky,icy,ideal,"
+
"idealistic,identical,idle,idiotic,idolized,ignorant,ill,illegal,ill-fated,ill-informed,illiterate,illustrious,imaginary,imaginative,immaculate,immaterial,immediate"
+
",immense,impassioned,impeccable,impartial,imperfect,imperturbable,impish,impolite,important,impossible,impractical,impressionable,impressive,improbable,impure"
+
",inborn,incomparable,incompatible,incomplete,inconsequential,incredible,indelible,inexperienced,indolent,infamous,infantile,infatuated,inferior,infinite,informal"
+
",innocent,insecure,insidious,insignificant,insistent,instructive,insubstantial,intelligent,intent,intentional,interesting,internal,international,intrepid,ironclad"
+
",irresponsible,irritating,itchy,jaded,jagged,jam-packed,jaunty,jealous,jittery,joint,jolly,jovial,joyful,joyous,jubilant,judicious,juicy,jumbo,junior,jumpy,juvenile,"
+
"kaleidoscopic,keen,key,kind,kindhearted,kindly,klutzy,knobby,knotty,knowledgeable,knowing,known,kooky,kosher,lame,lanky,large,last,lasting,late,lavish,lawful,lazy,leading,"
+
"lean,leafy,left,legal,legitimate,light,lighthearted,likable,likely,limited,limp,limping,linear,lined,liquid,little,live,lively,livid,loathsome,lone,lonely,long,"
+
"loose,lopsided,lost,loud,lovable,lovely,loving,low,loyal,lucky,lumbering,luminous,lumpy,lustrous,luxurious,mad,made-up,magnificent,majestic,major,male,mammoth,married,"
+
"marvelous,masculine,massive,mature,meager,mealy,mean,measly,meaty,medical,mediocre,medium,meek,mellow,melodic,memorable,menacing,merry,messy,metallic,mild,milky,mindless,"
+
"miniature,minor,minty,miserable,miserly,misguided,misty,mixed,modern,modest,moist,monstrous,monthly,monumental,moral,mortified,motherly,motionless,mountainous,muddy,muffled,"
+
"multicolored,mundane,murky,mushy,musty,muted,mysterious,naive,narrow,nasty,natural,naughty,nautical,near,neat,necessary,needy,negative,neglected,negligible,neighboring,"
+
"nervous,new,next,nice,nifty,nimble,nippy,nocturnal,noisy,nonstop,normal,notable,noted,noteworthy,novel,noxious,numb,nutritious,nutty,obedient,obese,oblong,oily,oblong,"
+
"obvious,occasional,odd,oddball,offbeat,offensive,official,old,old-fashioned,only,open,optimal,optimistic,opulent,orange,orderly,organic,ornate,ornery,ordinary,original,other,"
+
"our,outlying,outgoing,outlandish,outrageous,outstanding,oval,overcooked,overdue,overjoyed,overlooked,palatable,pale,paltry,parallel,parched,partial,passionate,past,pastel,"
+
"peaceful,peppery,perfect,perfumed,periodic,perky,personal,pertinent,pesky,pessimistic,petty,phony,physical,piercing,pink,pitiful,plain,plaintive,plastic,playful,pleasant,"
+
"pleased,pleasing,plump,plush,polished,polite,political,pointed,pointless,poised,poor,popular,portly,posh,positive,possible,potable,powerful,powerless,practical,precious,"
+
"present,prestigious,pretty,precious,previous,pricey,prickly,primary,prime,pristine,private,prize,probable,productive,profitable,profuse,proper,proud,prudent,punctual,pungent,"
+
"puny,pure,purple,pushy,putrid,puzzled,puzzling,quaint,qualified,quarrelsome,quarterly,queasy,querulous,questionable,quick,quick-witted,quiet,quintessential,quirky,quixotic,"
+
"quizzical,radiant,ragged,rapid,rare,rash,raw,recent,reckless,rectangular,ready,real,realistic,reasonable,red,reflecting,regal,regular,reliable,relieved,remarkable,remorseful,"
+
"remote,repentant,required,respectful,responsible,repulsive,revolving,rewarding,rich,rigid,right,ringed,ripe,roasted,robust,rosy,rotating,rotten,rough,round,rowdy,royal,rubbery,"
+
"rundown,ruddy,rude,runny,rural,rusty,sad,safe,salty,same,sandy,sane,sarcastic,sardonic,satisfied,scaly,scarce,scared,scary,scented,scholarly,scientific,scornful,scratchy,scrawny,"
+
"second,secondary,second-hand,secret,self-assured,self-reliant,selfish,sentimental,separate,serene,serious,serpentine,several,severe,shabby,shadowy,shady,shallow,shameful,shameless,"
+
"sharp,shimmering,shiny,shocked,shocking,shoddy,short,short-term,showy,shrill,shy,sick,silent,silky,silly,silver,similar,simple,simplistic,sinful,single,sizzling,skeletal,skinny,"
+
"sleepy,slight,slim,slimy,slippery,slow,slushy,small,smart,smoggy,smooth,smug,snappy,snarling,sneaky,sniveling,snoopy,sociable,soft,soggy,solid,somber,some,spherical,sophisticated"
+
",sore,sorrowful,soulful,soupy,sour,Spanish,sparkling,sparse,specific,spectacular,speedy,spicy,spiffy,spirited,spiteful,splendid,spotless,spotted,spry,square,squeaky,"
+
"squiggly,stable,staid,stained,stale,standard,starchy,stark,starry,steep,sticky,stiff,stimulating,stingy,stormy,straight,strange,steel,strict,strident,striking,striped,strong,"
+
"studious,stunning,stupendous,stupid,sturdy,stylish,subdued,submissive,substantial,subtle,suburban,sudden,sugary,sunny,super,superb,superficial,superior,supportive,sure-footed"
+
",surprised,suspicious,svelte,sweaty,sweet,sweltering,swift,sympathetic,tall,talkative,tame,tan,tangible,tart,tasty,tattered,taut,tedious,teeming,tempting,tender,tense,tepid,"
+
"terrible,terrific,testy,thankful,that,these,thick,thin,third,thirsty,this,thorough,thorny,those,thoughtful,threadbare,thrifty,thunderous,tidy,tight,timely,tinted,tiny,tired,torn"
+
",total,tough,traumatic,treasured,tremendous,tragic,trained,tremendous,triangular,tricky,trifling,trim,trivial,troubled,true,trusting,trustworthy,trusty,truthful,tubby,turbulent"
+
",twin,ugly,ultimate,unacceptable,unaware,uncomfortable,uncommon,unconscious,understated,unequaled,uneven,unfinished,unfit,unfolded,unfortunate,unhappy,unhealthy,uniform,"
+
"unimportant,unique,united,unkempt,unknown,unlawful,unlined,unlucky,unnatural,unpleasant,unrealistic,unripe,unruly,unselfish,unsightly,unsteady,unsung,untidy,untimely,untried,"
+
"untrue,unused,unusual,unwelcome,unwieldy,unwilling,unwitting,unwritten,upbeat,upright,upset,urban,usable,used,useful,useless,utilized,utter,vacant,vague,vain,valid,valuable,"
+
"vapid,variable,vast,velvety,venerated,vengeful,verifiable,vibrant,vicious,victorious,vigilant,vigorous,villainous,violet,violent,virtual,virtuous,visible,vital,vivacious,vivid,"
+
"voluminous,wan,warlike,warm,warmhearted,warped,wary,wasteful,watchful,waterlogged,watery,wavy,wealthy,weak,weary,webbed,wee,weekly,weepy,weighty,weird,welcome,well-documented"
+
",well-groomed,well-informed,well-lit,well-made,well-off,well-to-do,well-worn,wet,which,whimsical,whirlwind,whispered,white,whole,whopping,wicked,wide,wide-eyed,wiggly,wild,"
+
"willing,wilted,winding,windy,winged,wiry,wise,witty,wobbly,woeful,wonderful,wooden,woozy,wordy,worldly,worn,worried,worrisome,"
+
"worse,worst,worthless,worthwhile,worthy,wrathful,wretched,writhing,wrong,wry,yawning,yearly,yellow,yellowish,young,youthful,yummy,zany,zealous,zesty,zigzag"
).
split
(
","
);
private
String
[]
ANIMALS
=
(
"Cat,Caterpillar,Cattle,Chamois,Cheetah,Chicken,Chimpanzee,Chinchilla,Chough,Coati,Cobra,Cockroach,Cod,Cormorant,"
+
"Coyote,Crab,Crane,Crocodile,Crow,Curlew,Deer,Dinosaur,,Dog,,Dogfish,Shark,Dolphin,Donkey,"
+
"Dotterel,Dove,Dragonfly,Duck,,Mallard,Dugong,Dunlin,Eagle,Echidna,Eel,Eland,Elephant,Elephant,seal,Elk,"
+
"Emu,Falcon,Ferret,Finch,Fish,,Flamingo,Fly,Fox,Frog,Gaur,Gazelle,Gerbil,Giant,panda,Giraffe,Gnat,Gnu,Goat"
+
",Goldfinch,Goosander,Goose,Gorilla,Goshawk,Grasshopper,Grouse,Guanaco,Guinea,fowl,Guinea,pig,Gull,Hamster,Hare,Hawk,Hedgehog,"
+
"Heron,Herring,Hippo,Hornet,Horse,,Hummingbird,Hyena,Ibex,Ibis,Jackal,Jaguar,Jay,Jellyfish,Kangaroo,Kinkajou,Koala,Komodo,dragon,"
+
"Kouprey,Kudu,Lapwing,Lark,Lemur,Leopard,Lion,Llama,Lobster,Locust,,Loris,Louse,Lyrebird,Magpie,Mallard,Duck,Mammoth,Manatee,Mandrill,Mink,"
+
"Mole,Mongoose,Monkey,Moose,Mouse,Mosquito,Narwhal,Newt,Nightingale,Octopus,Okapi,Opossum,Ostrich,Otter,Owl,Oyster,Panther,Parrot,Panda,"
+
"Partridge,Peafowl,Pelican,Penguin,Pheasant,Pig,Boar,Pigeon,,Polarbear,Horse,Porcupine,Porpoise,Prairie dog,"
+
"Quail,Quelea,Quetzal,Rabbit,,Raccoon,Ram,Sheep,Rat,,Raven,Red,deer,Red,panda,Reindeer,(caribou),Rhinoceros,Rook,Salamander,Salmon,Sandpiper,"
+
"Sardine,Sea,lion,Sea,urchin,Seahorse,Seal,Shark,Sheep,,Ram,Shrew,Skunk,Sloth,Snail,Snake,,Spider,,Squirrel,Starling,Stegosaurus,Swan,Tapir,"
+
"Tarsier,Termite,Tiger,Toad,Turkey,,Turtle,Vicuña,Wallaby,Walrus,Wasp,Water,buffalo,Weasel,Whale,Wolf,Wolverine,Wombat,Wren,Yak,Zebra"
).
split
(
","
);
public
String
getRandomName
()
{
Random
r
=
new
Random
();
return
(
ADJECTIVES
[
r
.
nextInt
(
ADJECTIVES
.
length
)]
+
"_"
+
ANIMALS
[
r
.
nextInt
(
ANIMALS
.
length
)]
+
".kps"
).
toLowerCase
();
}
public
ScriptArea
newScript
()
{
ScriptArea
area
=
new
ScriptArea
();
area
.
setFilePath
(
new
File
(
getRandomName
()));
area
.
setFilePath
(
new
File
(
Utils
.
getRandomName
()));
openScripts
.
put
(
area
,
createDockNode
(
area
));
return
area
;
}
...
...
@@ -242,6 +167,15 @@ public class ScriptController {
return
postMortemHighlighter
;
}
public
void
saveCurrentScript
()
{
//TODO
}
private
ScriptArea
findEditor
(
ASTNode
node
)
{
File
f
=
new
File
(
node
.
getRuleContext
().
getStart
().
getInputStream
().
getSourceName
());
return
findEditor
(
f
);
}
public
class
ASTNodeHighlighter
{
public
final
String
clazzName
;
private
ScriptArea
.
RegionStyle
lastRegion
;
...
...
@@ -252,7 +186,8 @@ public class ScriptController {
}
public
void
remove
()
{
lastScriptArea
.
getMarkedRegions
().
remove
(
lastRegion
);
if
(
lastScriptArea
!=
null
)
lastScriptArea
.
getMarkedRegions
().
remove
(
lastRegion
);
}
public
void
highlight
(
ASTNode
node
)
{
...
...
@@ -269,14 +204,10 @@ public class ScriptController {
}
private
ScriptArea
.
RegionStyle
asRegion
(
ASTNode
node
)
{
assert
node
!=
null
;
return
new
ScriptArea
.
RegionStyle
(
node
.
getRuleContext
().
getStart
().
getStartIndex
(),
node
.
getRuleContext
().
getStop
().
getStopIndex
(),
clazzName
);
}
}
private
ScriptArea
findEditor
(
ASTNode
node
)
{
File
f
=
new
File
(
node
.
getRuleContext
().
getStart
().
getInputStream
().
getSourceName
());
return
findEditor
(
f
);
}
}
src/main/java/edu/kit/formal/gui/controls/Utils.java
View file @
30714eee
package
edu.kit.formal.gui.controls
;
import
de.uka.ilkd.key.logic.op.IProgramMethod
;
import
de.uka.ilkd.key.pp.ProgramPrinter
;
import
de.uka.ilkd.key.speclang.Contract
;
import
javafx.beans.property.Property
;
import
javafx.beans.value.ChangeListener
;
import
javafx.beans.value.ObservableValue
;
import
javafx.fxml.FXMLLoader
;
import
javafx.scene.control.Alert
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.TextArea
;
import
javafx.scene.layout.GridPane
;
import
javafx.scene.layout.Priority
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.util.Random
;
/**
* @author Alexander Weigl
* @version 1 (05.06.17)
*/
public
class
Utils
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
Utils
.
class
);
private
static
String
[]
ADJECTIVES
=
(
"abandoned,able,absolute,adorable,adventurous,academic,acceptable,acclaimed,accomplished,accurate,aching,acidic,acrobatic,active,actual,adept,admirable,admired,"
+
"adolescent,adorable,adored,advanced,afraid,affectionate,aged,aggravating,aggressive,agile,agitated,agonizing,agreeable,ajar,alarmed,alarming,alert,"
+
"alienated,alive,all,altruistic,amazing,ambitious,ample,amused,amusing,anchored,ancient,angelic,angry,anguished,animated,annual,another,antique,anxious,"
+