Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
3816df66
Commit
3816df66
authored
Sep 18, 2017
by
Vincent Aravantinos
Browse files
prevent opening a dialog if there is only one variable
parent
ac1f906b
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.specification.ui/trunk/src/org/fortiss/af3/specification/ui/constraint/BoundsConstraintUI.java
View file @
3816df66
...
...
@@ -21,6 +21,7 @@ import static java.util.stream.Collectors.toList;
import
static
org
.
eclipse
.
ui
.
PlatformUI
.
getWorkbench
;
import
static
org
.
fortiss
.
af3
.
component
.
ui
.
AF3ComponentUIActivator
.
getDefault
;
import
static
org
.
fortiss
.
af3
.
component
.
utils
.
ComponentArchitectureUtils
.
isAtomicComponent
;
import
static
org
.
fortiss
.
af3
.
specification
.
constraint
.
BoundsConstraint
.
getBoundsViolationTrace
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
EditorUtils
.
getOpenedEditor
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
LoggingUtils
.
error
;
...
...
@@ -128,23 +129,30 @@ public class BoundsConstraintUI extends ConstraintUIBases.ConstraintUIBaseAutoch
}
}
else
{
try
{
TraceSelectionDialog
dlg
=
new
TraceSelectionDialog
(
Display
.
getDefault
().
getActiveShell
(),
BoundsConstraint
.
getBoundsViolationTrace
(
ci
)
.
stream
()
.
collect
(
// only take one failed constraint per Var
groupSingle
(
oob
->
oob
.
getFirst
().
getVariable
()
.
getVar
().
getIdentifier
(),
p
->
p
.
getSecond
())));
if
(
dlg
.
open
()
!=
Window
.
OK
)
Map
<
String
,
CounterExample
>
traces
=
getBoundsViolationTrace
(
ci
).
stream
().
collect
(
// only take one failed constraint per Var
groupSingle
(
oob
->
oob
.
getFirst
().
getVariable
().
getVar
()
.
getIdentifier
(),
p
->
p
.
getSecond
()));
CounterExample
selectedTtrace
;
if
(
traces
.
size
()
==
1
)
{
selectedTtrace
=
traces
.
get
(
0
);
}
else
if
(
traces
.
size
()
>
1
)
{
TraceSelectionDialog
dlg
=
new
TraceSelectionDialog
(
Display
.
getDefault
().
getActiveShell
(),
traces
);
if
(
dlg
.
open
()
!=
Window
.
OK
)
{
return
false
;
}
selectedTtrace
=
dlg
.
getSelectedTrace
();
}
else
{
return
false
;
}
getWorkbench
().
showPerspective
(
SimulationPerspective
.
ID
,
getWorkbench
().
getActiveWorkbenchWindow
());
SimulationManager
.
INSTANCE
.
setCurrentSimulation
(
new
CounterExampleSimulator
(
dlg
.
getS
electedTrace
()
));
SimulationManager
.
INSTANCE
.
setCurrentSimulation
(
new
CounterExampleSimulator
(
s
electedT
t
race
));
}
catch
(
ChainTransformationFailedException
e
)
{
e
.
printStackTrace
();
}
catch
(
WorkbenchException
e
)
{
...
...
@@ -231,7 +239,7 @@ public class BoundsConstraintUI extends ConstraintUIBases.ConstraintUIBaseAutoch
@Override
protected
void
configureShell
(
Shell
shell
)
{
super
.
configureShell
(
shell
);
shell
.
setText
(
"Observe
state reachability
"
);
shell
.
setText
(
"Observe
bound mismatch
"
);
}
/** {@inheritDoc} */
...
...
@@ -239,7 +247,7 @@ public class BoundsConstraintUI extends ConstraintUIBases.ConstraintUIBaseAutoch
protected
Control
createDialogArea
(
Composite
parent
)
{
parent
.
setLayout
(
new
GridLayout
(
1
,
true
));
Label
label
=
new
Label
(
parent
,
SWT
.
NONE
);
label
.
setText
(
"Pick a
state
:"
);
label
.
setText
(
"Pick a
port
:"
);
l
=
new
org
.
eclipse
.
swt
.
widgets
.
List
(
parent
,
SWT
.
BORDER
|
SWT
.
CENTER
);
l
.
setLayoutData
(
new
GridData
(
SWT
.
FILL
,
SWT
.
TOP
,
true
,
true
));
for
(
String
s
:
traces
.
keySet
())
{
...
...
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