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
46ef19b3
Commit
46ef19b3
authored
8 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
utility functions for standard status text and colours
refs 2553
parent
e59e9535
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/ConstraintsUtils.java
+36
-1
36 additions, 1 deletion
.../org/fortiss/tooling/kernel/ui/util/ConstraintsUtils.java
with
36 additions
and
1 deletion
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/ConstraintsUtils.java
+
36
−
1
View file @
46ef19b3
...
...
@@ -23,6 +23,9 @@ import java.util.ArrayList;
import
java.util.List
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.Color
;
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
;
...
...
@@ -42,7 +45,7 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
20D9E980F0519B44760383E485DBE87C
* @ConQAT.Rating YELLOW Hash:
5F009C359872D3E716E02343F9AFD225
*/
public
class
ConstraintsUtils
{
/**
...
...
@@ -167,4 +170,36 @@ public class ConstraintsUtils {
EcoreUtils
.
postRefreshNotification
(
cwc
.
getConstrained
());
}
}
/**
* @param c
* @return Standard text describing the status of <code>c</code>.
*/
public
static
String
getText
(
IConstraint
c
)
{
IConstraintVerificationStatus
status
=
c
.
getVerificationStatus
();
String
mainMsg
=
"ERROR"
;
if
(
status
instanceof
SuccessVerificationStatus
)
{
mainMsg
=
"SUCCESS"
;
}
else
if
(
status
instanceof
FailVerificationStatus
)
{
mainMsg
=
"FAIL"
;
}
else
if
(
status
instanceof
OutdatedVerificationStatus
)
{
mainMsg
=
"OUTDATED"
;
}
return
mainMsg
;
}
/**
* @param c
* @return Standard colour corresponding to the status of <code>c</code>.
*/
public
static
Color
getColor
(
IConstraint
c
)
{
Display
display
=
Display
.
getCurrent
();
IConstraintVerificationStatus
status
=
c
.
getVerificationStatus
();
if
(
status
instanceof
FailVerificationStatus
||
status
instanceof
ErrorVerificationStatus
)
{
return
display
.
getSystemColor
(
SWT
.
COLOR_RED
);
}
else
if
(
status
instanceof
SuccessVerificationStatus
)
{
return
display
.
getSystemColor
(
SWT
.
COLOR_GREEN
);
}
return
display
.
getSystemColor
(
SWT
.
COLOR_GRAY
);
}
}
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