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
ac9b2ad6
Commit
ac9b2ad6
authored
8 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
adds addMissingConstraints
refs 2334
parent
0267a33c
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/ConstraintVerificationUIService.java
+58
-12
58 additions, 12 deletions
...g/kernel/ui/internal/ConstraintVerificationUIService.java
with
58 additions
and
12 deletions
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ConstraintVerificationUIService.java
+
58
−
12
View file @
ac9b2ad6
...
...
@@ -7,16 +7,20 @@ import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.loadClass;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
LoggingUtils
.
error
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
LoggingUtils
.
warning
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.function.Predicate
;
import
java.util.stream.Collectors
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.emf.common.notify.Adapter
;
import
org.eclipse.emf.common.notify.Notification
;
import
org.eclipse.emf.common.util.EList
;
import
org.eclipse.emf.common.util.TreeIterator
;
import
org.eclipse.emf.ecore.ENamedElement
;
import
org.eclipse.emf.ecore.EObject
;
...
...
@@ -53,7 +57,7 @@ import org.osgi.framework.Bundle;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
5FB1D1BA3A20C0560809BA04FE487D4E
* @ConQAT.Rating YELLOW Hash:
7DB8A6A2739AB60295A69BCC9774AB3B
*/
public
final
class
ConstraintVerificationUIService
implements
IConstraintVerificationUIService
,
IIntrospectiveKernelService
{
...
...
@@ -335,7 +339,7 @@ public final class ConstraintVerificationUIService implements IConstraintVerific
return
"Constraint Verification UI Service"
;
}
/** Activated constraints per top l
o
evel element. */
/** Activated constraints per top level element. */
private
static
Map
<
ITopLevelElement
,
Set
<
String
>>
activatedConstraints
=
new
HashMap
<>();
/** {@inheritDoc} */
...
...
@@ -360,6 +364,13 @@ public final class ConstraintVerificationUIService implements IConstraintVerific
return
handlerMap
.
keySet
();
}
/** {@inheritDoc} */
@Override
public
Set
<
String
>
getActivatedConstraintTypes
(
ITopLevelElement
top
)
{
Set
<
String
>
res
=
activatedConstraints
.
get
(
top
);
return
res
!=
null
?
res
:
new
HashSet
<>();
}
/** {@inheritDoc} */
@Override
public
void
activate
(
String
id
,
IConstraintContainer
cstrContainer
)
{
...
...
@@ -369,18 +380,53 @@ public final class ConstraintVerificationUIService implements IConstraintVerific
activatedConstraints
.
put
(
top
,
new
HashSet
<>());
}
activatedConstraints
.
get
(
top
).
add
(
id
);
IConstraintVerifierUI
verifier
=
getFirstVerifier
(
id
);
verifier
.
onActivate
(
cstrContainer
);
for
(
Constraint
c
:
cstrContainer
.
getConstraints
())
{
if
(
id
.
equals
(
c
.
getConstraintTypeID
()))
{
if
(!
IConstraintVerificationService
.
getInstance
().
isUpToDate
(
c
)
||
c
.
getVerificationStatus
()
==
null
||
c
.
getVerificationStatus
()
instanceof
OutdatedVerificationStatus
)
{
verifier
.
onOutdate
(
c
);
}
List
<
Constraint
>
addeds
=
IConstraintVerificationService
.
getInstance
().
addMissingConstraints
(
top
,
id
);
if
(!
addeds
.
isEmpty
())
{
ConstraintsUIUtils
.
displayTimeConsumptionWarning
(
id
);
}
// Install notifiers for newly added constraints
for
(
Constraint
added
:
addeds
)
{
IConstraintVerificationUIService
.
getInstance
().
install
(
added
);
}
EList
<
Constraint
>
cstrs
=
cstrContainer
.
getConstraints
();
Predicate
<
Constraint
>
isID
=
c
->
id
.
equals
(
c
.
getConstraintTypeID
());
List
<
Constraint
>
idCstrs
=
cstrs
.
stream
().
filter
(
isID
).
collect
(
Collectors
.
toList
());
update
(
idCstrs
);
}
/** {@inheritDoc} */
@Override
public
void
addMissingConstraints
(
IConstraintContainer
cstrContainer
)
{
ITopLevelElement
top
=
IPersistencyService
.
getInstance
().
getTopLevelElementFor
(
cstrContainer
);
List
<
Constraint
>
addeds
=
new
ArrayList
<
Constraint
>();
for
(
String
id
:
getActivatedConstraintTypes
(
top
))
{
addeds
.
addAll
(
IConstraintVerificationService
.
getInstance
().
addMissingConstraints
(
top
,
id
));
IConstraintVerificationService
.
getInstance
().
addMissingConstraints
(
top
,
id
);
}
// Install notifiers for newly added constraints
for
(
Constraint
added
:
addeds
)
{
IConstraintVerificationUIService
.
getInstance
().
install
(
added
);
}
update
(
addeds
);
}
/** Checks the constraints of type <code>id</code> among the given list of constraints. */
private
void
update
(
List
<
Constraint
>
constraints
)
{
// Checks all the constraints: the newly added and the already existing ones which are now
// activated.
for
(
Constraint
c
:
constraints
)
{
// No need to check if it turns out the status is already known from a previous
// activation.
if
(!
IConstraintVerificationService
.
getInstance
().
isUpToDate
(
c
)
||
c
.
getVerificationStatus
()
==
null
||
c
.
getVerificationStatus
()
instanceof
OutdatedVerificationStatus
)
{
getFirstVerifier
(
c
).
onOutdate
(
c
);
}
}
ConstraintsUIUtils
.
triggerMarkerRefresh
(
id
,
cstrCont
ain
er
);
ConstraintsUIUtils
.
triggerMarkerRefresh
(
constr
ain
ts
);
}
/** {@inheritDoc} */
...
...
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