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
02cac3fd
Commit
02cac3fd
authored
8 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
makes the verification run as a separate job
prevents verification to run when IDs are not ready refs 2553
parent
1038545e
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
+38
-7
38 additions, 7 deletions
...g/kernel/ui/internal/ConstraintVerificationUIService.java
with
38 additions
and
7 deletions
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ConstraintVerificationUIService.java
+
38
−
7
View file @
02cac3fd
package
org.fortiss.tooling.kernel.ui.internal
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
org.eclipse.core.runtime.IProgressMonitor
;
import
org.eclipse.core.runtime.IStatus
;
import
org.eclipse.core.runtime.Status
;
import
org.eclipse.core.runtime.jobs.Job
;
import
org.eclipse.emf.common.notify.Adapter
;
import
org.eclipse.emf.common.notify.Notification
;
import
org.eclipse.emf.common.util.TreeIterator
;
...
...
@@ -14,6 +19,7 @@ import org.eclipse.emf.ecore.util.EContentAdapter;
import
org.fortiss.tooling.kernel.ToolingKernelActivator
;
import
org.fortiss.tooling.kernel.extension.IEclipseResourcePostLoadProvider
;
import
org.fortiss.tooling.kernel.extension.data.ITopLevelElement
;
import
org.fortiss.tooling.kernel.model.IIdLabeled
;
import
org.fortiss.tooling.kernel.model.constraints.ConstrainedWithChecksum
;
import
org.fortiss.tooling.kernel.model.constraints.ConstraintsPackage
;
import
org.fortiss.tooling.kernel.model.constraints.IConstrained
;
...
...
@@ -36,7 +42,7 @@ import org.fortiss.tooling.kernel.utils.LoggingUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
CB3FC2AF2D45F99291553F698F3957B
9
* @ConQAT.Rating YELLOW Hash:
B1153D3AA79E3F3AC9F21E26A8BC2E9
9
*/
public
final
class
ConstraintVerificationUIService
extends
EObjectAwareServiceBase
<
IConstraintVerifierUI
<
IConstraint
>>
implements
...
...
@@ -146,17 +152,30 @@ public final class ConstraintVerificationUIService extends
if
(
constraint
.
isAutoCheck
())
{
ITopLevelElement
modelContext
=
IPersistencyService
.
INSTANCE
.
getTopLevelElementFor
(
constraint
);
modelContext
.
runAsCommand
(
new
Runnable
()
{
// IDs can be in a bad state if the notification is triggered during some
// composition
if
(!
checkIDs
(
modelContext
))
{
return
false
;
}
(
new
Job
(
"Constraint verification job"
)
{
@Override
public
void
run
()
{
IConstraintVerificationService
.
INSTANCE
.
verify
(
constraint
);
protected
IStatus
run
(
IProgressMonitor
monitor
)
{
synchronized
(
constraint
)
{
modelContext
.
runAsCommand
(
new
Runnable
()
{
@Override
public
void
run
()
{
IConstraintVerificationService
.
INSTANCE
.
verify
(
constraint
);
}
});
}
ConstraintsUIUtils
.
triggerMarkersRefresh
(
constraint
);
return
Status
.
OK_STATUS
;
}
});
})
.
schedule
()
;
}
else
if
(!(
constraint
.
getVerificationStatus
()
instanceof
OutdatedVerificationStatus
))
{
ConstraintsUtils
.
createOutdatedVerificationStatus
(
constraint
);
ConstraintsUIUtils
.
triggerMarkersRefresh
(
constraint
);
}
// Update GUI markers
ConstraintsUIUtils
.
triggerMarkersRefresh
(
constraint
);
return
true
;
}
return
false
;
...
...
@@ -220,6 +239,18 @@ public final class ConstraintVerificationUIService extends
return
false
;
}
/** Checks whether elements necessitating IDs do have an ID. */
private
static
boolean
checkIDs
(
ITopLevelElement
modelContext
)
{
Iterator
<
EObject
>
i
=
modelContext
.
getRootModelElement
().
eAllContents
();
while
(
i
.
hasNext
())
{
EObject
eo
=
i
.
next
();
if
(
eo
instanceof
IIdLabeled
&&
((
IIdLabeled
)
eo
).
getId
()
<=
0
)
{
return
false
;
}
}
return
true
;
}
/** {@inheritDoc} */
@Override
protected
String
getExtensionPointName
()
{
...
...
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