Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
30dd90d3
Commit
30dd90d3
authored
Jul 10, 2017
by
Alexander Weigl
Browse files
fix show marker hightlighting and context menü
parent
aa630358
Pipeline
#11979
failed with stage
in 1 minute and 29 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/edu/kit/formal/gui/controls/ANTLR4LexerHighlighter.java
View file @
30dd90d3
...
...
@@ -5,10 +5,7 @@ import org.antlr.v4.runtime.Token;
import
org.fxmisc.richtext.model.StyleSpans
;
import
org.fxmisc.richtext.model.StyleSpansBuilder
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.*
;
import
java.util.function.Function
;
/**
...
...
@@ -33,7 +30,8 @@ public class ANTLR4LexerHighlighter {
tokens
.
forEach
(
token
->
{
String
clazz
=
lexer
.
getVocabulary
().
getSymbolicName
(
token
.
getType
());
Set
<
String
>
clazzes
=
Collections
.
singleton
(
clazz
);
Set
<
String
>
clazzes
=
new
HashSet
<>();
clazzes
.
add
(
clazz
);
//System.out.format("%25s %s%n", clazz, token.getText());
spansBuilder
.
add
(
clazzes
,
...
...
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
View file @
30dd90d3
...
...
@@ -22,6 +22,7 @@ import javafx.geometry.Insets;
import
javafx.geometry.Point2D
;
import
javafx.scene.Node
;
import
javafx.scene.control.*
;
import
javafx.scene.input.ContextMenuEvent
;
import
javafx.scene.input.MouseButton
;
import
javafx.scene.input.MouseEvent
;
import
javafx.scene.layout.*
;
...
...
@@ -114,6 +115,8 @@ public class ScriptArea extends CodeArea {
highlightNonExecutionArea
();
});
markedRegions
.
addListener
((
InvalidationListener
)
o
->
updateHighlight
());
/* .successionEnds(Duration.ofMillis(100))
...
...
@@ -138,11 +141,17 @@ public class ScriptArea extends CodeArea {
});
mainScript
.
addListener
((
observable
)
->
updateMainScriptMarker
());
}
private
void
highlightNonExecutionArea
()
{
if
(
hasExecutionMarker
())
{
setStyle
(
0
,
getExecutionMarkerPosition
(),
Collections
.
singleton
(
"NON_EXE_AREA"
));
getStyleSpans
(
0
,
getExecutionMarkerPosition
()).
forEach
(
span
->
{
span
.
getStyle
().
add
(
"NON_EXE_AREA"
);
});
//setStyle(0, getExecutionMarkerPosition(), Collections.singleton("NON_EXE_AREA"));
}
}
...
...
@@ -172,7 +181,9 @@ public class ScriptArea extends CodeArea {
}
markedRegions
.
forEach
(
reg
->
{
setStyle
(
reg
.
start
,
reg
.
stop
,
Collections
.
singleton
(
reg
.
clazzName
));
Collection
<
String
>
list
=
new
HashSet
<>();
list
.
add
(
reg
.
clazzName
);
setStyle
(
reg
.
start
,
reg
.
stop
,
list
);
});
}
...
...
@@ -237,8 +248,10 @@ public class ScriptArea extends CodeArea {
problems
.
setAll
(
ls
.
check
(
Facade
.
getAST
(
CharStreams
.
fromString
(
getText
()))));
for
(
LintProblem
p
:
problems
)
{
for
(
Token
tok
:
p
.
getMarkTokens
())
{
Set
<
String
>
problem
=
new
HashSet
<>();
problem
.
add
(
"problem"
);
setStyle
(
tok
.
getStartIndex
(),
tok
.
getStopIndex
()
+
1
,
Collections
.
singleton
(
"
problem
"
)
);
tok
.
getStopIndex
()
+
1
,
problem
);
}
}
}
catch
(
Exception
e
)
{
...
...
@@ -300,8 +313,11 @@ public class ScriptArea extends CodeArea {
return
list
;
}
private
void
showBreakPointMenu
(
MouseEvent
event
,
int
line
)
{
private
void
showBreakPointMenu
(
ContextMenuEvent
event
,
int
line
)
{
event
.
consume
();
PopOver
d
=
new
PopOver
();
d
.
setStyle
(
"-fx-font-family:sans-serif; -fx-font-size:9pt"
);
//d.initStyle(StageStyle.UNDECORATED);
// d.setX(event.getScreenX());
//d.setY(event.getScreenY());
...
...
@@ -527,6 +543,7 @@ public class ScriptArea extends CodeArea {
public
BreakpointDialog
()
{
Utils
.
createWithFXML
(
this
);
getStyleClass
().
add
(
"breakpoint-menu"
);
}
public
void
save
(
ActionEvent
e
)
{
...
...
@@ -579,10 +596,13 @@ public class ScriptArea extends CodeArea {
GutterView
hbox
=
new
GutterView
(
model
);
model
.
textProperty
().
bind
(
formatted
);
hbox
.
setOnContextMenuRequested
(
mevent
->
showBreakPointMenu
(
mevent
,
idx
)
);
hbox
.
setOnMouseClicked
((
mevent
)
->
{
if
(
mevent
.
getButton
()
==
MouseButton
.
SECONDARY
)
showBreakPointMenu
(
mevent
,
idx
);
else
mevent
.
consume
();
if
(
mevent
.
getButton
()
==
MouseButton
.
PRIMARY
)
toggleBreakpoint
(
idx
);
});
...
...
src/main/resources/DebuggerMain.fxml
View file @
30dd90d3
...
...
@@ -4,6 +4,7 @@
<?import de.jensd.fx.glyphs.materialdesignicons.*?>
<?import edu.kit.formal.gui.controls.DebuggerStatusBar?>
<?import javafx.scene.control.*?>
<?import javafx.scene.input.KeyCodeCombination?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<?import org.dockfx.DockPane?>
...
...
@@ -38,17 +39,16 @@
<menus>
<Menu
fx:id=
"fileMenu"
text=
"File"
>
<items>
<MenuItem
fx:id=
"newScriptMenuItem"
onAction=
"#newScript"
text=
"New Script"
/>
<MenuItem
fx:id=
"openScriptFileMenuItem"
onAction=
"#openScript"
text=
"Open Script"
/>
<MenuItem
fx:id=
"newScriptMenuItem"
onAction=
"#newScript"
text=
"_New Script"
accelerator=
"Shortcut+n"
/>
<MenuItem
fx:id=
"openScriptFileMenuItem"
onAction=
"#openScript"
text=
"_Open Script"
accelerator=
"Shortcut+o"
/>
<SeparatorMenuItem/>
<MenuItem
fx:id=
"loadKeYFileMenuItem"
onAction=
"#loadKeYFile"
text=
"Load KeY File"
/>
<MenuItem
fx:id=
"loadJavaFileMenuItem"
onAction=
"#loadJavaFile"
text=
"Load Java File"
/>
<MenuItem
fx:id=
"loadKeYFileMenuItem"
onAction=
"#loadKeYFile"
text=
"Load
_
KeY File"
accelerator=
"Shortcut+Alt+o"
/>
<MenuItem
fx:id=
"loadJavaFileMenuItem"
onAction=
"#loadJavaFile"
text=
"Load
_
Java File"
accelerator=
"Shortcut+Shift+o"
/>
<SeparatorMenuItem/>
<MenuItem
onAction=
"#saveScript"
text=
"Save Script"
/>
<MenuItem
onAction=
"#saveAsScript"
text=
"Save Script As ..."
/>
<MenuItem
onAction=
"#saveProof"
text=
"Save Proof"
/>
<MenuItem
fx:id=
"closeMenuItem"
onAction=
"#closeProgram"
text=
"Close"
/>
<MenuItem
onAction=
"#saveScript"
text=
"
_
Save Script"
accelerator=
"Shortcut+s"
/>
<MenuItem
onAction=
"#saveAsScript"
text=
"Save Script
_
As ..."
accelerator=
"Shortcut+Shift+s"
/>
<MenuItem
onAction=
"#saveProof"
text=
"
_
Save Proof"
accelerator=
"Shortcut+Alt+s"
/>
<MenuItem
fx:id=
"closeMenuItem"
onAction=
"#closeProgram"
text=
"
_
Close"
accelerator=
"Shortcut+q"
/>
</items>
</Menu>
<Menu
text=
"Edit"
>
...
...
src/main/resources/edu/kit/formal/gui/debugger-ui.less
View file @
30dd90d3
...
...
@@ -126,6 +126,13 @@
}
.breakpoint-menu {
-fx-skin: "com.sun.javafx.scene.control.skin.ContextMenuSkin";
-fx-font-family: sans-serif;
-fx-font-size: 9pt;
}
.java-area {
-fx-background-color: @base3;
-fx-font-family: "Fira Code Medium", monospace;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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