Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mbe-tools
TTool
Commits
12aebd8d
Commit
12aebd8d
authored
Jul 31, 2017
by
Dominique Blouin
Browse files
Issue
#4
: Add file extension if not set by user in trace filename.
parent
711d8dc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/ui/interactivesimulation/JFrameInteractiveSimulation.java
View file @
12aebd8d
...
...
@@ -2422,10 +2422,34 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene
}
}
public
void
sendSaveTraceCommand
(
String
format
)
{
String
param
=
saveFileName
.
getText
().
trim
();
private
void
saveTraceVCD
()
{
sendSaveTraceCommand
(
manageFileExtension
(
saveFileName
.
getText
(),
".vcd"
),
"0"
);
}
private
void
saveTraceHTML
()
{
sendSaveTraceCommand
(
manageFileExtension
(
saveFileName
.
getText
(),
".html"
),
"1"
);
}
private
void
saveTraceText
()
{
sendSaveTraceCommand
(
manageFileExtension
(
saveFileName
.
getText
(),
".txt"
),
"2"
);
}
private
String
manageFileExtension
(
String
filename
,
final
String
extension
)
{
filename
=
filename
.
trim
();
if
(
!
filename
.
isEmpty
()
&&
!
filename
.
endsWith
(
extension
)
)
{
return
filename
.
concat
(
extension
);
}
return
filename
;
}
private
void
sendSaveTraceCommand
(
String
filename
,
final
String
format
)
{
// String param = saveFileName.getText().trim();
if
(
par
am
.
isEmpty
()
)
{
if
(
filen
am
e
.
isEmpty
()
)
{
final
String
message
=
"Please enter a file name for the trace."
;
JOptionPane
.
showMessageDialog
(
this
,
message
,
"Output File Name not Specified"
,
JOptionPane
.
ERROR_MESSAGE
);
error
(
message
);
...
...
@@ -2434,12 +2458,12 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene
final
String
directory
=
saveDirName
.
getText
().
trim
();
if
(
!
directory
.
isEmpty
()
)
{
par
am
=
directory
+
File
.
separator
+
par
am
;
filen
am
e
=
directory
+
File
.
separator
+
filen
am
e
;
}
// DB: now useless check
// if (param.length() >0) {
sendCommand
(
"save-trace-in-file"
+
" "
+
format
+
" "
+
par
am
);
sendCommand
(
"save-trace-in-file"
+
" "
+
format
+
" "
+
filen
am
e
);
// } else {
// error("Wrong parameter: must be a file name");
// }
...
...
@@ -3099,11 +3123,11 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene
}
else
if
(
command
.
equals
(
actions
[
InteractiveSimulationActions
.
ACT_RUN_UNTIL_CHANNEL_ACCESS
].
getActionCommand
()))
{
runUntilChannelAccess
();
}
else
if
(
command
.
equals
(
actions
[
InteractiveSimulationActions
.
ACT_SAVE_VCD
].
getActionCommand
()))
{
s
endS
aveTrace
Command
(
"0"
);
saveTrace
VCD
(
);
}
else
if
(
command
.
equals
(
actions
[
InteractiveSimulationActions
.
ACT_SAVE_HTML
].
getActionCommand
()))
{
s
endS
aveTrace
Command
(
"1"
);
saveTrace
HTML
(
);
}
else
if
(
command
.
equals
(
actions
[
InteractiveSimulationActions
.
ACT_SAVE_TXT
].
getActionCommand
()))
{
s
endS
aveTrace
Command
(
"2"
);
saveTrace
Text
(
);
}
else
if
(
command
.
equals
(
actions
[
InteractiveSimulationActions
.
ACT_SAVE_STATE
].
getActionCommand
()))
{
sendSaveStateCommand
();
}
else
if
(
command
.
equals
(
actions
[
InteractiveSimulationActions
.
ACT_RESTORE_STATE
].
getActionCommand
()))
{
...
...
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