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
7a3b0e4c
Commit
7a3b0e4c
authored
8 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
IConstraint -> Constraint
refs 2553
parent
c535a3d9
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/util/ConstraintsUIUtils.java
+26
-20
26 additions, 20 deletions
...rg/fortiss/tooling/kernel/ui/util/ConstraintsUIUtils.java
with
26 additions
and
20 deletions
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/ConstraintsUIUtils.java
+
26
−
20
View file @
7a3b0e4c
...
...
@@ -31,10 +31,10 @@ import org.eclipse.swt.widgets.Display;
import
org.fortiss.tooling.kernel.extension.data.IConstraintViolation
;
import
org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity
;
import
org.fortiss.tooling.kernel.model.constraints.ConstrainedWithChecksum
;
import
org.fortiss.tooling.kernel.model.constraints.Constraint
;
import
org.fortiss.tooling.kernel.model.constraints.ErrorVerificationStatus
;
import
org.fortiss.tooling.kernel.model.constraints.FailVerificationStatus
;
import
org.fortiss.tooling.kernel.model.constraints.IConstrained
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraint
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraintContainer
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraintVerificationStatus
;
import
org.fortiss.tooling.kernel.model.constraints.OutdatedVerificationStatus
;
...
...
@@ -48,7 +48,7 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
DEFFE3B2CD87000FA08371CCE78E9F33
* @ConQAT.Rating YELLOW Hash:
8E535AAF5BE563F94B385D091D10B45E
*/
public
class
ConstraintsUIUtils
{
...
...
@@ -82,7 +82,7 @@ public class ConstraintsUIUtils {
*/
public
static
ClassifiedStatuses
getClassifiedStatuses
(
IConstrained
constrained
)
{
ClassifiedStatuses
res
=
new
ClassifiedStatuses
();
for
(
I
Constraint
constraint
:
constrained
.
getConstraints
())
{
for
(
Constraint
constraint
:
constrained
.
getConstraints
())
{
IConstraintVerificationStatus
status
=
IConstraintVerificationUIService
.
getInstance
().
getStatus
(
constraint
);
if
(
status
instanceof
FailVerificationStatus
)
{
...
...
@@ -105,9 +105,16 @@ public class ConstraintsUIUtils {
* @param c
* @return {@link ESeverity} corresponding to the status of the constraint <code>c</code>
*/
public
static
ESeverity
getConstraintSeverity
(
I
Constraint
c
)
{
public
static
ESeverity
getConstraintSeverity
(
Constraint
c
)
{
IConstraintVerificationStatus
status
=
IConstraintVerificationUIService
.
getInstance
().
getStatus
(
c
);
if
(
IConstraintVerificationUIService
.
getInstance
().
shallDisplayAsWarning
(
c
))
{
if
(
status
instanceof
FailVerificationStatus
||
status
instanceof
OutdatedVerificationStatus
)
{
return
ESeverity
.
WARNING
;
}
return
ESeverity
.
lowest
();
}
if
(
status
instanceof
FailVerificationStatus
)
{
return
ESeverity
.
ERROR
;
}
else
if
(
status
instanceof
ErrorVerificationStatus
)
{
...
...
@@ -156,7 +163,7 @@ public class ConstraintsUIUtils {
* Sends (kernel-specific) refresh notifications to the constrained elements to
* trigger a refresh of the marker decorations.
*/
public
static
void
triggerMarkersRefresh
(
I
Constraint
c
)
{
public
static
void
triggerMarkersRefresh
(
Constraint
c
)
{
List
<
IConstrained
>
constraineds
=
new
ArrayList
<
IConstrained
>();
// We first collect separately the constrained objects because - unfortunately for some
// unknown reason - the following notification seems to trigger a change of the list of
...
...
@@ -172,15 +179,14 @@ public class ConstraintsUIUtils {
}
/**
* @param
constraintType
* @param
id
* @param cstrContainer
* Calls <code>triggerMarkersRefresh</code> on every constraint of
* <code>cstrContainer</code>.
* <code>cstrContainer</code>
matching <code>id</code>
.
*/
public
static
<
T
extends
IConstraint
>
void
triggerMarkerRefresh
(
Class
<
T
>
constraintType
,
IConstraintContainer
cstrContainer
)
{
for
(
IConstraint
c
:
cstrContainer
.
getConstraints
())
{
if
(
constraintType
.
isInstance
(
c
))
{
public
static
void
triggerMarkerRefresh
(
String
id
,
IConstraintContainer
cstrContainer
)
{
for
(
Constraint
c
:
cstrContainer
.
getConstraints
())
{
if
(
c
.
getConstraintTypeID
().
equals
(
id
))
{
ConstraintsUIUtils
.
triggerMarkersRefresh
(
c
);
}
}
...
...
@@ -190,7 +196,7 @@ public class ConstraintsUIUtils {
* @param c
* @return Standard text describing the status of <code>c</code>.
*/
public
static
String
getText
(
I
Constraint
c
)
{
public
static
String
getText
(
Constraint
c
)
{
if
(
c
==
null
)
{
return
""
;
}
...
...
@@ -213,7 +219,7 @@ public class ConstraintsUIUtils {
* @param c
* @return Standard "hint" indicating possible action on the status of <code>c</code>.
*/
public
static
String
getHint
(
I
Constraint
c
)
{
public
static
String
getHint
(
Constraint
c
)
{
if
(
c
==
null
)
{
return
""
;
}
...
...
@@ -231,7 +237,7 @@ public class ConstraintsUIUtils {
* @param c
* @return Standard colour corresponding to the status of <code>c</code>.
*/
public
static
Color
getColor
(
I
Constraint
c
)
{
public
static
Color
getColor
(
Constraint
c
)
{
Display
display
=
Display
.
getCurrent
();
if
(
c
==
null
)
{
return
display
.
getSystemColor
(
SWT
.
COLOR_GRAY
);
...
...
@@ -249,14 +255,14 @@ public class ConstraintsUIUtils {
return
display
.
getSystemColor
(
SWT
.
COLOR_GRAY
);
}
/** A label provider for the status of an {@link
I
Constraint}. */
/** A label provider for the status of an {@link Constraint}. */
public
static
class
StatusLabelProvider
extends
ColumnLabelProvider
{
/** See constructor. */
private
boolean
withHint
;
/** Function to retrieve a constraint from the embedded objects. */
private
Function
<
Object
,
I
Constraint
>
getConstraint
;
private
Function
<
Object
,
Constraint
>
getConstraint
;
/**
* Constructor.
...
...
@@ -269,7 +275,7 @@ public class ConstraintsUIUtils {
* @param getConstraint
* Function returning a constraint from the object to be provided.
*/
public
StatusLabelProvider
(
boolean
withHint
,
Function
<
Object
,
I
Constraint
>
getConstraint
)
{
public
StatusLabelProvider
(
boolean
withHint
,
Function
<
Object
,
Constraint
>
getConstraint
)
{
super
();
this
.
getConstraint
=
getConstraint
;
this
.
withHint
=
withHint
;
...
...
@@ -278,7 +284,7 @@ public class ConstraintsUIUtils {
/** {@inheritDoc} */
@Override
public
String
getText
(
Object
element
)
{
I
Constraint
cstr
=
getConstraint
.
apply
(
element
);
Constraint
cstr
=
getConstraint
.
apply
(
element
);
String
mainMsg
=
ConstraintsUIUtils
.
getText
(
cstr
);
return
mainMsg
+
(
withHint
?
" "
+
ConstraintsUIUtils
.
getHint
(
cstr
)
:
""
);
}
...
...
@@ -286,7 +292,7 @@ public class ConstraintsUIUtils {
/** {@inheritDoc} */
@Override
public
Color
getBackground
(
Object
element
)
{
I
Constraint
cstr
=
getConstraint
.
apply
(
element
);
Constraint
cstr
=
getConstraint
.
apply
(
element
);
return
ConstraintsUIUtils
.
getColor
(
cstr
);
}
}
...
...
@@ -295,7 +301,7 @@ public class ConstraintsUIUtils {
* @param constraint
* @return <code>true</code> if <code>constraint</code> is active.
*/
public
static
boolean
isConstraintActive
(
I
Constraint
constraint
)
{
public
static
boolean
isConstraintActive
(
Constraint
constraint
)
{
return
IConstraintVerificationUIService
.
getInstance
().
getStatus
(
constraint
)
!=
null
;
}
...
...
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