Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ProB Rodin Plugin
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
ProB Rodin Plugin
Commits
090b7ffb
Commit
090b7ffb
authored
5 years ago
by
Michael Leuschel
Browse files
Options
Downloads
Patches
Plain Diff
show parameter names in custom execute dialog
parent
ee6ab585
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
de.prob.ui/src/de/prob/ui/operationview/CustomPreconditionInputDialog.java
+42
-8
42 additions, 8 deletions
.../prob/ui/operationview/CustomPreconditionInputDialog.java
with
42 additions
and
8 deletions
de.prob.ui/src/de/prob/ui/operationview/CustomPreconditionInputDialog.java
+
42
−
8
View file @
090b7ffb
...
...
@@ -6,6 +6,10 @@
package
de.prob.ui.operationview
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
org.eclipse.jface.dialogs.InputDialog
;
import
org.eclipse.swt.widgets.Shell
;
...
...
@@ -13,6 +17,7 @@ import de.be4.classicalb.core.parser.exceptions.BException;
import
de.prob.core.Animator
;
import
de.prob.core.command.*
;
import
de.prob.core.domainobjects.Operation
;
import
de.prob.core.domainobjects.OperationInfo
;
import
de.prob.exceptions.ProBException
;
import
de.prob.unicode.UnicodeTranslator
;
...
...
@@ -21,23 +26,25 @@ public class CustomPreconditionInputDialog extends InputDialog {
private
final
Animator
animator
;
private
final
Operation
op
;
public
CustomPreconditionInputDialog
(
final
Shell
parentShell
,
Operation
op
)
{
super
(
parentShell
,
"Execute with additional Guard"
,
getMenuText
(
op
),
public
CustomPreconditionInputDialog
(
final
Shell
parentShell
,
Operation
op
,
Animator
a
)
{
super
(
parentShell
,
"Execute with additional Guard
Constraint
"
,
getMenuText
(
op
,
a
),
""
,
new
EventBInputValidator
());
this
.
op
=
op
;
animator
=
Animator
.
getAnimator
()
;
animator
=
a
;
}
private
static
String
getMenuText
(
Operation
op
)
{
private
static
String
getMenuText
(
Operation
op
,
Animator
animator
)
{
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"Enter Guard to be added to the Event \""
);
sb
.
append
(
"Enter Guard
Constraint
to be added to the Event \""
);
sb
.
append
(
op
.
getName
());
sb
.
append
(
"\" before execution."
);
if
(
op
.
getArguments
().
size
()>
0
)
{
sb
.
append
(
"\nParameters are: "
);
sb
.
append
(
getOperationParams
(
op
,
animator
));
if
(
op
.
getArguments
().
size
()>
0
)
{
sb
.
append
(
"\nValues are:"
);
for
(
String
arg
:
op
.
getArguments
())
{
sb
.
append
(
" "
);
sb
.
append
(
arg
);
sb
.
append
(
arg
);
// these are the parameter values not the parameter names !!!
}
}
...
...
@@ -73,12 +80,39 @@ public class CustomPreconditionInputDialog extends InputDialog {
}
public
static
Operation
getOperation
(
Operation
op
)
{
CustomPreconditionInputDialog
osd
=
new
CustomPreconditionInputDialog
(
new
Shell
(),
op
);
new
Shell
(),
op
,
Animator
.
getAnimator
()
);
if
(
osd
.
open
()
==
InputDialog
.
OK
)
return
osd
.
getCustomOperation
();
else
return
null
;
}
// copy from Paramter OperationTableViewer
private
static
List
<
String
>
getOperationParams
(
final
Operation
op
,
Animator
animator
)
{
Collection
<
OperationInfo
>
infos
=
null
;
try
{
infos
=
GetOperationNamesCommand
.
getNames
(
animator
);
}
catch
(
ProBException
e
)
{
e
.
notifyUserOnce
();
}
final
OperationInfo
params
=
infos
==
null
?
null
:
OperationInfo
.
getParams
(
op
.
getName
(),
infos
);
final
List
<
String
>
result
;
if
(
params
!=
null
)
{
result
=
params
.
getParameters
();
}
else
{
// If we cannot see the parameter names, we just use the operation's
// number of arguments and use empty titles
final
int
numArgs
=
op
.
getArguments
().
size
();
result
=
new
ArrayList
<
String
>(
numArgs
);
for
(
int
i
=
0
;
i
<
numArgs
;
i
++)
{
result
.
add
(
""
);
}
}
return
result
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment