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
42cdb545
Commit
42cdb545
authored
Jun 20, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
line highlighting preparation
parent
0efab96a
Pipeline
#11258
failed with stage
in 2 minutes and 27 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
9 deletions
+55
-9
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
...t/formal/gui/controller/DebuggerMainWindowController.java
+9
-0
src/main/java/edu/kit/formal/gui/controls/InspectionViewTab.java
...n/java/edu/kit/formal/gui/controls/InspectionViewTab.java
+3
-1
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
+33
-7
src/main/resources/DebuggerMain.fxml
src/main/resources/DebuggerMain.fxml
+1
-1
src/main/resources/edu/kit/formal/gui/debugger-ui.less
src/main/resources/edu/kit/formal/gui/debugger-ui.less
+9
-0
No files found.
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
View file @
42cdb545
...
...
@@ -234,6 +234,9 @@ public class DebuggerMainWindowController implements Initializable {
}
blocker
.
install
(
currentInterpreter
);
System
.
out
.
println
(
"Start of Script in: "
+
scripts
.
get
(
0
).
getStartPosition
());
tabPane
.
getActiveScriptAreaTab
().
getScriptArea
().
setDebugMark
(
scripts
.
get
(
0
).
getStartPosition
().
getLineNumber
());
interpreterService
.
interpreter
.
set
(
currentInterpreter
);
interpreterService
.
mainScript
.
set
(
scripts
.
get
(
0
));
interpreterService
.
start
();
...
...
@@ -416,6 +419,12 @@ public class DebuggerMainWindowController implements Initializable {
return
executeNotPossible
;
}
public
void
stopDebugMode
(
ActionEvent
actionEvent
)
{
//linenumberMainscript from model?
// tabPane.getActiveScriptAreaTab().getScriptArea().removeHighlightStmt(lineNumberMainScript);
//inspectionViewTabPane.getInspectionViewTab.clear();
}
public
class
ContractLoaderService
extends
Service
<
List
<
Contract
>>
{
@Override
protected
Task
<
List
<
Contract
>>
createTask
()
{
...
...
src/main/java/edu/kit/formal/gui/controls/InspectionViewTab.java
View file @
42cdb545
...
...
@@ -100,7 +100,9 @@ public class InspectionViewTab extends Tab implements Initializable {
@Override
public
void
initialize
(
URL
location
,
ResourceBundle
resources
)
{
getGoalView
().
getSelectionModel
().
selectedItemProperty
().
addListener
((
observable
,
oldValue
,
newValue
)
->
{
getSequentView
().
setNode
(
newValue
.
getData
().
getNode
());
if
(
newValue
!=
null
&&
newValue
.
getData
()
!=
null
)
{
getSequentView
().
setNode
(
newValue
.
getData
().
getNode
());
}
});
getGoalView
().
setCellFactory
(
GoalNodeListCell:
:
new
);
...
...
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
View file @
42cdb545
...
...
@@ -54,6 +54,7 @@ public class ScriptArea extends CodeArea {
* Lines to highlight?
*/
private
ObservableSet
<
Integer
>
markedLines
=
FXCollections
.
observableSet
();
private
GutterFactory
gutter
;
private
ANTLR4LexerHighlighter
highlighter
;
private
ListProperty
<
LintProblem
>
problems
=
new
SimpleListProperty
<>(
FXCollections
.
observableArrayList
());
...
...
@@ -187,20 +188,44 @@ public class ScriptArea extends CodeArea {
/**
* Highlight line given by the characterindex
*
* @param chrIdx
* @param lineNumber
*/
public
void
highlight
Line
(
int
chrIdx
)
{
public
void
highlight
Stmt
(
int
lineNumber
,
String
cssStyleTag
)
{
//calculate line number from characterindex
int
lineNumber
=
this
.
offsetToPosition
(
chrIdx
,
Bias
.
Forward
).
getMajor
();
//
int lineNumber = this.offsetToPosition(chrIdx, Bias.Forward).getMajor();
Paragraph
<
Collection
<
String
>,
StyledText
<
Collection
<
String
>>,
Collection
<
String
>>
paragraph
=
this
.
getParagraph
(
lineNumber
);
//calculate start and endposition
int
startPos
=
getAbsolutePosition
(
this
.
offsetToPosition
(
chrIdx
,
Bias
.
Forward
).
getMajor
(),
0
);
//int startPos = getAbsolutePosition(this.offsetToPosition(chrIdx, Bias.Forward).getMajor(), 0);
int
startPos
=
getAbsolutePosition
(
lineNumber
,
0
);
int
length
=
paragraph
.
length
();
//highlight line
this
.
setStyle
(
startPos
,
startPos
+
length
,
Collections
.
singleton
(
"line-highlight-postmortem"
));
this
.
setStyle
(
startPos
,
startPos
+
length
,
Collections
.
singleton
(
cssStyleTag
));
}
/**
* Remove the highlighting of a statement
*
* @param lineNumber
*/
public
void
removeHighlightStmt
(
int
lineNumber
)
{
highlightStmt
(
lineNumber
,
"line-unhighlight"
);
}
/**
* Set a mark in the gutter next to the definition of the main script
*
* @param lineNumberOfSigMainScript
*/
public
void
setDebugMark
(
int
lineNumberOfSigMainScript
)
{
highlightStmt
(
lineNumberOfSigMainScript
-
1
,
"line-highlight-mainScript"
);
}
public
void
unsetDebugMark
(
int
lineNumberOfSigMainScript
)
{
removeHighlightStmt
(
lineNumberOfSigMainScript
-
1
);
}
...
...
@@ -299,7 +324,8 @@ public class ScriptArea extends CodeArea {
ScriptArea
area
=
(
ScriptArea
)
cm
.
getOwnerNode
();
int
chrIdx
=
currentIdx
.
get
().
getCharacterIndex
().
orElse
(
0
);
if
(
chrIdx
!=
0
)
{
area
.
highlightLine
(
chrIdx
);
int
lineNumber
=
area
.
offsetToPosition
(
chrIdx
,
Bias
.
Forward
).
getMajor
();
area
.
highlightStmt
(
lineNumber
,
"line-highlight-postmortem"
);
}
});
...
...
src/main/resources/DebuggerMain.fxml
View file @
42cdb545
...
...
@@ -89,7 +89,7 @@
</tooltip>
</Button>
<Button
disable=
"${! controller.debugMode}"
>
<Button
onAction=
"#stopDebugMode"
disable=
"${! controller.debugMode}"
>
<graphic>
<MaterialDesignIconView
glyphName=
"STOP"
size=
"24.0"
/>
</graphic>
...
...
src/main/resources/edu/kit/formal/gui/debugger-ui.less
View file @
42cdb545
...
...
@@ -83,6 +83,15 @@
.line-highlight-postmortem{
-rtfx-background-color: @blue;
}
.line-unhighlight{
-fx-background-color: @base3;
}
.line-highlight-mainScript{
-rtfx-background-color: @green;
}
}
/**********************************************************************************************************************/
...
...
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