Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
27c503a0
Commit
27c503a0
authored
Oct 16, 2018
by
Sarah Grebing
Browse files
Merge remote-tracking branch 'origin/grebing_luong_workbranch' into grebing_luong_workbranch
parents
5be7abf6
efa414a4
Changes
5
Hide whitespace changes
Inline
Side-by-side
build.gradle
View file @
27c503a0
plugins
{
plugins
{
// id 'io.franzbecker.gradle-lombok' version '1.14' apply false
id
"com.github.ben-manes.versions"
version
"0.17.0"
id
"com.github.ben-manes.versions"
version
"0.17.0"
}
}
...
@@ -43,7 +42,6 @@ subprojects {
...
@@ -43,7 +42,6 @@ subprojects {
compile
group:
'org.apache.logging.log4j'
,
name:
'log4j-api'
,
version:
'2.11.0'
compile
group:
'org.apache.logging.log4j'
,
name:
'log4j-api'
,
version:
'2.11.0'
compile
group:
'org.apache.logging.log4j'
,
name:
'log4j-core'
,
version:
'2.11.0'
compile
group:
'org.apache.logging.log4j'
,
name:
'log4j-core'
,
version:
'2.11.0'
testCompile
group:
'junit'
,
name:
'junit'
,
version:
'4.12'
testCompile
group:
'junit'
,
name:
'junit'
,
version:
'4.12'
//compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.16.20'
compileOnly
group:
'org.projectlombok'
,
name:
'lombok'
,
version:
'1.16.20'
compileOnly
files
(
"$rootDir/lombok-edge.jar"
)
}
}
}
}
lombok-edge.jar
deleted
100644 → 0
View file @
5be7abf6
File deleted
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptArea.java
View file @
27c503a0
...
@@ -5,14 +5,13 @@ import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
...
@@ -5,14 +5,13 @@ import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import
de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView
;
import
de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView
;
import
edu.kit.iti.formal.psdbg.gui.actions.acomplete.AutoCompletionController
;
import
edu.kit.iti.formal.psdbg.gui.actions.acomplete.AutoCompletionController
;
import
edu.kit.iti.formal.psdbg.gui.actions.acomplete.CompletionPosition
;
import
edu.kit.iti.formal.psdbg.gui.actions.acomplete.CompletionPosition
;
import
edu.kit.iti.formal.psdbg.gui.actions.acomplete.DefaultAutoCompletionController
;
import
edu.kit.iti.formal.psdbg.gui.actions.acomplete.Suggestion
;
import
edu.kit.iti.formal.psdbg.gui.actions.acomplete.Suggestion
;
import
edu.kit.iti.formal.psdbg.gui.actions.inline.InlineActionSupplier
;
import
edu.kit.iti.formal.psdbg.gui.actions.inline.InlineActionSupplier
;
import
edu.kit.iti.formal.psdbg.gui.controller.Events
;
import
edu.kit.iti.formal.psdbg.gui.controller.Events
;
import
edu.kit.iti.formal.psdbg.gui.model.MainScriptIdentifier
;
import
edu.kit.iti.formal.psdbg.gui.model.MainScriptIdentifier
;
import
edu.kit.iti.formal.psdbg.interpreter.data.KeyData
;
import
edu.kit.iti.formal.psdbg.interpreter.data.SavePoint
;
import
edu.kit.iti.formal.psdbg.interpreter.data.SavePoint
;
import
edu.kit.iti.formal.psdbg.interpreter.dbg.Breakpoint
;
import
edu.kit.iti.formal.psdbg.interpreter.dbg.Breakpoint
;
import
edu.kit.iti.formal.psdbg.interpreter.dbg.PTreeNode
;
import
edu.kit.iti.formal.psdbg.lint.LintProblem
;
import
edu.kit.iti.formal.psdbg.lint.LintProblem
;
import
edu.kit.iti.formal.psdbg.lint.LinterStrategy
;
import
edu.kit.iti.formal.psdbg.lint.LinterStrategy
;
import
edu.kit.iti.formal.psdbg.parser.Facade
;
import
edu.kit.iti.formal.psdbg.parser.Facade
;
...
@@ -37,13 +36,13 @@ import javafx.scene.Node;
...
@@ -37,13 +36,13 @@ import javafx.scene.Node;
import
javafx.scene.Scene
;
import
javafx.scene.Scene
;
import
javafx.scene.control.*
;
import
javafx.scene.control.*
;
import
javafx.scene.input.*
;
import
javafx.scene.input.*
;
import
static
javafx
.
scene
.
input
.
KeyCombination
.
CONTROL_ANY
;
import
javafx.scene.layout.*
;
import
javafx.scene.layout.*
;
import
javafx.scene.paint.Color
;
import
javafx.scene.paint.Color
;
import
javafx.scene.paint.Paint
;
import
javafx.scene.paint.Paint
;
import
javafx.scene.text.Font
;
import
javafx.scene.text.Font
;
import
javafx.scene.text.FontPosture
;
import
javafx.scene.text.FontPosture
;
import
javafx.stage.Modality
;
import
javafx.stage.Modality
;
import
javafx.stage.Popup
;
import
javafx.stage.Stage
;
import
javafx.stage.Stage
;
import
javafx.stage.StageStyle
;
import
javafx.stage.StageStyle
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -75,8 +74,10 @@ import java.util.function.IntFunction;
...
@@ -75,8 +74,10 @@ import java.util.function.IntFunction;
import
java.util.function.UnaryOperator
;
import
java.util.function.UnaryOperator
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
static
javafx
.
scene
.
input
.
KeyCombination
.
SHIFT_DOWN
;
import
static
javafx
.
scene
.
input
.
KeyCombination
.
SHORTCUT_DOWN
;
import
static
javafx
.
scene
.
input
.
KeyCombination
.
SHORTCUT_DOWN
;
import
static
org
.
fxmisc
.
wellbehaved
.
event
.
EventPattern
.
keyPressed
;
import
static
org
.
fxmisc
.
wellbehaved
.
event
.
EventPattern
.
keyPressed
;
import
static
org
.
fxmisc
.
wellbehaved
.
event
.
InputHandler
.
Result
.
CONSUME
;
import
static
org
.
fxmisc
.
wellbehaved
.
event
.
InputHandler
.
Result
.
PROCEED
;
import
static
org
.
fxmisc
.
wellbehaved
.
event
.
InputHandler
.
Result
.
PROCEED
;
import
static
org
.
fxmisc
.
wellbehaved
.
event
.
InputMap
.*;
import
static
org
.
fxmisc
.
wellbehaved
.
event
.
InputMap
.*;
...
@@ -113,15 +114,14 @@ public class ScriptArea extends BorderPane {
...
@@ -113,15 +114,14 @@ public class ScriptArea extends BorderPane {
* set by {@link ScriptController}
* set by {@link ScriptController}
*/
*/
private
final
ObjectProperty
<
MainScriptIdentifier
>
mainScript
=
new
SimpleObjectProperty
<>();
private
final
ObjectProperty
<
MainScriptIdentifier
>
mainScript
=
new
SimpleObjectProperty
<>();
private
final
AutoCompletion
autoCompletion
=
new
AutoCompletion
();
public
InlineToolbar
inlineToolbar
=
new
InlineToolbar
();
public
InlineToolbar
inlineToolbar
=
new
InlineToolbar
();
/**
/**
*
*
*/
*/
@Getter
@Getter
@Setter
@Setter
private
AutoCompletionController
autoCompletionController
;
private
AutoCompletionController
autoCompletionController
=
new
DefaultAutoCompletionController
();
private
AutoCompletion
autoCompletion
=
new
AutoCompletion
();
@Getter
@Getter
//@Delegate
//@Delegate
...
@@ -155,9 +155,31 @@ public class ScriptArea extends BorderPane {
...
@@ -155,9 +155,31 @@ public class ScriptArea extends BorderPane {
return
PROCEED
;
return
PROCEED
;
}),
}),
consume
(
keyPressed
(
new
KeyCodeCombination
(
KeyCode
.
E
,
KeyCombination
.
CONTROL_DOWN
))
consume
(
keyPressed
(
new
KeyCodeCombination
(
KeyCode
.
E
,
KeyCombination
.
CONTROL_DOWN
))
,
(
e
)
->
addBackticks
()),
,
(
e
)
->
addBackticks
()),
consumeWhen
(
keyPressed
(
KeyCode
.
ENTER
),
autoCompletion:
:
isVisible
,
//consumeWhen(keyPressed(KeyCode.ENTER), autoCompletion::isVisible,
e
->
autoCompletion
.
complete
()),
// e -> autoCompletion.complete()),
process
(
keyPressed
(
KeyCode
.
ESCAPE
),
(
e
)
->
{
if
(
autoCompletion
.
isVisible
())
{
autoCompletion
.
hide
();
return
CONSUME
;
}
return
PROCEED
;
}
),
process
(
keyPressed
(
KeyCode
.
ENTER
),
e
->
{
if
(
autoCompletion
.
isVisible
())
{
autoCompletion
.
complete
();
return
CONSUME
;
}
return
PROCEED
;
}),
consume
(
keyPressed
(
KeyCode
.
ENTER
,
SHIFT_DOWN
),
(
e
)
->
autoCompletion
.
complete
()),
consume
(
keyPressed
(
KeyCode
.
ENTER
,
SHIFT_DOWN
,
SHORTCUT_DOWN
),
(
e
)
->
autoCompletion
.
completeFast
()),
consume
(
keyPressed
(
KeyCode
.
ENTER
,
SHORTCUT_DOWN
),
consume
(
keyPressed
(
KeyCode
.
ENTER
,
SHORTCUT_DOWN
),
(
e
)
->
simpleReformat
()),
(
e
)
->
simpleReformat
()),
consume
(
keyPressed
(
KeyCode
.
H
,
SHORTCUT_DOWN
),
consume
(
keyPressed
(
KeyCode
.
H
,
SHORTCUT_DOWN
),
...
@@ -166,6 +188,7 @@ public class ScriptArea extends BorderPane {
...
@@ -166,6 +188,7 @@ public class ScriptArea extends BorderPane {
if
(
autoCompletion
.
isVisible
())
{
if
(
autoCompletion
.
isVisible
())
{
autoCompletion
.
hide
();
autoCompletion
.
hide
();
}
else
{
}
else
{
autoCompletion
.
reset
();
autoCompletion
.
update
();
autoCompletion
.
update
();
autoCompletion
.
show
();
autoCompletion
.
show
();
}
}
...
@@ -249,7 +272,7 @@ public class ScriptArea extends BorderPane {
...
@@ -249,7 +272,7 @@ public class ScriptArea extends BorderPane {
//this.moveTo(characterPosition, NavigationActions.SelectionPolicy.CLEAR);
//this.moveTo(characterPosition, NavigationActions.SelectionPolicy.CLEAR);
});
});
mainScript
.
addListener
((
observable
)
->
updateMainScriptMarker
());
mainScript
.
addListener
((
observable
)
->
updateMainScriptMarker
());
filePath
.
addListener
((
p
,
o
,
n
)
->
{
filePath
.
addListener
((
p
,
o
,
n
)
->
{
if
(
o
!=
null
)
if
(
o
!=
null
)
...
@@ -307,7 +330,6 @@ public class ScriptArea extends BorderPane {
...
@@ -307,7 +330,6 @@ public class ScriptArea extends BorderPane {
String
newValue
=
codeArea
.
getText
();
String
newValue
=
codeArea
.
getText
();
if
(
newValue
.
length
()
!=
0
)
{
if
(
newValue
.
length
()
!=
0
)
{
//weigl: resets the text position
//weigl: resets the text position
double
x
=
scrollPane
.
getEstimatedScrollX
();
double
x
=
scrollPane
.
getEstimatedScrollX
();
double
y
=
scrollPane
.
getEstimatedScrollY
();
double
y
=
scrollPane
.
getEstimatedScrollY
();
//codeArea.clearStyle(0, newValue.length());
//codeArea.clearStyle(0, newValue.length());
...
@@ -366,14 +388,14 @@ public class ScriptArea extends BorderPane {
...
@@ -366,14 +388,14 @@ public class ScriptArea extends BorderPane {
}
}
private
void
addBackticks
(){
private
void
addBackticks
()
{
int
pos
=
codeArea
.
getCaretPosition
();
int
pos
=
codeArea
.
getCaretPosition
();
insertText
(
pos
,
"``"
);
insertText
(
pos
,
"``"
);
codeArea
.
displaceCaret
(
pos
+
1
);
codeArea
.
displaceCaret
(
pos
+
1
);
}
}
private
void
highlightProblems
()
{
private
void
highlightProblems
()
{
LinterStrategy
ls
=
LinterStrategy
.
getDefaultLinter
();
LinterStrategy
ls
=
LinterStrategy
.
getDefaultLinter
();
try
{
try
{
...
@@ -391,8 +413,8 @@ public class ScriptArea extends BorderPane {
...
@@ -391,8 +413,8 @@ public class ScriptArea extends BorderPane {
}
}
}
}
public
void
underlineSavepoint
(
SavePoint
sp
){
public
void
underlineSavepoint
(
SavePoint
sp
)
{
codeArea
.
setStyle
(
sp
.
getLineNumber
()
-
1
,
Collections
.
singleton
(
"underlinesave"
));
codeArea
.
setStyle
(
sp
.
getLineNumber
()
-
1
,
Collections
.
singleton
(
"underlinesave"
));
}
}
private
void
highlightNonExecutionArea
()
{
private
void
highlightNonExecutionArea
()
{
...
@@ -434,10 +456,10 @@ public class ScriptArea extends BorderPane {
...
@@ -434,10 +456,10 @@ public class ScriptArea extends BorderPane {
Label
lbl
=
new
Label
(
p
.
getMessage
());
Label
lbl
=
new
Label
(
p
.
getMessage
());
lbl
.
getStyleClass
().
addAll
(
"problem-popup-label"
,
lbl
.
getStyleClass
().
addAll
(
"problem-popup-label"
,
"problem-popup-label-"
+
p
.
getIssue
(),
"problem-popup-label-"
+
p
.
getIssue
(),
//.getRulename(),
//.getRulename(),
"problem-popup-label-"
+
p
.
getIssue
()
"problem-popup-label-"
+
p
.
getIssue
()
//.getSeverity()
//.getSeverity()
);
);
box
.
getChildren
().
add
(
lbl
);
box
.
getChildren
().
add
(
lbl
);
}
}
}
}
...
@@ -467,7 +489,6 @@ public class ScriptArea extends BorderPane {
...
@@ -467,7 +489,6 @@ public class ScriptArea extends BorderPane {
}
}
private
boolean
hasExecutionMarker
()
{
private
boolean
hasExecutionMarker
()
{
return
getText
().
contains
(
EXECUTION_MARKER
);
return
getText
().
contains
(
EXECUTION_MARKER
);
}
}
...
@@ -738,14 +759,14 @@ public class ScriptArea extends BorderPane {
...
@@ -738,14 +759,14 @@ public class ScriptArea extends BorderPane {
return
alert
.
get
();
return
alert
.
get
();
}
}
public
SimpleBooleanProperty
alertProperty
()
{
return
alert
;
}
public
void
setAlert
(
boolean
alert
)
{
public
void
setAlert
(
boolean
alert
)
{
this
.
alert
.
set
(
alert
);
this
.
alert
.
set
(
alert
);
}
}
public
SimpleBooleanProperty
alertProperty
()
{
return
alert
;
}
public
String
getText
()
{
public
String
getText
()
{
return
text
.
get
();
return
text
.
get
();
}
}
...
@@ -1049,7 +1070,7 @@ public class ScriptArea extends BorderPane {
...
@@ -1049,7 +1070,7 @@ public class ScriptArea extends BorderPane {
private ListView<Suggestion> suggestionView;
private ListView<Suggestion> suggestionView;
private ObservableList<Suggestion> suggestions;*/
private ObservableList<Suggestion> suggestions;*/
private
int
lastSelected
=
-
1
;
private
int
lastSelected
=
-
1
;
private
Stage
popup
;
private
Popup
popup
;
private
ListView
<
Suggestion
>
suggestionView
=
new
ListView
<>();
private
ListView
<
Suggestion
>
suggestionView
=
new
ListView
<>();
private
ObservableList
<
Suggestion
>
suggestions
;
private
ObservableList
<
Suggestion
>
suggestions
;
...
@@ -1058,58 +1079,65 @@ public class ScriptArea extends BorderPane {
...
@@ -1058,58 +1079,65 @@ public class ScriptArea extends BorderPane {
popup.setAutoHide(true);
popup.setAutoHide(true);
popup.setSkin(new AutoCompletePopupSkin<>(popup));
popup.setSkin(new AutoCompletePopupSkin<>(popup));
suggestionView = (ListView<Suggestion>) popup.getSkin().getNode();*/
suggestionView = (ListView<Suggestion>) popup.getSkin().getNode();*/
InputMap
<
KeyEvent
>
inputMap
=
sequence
(
consume
(
keyPressed
(
KeyCode
.
ENTER
),
(
e
)
->
complete
()),
consume
(
keyPressed
(
KeyCode
.
ESCAPE
),
(
e
)
->
hide
())
);
Nodes
.
addInputMap
(
suggestionView
,
inputMap
);
suggestions
=
suggestionView
.
getItems
();
suggestions
=
suggestionView
.
getItems
();
suggestionView
.
getSelectionModel
().
setSelectionMode
(
SelectionMode
.
SINGLE
);
suggestionView
.
getSelectionModel
().
setSelectionMode
(
SelectionMode
.
SINGLE
);
suggestionView
.
getSelectionModel
().
getSelectedIndices
().
addListener
((
InvalidationListener
)
observable
->
{
suggestionView
.
getSelectionModel
().
getSelectedIndices
().
addListener
((
InvalidationListener
)
observable
->
{
System
.
out
.
println
(
" = "
+
suggestionView
.
getSelectionModel
().
getSelectedIndex
());
//
System.out.println(" = " + suggestionView.getSelectionModel().getSelectedIndex());
//
lastSelected = suggestionView.getSelectionModel().getSelectedIndex();
lastSelected
=
suggestionView
.
getSelectionModel
().
getSelectedIndex
();
});
});
//popup.setVisibleRowCount(5);
suggestionView
.
setEditable
(
false
);
suggestionView
.
setEditable
(
false
);
suggestionView
.
setCellFactory
(
param
->
new
SuggestionCell
());
suggestionView
.
setCellFactory
(
param
->
new
SuggestionCell
());
}
}
public
Stage
getPopup
()
{
public
Popup
getPopup
()
{
if
(
popup
==
null
)
{
if
(
popup
==
null
)
{
popup
=
new
Stage
();
popup
=
new
Popup
();
popup
.
initOwner
(
ScriptArea
.
this
.
getScene
().
getWindow
());
//
popup.initOwner(ScriptArea.this.getScene().getWindow());
popup
.
initStyle
(
StageStyle
.
TRANSPARENT
);
//
popup.initStyle(StageStyle.TRANSPARENT);
popup
.
initModality
(
Modality
.
NONE
);
//
popup.initModality(Modality.NONE);
Scene
scene
=
new
Scene
(
suggestionView
);
//
Scene scene = new Scene(suggestionView);
scene
.
getStylesheets
().
setAll
(
getScene
().
getStylesheets
());
//
getStylesheets().setAll(getScene().getStylesheets());
popup
.
s
et
Scene
(
scene
);
popup
.
g
et
Content
().
addAll
(
suggestionView
);
}
}
return
popup
;
return
popup
;
}
}
private
void
handle
(
Event
event
)
{
private
void
handle
(
Event
event
)
{
System
.
out
.
println
(
"event = "
+
event
);
event
.
consume
();
event
.
consume
();
}
}
public
void
update
()
{
public
void
update
()
{
popup
=
getPopup
();
int
end
=
codeArea
.
getCaretPosition
()
-
1
;
int
end
=
codeArea
.
getCaretPosition
()
-
1
;
//int start = text.lastIndexOf(' ');
//int start = text.lastIndexOf(' ');
//final String searchPrefix = text.substring(start).trim();
//final String searchPrefix = text.substring(start).trim();
//System.out.println("searchPrefix = " + searchPrefix);
//System.out.println("searchPrefix = " + searchPrefix);
CompletionPosition
cp
=
new
CompletionPosition
(
getText
(),
end
);
CompletionPosition
cp
=
new
CompletionPosition
(
getText
(),
end
);
System
.
out
.
println
(
"cp.getPrefix() = "
+
cp
.
getPrefix
());
consoleLogger
.
debug
(
"Completion prefix {}"
,
cp
.
getPrefix
());
List
<
Suggestion
>
newS
=
autoCompletionController
.
getSuggestions
(
cp
);
List
<
Suggestion
>
newS
=
autoCompletionController
.
getSuggestions
(
cp
);
suggestions
.
setAll
(
newS
);
suggestions
.
setAll
(
newS
);
consoleLogger
.
debug
(
"Found completions: {}"
,
suggestions
.
size
());
Bounds
b
=
codeArea
.
getCaretBounds
().
get
();
popup
.
setX
(
b
.
getMaxX
());
Optional
<
Bounds
>
caretBounds
=
codeArea
.
getCaretBounds
();
popup
.
setY
(
b
.
getMaxY
());
if
(
caretBounds
.
isPresent
())
{
popup
.
setHeight
(
25
*
Math
.
min
(
Math
.
max
(
newS
.
size
(),
3
),
10
));
Popup
popup
=
getPopup
();
Bounds
b
=
caretBounds
.
get
();
popup
.
setX
(
b
.
getMaxX
());
popup
.
setY
(
b
.
getMaxY
());
popup
.
setHeight
(
25
*
Math
.
min
(
Math
.
max
(
newS
.
size
(),
3
),
10
));
}
}
}
public
void
show
()
{
public
void
show
()
{
//popup.show(ScriptArea.this.getScene().getWindow());
getPopup
().
show
(
ScriptArea
.
this
.
getScene
().
getWindow
());
popup
.
show
();
codeArea
.
requestFocus
();
codeArea
.
requestFocus
();
}
}
...
@@ -1122,9 +1150,18 @@ public class ScriptArea extends BorderPane {
...
@@ -1122,9 +1150,18 @@ public class ScriptArea extends BorderPane {
}
}
public
void
complete
()
{
public
void
complete
()
{
String
entry
=
suggestions
.
get
(
lastSelected
).
getText
();
int
sel
=
Math
.
max
(
lastSelected
,
0
);
if
(
sel
>=
suggestions
.
size
())
return
;
String
entry
=
suggestions
.
get
(
sel
).
getText
();
codeArea
.
selectWord
();
codeArea
.
selectWord
();
codeArea
.
replaceSelection
(
entry
);
if
(
Character
.
isWhitespace
(
codeArea
.
getSelectedText
().
charAt
(
0
)))
{
codeArea
.
replaceSelection
(
" "
+
entry
);
}
else
{
codeArea
.
replaceSelection
(
entry
);
}
hide
();
hide
();
codeArea
.
requestFocus
();
codeArea
.
requestFocus
();
}
}
...
@@ -1142,6 +1179,20 @@ public class ScriptArea extends BorderPane {
...
@@ -1142,6 +1179,20 @@ public class ScriptArea extends BorderPane {
suggestionView
.
getSelectionModel
().
select
(
lastSelected
);
suggestionView
.
getSelectionModel
().
select
(
lastSelected
);
suggestionView
.
scrollTo
(
lastSelected
);
suggestionView
.
scrollTo
(
lastSelected
);
}
}
public
void
reset
()
{
suggestionView
.
scrollTo
(
0
);
suggestionView
.
getSelectionModel
().
selectFirst
();
}
public
void
completeFast
()
{
update
();
if
(!
suggestions
.
isEmpty
())
{
reset
();
complete
();
}
hide
();
}
}
}
//endregion
//endregion
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptTreeGraph.java
View file @
27c503a0
...
@@ -162,6 +162,8 @@ public class ScriptTreeGraph {
...
@@ -162,6 +162,8 @@ public class ScriptTreeGraph {
}
}
List
<
AbstractTreeNode
>
subchild
=
new
ArrayList
<>();
List
<
AbstractTreeNode
>
subchild
=
new
ArrayList
<>();
subchild
.
add
(
atn
);
subchild
.
add
(
atn
);
//TODO: Hack for double foreach-end recognition
if
(
atn
.
getParent
()
==
childlist
.
get
(
0
).
getParent
())
return
;
childlist
.
get
(
0
).
setChildren
(
subchild
);
childlist
.
get
(
0
).
setChildren
(
subchild
);
}
}
}
}
...
@@ -431,7 +433,7 @@ public class ScriptTreeGraph {
...
@@ -431,7 +433,7 @@ public class ScriptTreeGraph {
AbstractTreeNode
current
=
mapping
.
get
(
n
);
AbstractTreeNode
current
=
mapping
.
get
(
n
);
if
(
current
instanceof
PlaceholderNode
)
{
if
(
current
instanceof
PlaceholderNode
)
{
//TODO : atn.setParent(current.getParent()); -> leads to concurretn exception
current
.
getParent
().
setChildren
(
new
ArrayList
<>(
Arrays
.
asList
(
atn
)));
current
.
getParent
().
setChildren
(
new
ArrayList
<>(
Arrays
.
asList
(
atn
)));
mapping
.
put
(
n
,
atn
);
mapping
.
put
(
n
,
atn
);
iterator
.
remove
();
iterator
.
remove
();
...
@@ -440,11 +442,11 @@ public class ScriptTreeGraph {
...
@@ -440,11 +442,11 @@ public class ScriptTreeGraph {
while
(!(
current
instanceof
PlaceholderNode
))
{
while
(!(
current
instanceof
PlaceholderNode
))
{
//TODO: if(current.getChildren().size() > 0) return;
if
(
current
.
getChildren
()
==
null
)
return
;
if
(
current
.
getChildren
()
==
null
)
return
;
if
(
current
.
getChildren
().
get
(
0
)
instanceof
PlaceholderNode
)
{
if
(
current
.
getChildren
().
get
(
0
)
instanceof
PlaceholderNode
)
{
//TODO: insert a variable instead of using atn?
atn
.
setParent
(
current
.
getChildren
().
get
(
0
).
getParent
());
atn
.
setParent
(
current
.
getChildren
().
get
(
0
).
getParent
());
current
.
setChildren
(
new
ArrayList
<>(
Arrays
.
asList
(
atn
)));
current
.
setChildren
(
new
ArrayList
<>(
Arrays
.
asList
(
atn
)));
iterator
.
remove
();
iterator
.
remove
();
...
@@ -487,6 +489,9 @@ public class ScriptTreeGraph {
...
@@ -487,6 +489,9 @@ public class ScriptTreeGraph {
}
}
}
}
/*
checks if given node is the end of a foreach-statement
*/
private
void
checkIfForeachEnd
(
Node
n
)
{
private
void
checkIfForeachEnd
(
Node
n
)
{
if
(
foreachNodes
.
containsKey
(
n
))
{
if
(
foreachNodes
.
containsKey
(
n
))
{
PTreeNode
ptn
=
foreachNodes
.
get
(
n
);
PTreeNode
ptn
=
foreachNodes
.
get
(
n
);
...
@@ -495,8 +500,8 @@ public class ScriptTreeGraph {
...
@@ -495,8 +500,8 @@ public class ScriptTreeGraph {
ptn
,
ptn
,
ptn
.
getStatement
().
getStartPosition
().
getLineNumber
(),
ptn
.
getStatement
().
getStartPosition
().
getLineNumber
(),
false
);
false
);
//TODO: replacePlaceholder(nextPtreeNode.getStateBeforeStmt().getSelectedGoalNode().getData().getNode(), ftn);
replacePlaceholder
(
n
extPtreeNode
.
getStateBeforeStmt
().
getSelectedGoalNode
().
getData
().
getNode
()
,
ftn
);
replacePlaceholder
(
n
,
ftn
);
addPlaceholder
(
ftn
,
n
);
addPlaceholder
(
ftn
,
n
);
foreachNodes
.
remove
(
n
);
foreachNodes
.
remove
(
n
);
...
...
ui/src/main/resources/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.fxml
View file @
27c503a0
...
@@ -184,7 +184,7 @@
...
@@ -184,7 +184,7 @@
<MaterialDesignIconView
glyphName=
"TREE"
size=
"24.0"
/>
<MaterialDesignIconView
glyphName=
"TREE"
size=
"24.0"
/>
</graphic>
</graphic>
</CheckMenuItem>
</CheckMenuItem>
<CheckMenuItem
fx:id=
"miScriptTree"
onAction=
"#showScriptTree"
text=
"Show Script Tree"
>
<CheckMenuItem
fx:id=
"miScriptTree"
onAction=
"#showScriptTree"
text=
"Show Script Tree"
accelerator=
"Ctrl+r"
>
<graphic>
<graphic>
<ImageView>
<ImageView>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment