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
d1c3fb76
Commit
d1c3fb76
authored
May 23, 2018
by
Sarah Grebing
Browse files
Added confirmation box
parent
15b00201
Pipeline
#22006
passed with stages
in 5 minutes and 32 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/funchdl/SaveCommand.java
View file @
d1c3fb76
...
...
@@ -5,6 +5,9 @@ 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.VariableAssignment
;
import
edu.kit.iti.formal.psdbg.parser.ast.CallStatement
;
import
javafx.application.Platform
;
import
javafx.scene.control.Alert
;
import
javafx.scene.control.ButtonType
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -13,6 +16,11 @@ import org.apache.logging.log4j.Logger;
import
javax.annotation.Nullable
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Optional
;
import
java.util.concurrent.CyclicBarrier
;
import
java.util.concurrent.Semaphore
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.locks.ReentrantLock
;
public
class
SaveCommand
implements
CommandHandler
<
KeyData
>
{
public
static
final
String
SAVE_COMMAND_NAME
=
"#save"
;
...
...
@@ -47,10 +55,28 @@ public class SaveCommand implements CommandHandler<KeyData> {
consoleLogger
.
info
(
"(Safepoint) Location to be saved to = "
+
newFile
.
getAbsolutePath
());
try
{
interpreter
.
getSelectedNode
().
getData
().
getProof
().
saveToFile
(
newFile
);
AtomicBoolean
execute
=
new
AtomicBoolean
(
sp
.
getForce
()
==
SavePoint
.
ForceOption
.
YES
);
if
(
sp
.
getForce
()
==
SavePoint
.
ForceOption
.
INTERACTIVE
){
Semaphore
semaphore
=
new
Semaphore
(
0
);
Platform
.
runLater
(()
->
{
Alert
a
=
new
Alert
(
Alert
.
AlertType
.
CONFIRMATION
);
a
.
setTitle
(
"Foo"
);
Optional
<
ButtonType
>
buttonType
=
a
.
showAndWait
();
if
(
buttonType
.
isPresent
()
&&
buttonType
.
get
()
==
ButtonType
.
OK
){
execute
.
set
(
true
);
}
semaphore
.
release
();
});
semaphore
.
acquire
();
}
if
(
execute
.
get
())
interpreter
.
getSelectedNode
().
getData
().
getProof
().
saveToFile
(
newFile
);
//TODO Call to key persistend facade
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
...
...
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/data/SavePoint.java
View file @
d1c3fb76
...
...
@@ -25,7 +25,11 @@ public class SavePoint {
if
(
isSaveCommand
(
call
))
{
Parameters
p
=
call
.
getParameters
();
name
=
evalAsText
(
p
,
"#2"
,
"not-available"
);
force
=
ForceOption
.
valueOf
(
evalAsText
(
p
,
"force"
,
"yes"
).
toUpperCase
());
try
{
force
=
ForceOption
.
valueOf
(
evalAsText
(
p
,
"force"
,
"yes"
).
toUpperCase
());
}
catch
(
IllegalArgumentException
e
){
}
try
{
startOffset
=
call
.
getRuleContext
().
getStart
().
getStartIndex
();
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/ScriptExecutionController.java
View file @
d1c3fb76
...
...
@@ -8,6 +8,7 @@ import edu.kit.iti.formal.psdbg.interpreter.KeYProofFacade;
import
edu.kit.iti.formal.psdbg.interpreter.KeyInterpreter
;
import
edu.kit.iti.formal.psdbg.interpreter.data.SavePoint
;
import
edu.kit.iti.formal.psdbg.interpreter.dbg.Breakpoint
;
import
edu.kit.iti.formal.psdbg.parser.Facade
;
import
edu.kit.iti.formal.psdbg.parser.ast.ProofScript
;
import
edu.kit.iti.formal.psdbg.parser.ast.Statements
;
import
javafx.scene.control.Alert
;
...
...
@@ -153,6 +154,7 @@ public class ScriptExecutionController {
private
void
executeScript0
(
InterpreterBuilder
ib
,
Collection
<?
extends
Breakpoint
>
breakpoints
,
ProofScript
ms
,
boolean
addInitBreakpoint
)
{
ib
.
setProblemPath
(
mainCtrl
.
getFacade
().
getFilepath
());
KeyInterpreter
interpreter
=
ib
.
build
();
mainCtrl
.
createDebuggerFramework
(
breakpoints
,
ms
,
addInitBreakpoint
,
interpreter
);
}
...
...
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