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
2d44879d
Commit
2d44879d
authored
Jun 03, 2017
by
Alexander Weigl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add apache commons-io and showExceptionDialog
parent
670967de
Pipeline
#10933
passed with stage
in 1 minute and 53 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
35 deletions
+59
-35
pom.xml
pom.xml
+12
-0
src/main/java/edu/kit/formal/gui/FileUtils.java
src/main/java/edu/kit/formal/gui/FileUtils.java
+0
-31
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
...t/formal/gui/controller/DebuggerMainWindowController.java
+47
-4
No files found.
pom.xml
View file @
2d44879d
...
...
@@ -235,6 +235,18 @@
<version>
8.40.12
</version>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.5
</version>
</dependency>
<dependency>
<groupId>
commons-lang
</groupId>
<artifactId>
commons-lang
</artifactId>
<version>
2.6
</version>
</dependency>
</dependencies>
...
...
src/main/java/edu/kit/formal/gui/FileUtils.java
deleted
100644 → 0
View file @
670967de
package
edu.kit.formal.gui
;
import
java.io.*
;
/**
* Created by sarah on 5/29/17.
*/
public
class
FileUtils
{
public
static
BufferedReader
readFile
(
File
file
)
{
BufferedReader
br
=
null
;
try
{
br
=
new
BufferedReader
(
new
FileReader
(
file
));
StringBuilder
sb
=
new
StringBuilder
();
String
line
=
br
.
readLine
();
while
(
line
!=
null
)
{
sb
.
append
(
line
);
sb
.
append
(
System
.
lineSeparator
());
line
=
br
.
readLine
();
}
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
br
;
}
}
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
View file @
2d44879d
package
edu.kit.formal.gui.controller
;
import
de.uka.ilkd.key.speclang.Contract
;
import
edu.kit.formal.gui.FileUtils
;
import
edu.kit.formal.gui.model.RootModel
;
import
edu.kit.formal.interpreter.KeYProofFacade
;
import
edu.kit.formal.interpreter.data.GoalNode
;
...
...
@@ -14,14 +13,21 @@ import javafx.concurrent.Task;
import
javafx.fxml.FXML
;
import
javafx.fxml.Initializable
;
import
javafx.scene.control.*
;
import
javafx.scene.layout.GridPane
;
import
javafx.scene.layout.Pane
;
import
javafx.scene.layout.Priority
;
import
javafx.stage.FileChooser
;
import
javafx.stage.Stage
;
import
lombok.Setter
;
import
org.apache.commons.io.FileUtils
;
import
org.controlsfx.dialog.Wizard
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.net.URL
;
import
java.nio.charset.Charset
;
import
java.util.List
;
import
java.util.ResourceBundle
;
import
java.util.concurrent.ExecutorService
;
...
...
@@ -120,11 +126,47 @@ public class DebuggerMainWindowController implements Initializable {
protected
void
openScript
()
{
File
scriptFile
=
openFileChooserDialog
(
"Select Script File"
,
"Proof Script File"
,
"kps"
);
if
(
scriptFile
!=
null
)
{
model
.
setScriptFile
(
scriptFile
);
this
.
model
.
currentScriptProperty
().
set
(
FileUtils
.
readFile
(
scriptFile
).
toString
());
try
{
String
code
=
FileUtils
.
readFileToString
(
scriptFile
,
Charset
.
defaultCharset
());
model
.
currentScriptProperty
().
set
(
code
);
model
.
setScriptFile
(
scriptFile
);
}
catch
(
IOException
e
)
{
showExceptionDialog
(
"Exception occured"
,
""
,
"Could not load file "
+
scriptFile
,
e
);
}
}
}
public
void
showExceptionDialog
(
String
title
,
String
headerText
,
String
contentText
,
Exception
ex
)
{
Alert
alert
=
new
Alert
(
Alert
.
AlertType
.
ERROR
);
alert
.
setTitle
(
title
);
alert
.
setHeaderText
(
headerText
);
alert
.
setContentText
(
contentText
);
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
ex
.
printStackTrace
(
pw
);
String
exceptionText
=
sw
.
toString
();
Label
label
=
new
Label
(
"The exception stacktrace was:"
);
TextArea
textArea
=
new
TextArea
(
exceptionText
);
textArea
.
setEditable
(
false
);
textArea
.
setWrapText
(
true
);
textArea
.
setMaxWidth
(
Double
.
MAX_VALUE
);
textArea
.
setMaxHeight
(
Double
.
MAX_VALUE
);
GridPane
.
setVgrow
(
textArea
,
Priority
.
ALWAYS
);
GridPane
.
setHgrow
(
textArea
,
Priority
.
ALWAYS
);
GridPane
expContent
=
new
GridPane
();
expContent
.
setMaxWidth
(
Double
.
MAX_VALUE
);
expContent
.
add
(
label
,
0
,
0
);
expContent
.
add
(
textArea
,
0
,
1
);
alert
.
getDialogPane
().
setExpandableContent
(
expContent
);
alert
.
showAndWait
();
}
@FXML
protected
void
loadKeYFile
()
{
File
keyFile
=
openFileChooserDialog
(
"Select KeY File"
,
"KeY Files"
,
"key"
,
"script"
);
...
...
@@ -248,7 +290,8 @@ public class DebuggerMainWindowController implements Initializable {
FileChooser
fileChooser
=
new
FileChooser
();
fileChooser
.
setTitle
(
title
);
fileChooser
.
setSelectedExtensionFilter
(
new
FileChooser
.
ExtensionFilter
(
description
,
fileEndings
));
fileChooser
.
setInitialDirectory
(
new
File
(
testFile1
));
File
value
=
new
File
(
testFile1
);
fileChooser
.
setInitialDirectory
(
value
.
exists
()
?
value
:
new
File
(
"."
));
File
file
=
fileChooser
.
showOpenDialog
(
this
.
stage
);
return
file
;
...
...
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