aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2009-02-23 13:46:23 -0500
committerashatalin2009-02-23 13:46:23 -0500
commita974895dcf90b8a1e8a8da6161b08da22749f422 (patch)
tree4de13ebf0432ef89b88884a3ee6a5b5234952933
parentc70959f539113fc09d3ece86d3926514b6944ab0 (diff)
downloadorg.eclipse.gmf-tooling-a974895dcf90b8a1e8a8da6161b08da22749f422.tar.gz
org.eclipse.gmf-tooling-a974895dcf90b8a1e8a8da6161b08da22749f422.tar.xz
org.eclipse.gmf-tooling-a974895dcf90b8a1e8a8da6161b08da22749f422.zip
- native libraries used in GMF code generation was repackaged
- .nativestubs .qvto root added with stabs for all native libraries - can be used during compile time
-rw-r--r--plugins/org.eclipse.gmf.codegen/.xpand-root4
-rw-r--r--plugins/org.eclipse.gmf.codegen/plugin.xml15
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/EmfUtils.java42
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates-dynmodel.migrated/MetaModel.xpt2
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.qvto3
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.xpt3
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt2
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/EMFUtils.qvto3
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto2
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt2
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt12
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementInitializers.xpt2
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MetricProvider.xpt3
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/Metrics.qvto2
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ValidationProvider.xpt1
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/CodeGenerationUtils.qvto37
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/EMFUtils.qvto27
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/GenModelUtils.qvto48
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/NativeMetaModel.java8
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/CodeGenerationUtils.java40
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/EMFUtils.java31
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/GenModelUtils.java (renamed from plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/GenModelUtils.java)45
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeEMFUtils.java9
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeGenAuditRoot.java7
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeGenModelUtils.java15
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/navigator/NativeUtils.java7
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/providers/NativeMetrics.java7
30 files changed, 234 insertions, 157 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/.xpand-root b/plugins/org.eclipse.gmf.codegen/.xpand-root
index b80e35d95..1d895312d 100644
--- a/plugins/org.eclipse.gmf.codegen/.xpand-root
+++ b/plugins/org.eclipse.gmf.codegen/.xpand-root
@@ -1,2 +1,2 @@
-templates.migrated
-templates-dynmodel.migrated, templates.migrated/
+templates.migrated, templates.nativestubs
+templates-dynmodel.migrated, templates.migrated, templates.nativestubs
diff --git a/plugins/org.eclipse.gmf.codegen/plugin.xml b/plugins/org.eclipse.gmf.codegen/plugin.xml
index e0bf44ddb..6fa48ff16 100644
--- a/plugins/org.eclipse.gmf.codegen/plugin.xml
+++ b/plugins/org.eclipse.gmf.codegen/plugin.xml
@@ -104,11 +104,14 @@
</extension>
<extension point="org.eclipse.m2m.qvt.oml.javaBlackboxUnits">
- <library class="xpt.providers.NativeMetrics"><metamodel nsURI="http://www.eclipse.org/gmf/2008/GenModel"/><metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/></library>
- <library class="xpt.navigator.NativeUtils"><metamodel nsURI="http://www.eclipse.org/gmf/2008/GenModel"/><metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/><metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/></library>
- <library class="xpt.NativeGenModelUtils"><metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/><metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/></library>
- <library class="xpt.NativeGenAuditRoot"><metamodel nsURI="http://www.eclipse.org/gmf/2008/GenModel"/><metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/><metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/></library>
- <library class="xpt.NativeEMFUtils"><metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/></library>
- <library class="NativeMetaModel"><metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/><metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/></library>
+ <library class="org.eclipse.gmf.internal.codegen.util.GenModelUtils">
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/>
+ </library>
+ <library class="org.eclipse.gmf.internal.codegen.util.EMFUtils">
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/>
+ </library>
+ <library class="org.eclipse.gmf.internal.codegen.util.CodeGenerationUtils">
+ </library>
</extension>
</plugin>
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/EmfUtils.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/EmfUtils.java
deleted file mode 100644
index 6a514bc4e..000000000
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/EmfUtils.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2007 Borland Software Corp.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-package org.eclipse.gmf.internal.codegen.util;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer;
-import org.eclipse.gmf.internal.common.codegen.Conversions;
-
-public class EmfUtils {
-
- public static final List<EObject> getReferencingObjects(EObject target) {
- LinkedList<EObject> result = new LinkedList<EObject>();
- Collection<EStructuralFeature.Setting> settings = CrossReferencer.find(target.eResource().getContents()).get(target);
- if (settings == null) {
- return Collections.emptyList();
- }
- for (Setting setting : settings) {
- result.add(setting.getEObject());
- }
- return result;
- }
-
- public static final String toStringLiteral(String s) {
- return Conversions.toStringLiteral(s);
- }
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates-dynmodel.migrated/MetaModel.xpt b/plugins/org.eclipse.gmf.codegen/templates-dynmodel.migrated/MetaModel.xpt
index 820889ff3..7babe75e5 100644
--- a/plugins/org.eclipse.gmf.codegen/templates-dynmodel.migrated/MetaModel.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates-dynmodel.migrated/MetaModel.xpt
@@ -16,7 +16,7 @@
«EXTENSION Facility»
«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::NativeGenModelUtils»
+«EXTENSION org::eclipse::gmf::internal::codegen::util::GenModelUtils»
// XXX is isExternalInterface use valid here, won't all objects be just EObject?
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.qvto
index 066317b60..8c851466b 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.qvto
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.qvto
@@ -10,9 +10,8 @@
* Artem Tikhomirov (Borland) - initial API and implementation
*/
import xpt.StringOperations;
-import NativeMetaModel;
-
import xpt.GenModelUtils;
+import org.eclipse.gmf.internal.codegen.util.CodeGenerationUtils;
modeltype genModel uses "http://www.eclipse.org/emf/2002/GenModel";
modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.xpt
index 8602e7035..93c87df52 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/MetaModel.xpt
@@ -16,8 +16,7 @@
«EXTENSION MetaModel»
«EXTENSION xpt::GenModelUtils»
-«EXTENSION NativeMetaModel»
-«EXTENSION xpt::NativeGenModelUtils»
+«EXTENSION org::eclipse::gmf::internal::codegen::util::GenModelUtils»
/*
* Does instanceof check.
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt
index 9fd68e5ec..dbb98dd7b 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt
@@ -13,7 +13,7 @@
«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
«EXTENSION xpt::GenAuditRoot»
«EXTENSION xpt::GenEditorGenerator»
-«EXTENSION xpt::NativeGenAuditRoot»
+«EXTENSION org::eclipse::gmf::internal::codegen::util::CodeGenerationUtils»
«DEFINE extensions FOR gmfgen::GenEditorGenerator-»
«IF hasAudits(self)»«EXPAND extensions FOR audits»«ENDIF-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/EMFUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/EMFUtils.qvto
deleted file mode 100644
index 5c31c9afb..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/EMFUtils.qvto
+++ /dev/null
@@ -1,3 +0,0 @@
-library EMFUtils;
-
-
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto
index 725ac349e..f314ceadc 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto
@@ -1,4 +1,4 @@
-import xpt.NativeGenModelUtils;
+import org.eclipse.gmf.internal.codegen.util.GenModelUtils;
import xpt.StringOperations;
modeltype genModel uses "http://www.eclipse.org/emf/2002/GenModel";
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
index b7ef6ca8c..4d9bfe8ba 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
@@ -9,9 +9,7 @@
* Contributors:
* Dmitry Stadnik (Borland) - initial API and implementation
*/
-import xpt.NativeGenModelUtils;
-
-import xpt.GenModelUtils;
+import org.eclipse.gmf.internal.codegen.util.GenModelUtils;
modeltype gmfgen uses "http://www.eclipse.org/gmf/2008/GenModel";
modeltype notation uses "http://www.eclipse.org/gmf/runtime/1.0.2/notation";
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt
index 2bcb9cb66..3778df79b 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt
@@ -18,7 +18,7 @@
«EXTENSION xpt::diagram::updater::Utils»
«EXTENSION xpt::diagram::editpolicies::LinkUtils»
«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::NativeGenModelUtils»
+«EXTENSION org::eclipse::gmf::internal::codegen::util::GenModelUtils»
«DEFINE DiagramUpdater FOR gmfgen::GenDiagramUpdater-»
«EXPAND xpt::Common::copyright FOR editorGen-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto
index e6716d8b8..4a355e60b 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto
@@ -1,6 +1,4 @@
-import xpt.NativeGenModelUtils;
-
-import xpt.GenModelUtils;
+import org.eclipse.gmf.internal.codegen.util.GenModelUtils;
modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
modeltype genModel_1 uses "http://www.eclipse.org/emf/2002/GenModel";
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt
index bd55cdc4a..9e8a05070 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt
@@ -13,7 +13,7 @@
«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
«EXTENSION xpt::navigator::Utils»
-«EXTENSION xpt::navigator::NativeUtils»
+«EXTENSION org::eclipse::gmf::internal::codegen::util::CodeGenerationUtils»
«DEFINE NavigatorContentProvider FOR gmfgen::GenNavigator-»
«EXPAND xpt::Common::copyright FOR editorGen-»
@@ -388,22 +388,22 @@ private java.util.Collection getForeignShortcuts(org.eclipse.gmf.runtime.notatio
«DEFINE createEditingDomain FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain()«ENDDEFINE»
«DEFINE initGroupVariables(navigator : gmfgen::GenNavigator, _references : Sequence(gmfgen::GenNavigatorChildReference), parentVarName : String, contextElement : gmfgen::GenCommonBase) FOR String-»
- «navigator.getNavigatorGroupQualifiedClassName()» «asValidJavaIdentifier(self)» = new «navigator.getNavigatorGroupQualifiedClassName()»(
+ «navigator.getNavigatorGroupQualifiedClassName()» «validJavaIdentifier(self)» = new «navigator.getNavigatorGroupQualifiedClassName()»(
«EXPAND xpt::Externalizer::accessorCall(i18nKeyForGroup(self, contextElement)) FOR navigator.editorGen»,
"«getNavigatorReference(self, _references).groupIcon»", «parentVarName»); «EXPAND xpt::Common::nonNLS»
«ENDDEFINE»
-«DEFINE addNavigatorItemsPrefix FOR gmfgen::GenNavigatorChildReference»«IF isInsideGroup()»«asValidJavaIdentifier(groupName)».addChildren(«ELSE»result.addAll(«ENDIF»createNavigatorItems(«ENDDEFINE»
+«DEFINE addNavigatorItemsPrefix FOR gmfgen::GenNavigatorChildReference»«IF isInsideGroup()»«validJavaIdentifier(groupName)».addChildren(«ELSE»result.addAll(«ENDIF»createNavigatorItems(«ENDDEFINE»
«DEFINE addNavigatorItemsSuffix(parentVarName : String, isLeaf : Boolean) FOR gmfgen::GenNavigatorChildReference-»
-, «IF isInsideGroup()»«asValidJavaIdentifier(groupName)»«ELSE»«parentVarName»«ENDIF», «isLeaf»));
+, «IF isInsideGroup()»«validJavaIdentifier(groupName)»«ELSE»«parentVarName»«ENDIF», «isLeaf»));
«ENDDEFINE»
«DEFINE addGroups(_references : Sequence(gmfgen::GenNavigatorChildReference)) FOR String-»
«LET getNavigatorReference(self, _references) AS ref-»
«IF ref.hideIfEmpty-»
- if (!«asValidJavaIdentifier(self)».isEmpty()) {«ENDIF-»
- result.add(«asValidJavaIdentifier(self)»);
+ if (!«validJavaIdentifier(self)».isEmpty()) {«ENDIF-»
+ result.add(«validJavaIdentifier(self)»);
«IF ref.hideIfEmpty-»
}«ENDIF-»
«ENDLET-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto
index 18631d24e..d586c035f 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto
@@ -1,4 +1,4 @@
-import xpt.navigator.NativeUtils;
+import org.eclipse.gmf.internal.codegen.util.CodeGenerationUtils;
modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
modeltype genModel_1 uses "http://www.eclipse.org/emf/2002/GenModel";
@@ -55,7 +55,7 @@ helper getDiagramTopReference(navigator : genModel::GenNavigator) : genModel::Ge
helper i18nKeyForGroup(groupName : String, contextElement : genModel::GenCommonBase) : String {
- return 'NavigatorGroupName.' + (if null <> contextElement then contextElement.getUniqueIdentifier() else 'File' endif) + '.' + asValidJavaIdentifier(groupName)
+ return 'NavigatorGroupName.' + (if null <> contextElement then contextElement.getUniqueIdentifier() else 'File' endif) + '.' + validJavaIdentifier(groupName)
}
helper i18nKeyForOpenDiagramActionName() : String {
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementInitializers.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementInitializers.xpt
index 202992cfe..42f1ba7a9 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementInitializers.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementInitializers.xpt
@@ -19,7 +19,7 @@
«EXTENSION xpt::providers::ElementInitializers»
«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::NativeGenModelUtils»
+«EXTENSION org::eclipse::gmf::internal::codegen::util::GenModelUtils»
«EXTENSION xpt::StringOperations»
«DEFINE ElementInitializers FOR gmfgen::GenDiagram-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MetricProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MetricProvider.xpt
index 9218d3408..dc97ae4a5 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MetricProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MetricProvider.xpt
@@ -16,10 +16,9 @@
«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::EMFUtils»
«EXTENSION xpt::providers::Metrics»
«EXTENSION xpt::StringOperations»
-«EXTENSION xpt::NativeEMFUtils»
+«EXTENSION org::eclipse::gmf::internal::codegen::util::CodeGenerationUtils»
«DEFINE MetricProvider FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::copyright FOR editorGen-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/Metrics.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/Metrics.qvto
index 5b8868b63..10d481cac 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/Metrics.qvto
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/Metrics.qvto
@@ -1,4 +1,4 @@
-import xpt.providers.NativeMetrics;
+import org.eclipse.gmf.internal.codegen.util.CodeGenerationUtils;
modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ValidationProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ValidationProvider.xpt
index 4a5019174..087747ee6 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ValidationProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ValidationProvider.xpt
@@ -16,7 +16,6 @@
«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::EMFUtils»
«EXTENSION xpt::GenAuditRoot»
«EXTENSION xpt::GenEditorGenerator»
«EXTENSION xpt::StringOperations»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/CodeGenerationUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/CodeGenerationUtils.qvto
new file mode 100644
index 000000000..3ba2b6fc9
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/CodeGenerationUtils.qvto
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2009 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+library CodeGenerationUtils;
+
+/*
+ * This file contains a set of qvto queries duplicating corresponding queries
+ * from same native library and can be important to compile corresponding
+ * templates in a workspace.
+ *
+ * This file should NOT be deployed to final .jar - original native library
+ * implementation (registered via plugin.xml) should be used on execution time.
+ */
+
+helper toStringLiteral(stringValue : String) : String {
+ return null;
+}
+
+helper escapeXML(stringValue : String) : String {
+ return null;
+}
+
+helper safeName(stringValue : String) : String {
+ return null;
+}
+
+helper validJavaIdentifier(stringValue : String) : String {
+ return null;
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/EMFUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/EMFUtils.qvto
new file mode 100644
index 000000000..69a5896c4
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/EMFUtils.qvto
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2009 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
+
+library EMFUtils;
+
+/*
+ * This file contains a set of qvto queries duplicating corresponding queries
+ * from same native library and can be important to compile corresponding
+ * templates in a workspace.
+ *
+ * This file should NOT be deployed to final .jar - original native library
+ * implementation (registered via plugin.xml) should be used on execution time.
+ */
+
+helper getReferencingObjects(target : ecore::EObject) : Sequence(ecore::EObject) {
+ return null;
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/GenModelUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/GenModelUtils.qvto
new file mode 100644
index 000000000..2ea0ed952
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.nativestubs/org/eclipse/gmf/internal/codegen/util/GenModelUtils.qvto
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2009 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+modeltype genModel uses "http://www.eclipse.org/emf/2002/GenModel";
+modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
+
+library GenModelUtils;
+
+/*
+ * This file contains a set of qvto queries duplicating corresponding queries
+ * from same native library and can be important to compile corresponding
+ * templates in a workspace.
+ *
+ * This file should NOT be deployed to final .jar - original native library
+ * implementation (registered via plugin.xml) should be used on execution time.
+ */
+
+helper getDocumentRoot(genPackage : genmodel::GenPackage) : genmodel::GenClass {
+ return null;
+}
+
+helper findGenClassifier(genModel : genmodel::GenModel, eClassifier : ecore::EClassifier) : genmodel::GenClassifier {
+ return null;
+}
+
+helper isListType(genFeature : genmodel::GenFeature) : Boolean {
+ return null;
+}
+
+helper isDerived(genFeature : genmodel::GenFeature) : Boolean {
+ return null;
+}
+
+helper getTypeGenClassX(genFeature : genmodel::GenFeature) : genmodel::GenClass {
+ return null;
+}
+
+helper getGetAccessor(genFeature : genmodel::GenFeature) : String {
+ return null;
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/NativeMetaModel.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/NativeMetaModel.java
deleted file mode 100644
index 112db4271..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/NativeMetaModel.java
+++ /dev/null
@@ -1,8 +0,0 @@
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
-public class NativeMetaModel {
-@Operation(contextual = false, kind = Kind.HELPER)
-public static String getGetAccessor(org.eclipse.emf.codegen.ecore.genmodel.GenFeature gf) { return org.eclipse.gmf.internal.codegen.util.GenModelUtils.getGetAccessor(gf); }
-@Operation(contextual = false, kind = Kind.HELPER)
-public static String safeName(String name) { return org.eclipse.emf.codegen.util.CodeGenUtil.safeName(name); }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/CodeGenerationUtils.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/CodeGenerationUtils.java
new file mode 100644
index 000000000..fd4759a05
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/CodeGenerationUtils.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2009 Borland Software Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.internal.codegen.util;
+
+import org.eclipse.gmf.internal.common.codegen.Conversions;
+import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
+import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
+
+public class CodeGenerationUtils {
+
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static String toStringLiteral(String stringValue) {
+ return Conversions.toStringLiteral(stringValue);
+ }
+
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static String escapeXML(String stringValue) {
+ return org.eclipse.gmf.internal.common.codegen.Conversions.escapeXML(stringValue);
+ }
+
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static String safeName(String name) {
+ return org.eclipse.emf.codegen.util.CodeGenUtil.safeName(name);
+ }
+
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static String validJavaIdentifier(String identifier) {
+ return org.eclipse.emf.codegen.util.CodeGenUtil.validJavaIdentifier(identifier);
+ }
+
+}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/EMFUtils.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/EMFUtils.java
new file mode 100644
index 000000000..f35d87305
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/EMFUtils.java
@@ -0,0 +1,31 @@
+package org.eclipse.gmf.internal.codegen.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer;
+import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
+import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
+import org.eclipse.ocl.util.CollectionUtil;
+
+public class EMFUtils {
+
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static List<EObject> getReferencingObjects(EObject target) {
+ Collection<EStructuralFeature.Setting> settings = CrossReferencer.find(target.eResource().getContents()).get(target);
+ if (settings == null) {
+ return CollectionUtil.<EObject> createNewSequence(Collections.<EObject> emptyList());
+ }
+ List<EObject> result = new ArrayList<EObject>();
+ for (Setting setting : settings) {
+ result.add(setting.getEObject());
+ }
+ return CollectionUtil.<EObject> createNewSequence(result);
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/GenModelUtils.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/GenModelUtils.java
index 357f5fddb..ef52b53a4 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/GenModelUtils.java
+++ b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/org/eclipse/gmf/internal/codegen/util/GenModelUtils.java
@@ -1,14 +1,3 @@
-/**
- * Copyright (c) 2007 Borland Software Corp.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
package org.eclipse.gmf.internal.codegen.util;
import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
@@ -17,33 +6,41 @@ import org.eclipse.emf.codegen.ecore.genmodel.GenFeature;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
+import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
public class GenModelUtils {
-
- public static final String getGetAccessor(GenFeature feature) {
- return feature.getGetAccessor();
- }
-
- public static final GenClassifier findGenClassifier(GenModel genModel, EClassifier eClassifier) {
- return genModel.findGenClassifier(eClassifier);
- }
+ @Operation(contextual = false, kind = Kind.HELPER)
public static GenClass getDocumentRoot(GenPackage genPackage) {
return genPackage.hasDocumentRoot() ? genPackage.getDocumentRoot() : null;
}
- public static boolean isListType(GenFeature genFeature) {
- // can't implement in .ext because
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static GenClassifier findGenClassifier(GenModel genModel, EClassifier eClassifier) {
+ return genModel.findGenClassifier(eClassifier);
+ }
+
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static Boolean isListType(GenFeature genFeature) {
+ // can't implement in .qvto because
// XMLTypePackage.eNS_URI.equals(getExtendedMetaData().getNamespace((EStructuralFeature)eTypedElement));
// part of the check seems to be essential
return genFeature.isListType();
}
- public static boolean isDerived(GenFeature genFeature) {
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static Boolean isDerived(GenFeature genFeature) {
return genFeature.isDerived();
}
- public static GenClass getTypeGenClass(GenFeature genFeature) {
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static GenClass getTypeGenClassX(GenFeature genFeature) {
return genFeature.getTypeGenClass();
}
-}
+
+ @Operation(contextual = false, kind = Kind.HELPER)
+ public static String getGetAccessor(GenFeature genFeature) {
+ return genFeature.getGetAccessor();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeEMFUtils.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeEMFUtils.java
deleted file mode 100644
index 535bfc2e2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeEMFUtils.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package xpt;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
-public class NativeEMFUtils {
-@Operation(contextual = false, kind = Kind.HELPER)
-public static java.util.List<org.eclipse.emf.ecore.EObject> getReferencingObjects(org.eclipse.emf.ecore.EObject target) { return org.eclipse.ocl.util.CollectionUtil.<org.eclipse.emf.ecore.EObject> createNewSequence(org.eclipse.gmf.internal.codegen.util.EmfUtils.getReferencingObjects(target)); }
-@Operation(contextual = false, kind = Kind.HELPER)
-public static String toStringLiteral(String strValue) { return org.eclipse.gmf.internal.codegen.util.EmfUtils.toStringLiteral(strValue); }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeGenAuditRoot.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeGenAuditRoot.java
deleted file mode 100644
index bda6a1d4c..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeGenAuditRoot.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package xpt;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
-public class NativeGenAuditRoot {
-@Operation(contextual = false, kind = Kind.HELPER)
-public static String escapeXML(String s) { return org.eclipse.gmf.internal.common.codegen.Conversions.escapeXML(s); }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeGenModelUtils.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeGenModelUtils.java
deleted file mode 100644
index 17d396705..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/NativeGenModelUtils.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package xpt;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
-public class NativeGenModelUtils {
-@Operation(contextual = false, kind = Kind.HELPER)
-public static org.eclipse.emf.codegen.ecore.genmodel.GenClass getDocumentRoot(org.eclipse.emf.codegen.ecore.genmodel.GenPackage gp) { return org.eclipse.gmf.internal.codegen.util.GenModelUtils.getDocumentRoot(gp); }
-@Operation(contextual = false, kind = Kind.HELPER)
-public static org.eclipse.emf.codegen.ecore.genmodel.GenClassifier findGenClassifier(org.eclipse.emf.codegen.ecore.genmodel.GenModel genModel, org.eclipse.emf.ecore.EClassifier eClassifier) { return org.eclipse.gmf.internal.codegen.util.GenModelUtils.findGenClassifier(genModel, eClassifier); }
-@Operation(contextual = false, kind = Kind.HELPER)
-public static Boolean isListType(org.eclipse.emf.codegen.ecore.genmodel.GenFeature feature) { return org.eclipse.gmf.internal.codegen.util.GenModelUtils.isListType(feature); }
-@Operation(contextual = false, kind = Kind.HELPER)
-public static Boolean isDerived(org.eclipse.emf.codegen.ecore.genmodel.GenFeature feature) { return org.eclipse.gmf.internal.codegen.util.GenModelUtils.isDerived(feature); }
-@Operation(contextual = false, kind = Kind.HELPER)
-public static org.eclipse.emf.codegen.ecore.genmodel.GenClass getTypeGenClassX(org.eclipse.emf.codegen.ecore.genmodel.GenFeature feature) { return org.eclipse.gmf.internal.codegen.util.GenModelUtils.getTypeGenClass(feature); }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/navigator/NativeUtils.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/navigator/NativeUtils.java
deleted file mode 100644
index 64fdd44c6..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/navigator/NativeUtils.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package xpt.navigator;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
-public class NativeUtils {
-@Operation(contextual = false, kind = Kind.HELPER)
-public static String asValidJavaIdentifier(String identifier) { return org.eclipse.emf.codegen.util.CodeGenUtil.validJavaIdentifier(identifier); }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/providers/NativeMetrics.java b/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/providers/NativeMetrics.java
deleted file mode 100644
index 7a05d904e..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.qvtlib/xpt/providers/NativeMetrics.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package xpt.providers;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation;
-import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
-public class NativeMetrics {
-@Operation(contextual = false, kind = Kind.HELPER)
-public static String validJavaIdentifier(String identifier) { return org.eclipse.emf.codegen.util.CodeGenUtil.validJavaIdentifier(identifier); }
-} \ No newline at end of file