Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
1934d97a
Commit
1934d97a
authored
8 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
makes use of the new service
refs 2620
parent
07034df2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/ConstraintMenu.java
+29
-15
29 additions, 15 deletions
...tiss/tooling/kernel/ui/internal/views/ConstraintMenu.java
with
29 additions
and
15 deletions
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/ConstraintMenu.java
+
29
−
15
View file @
1934d97a
...
...
@@ -55,7 +55,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
B2B88D03669D73EC77D1D69F51E62
B5
4
* @ConQAT.Rating YELLOW Hash:
265A5183E7E403DDC53A61F5B27D8
B5
A
*/
public
class
ConstraintMenu
implements
IContextMenuContributor
{
...
...
@@ -67,11 +67,22 @@ public class ConstraintMenu implements IContextMenuContributor {
return
Collections
.
emptyList
();
}
return
((
IConstrained
)
selectedObject
).
getConstraints
().
stream
()
.
filter
(
c
->
!(
c
.
getVerificationStatus
()
instanceof
SuccessVerificationStatus
))
.
filter
(
c
->
shouldGetMenuEntry
(
c
))
.
map
(
c
->
constraintToAction
(
c
,
(
IConstrained
)
selectedObject
))
.
collect
(
Collectors
.
toList
());
}
/**
* @param c
* @return <code>true</code> iff <code>c</code> should get a menu entry, i.e., if not successful
* and activated.
*/
private
boolean
shouldGetMenuEntry
(
IConstraint
c
)
{
IConstraintVerificationStatus
status
=
IConstraintVerificationUIService
.
getInstance
().
getStatus
(
c
);
return
!(
status
==
null
||
status
instanceof
SuccessVerificationStatus
);
}
/**
* @param c
* @param elt
...
...
@@ -80,14 +91,18 @@ public class ConstraintMenu implements IContextMenuContributor {
* (not hurtful, but useless, since the user is already seeing it).
*/
private
IContributionItem
constraintToAction
(
IConstraint
c
,
IConstrained
elt
)
{
IConstraintVerificationStatus
status
=
c
.
getVerificationStatus
();
IConstraintVerificationStatus
status
=
IConstraintVerificationUIService
.
getInstance
().
getStatus
(
c
);
ConstraintSubMenuBase
m
;
if
(
status
instanceof
FailVerificationStatus
)
{
m
=
new
CheckFailingConstraintAction
(
c
,
elt
);
}
else
if
(
status
instanceof
ErrorVerificationStatus
)
{
m
=
new
CheckErrorConstraintAction
(
c
,
elt
);
}
else
{
}
else
if
(
status
instanceof
OutdatedVerificationStatus
)
{
m
=
new
CheckOutdatedConstraintAction
(
c
,
elt
);
}
else
{
// should not happen
return
null
;
}
if
(
m
.
getItems
().
length
>
1
)
{
return
m
;
...
...
@@ -194,19 +209,20 @@ public class ConstraintMenu implements IContextMenuContributor {
/** {@inheritDoc} */
@Override
public
void
run
()
{
IConstraintVerificationStatus
status
=
c
.
getVerificationStatus
();
if
(
c
.
getVerificationStatus
()
instanceof
OutdatedVerificationStatus
&&
IConstraintVerificationUIService
.
getInstance
().
canOpen
(
status
))
{
IConstraintVerificationStatus
status
=
IConstraintVerificationUIService
.
getInstance
().
getStatus
(
c
);
if
(
status
instanceof
OutdatedVerificationStatus
&&
IConstraintVerificationUIService
.
getInstance
().
canOpen
(
c
))
{
ICommandStackService
.
getInstance
().
runAsCommand
(
c
,
new
Runnable
()
{
@Override
public
void
run
()
{
IConstraintVerificationUIService
.
getInstance
().
openStatus
(
status
);
IConstraintVerificationUIService
.
getInstance
().
openStatus
(
c
);
}
});
return
;
}
if
(
IConstraintVerificationUIService
.
getInstance
().
canOpen
(
status
))
{
IConstraintVerificationUIService
.
getInstance
().
openStatus
(
status
);
if
(
IConstraintVerificationUIService
.
getInstance
().
canOpen
(
c
))
{
IConstraintVerificationUIService
.
getInstance
().
openStatus
(
c
);
}
else
{
// In the very rare cases where the status cannot be open (if the defaults are
// used, this should not happen), we provide some defaults.
...
...
@@ -221,8 +237,7 @@ public class ConstraintMenu implements IContextMenuContributor {
String
msg
=
"There was an error while verifying "
;
msg
+=
(
name
==
null
?
"the "
:
""
)
+
fullName
+
"."
;
openError
(
sh
,
"Error while verifying constraint"
,
msg
);
}
if
(
status
instanceof
OutdatedVerificationStatus
)
{
}
else
if
(
status
instanceof
OutdatedVerificationStatus
)
{
String
msg
=
(
name
==
null
?
"The "
:
fullName
)
+
" is outdated."
;
MessageDialog
.
openWarning
(
sh
,
"Outdated constraint"
,
msg
);
}
...
...
@@ -251,8 +266,7 @@ public class ConstraintMenu implements IContextMenuContributor {
public
CheckUnsuccessfulConstraintAction
(
IConstraint
c
,
IConstrained
selectedElt
,
String
prefix
)
{
super
(
c
,
selectedElt
,
prefix
,
ESharedImages
.
ERROR_OVERLAY
.
getImageDescriptor
());
List
<
IFix
>
fixes
=
IConstraintVerificationService
.
getInstance
().
fixes
(
c
.
getVerificationStatus
());
List
<
IFix
>
fixes
=
IConstraintVerificationService
.
getInstance
().
fixes
(
c
);
if
(
fixes
!=
null
)
{
for
(
IFix
fix
:
fixes
)
{
this
.
add
(
new
ActionContributionItem
(
new
FixAction
(
fix
)));
...
...
@@ -280,7 +294,7 @@ public class ConstraintMenu implements IContextMenuContributor {
@Override
public
void
run
()
{
fix
.
runFix
(
c
.
ge
tVerificationStatus
());
fix
.
runFix
(
IConstrain
tVerification
UIService
.
getInstance
().
get
Status
(
c
));
}
});
}
...
...
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