Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
ProofScriptParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
24
Issues
24
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sarah.grebing
ProofScriptParser
Commits
bc05d208
Commit
bc05d208
authored
Jul 25, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Line highlighting for Java source is working now
parent
32c4c671
Pipeline
#12296
failed with stage
in 1 minute and 35 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
22 deletions
+67
-22
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
...t/formal/gui/controller/DebuggerMainWindowController.java
+9
-6
src/main/java/edu/kit/formal/gui/controls/InspectionView.java
...main/java/edu/kit/formal/gui/controls/InspectionView.java
+1
-7
src/main/java/edu/kit/formal/gui/controls/JavaArea.java
src/main/java/edu/kit/formal/gui/controls/JavaArea.java
+48
-7
src/main/java/edu/kit/formal/gui/model/InspectionModel.java
src/main/java/edu/kit/formal/gui/model/InspectionModel.java
+1
-1
src/main/resources/edu/kit/formal/gui/debugger-ui.less
src/main/resources/edu/kit/formal/gui/debugger-ui.less
+8
-1
No files found.
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
View file @
bc05d208
...
...
@@ -158,10 +158,6 @@ public class DebuggerMainWindowController implements Initializable {
scriptController
.
getDebugPositionHighlighter
().
highlight
(
newValue
);
});
imodel
.
highlightedJavaLinesProperty
().
addListener
((
observable
,
oldValue
,
newValue
)
->
{
javaArea
.
enableCurrentLineHighlightingProperty
();
});
Utils
.
addDebugListener
(
proofTreeController
.
currentGoalsProperty
(),
Utils:
:
reprKeyDataList
);
Utils
.
addDebugListener
(
proofTreeController
.
currentSelectedGoalProperty
(),
Utils:
:
reprKeyData
);
Utils
.
addDebugListener
(
proofTreeController
.
currentHighlightNodeProperty
());
...
...
@@ -190,20 +186,27 @@ public class DebuggerMainWindowController implements Initializable {
showCodeDock
(
null
);
});
//add listener for linehighlighting when changing selection in inspectionview
getInspectionViewsController
().
getActiveInspectionViewTab
().
getModel
().
highlightedJavaLinesProperty
().
addListener
((
observable
,
oldValue
,
newValue
)
->
{
if
(
newValue
!=
null
)
{
javaArea
.
linesToHighlightProperty
().
set
(
newValue
);
}
else
{
javaArea
.
linesToHighlightProperty
().
set
(
FXCollections
.
emptyObservableSet
());
}
});
javaCode
.
addListener
(
new
ChangeListener
<
String
>()
{
@Override
public
void
changed
(
ObservableValue
<?
extends
String
>
observable
,
String
oldValue
,
String
newValue
)
{
try
{
javaArea
.
setText
(
newValue
);
javaArea
.
enableLineHighlightingProperty
();
}
catch
(
Exception
e
)
{
LOGGER
.
catching
(
e
);
}
}
});
}
...
...
src/main/java/edu/kit/formal/gui/controls/InspectionView.java
View file @
bc05d208
...
...
@@ -46,14 +46,8 @@ public class InspectionView extends BorderPane {
if
(
newValue
!=
null
&&
newValue
.
getData
()
!=
null
)
{
getSequentView
().
setNode
(
newValue
.
getData
().
getNode
());
getSequentView
().
setGoal
(
newValue
.
getData
().
getGoal
());
// TODO weigl: get marked lines of the program, and set it
/*model.get().highlightedJavaLinesProperty().get()
.clear();*/
//set Java lines to highlight in model
model
.
get
().
setHighlightedJavaLines
(
FXCollections
.
observableSet
(
newValue
.
getData
().
constructLinesSet
()));
System
.
out
.
println
(
newValue
.
getData
().
constructLinesSet
());
}
});
...
...
src/main/java/edu/kit/formal/gui/controls/JavaArea.java
View file @
bc05d208
...
...
@@ -2,23 +2,18 @@ package edu.kit.formal.gui.controls;
import
antlrgrammars.Java8Lexer
;
import
javafx.beans.property.SimpleSetProperty
;
import
javafx.collections.FXCollections
;
import
javafx.collections.ObservableSet
;
import
javafx.collections.SetChangeListener
;
import
org.antlr.v4.runtime.CharStreams
;
import
org.fxmisc.richtext.CodeArea
;
import
org.fxmisc.richtext.LineNumberFactory
;
import
java.util.Collections
;
import
java.util.Set
;
/**
* @author Alexander Weigl
* @version 1 (03.06.17)
*/
public
class
JavaArea
extends
BaseCodeArea
{
private
ANTLR4LexerHighlighter
highlighter
=
new
ANTLR4LexerHighlighter
((
s
)
->
new
Java8Lexer
(
CharStreams
.
fromString
(
s
)));
//set with current lines to highlight
private
SimpleSetProperty
<
Integer
>
linesToHighlight
=
new
SimpleSetProperty
<>(
this
,
"JavaLinesToHighlight"
);
public
JavaArea
()
{
init
();
}
...
...
@@ -35,6 +30,36 @@ public class JavaArea extends BaseCodeArea {
getStyleClass
().
add
(
"java-area"
);
textProperty
().
addListener
(
(
a
,
b
,
c
)
->
updateView
());
linesToHighlightProperty
().
addListener
((
observable
,
oldValue
,
newValue
)
->
{
setEnableLineHighlighting
(
true
);
unHighlightOldSet
(
oldValue
);
highlightLineSet
();
});
}
/**
* Remove old highlights
*
* @param oldValue
*/
private
void
unHighlightOldSet
(
ObservableSet
<
Integer
>
oldValue
)
{
if
(
oldValue
!=
null
)
{
oldValue
.
forEach
(
integer
->
{
lineToClass
.
put
(
integer
-
1
,
"un-highlight-line"
);
highlightLines
();
});
}
}
/**
* highlight new lines
*/
private
void
highlightLineSet
()
{
linesToHighlightProperty
().
get
().
forEach
(
integer
->
{
lineToClassProperty
().
get
().
put
(
integer
-
1
,
"line-highlight"
);
});
highlightLines
();
}
private
void
updateView
()
{
...
...
@@ -42,4 +67,20 @@ public class JavaArea extends BaseCodeArea {
setStyleSpans
(
0
,
highlighter
.
highlight
(
textProperty
().
getValue
()));
highlightLines
();
}
public
ObservableSet
<
Integer
>
getLinesToHighlight
()
{
return
linesToHighlight
.
get
();
}
public
void
setLinesToHighlight
(
ObservableSet
<
Integer
>
linesToHighlight
)
{
this
.
linesToHighlight
.
set
(
linesToHighlight
);
}
public
SimpleSetProperty
<
Integer
>
linesToHighlightProperty
()
{
return
linesToHighlight
;
}
}
src/main/java/edu/kit/formal/gui/model/InspectionModel.java
View file @
bc05d208
...
...
@@ -24,7 +24,7 @@ public class InspectionModel {
private
final
MapProperty
<
GoalNode
,
Color
>
colorofEachGoalNodeinListView
=
new
SimpleMapProperty
<>(
FXCollections
.
observableHashMap
());
//private final StringProperty javaString = new SimpleStringProperty();
private
final
SetProperty
<
Integer
>
highlightedJavaLines
=
new
SimpleSetProperty
<>(
FXCollections
.
observableSet
(),
"highlightedJavaLines"
);
private
final
BooleanProperty
closable
=
new
SimpleBooleanProperty
(
this
,
"I
N
spectionViewClosableProperty"
);
private
final
BooleanProperty
closable
=
new
SimpleBooleanProperty
(
this
,
"I
n
spectionViewClosableProperty"
);
private
final
BooleanProperty
isInterpreterTab
=
new
SimpleBooleanProperty
();
private
ObjectProperty
<
Mode
>
mode
=
new
SimpleObjectProperty
<>();
...
...
src/main/resources/edu/kit/formal/gui/debugger-ui.less
View file @
bc05d208
...
...
@@ -179,6 +179,13 @@
-fx-fill: firebrick !important;
-fx-underline: true;
}
.line-highlight {
-rtfx-background-color: @blue;
}
.line-un-highlight {
-rtfx-background-color: @base3;
}
}
/**********************************************************************************************************************/
...
...
@@ -226,7 +233,7 @@
.closed-sequent-view {
-fx-font-size: 14pt;
-fx-background-color: @
red
;
-fx-background-color: @
green
;
.sequent-highlight {
-rtfx-background-color: @base01;
...
...
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