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
68c90ba6
Commit
68c90ba6
authored
12 years ago
by
Florian Hölzl
Browse files
Options
Downloads
Patches
Plain Diff
bugfix
refs 504
parent
3e7f2de8
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/MarkerService.java
+29
-5
29 additions, 5 deletions
...org/fortiss/tooling/kernel/ui/internal/MarkerService.java
with
29 additions
and
5 deletions
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java
+
29
−
5
View file @
68c90ba6
...
...
@@ -17,6 +17,7 @@ $Id$
+--------------------------------------------------------------------------*/
package
org.fortiss.tooling.kernel.ui.internal
;
import
static
java
.
util
.
Collections
.
emptyList
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
postRefreshNotification
;
import
java.util.ArrayList
;
...
...
@@ -58,7 +59,7 @@ import org.fortiss.tooling.kernel.ui.service.IMarkerService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
GREEN
Hash:
4F42D5352BEE034F1D749E50A2E29437
* @ConQAT.Rating
YELLOW
Hash:
EFDAD4F40879A52F009A2D9DCFAC4181
*/
public
class
MarkerService
implements
IMarkerService
,
IPersistencyServiceListener
,
ILightweightLabelDecorator
{
...
...
@@ -148,7 +149,12 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene
if
(
top
==
null
)
{
return
Collections
.
emptyList
();
}
return
getCacheEntry
(
top
).
getCachedList
(
element
);
CacheEntry
ce
=
getCacheEntry
(
top
);
Collection
<
IConstraintViolation
<?
extends
EObject
>>
coll
=
ce
.
getCachedList
(
element
);
if
(
coll
.
isEmpty
())
{
return
ce
.
getChildCachedList
(
element
);
}
return
coll
;
}
/** {@inheritDoc} */
...
...
@@ -273,9 +279,7 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene
}
}
/**
* Marker service cache entry.
*/
/** Marker service cache entry. */
private
static
class
CacheEntry
{
/** Stores the mapping from model elements to violation lists. */
...
...
@@ -286,6 +290,10 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene
private
final
Map
<
EObject
,
ESeverity
>
highestSeverityMap
=
new
ConcurrentHashMap
<
EObject
,
ESeverity
>();
/** Stores the child causing the highest severity value for each cached element. */
private
final
Map
<
EObject
,
EObject
>
highestSeverityChildMap
=
new
ConcurrentHashMap
<
EObject
,
EObject
>();
/** Stores the top-level element. */
private
ITopLevelElement
topElement
;
...
...
@@ -331,9 +339,11 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene
List
<
IConstraintViolation
<?
extends
EObject
>>
list
=
violationsMap
.
get
(
eo
);
if
(
list
.
isEmpty
())
{
highestSeverityMap
.
put
(
eo
,
ESeverity
.
lowest
());
highestSeverityChildMap
.
remove
(
eo
);
}
else
{
Collections
.
sort
(
list
,
IConstraintViolation
.
SEVERITY_COMPARATOR
);
highestSeverityMap
.
put
(
eo
,
list
.
get
(
0
).
getSeverity
());
highestSeverityChildMap
.
put
(
eo
,
list
.
get
(
0
).
getSource
());
}
}
// project severity to parent
...
...
@@ -345,13 +355,18 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene
/** Recursively projects highest severity from children to parents. */
private
ESeverity
computeHighestSeverity
(
EObject
element
)
{
ESeverity
severity
=
getHighestSeverity
(
element
);
EObject
causingChild
=
highestSeverityChildMap
.
get
(
element
);
for
(
EObject
child
:
element
.
eContents
())
{
ESeverity
childSeverity
=
computeHighestSeverity
(
child
);
if
(
ESeverity
.
getIntSeverity
(
severity
)
>
ESeverity
.
getIntSeverity
(
childSeverity
))
{
severity
=
childSeverity
;
causingChild
=
child
;
}
}
highestSeverityMap
.
put
(
element
,
severity
);
if
(
causingChild
!=
null
)
{
highestSeverityChildMap
.
put
(
element
,
causingChild
);
}
return
severity
;
}
...
...
@@ -365,6 +380,14 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene
return
list
;
}
/** Returns the cached list of child causing the violation of the given element. */
public
List
<
IConstraintViolation
<?
extends
EObject
>>
getChildCachedList
(
EObject
element
)
{
if
(!
highestSeverityChildMap
.
containsKey
(
element
))
{
return
emptyList
();
}
return
getCachedList
(
highestSeverityChildMap
.
get
(
element
));
}
/** Returns all violations of the given severity. */
public
List
<
IConstraintViolation
<?
extends
EObject
>>
getAllViolationsWithSeverity
(
ESeverity
severity
)
{
...
...
@@ -387,6 +410,7 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene
}
for
(
EObject
eo
:
highestSeverityMap
.
keySet
())
{
highestSeverityMap
.
put
(
eo
,
ESeverity
.
lowest
());
highestSeverityChildMap
.
remove
(
eo
);
}
}
}
...
...
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