Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto35
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto
new file mode 100644
index 000000000..4c8839345
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto
@@ -0,0 +1,35 @@
+import xpt.GenEditorGenerator;
+
+modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
+modeltype genModel_1 uses "http://www.eclipse.org/emf/2002/GenModel";
+
+library GenAuditRoot;
+
+helper getAllTargetedModelPackages(root : genModel::GenAuditRoot) : Sequence(genModel_1::GenPackage) {
+ return root.rules->select(r | r.target <> null and r.target.getTargetClass() <> null)->collect(r | r.target.getTargetClass().genPackage)->asOrderedSet()->asSequence()
+}
+
+helper getQualifiedIdentity(ctx : genModel::GenAuditContext) : String {
+ return ctx.root.editorGen.plugin.iD + ctx.id
+}
+
+helper hasDiagramElementTargetRule(audits : genModel::GenAuditRoot) : Boolean {
+ return audits <> null and (audits.rules.target)[genModel::GenDiagramElementTarget]->size() > 0
+}
+
+helper hasAnyNotationElementTargetRule(audits : genModel::GenAuditRoot) : Boolean {
+ return audits <> null and (audits.rules.target)[genModel::GenNotationElementTarget]->size() > 0
+}
+
+helper shouldRunValidateOnDiagram(audits : genModel::GenAuditRoot) : Boolean {
+ return hasDiagramElementTargetRule(audits) or hasAnyNotationElementTargetRule(audits)
+}
+
+helper getTargetDiagramElements(ctx : genModel::GenAuditContext) : Sequence(genModel::GenCommonBase) {
+ return (ctx.ruleTargets)[genModel::GenDiagramElementTarget].element->asOrderedSet()->asSequence()
+}
+
+helper getAllTargetDiagramElements(root : genModel::GenAuditRoot) : Sequence(genModel::GenCommonBase) {
+ return root.clientContexts->collect(it | getTargetDiagramElements(it))->asOrderedSet()->asSequence()
+}
+

Back to the top