diff options
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen')
28 files changed, 0 insertions, 4431 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.classpath b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.classpath deleted file mode 100644 index 661ef4bb0e8..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="generation-classes-helper-src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.project b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.project deleted file mode 100644 index fa54661acff..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.sysml.sysmloveruml.codegen</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.settings/org.eclipse.jdt.core.prefs b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index cc0129caebe..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Wed Sep 07 16:57:36 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.settings/org.eclipse.jdt.ui.prefs b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 95c12364292..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Wed Sep 07 16:57:36 CEST 2011
-eclipse.preferences.version=1
-formatter_settings_version=12
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/META-INF/MANIFEST.MF deleted file mode 100644 index f89877df59e..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.sysml.sysmloveruml.codegen,
- org.eclipse.papyrus.sysml.sysmloveruml.codegen.core,
- org.eclipse.papyrus.sysml.sysmloveruml.codegen.utils
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf.common;bundle-version="2.7.0",
- org.eclipse.jet;bundle-version="1.1.1",
- org.eclipse.emf.ecore;bundle-version="2.8.0",
- org.eclipse.emf.codegen.ecore;bundle-version="2.8.0"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.1.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Activator: org.eclipse.papyrus.sysml.sysmloveruml.codegen.SysML
- OverUMLGeneratorPlugin$Implementation
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.sysmloveruml.codegen;si
- ngleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/about.html b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/about.html deleted file mode 100644 index 82d49bf5f81..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/build.properties b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/build.properties deleted file mode 100644 index 0d535357068..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -source.. = src/,\
- generation-classes-helper-src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- templates/,\
- plugin.xml,\
- generation-classes-helper-src/
-src.includes = templates/
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/generation-classes-helper-src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/generationUtils/SysMLOverUMLHelper.java b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/generation-classes-helper-src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/generationUtils/SysMLOverUMLHelper.java deleted file mode 100644 index 101a2fd4e24..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/generation-classes-helper-src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/generationUtils/SysMLOverUMLHelper.java +++ /dev/null @@ -1,421 +0,0 @@ -/**
- * Copyright (c) 2011 Atos.
- *
- * 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:
- * Atos - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.sysml.sysmloveruml.codegen.generationUtils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
-import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
-import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * Helper class for generation
- *
- * @author "Arthur Daussy <a href="mailto:arthur.daussy@atos.net
- * ">arthur.daussy@atos.net</a>"
- *
- */
-public class SysMLOverUMLHelper {
-
- /**
- * Get all the based element of all the element of the package sorted by the
- * Classifer_ID of their based element
- *
- * @param genPackage
- * {@link GenPackage}
- * @return {@link TreeMap} of the all the based element sorted by the
- * classifier_ID of their based element
- */
- public static TreeMap<String, List<GenClass>> getSortedBasedElementFromPackage(GenPackage genPackage) {
- TreeMap<String, List<GenClass>> result = new TreeMap<String, List<GenClass>>();
- for (GenClass genClass : genPackage.getGenClasses()) {
- /**
- * Get all the based element for this class
- */
- List<EClass> basedElements = getBasedElement(genClass.getEcoreClass());
- /**
- * Register in the registery by EClass classifier
- */
- for (EClass basedClass : basedElements) {
- List<GenClass> list = result.get(basedClass.getName());
- if (list == null) {
- result.put(basedClass.getName(), new ArrayList<GenClass>(Collections.singletonList(genClass)));
- } else {
- list.add(genClass);
- }
- }
- }
- return result;
- }
-
- /**
- * Get the list of all EClass from the UML metamodel present in the SysML
- * language
- *
- * @param genModel
- * @return {@link Set} of all UML EClass present in the sysml language
- */
- public static Set<EClass> getAllUMLElementNameFromModel(GenModel genModel) {
- Set<EClass> result = new HashSet<EClass>();
- for (GenPackage genPackage : genModel.getAllGenPackagesWithConcreteClasses()) {
- for (GenClass genClass : genPackage.getGenClasses()) {
- /**
- * Get all the based element for this class
- */
- List<EClass> basedElements = getBasedElement(genClass.getEcoreClass());
- /**
- * Register in the registery by EClass classifier
- */
- for (EClass basedClass : basedElements) {
- result.add(basedClass);
- }
- }
- }
- return result;
- }
-
- /**
- * Get all the based element of all the element of the model sorted by the
- * Classifer_ID of their based element
- *
- * @param genModel
- * {@link GenModel}
- * @return {@link TreeMap} of the all the based element sorted by the
- * classifier_ID of their based element
- */
- public static TreeMap<String, Set<GenPackage>> getSortedEClassBasedElementFromModel(GenModel genModel) {
- TreeMap<String, Set<GenPackage>> result = new TreeMap<String, Set<GenPackage>>();
- for (GenPackage genPackage : genModel.getAllGenPackagesWithConcreteClasses()) {
- for (GenClass genClass : genPackage.getGenClasses()) {
- /**
- * Get all the based element for this class
- */
- List<EClass> basedElements = getBasedElement(genClass.getEcoreClass());
- /**
- * Register in the registery by EClass classifier
- */
- for (EClass basedClass : basedElements) {
- final Set<GenPackage> set = result.get(getClassifierCorrectLabel(basedClass.getName()));
- if (set != null) {
- set.add(genClass.getGenPackage());
- } else {
- result.put(getClassifierCorrectLabel(basedClass.getName()), new HashSet<GenPackage>(Collections.singletonList(genClass.getGenPackage())));
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Get the name of the test function for uml element in sysml langage
- * Example : protected boolean isBlock ( Class clazz) { ... }
- *
- * @param genClass
- * @return the name of the function
- */
- public static String getIsXFromYLabelFunction(GenClass genClass, EClass basedClass) {
- return "is" + genClass.getClassifierAccessorName() + "From" //$NON-NLS-1$ //$NON-NLS-2$
- + basedClass.getName();//
- }
-
- /**
- * Get the name of the case function for uml element in sysml language
- * Example : public T caseClassStereotypedByBlock(Class object) {...}
- *
- * @param genClass
- * @param basedClass
- * @return
- */
- public static String getCaseXStereotypedByYLabelFunction(GenClass genClass, EClass basedClass) {
- return getCaseXStereotypedByYLabelFunction(genClass, basedClass.getName());
- }
-
- /**
- * Get the name of the case function for uml element in sysml language
- * Example : public T caseClassStereotypedByBlock(Class object) {...}
- *
- * @param genClass
- * @param String
- * based class name
- * @return
- */
- public static String getCaseXStereotypedByYLabelFunction(GenClass genClass, String basedClassName) {
- return "case" + basedClassName + "StereotypedBy" //$NON-NLS-1$ //$NON-NLS-2$
- + genClass.getClassifierAccessorName();////$NON-NLS-
- }
-
- /**
- * Get the variablele anme for the isXFromY methods
- *
- * @param eClass
- * @return
- */
- public static String getBasedClassVariableName(EClass eClass) {
- return setFirstLetterToLowerCase(eClass.getName()) + "_"; //$NON-NLS-1$
- }
-
- /**
- * Get the based elements from a stereotype application EObject. (copied
- * from org.eclipse.emf.compare.sysml.codegen)
- *
- * @param eClass
- * {@link EClass} of the based element of the stereotype
- * @return The basedElement or empty list
- */
- public static List<EClass> getBasedElement(EClass eClass) {
- if (eClass != null) {
- final EList<EStructuralFeature> structuralFeatures = eClass.getEStructuralFeatures();
- final ArrayList<EClass> basedElements = new ArrayList<EClass>();
- for (EStructuralFeature struc : structuralFeatures) {
- if (struc.getName().startsWith("base_")) { //$NON-NLS-1$
- final EClassifier attType = struc.getEType();
- if (attType instanceof EClass) {
- basedElements.add((EClass) attType);
- }
- }
- }
- if (basedElements.isEmpty()) {
- /**
- * If no based class found look into the super EClass Handle for
- * exmaple the constriant block example.
- * |Class|<-|Block]<-|ConstraintBlock|
- */
- EList<EClass> superEclasses = eClass.getESuperTypes();
- if (superEclasses == null || superEclasses.isEmpty()) {
- return Collections.emptyList();
- } else {
- for (EClass superEClass : superEclasses) {
- basedElements.addAll(getBasedElement(superEClass));
- }
- }
- }
- return basedElements;
- }
- return Collections.emptyList();
- }
-
- /**
- * get the complete name of Uml interfaces ex: org.eclipse.uml.Class
- *
- * @param eClass
- * @return
- */
- public static String getUMLInterfaceName(EClass eClass) {
- return "org.eclipse.uml2.uml." + eClass.getName(); //$NON-NLS-1$
- }
-
- /**
- * Get the classifier label of this structural feature
- *
- * @param feature
- * @param basedClass
- * @return
- */
- public static String getEStructuralFeatureClassifier(EStructuralFeature feature, EClass basedClass) {
- return getClassifierCorrectLabel(basedClass) + "__" + getClassifierCorrectLabel(feature.getName());
- }
-
- /**
- * Get the base feature name Example: For Requirement -> "getBase_Class()"
- *
- * @param stereotypeClass
- * @param basedClass
- * @return
- */
- public static String getBase_ElementMethodName(EClass stereotypeClass, EClass basedClass) {
- String result = ""; //$NON-NLS-1$
- if (stereotypeClass != null && basedClass != null) {
- final EList<EStructuralFeature> structuralFeatures = stereotypeClass.getEStructuralFeatures();
- for (EStructuralFeature feature : structuralFeatures) {
- EClassifier classifier = feature.getEType();
- if (classifier instanceof EClass) {
- String featureName = feature.getName();
- if (((EClass) classifier).equals(basedClass) && featureName.startsWith("base_")) { //$NON-NLS-1$
- return getQualifiedBasedMethodName(featureName);
- }
- }
- }
- }
- /**
- * Look into super type TODO Check if it work with two super type
- */
- for (EClass superType : stereotypeClass.getESuperTypes()) {
- result = getBase_ElementMethodName(superType, basedClass);
- if (result != null && !("".equals(result))) { //$NON-NLS-1$
- return result;
- }
- }
- return "ErrorNotbaseMethodFound(look into SysMLOverUMLHelper#getBase_ElementMethodName)"; //$NON-NLS-1$
- }
-
- /**
- * Get the qualified name of the method to get the based element Example:
- * Block -> return "getBase_Class"
- *
- * @param featureName
- * @return
- */
- private static String getQualifiedBasedMethodName(String featureName) {
- return "get" + setFirstLetterToUpperCase(featureName); //$NON-NLS-1$
- }
-
- /**
- * Set the first letter of the word to upper case
- *
- * @param s
- * @return
- */
- private static String setFirstLetterToUpperCase(String s) {
- StringBuilder result = new StringBuilder(s);
- Character first = result.charAt(0);
- result.setCharAt(0, Character.toUpperCase(first));
- return result.toString();
- }
-
- /**
- * get the displayed name as it is displayed with UML Item provider
- *
- * @param eClass
- * @return
- */
- public static String getDisplayedClassName(EClass eClass) {
- return setFirstLetterToLowerCase(eClass.getName());
- }
-
- /**
- * Set the first letter of the word to upper case
- *
- * @param s
- * @return
- */
- private static String setFirstLetterToLowerCase(String s) {
- StringBuilder result = new StringBuilder(s);
- Character first = result.charAt(0);
- result.setCharAt(0, Character.toLowerCase(first));
- return result.toString();
- }
-
- /**
- * Get the qualified name (in the UML way) of the EClass example:
- * SysML::Block::block
- *
- * @param eClass
- * @return
- */
- public static String getQualifiedUMLLikeName(EClass eClass) {
- String eClassName = eClass.getName();
- EPackage package_ = eClass.getEPackage();
- /**
- * Concat the packages names
- */
- String packageName = ""; //$NON-NLS-1$
- String packageNameAux = ""; //$NON-NLS-1$
- if (package_ != null) {
- packageName = new String(package_.getNsPrefix());
- packageName = packageName.concat("::").concat(eClassName); //$NON-NLS-1$
- while (package_.getESuperPackage() != null) {
- package_ = package_.getESuperPackage();
- packageNameAux = new String(package_.getNsPrefix());
- packageNameAux = packageNameAux.concat("::") //$NON-NLS-1$
- .concat(packageName);
- packageName = new String(packageNameAux);
- }
- }
- return packageName;
- }
-
- public static String getClassifierCorrectLabel(String classifier) {
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < classifier.length(); i++) {
- if (Character.isUpperCase(classifier.charAt(i)) && i > 0) {
- builder.append('_');
- }
- builder.append(classifier.charAt(i));
- }
- return builder.toString().toUpperCase();
- }
-
- public static String getElementTypeCorrectLabel(String classifier) {
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < classifier.length(); i++) {
- if (Character.isUpperCase(classifier.charAt(i)) && i > 0) {
- builder.append(' ');
- }
- builder.append(classifier.charAt(i));
- }
- return builder.toString();
- }
-
- /**
- * Get the correct label name of an {@link EClass} as it is written in UMLPackage.litterals
- * Example:
- *
- * EClass ActivityEdge -> return ACTIVITY_EDGE
- *
- * @param eClass
- * @return
- */
- public static String getClassifierCorrectLabel(EClass eClass) {
- return getClassifierCorrectLabel(eClass.getName());
- }
-
- /**
- * Get the correct label name of an {@link EClass} as it is written in plugins.properties to externalize strings
- * Example:
- *
- * EClass ActivityEdge -> return Activity Edge
- *
- * @param eClass
- * @return
- */
- public static String getElementTypeCorrectLabel(EClass eClass) {
- return getElementTypeCorrectLabel(eClass.getName());
- }
-
- /**
- * Get the package name with an adding string.
- *
- * @param genPackage
- * {@link GenClass}
- * @param elementName
- * {@link String} you want to add to create the apckage name
- * @return Package name
- */
- static String getXPackageName(GenModel genPackage, String elementName) {
- final String basePackage = genPackage.getInterfaceNamePattern();
- if (basePackage.length() > 0) {
- return basePackage + "." + elementName.toLowerCase(); //$NON-NLS-1$
- } else {
- return elementName.toLowerCase();
- }
- }
-
- public static String getAdapterFactoryRegistryPackageName() {
- return "org.eclipse.papyrus.sysml.registry"; //$NON-NLS-1$
- }
-
- public static String getAdapterFactoryRegistryClassName() {
- return "SysmlRegistryAdapterFactoryRegistry"; //$NON-NLS-1$
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/plugin.properties b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/plugin.properties deleted file mode 100644 index 602385467f1..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2011 Atos Origin.
-#
-# 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:
-# Atos Origin - Initial API and implementation
-#
-
-pluginName = Papyrus SysML Codegen
-providerName = Eclipse Modeling Project
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/plugin.xml b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/plugin.xml deleted file mode 100644 index 8feb7358095..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/plugin.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.emf.codegen.ecore.generatorAdapters">
- <adapterFactory
- class="org.eclipse.papyrus.sysml.sysmloveruml.codegen.core.SysMLOverUMLGenModelGeneratorAdapterFactory">
- </adapterFactory>
- </extension>
-
-</plugin>
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/pom.xml b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/pom.xml deleted file mode 100644 index 7d3bddeb50d..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>org.eclipse.papyrus</artifactId> - <groupId>org.eclipse.papyrus</groupId> - <version>1.1.0-SNAPSHOT</version> - <relativePath>../../../releng/top-pom-dev.xml</relativePath> - </parent> - <artifactId>org.eclipse.papyrus.sysml.sysmloveruml.codegen</artifactId> - <groupId>org.eclipse.papyrus</groupId> - <version>1.1.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project>
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/SysMLOverUMLGeneratorPlugin.java b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/SysMLOverUMLGeneratorPlugin.java deleted file mode 100644 index eb080306d59..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/SysMLOverUMLGeneratorPlugin.java +++ /dev/null @@ -1,75 +0,0 @@ -/**
- * Copyright (c) 2011 Atos.
- *
- * 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:
- * Atos - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.sysml.sysmloveruml.codegen;
-
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.emf.common.util.ResourceLocator;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class SysMLOverUMLGeneratorPlugin extends EMFPlugin {
-
- /**
- * The singleton instance of the plugin.
- */
- public static final SysMLOverUMLGeneratorPlugin INSTANCE = new SysMLOverUMLGeneratorPlugin();
-
- // The plug-in ID
- public static final String ID = "org.eclipse.papyrus.sysml.sysmloveruml.codegen"; //$NON-NLS-1$
-
- /**
- * The shared instance.
- */
- private static Implementation plugin;
-
- /**
- * Creates the singleton instance.
- */
- private SysMLOverUMLGeneratorPlugin() {
- super(new ResourceLocator[] {});
- }
-
- /*
- * Javadoc copied from base class.
- */
- @Override
- public ResourceLocator getPluginResourceLocator() {
- return plugin;
- }
-
- /**
- * Returns the singleton instance of the Eclipse plugin.
- *
- * @return the singleton instance.
- */
- public static Implementation getPlugin() {
- return plugin;
- }
-
- /**
- * The actual implementation of the Eclipse <b>Plugin</b>.
- */
- public static class Implementation extends EclipsePlugin {
-
- /**
- * Creates an instance.
- */
- public Implementation() {
- super();
- // Remember the static instance.
- //
- plugin = this;
- }
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/AbstractGeneratorAdaptor.java b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/AbstractGeneratorAdaptor.java deleted file mode 100644 index 1e0ce48505b..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/AbstractGeneratorAdaptor.java +++ /dev/null @@ -1,94 +0,0 @@ -/**
- * Copyright (c) 2011 Atos.
- *
- * 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:
- * Atos - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.sysml.sysmloveruml.codegen.core;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory;
-import org.eclipse.emf.codegen.ecore.genmodel.GenBase;
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
-import org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter;
-import org.eclipse.papyrus.sysml.sysmloveruml.codegen.utils.LabelHelper;
-
-/**
- * Abstract Generator adaptor. Used has based for future generator. it's
- * provide: -> A store mechanism of JETEmitter -> A condition mechanism which
- * select JETEmitter in function of the an argument which extends genBase
- *
- * @author "Arthur Daussy <a href="mailto:arthur.daussy@atos.net
- * ">arthur.daussy@atos.net</a>"
- * @param <T>
- */
-public abstract class AbstractGeneratorAdaptor<T extends GenBase> extends GenBaseGeneratorAdapter {
-
- /**
- * Map to store all JETEmitterDescriptor with their corresponding execution
- * condition.
- */
- protected Map<JETEmitterDescriptor, Condition<T>> jetEmitterMap = new HashMap<JETEmitterDescriptor, Condition<T>>();
-
- /**
- * Super implementation plus initialize the store.
- */
- public AbstractGeneratorAdaptor() {
- super();
- initializeJETEEMITTERDescriptorStore();
- }
-
- /**
- * Super implementation plus initialize the store.
- *
- * @param generatorAdapterFactory
- * See super implementation
- */
- public AbstractGeneratorAdaptor(GeneratorAdapterFactory generatorAdapterFactory) {
- super(generatorAdapterFactory);
- initializeJETEEMITTERDescriptorStore();
- }
-
- /**
- * Get the getJETEmitterDescriptors which are stored and which are
- * corresponding condition which is validate with the {@link GenClass} passed in argument.
- *
- * @param genBase
- * {@link GenBase} inherited element to compute the {@link JETEmitterDescriptor} according to conditions
- * @return List of all {@link JETEmitterDescriptor} which correspond to the {@link GenBase} element
- */
- protected JETEmitterDescriptor[] getJETEmitterDescriptors(T genBase) {
- final ArrayList<JETEmitterDescriptor> result = new ArrayList<JETEmitterDescriptor>();
- for (JETEmitterDescriptor descriptor : jetEmitterMap.keySet()) {
- if (jetEmitterMap.get(descriptor).canGenerate(genBase)) {
- result.add(descriptor);
- }
- }
- if (result.isEmpty()) {
- return new JETEmitterDescriptor[0];
- }
- return result.toArray(new JETEmitterDescriptor[result.size()]);
- }
-
- @Override
- protected void addBaseTemplatePathEntries(List<String> templatePath) {
- templatePath.add(LabelHelper.TEMPLATE_LOCATION);
- super.addBaseTemplatePathEntries(templatePath);
- }
-
- /**
- * Initialize all JETEmitterDescriptor with a condition of execution and put
- * it in jetEmitterMap.
- */
- protected abstract void initializeJETEEMITTERDescriptorStore();
-}
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/Condition.java b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/Condition.java deleted file mode 100644 index a5bd8918feb..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/Condition.java +++ /dev/null @@ -1,35 +0,0 @@ -/**
- * Copyright (c) 2011 Atos.
- *
- * 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:
- * Atos - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.sysml.sysmloveruml.codegen.core;
-
-import org.eclipse.emf.codegen.ecore.genmodel.GenBase;
-
-/**
- * Condition on a GenBase to say if a generator has to be used with this {@link GenBase}.
- *
- * @author Arthur Daussy <a
- * href="mailto:arthur.daussy@atos.net">arthur.daussy@atos.net</a>
- * @param <T>
- * Element inherited from {@link GenBase} to calculate the condition
- */
-public interface Condition<T extends GenBase> {
-
- /**
- * Tell if the condition is true with the parameter.
- *
- * @param gen
- * T
- * @return true if the condition relate to T is true
- */
- boolean canGenerate(T gen);
-}
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/Messages.java b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/Messages.java deleted file mode 100644 index d292a279963..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/Messages.java +++ /dev/null @@ -1,39 +0,0 @@ -/**
- * Copyright (c) 2011 Atos.
- *
- * 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:
- * Atos - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.sysml.sysmloveruml.codegen.core;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Externalize messages.
- *
- * @author "Arthur Daussy <a href="mailto:arthur.daussy@atos.net">arthur.daussy@atos.net</a>"
- *
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.sysml.sysmloveruml.codegen.core.messages"; //$NON-NLS-1$
-
- public static String SysMLOverUmlGenModelGenerator_GENERATOR_LABEL;
-
- public static String SysMLOverUmlGenModelGenerator_package;
-
- public static String SysMLOverUmlGenModelGenerator_SysMLAdapterFactoryRegisteryTemplate;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/SysMLOverUMLGenModelGeneratorAdapterFactory.java b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/SysMLOverUMLGenModelGeneratorAdapterFactory.java deleted file mode 100644 index c55ea33e4c1..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/SysMLOverUMLGenModelGeneratorAdapterFactory.java +++ /dev/null @@ -1,54 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos.
- *
- *
- * 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:
- * Atos - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.sysmloveruml.codegen.core;
-
-import org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapterFactory;
-import org.eclipse.emf.common.notify.Adapter;
-
-/**
- * @author "Arthur Daussy <a href="mailto:arthur.daussy@atos.net
- * ">arthur.daussy@atos.net</a>"
- *
- */
-public class SysMLOverUMLGenModelGeneratorAdapterFactory extends GenModelGeneratorAdapterFactory {
-
- @Override
- public Adapter createGenPackageAdapter() {
- return null;
- }
-
- @Override
- public Adapter createGenEnumAdapter() {
- return null;
- }
-
- @Override
- public Adapter createGenModelAdapter() {
- if (genPackageGeneratorAdapter == null) {
- genPackageGeneratorAdapter = new SysMLOverUmlGenModelGenerator(this);
- }
- return genPackageGeneratorAdapter;
- }
-
- /**
- * Define the new GenClassFatoryGeneratorAdaptor.
- *
- * @see org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapterFactory#createGenClassAdapter()
- * @return {@link Adapter}
- */
- @Override
- public Adapter createGenClassAdapter() {
- return null;
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/SysMLOverUmlGenModelGenerator.java b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/SysMLOverUmlGenModelGenerator.java deleted file mode 100644 index ddc52878d30..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/SysMLOverUmlGenModelGenerator.java +++ /dev/null @@ -1,77 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos.
- *
- *
- * 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:
- * Atos - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.sysmloveruml.codegen.core;
-
-import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory;
-import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.Monitor;
-import org.eclipse.papyrus.sysml.sysmloveruml.codegen.generationUtils.SysMLOverUMLHelper;
-
-/**
- * Generator for model elements.
- *
- * @author "Arthur Daussy <a href="mailto:arthur.daussy@atos.net">arthur.daussy@atos.net</a>"
- *
- */
-public class SysMLOverUmlGenModelGenerator extends AbstractGeneratorAdaptor<GenModel> {
-
- /**
- * Id.
- */
- private static final String GENERATOR_LABEL = Messages.SysMLOverUmlGenModelGenerator_GENERATOR_LABEL;
-
- /**
- * Name of the generator.
- */
- private static final int CHANGE_ELEMENT_ID = 0;
-
- @Override
- protected Diagnostic generateEdit(Object object, Monitor monitor) {
- final GenModel genModel = (GenModel) object;
- monitor.beginTask("", 2); //$NON-NLS-1$
- message = GENERATOR_LABEL;
- monitor.subTask(message);
- // final GenModel genModel = genClass.getGenModel();
- ensureProjectExists(genModel.getEditDirectory(), genModel, MODEL_PROJECT_TYPE, genModel.isUpdateClasspath(), createMonitor(monitor, 1));
- /**
- * Generate only if there at least one good template to generate
- */
- final JETEmitterDescriptor[] emitters = getJETEmitterDescriptors(genModel);
- if (emitters.length > 0) {
- generateJava(genModel.getEditDirectory(), SysMLOverUMLHelper.getAdapterFactoryRegistryPackageName(), SysMLOverUMLHelper.getAdapterFactoryRegistryClassName(), getJETEmitter(getJETEmitterDescriptors(genModel), CHANGE_ELEMENT_ID), null,
- createMonitor(monitor, 1));
- }
- return Diagnostic.OK_INSTANCE;
- }
-
- @Override
- protected void initializeJETEEMITTERDescriptorStore() {
- final Condition<GenModel> trueCondition = new Condition<GenModel>() {
-
- public boolean canGenerate(GenModel gen) {
- return true;
- }
- };
- jetEmitterMap.put(new JETEmitterDescriptor(Messages.SysMLOverUmlGenModelGenerator_SysMLAdapterFactoryRegisteryTemplate, Messages.SysMLOverUmlGenModelGenerator_package), trueCondition);
- }
-
- public SysMLOverUmlGenModelGenerator() {
- super();
- }
-
- public SysMLOverUmlGenModelGenerator(GeneratorAdapterFactory generatorAdapterFactory) {
- super(generatorAdapterFactory);
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/messages.properties b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/messages.properties deleted file mode 100644 index 47e13d84d70..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/core/messages.properties +++ /dev/null @@ -1,3 +0,0 @@ -SysMLOverUmlGenModelGenerator_GENERATOR_LABEL=SysML GenPackage Generator
-SysMLOverUmlGenModelGenerator_package=org.eclipse.papyrus.sysml.overumllayer
-SysMLOverUmlGenModelGenerator_SysMLAdapterFactoryRegisteryTemplate=edit/SysMLAdapterFactoryRegistery.javajet
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/utils/LabelHelper.java b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/utils/LabelHelper.java deleted file mode 100644 index 68261527304..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/src/org/eclipse/papyrus/sysml/sysmloveruml/codegen/utils/LabelHelper.java +++ /dev/null @@ -1,46 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.sysmloveruml.codegen.utils;
-
-import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
-import org.eclipse.papyrus.sysml.sysmloveruml.codegen.SysMLOverUMLGeneratorPlugin;
-
-/**
- * Helper to print label during generation.
- *
- * @author "Arthur Daussy <a href="mailto:arthur.daussy@atos.net
- * ">arthur.daussy@atos.net</a>"
- */
-public final class LabelHelper {
-
- /**
- * Path to template repository.
- */
- public static final String TEMPLATE_LOCATION = SysMLOverUMLGeneratorPlugin.INSTANCE.getBaseURL().toString() + "templates"; //$NON-NLS-1$
-
- /**
- * Class path name.
- */
- public static final String CLASSPATH_VARIABLE_NAME = "SYSML_OVER_UML_GENERATOR"; //$NON-NLS-1$
-
- /**
- * Get the name of the extension class of the Adapter Factory Class
- *
- * @param genPackage
- * @return
- */
- public static String getAdapterFactoryExtensionName(GenPackage genPackage) {
- return genPackage.getAdapterFactoryClassName() + "forUmlOverSysLM"; //$NON-NLS-1$
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/edit/ItemProvider.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/edit/ItemProvider.javajet deleted file mode 100644 index 88841bb8886..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/edit/ItemProvider.javajet +++ /dev/null @@ -1,476 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.edit" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="ItemProvider" version="$Id: ItemProvider.javajet,v 1.44 2009/10/20 13:39:38 davidms Exp $" %> -<% -/** - * <copyright> - * - * Copyright (c) 2002-2007 IBM Corporation and others. - * 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: - * IBM - Initial API and implementation - * - * </copyright> - */ -%> -<%GenClass genClass = (GenClass)argument; GenPackage genPackage = genClass.getGenPackage(); GenModel genModel=genPackage.getGenModel();%> -<%@ include file="../Header.javajetinc"%> -package <%=genPackage.getProviderPackageName()%>; - - -<%genModel.addImport("org.eclipse.emf.common.notify.AdapterFactory");%> -<%genModel.addImport("org.eclipse.emf.common.notify.Notification");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IEditingDomainItemProvider");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IItemLabelProvider");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IItemPropertySource");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IStructuredItemContentProvider");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.ITreeItemContentProvider");%> -<%String _List = genModel.getImportedName(genModel.useGenerics() ? "java.util.List<org.eclipse.emf.edit.provider.IItemPropertyDescriptor>" : "java.util.List");%> -<%genModel.markImportLocation(stringBuffer);%> - -/** - * This is the item provider adapter for a {@link <%=genClass.getQualifiedInterfaceName()%>} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class <%=genClass.getProviderClassName()%> - extends <%=genClass.getProviderBaseClassName() != null ? genClass.getProviderBaseClassName() : genModel.getImportedName("org.eclipse.emf.edit.provider.ItemProviderAdapter")%> - implements -<%for (Iterator<String> i = genPackage.getProviderSupportedTypes().iterator(); i.hasNext(); ) {%> - <%=genModel.getImportedName(i.next())%><%if (i.hasNext()){%>,<%}%> -<%}%> -{ -<%if (genModel.hasCopyrightField()) {%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%> - -<%}%> - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=genClass.getProviderClassName()%>(AdapterFactory adapterFactory) - { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public <%=_List%> getPropertyDescriptors(Object object) - { - if (itemPropertyDescriptors == null) - { - super.getPropertyDescriptors(object); - -<%for (GenFeature genFeature : genClass.getPropertyFeatures()) { %> - add<%=genFeature.getCapName()%>PropertyDescriptor(object); -<%}%> - } - return itemPropertyDescriptors; - } - -<%for (GenFeature genFeature : genClass.getPropertyFeatures()) { %> - /** - * This adds a property descriptor for the <%=genFeature.getFormattedName()%> feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void add<%=genFeature.getCapName()%>PropertyDescriptor(Object object) - { -<%@ include file="ItemProvider/addPropertyDescriptor.override.javajetinc" fail="alternative" %> -<%@ start %> - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((<%=genModel.getImportedName("org.eclipse.emf.edit.provider.ComposeableAdapterFactory")%>)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_feature"),<%=genModel.getNonNLS()%> - <%if (genFeature.getPropertyDescription() == null || genFeature.getPropertyDescription().length() == 0) {%> - getString("_UI_PropertyDescriptor_description", "_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_feature", "_UI_<%=genFeature.getGenClass().getName()%>_type"),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%><%=genModel.getNonNLS(3)%> - <%} else {%> - getString("_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_description"),<%=genModel.getNonNLS()%> - <%}%> - <%=genFeature.getQualifiedFeatureAccessor()%>, - <%=genFeature.getProperty() == GenPropertyKind.EDITABLE_LITERAL ? "true" : "false"%>, - <%=genFeature.isPropertyMultiLine() ? "true" : "false"%>, - <%=genFeature.isPropertySortChoices() ? "true" : "false"%>, - <%if (genFeature.isReferenceType()) {%> - null, - <%} else {%> - <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ItemPropertyDescriptor")%>.<%=genFeature.getPropertyImageName()%>, - <%}%> - <%if (genFeature.getPropertyCategory() == null || genFeature.getPropertyCategory().length() == 0) {%> - null, - <%} else {%> - getString("<%=genModel.getPropertyCategoryKey(genFeature.getPropertyCategory())%>"),<%=genModel.getNonNLS()%> - <%}%> - <%if (genFeature.getPropertyFilterFlags().isEmpty()) {%> - null)); - <%} else {%> - new String[] { - <%for (Iterator<String> j = genFeature.getPropertyFilterFlags().iterator(); j.hasNext();) { String filterFlag = j.next();%> - <%if (filterFlag != null && filterFlag.length() > 0) {%> - "<%=filterFlag%>"<%if (j.hasNext()) {%>,<%}%><%=genModel.getNonNLS()%> - <%}%> - <%}%> - })); - <%}%> -<%@ end %><%//ItemProvider/addPropertyDescriptor.override.javajetinc%> - } - -<%}%> -<%if (!genClass.getChildrenFeatures().isEmpty()) {%> - /** - * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an - * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or - * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public <%=genModel.getImportedName(genModel.useGenerics() ? "java.util.Collection<? extends org.eclipse.emf.ecore.EStructuralFeature>" : "java.util.Collection")%> getChildrenFeatures(Object object) - { - if (childrenFeatures == null) - { - super.getChildrenFeatures(object); -<%for (GenFeature genFeature : genClass.getChildrenFeatures()) { %> - childrenFeatures.add(<%=genFeature.getQualifiedFeatureAccessor()%>); -<%}%> - } - return childrenFeatures; - } - -<%if (!genClass.getChildrenFeatures().isEmpty()) {%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - protected <%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> getChildFeature(Object object, Object child) - { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildFeature(object, child); - } - -<%}%> -<%}%> -<%if (genClass.needsHasChildrenMethodOverride()) {%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public boolean hasChildren(Object object) - { - return hasChildren(object, <%=genModel.isOptimizedHasChildren()%>); - } - -<%}%> -<%if (genClass.isImage()) {%> - /** - * This returns <%=genClass.getName()%>.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public Object getImage(Object object) - { - return overlayImage(object, getResourceLocator().getImage("full/obj16/<%=genClass.getName()%>"));<%=genModel.getNonNLS()%> - } - -<%}%> -<%if (genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF26_VALUE && !genModel.isCreationIcons()) {%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - protected boolean shouldComposeCreationImage() - { - return true; - } - -<%}%> - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public String getText(Object object) - { -<%@ include file="ItemProvider/getText.override.javajetinc" fail="alternative" %> -<%@ start %> -<%if (genClass.isMapEntry()) {%> - <%=genClass.getImportedInterfaceName()%><%if (genModel.useGenerics()) {%><?, ?><%}%> <%=genClass.getSafeUncapName()%> = (<%=genClass.getImportedInterfaceName()%><%if (genModel.useGenerics()) {%><?, ?><%}%>)object; - <%if (!genClass.getMapEntryKeyFeature().isPropertyMultiLine() && !genClass.getMapEntryValueFeature().isPropertyMultiLine()) {%> - return "" + <%=genClass.getSafeUncapName()%>.getKey() + " -> " + <%=genClass.getSafeUncapName()%>.getValue();<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> - <%} else {%> - <%if (genClass.getMapEntryKeyFeature().isPropertyMultiLine()) {%> - String key = crop("" + <%=genClass.getSafeUncapName()%>.getKey());<%=genModel.getNonNLS()%> - <%} else {%> - String key = "" + <%=genClass.getSafeUncapName()%>.getKey();<%=genModel.getNonNLS()%> - <%}%> - <%if (genClass.getMapEntryValueFeature().isPropertyMultiLine()) {%> - String value = crop("" + <%=genClass.getSafeUncapName()%>.getValue());<%=genModel.getNonNLS()%> - <%} else {%> - String value = "" + <%=genClass.getSafeUncapName()%>.getValue();<%=genModel.getNonNLS()%> - <%}%> - return key + " -> " + value;<%=genModel.getNonNLS()%> - <%}%> -<%} else if (genClass.getLabelFeature() != null) { GenFeature labelFeature = genClass.getLabelFeature();%> - <%if (labelFeature.isPrimitiveType() && !labelFeature.getGenClass().isDynamic() && !labelFeature.isSuppressedGetVisibility()) {%> - <%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%> <%=genClass.getSafeUncapName()%> = (<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)object; - return getString("_UI_<%=genClass.getName()%>_type") + " " + <%=genClass.getSafeUncapName()%>.<%=genClass.getLabelFeature().getGetAccessor()%>();<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> - <%} else {%> - <%if (labelFeature.isStringType() && !labelFeature.getGenClass().isDynamic() && !labelFeature.isSuppressedGetVisibility()) {%> - <%if (labelFeature.isPropertyMultiLine()) {%> - String label = crop(((<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)object).<%=labelFeature.getGetAccessor()%>()); - <%} else {%> - String label = ((<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)object).<%=labelFeature.getGetAccessor()%>(); - <%}%> - <%} else {%> - <%if (labelFeature.isSuppressedGetVisibility() || labelFeature.getGenClass().isDynamic()) {%> - <%=genModel.getImportedName("java.lang.Object")%> labelValue = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%>)object).eGet(<%=labelFeature.getQualifiedFeatureAccessor()%>); - <%} else {%> - <%=labelFeature.getRawImportedType()%> labelValue = ((<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)object).<%=labelFeature.getGetAccessor()%>(); - <%}%> - String label = labelValue == null ? null : labelValue.toString(); - <%}%> - return label == null || label.length() == 0 ? - getString("_UI_<%=genClass.getName()%>_type") :<%=genModel.getNonNLS()%> - getString("_UI_<%=genClass.getName()%>_type") + " " + label;<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> - <%}%> -<%} else {%> - return getString("_UI_<%=genClass.getName()%>_type");<%=genModel.getNonNLS()%> -<%}%> -<%@ end %><%//ItemProvider/getText.override.javajetinc%> - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public void notifyChanged(Notification notification) - { - updateChildren(notification); -<%if (!genClass.getLabelNotifyFeatures().isEmpty() || !genClass.getContentNotifyFeatures().isEmpty() || !genClass.getLabelAndContentNotifyFeatures().isEmpty()) {%> - - switch (notification.getFeatureID(<%=genClass.getRawImportedInterfaceName()%>.class)) - { - <%if (!genClass.getLabelNotifyFeatures().isEmpty()) {%> - <%for (GenFeature genFeature : genClass.getLabelNotifyFeatures()) { %> - case <%=genClass.getQualifiedFeatureID(genFeature)%>: - <%}%> - fireNotifyChanged(new <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ViewerNotification")%>(notification, notification.getNotifier(), false, true)); - return; - <%}%> - <%if (!genClass.getContentNotifyFeatures().isEmpty()) {%> - <%for (GenFeature genFeature : genClass.getContentNotifyFeatures()) { %> - case <%=genClass.getQualifiedFeatureID(genFeature)%>: - <%}%> - fireNotifyChanged(new <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ViewerNotification")%>(notification, notification.getNotifier(), true, false)); - return; - <%}%> - <%if (!genClass.getLabelAndContentNotifyFeatures().isEmpty()) {%> - <%for (GenFeature genFeature : genClass.getLabelAndContentNotifyFeatures()) { %> - case <%=genClass.getQualifiedFeatureID(genFeature)%>: - <%}%> - fireNotifyChanged(new <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ViewerNotification")%>(notification, notification.getNotifier(), true, true)); - return; - <%}%> - } -<%}%> - super.notifyChanged(notification); - } - -<%if (genModel.isCreationCommands()) {%> - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children - * that can be created under this object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - protected void collectNewChildDescriptors(<%=genModel.getImportedName(genModel.useGenerics() ? "java.util.Collection<java.lang.Object>" : "java.util.Collection")%> newChildDescriptors, Object object) - { - super.collectNewChildDescriptors(newChildDescriptors, object); - <%for (GenClass.ChildCreationData childCreationData : genClass.getChildCreationData()) { GenFeature createFeature = childCreationData.createFeature; GenFeature delegatedFeature = childCreationData.delegatedFeature; GenClassifier createClassifier = childCreationData.createClassifier;%> - <%if (createFeature.isFeatureMapType()) {%> - <%if (delegatedFeature.isReferenceType()) { GenClass createClass = (GenClass)createClassifier;%> -<%@ include file="ItemProvider/newChildDescriptorsReferenceDelegatedFeature.override.javajetinc" fail="alternative"%> -<%@ start %> - - newChildDescriptors.add - (createChildParameter - (<%=createFeature.getQualifiedFeatureAccessor()%>, - <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.createEntry - (<%=delegatedFeature.getQualifiedFeatureAccessor()%>, - <%if (createClass.isMapEntry()) { %> - <%=createClass.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.create(<%=createClass.getQualifiedClassifierAccessor()%>)))); - <%} else {%> - <%=createClass.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.create<%=createClass.getName()%>()))); - <%}%> -<%@ include file="ItemProvider/newChildDescriptorsReferenceDelegatedFeature.insert.javajetinc" fail="silent"%> -<%@ end %><%//ItemProvider/newChildDescriptorsReferenceDelegatedFeature.override.javajetinc%> - <%} else { GenDataType createDataType = (GenDataType)createClassifier;%> -<%@ include file="ItemProvider/newChildDescriptorsAttributeDelegatedFeature.override.javajetinc" fail="alternative"%> -<%@ start %> - - newChildDescriptors.add - (createChildParameter - (<%=createFeature.getQualifiedFeatureAccessor()%>, - <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.createEntry - (<%=delegatedFeature.getQualifiedFeatureAccessor()%>, - <%if (delegatedFeature.isEnumBasedType()) {%> - <%=delegatedFeature.getTypeGenEnum().getStaticValue(delegatedFeature.getEcoreFeature().getDefaultValueLiteral())%>))); - <%} else if (delegatedFeature.isStringBasedType()) {%> - <%=delegatedFeature.getCreateChildValueLiteral()%>)));<%=genModel.getNonNLS()%> - <%} else { String literal = delegatedFeature.getCreateChildValueLiteral();%> - <%=createDataType.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.createFromString(<%=createDataType.getQualifiedClassifierAccessor()%>, <%=literal%>))));<%if (literal != null) {%><%=genModel.getNonNLS()%><%} else {%> // TODO: ensure this is a valid literal value<%}%> - <%}%> -<%@ include file="ItemProvider/newChildDescriptorsAttributeDelegatedFeature.insert.javajetinc" fail="silent"%> -<%@ end %><%//ItemProvider/newChildDescriptorsAttributeDelegatedFeature.override.javajetinc%> - <%}%> - <%} else if (createFeature.isReferenceType()) { GenClass createClass = (GenClass)createClassifier;%> -<%@ include file="ItemProvider/newChildDescriptorsReferenceFeature.override.javajetinc" fail="alternative"%> -<%@ start %> - - newChildDescriptors.add - (createChildParameter - (<%=createFeature.getQualifiedFeatureAccessor()%>, - <%if (createClass.isMapEntry()) { %> - <%=createClass.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.create(<%=createClass.getQualifiedClassifierAccessor()%>))); - <%} else {%> - <%=createClass.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.create<%=createClass.getName()%>())); - <%}%> -<%@ include file="ItemProvider/newChildDescriptorsReferenceFeature.insert.javajetinc" fail="silent"%> -<%@ end %><%//ItemProvider/newChildDescriptorsReferenceFeature.override.javajetinc %> - <%} else { GenDataType createDataType = (GenDataType)createClassifier;%> -<%@ include file="ItemProvider/newChildDescriptorsAttributeFeature.override.javajetinc" fail="alternative"%> -<%@ start %> - - newChildDescriptors.add - (createChildParameter - (<%=createFeature.getQualifiedFeatureAccessor()%>, - <%if (createFeature.isEnumBasedType()) {%> - <%=createFeature.getTypeGenEnum().getStaticValue(createFeature.getEcoreFeature().getDefaultValueLiteral())%>)); - <%} else if (createFeature.isStringBasedType()) {%> - <%=createFeature.getCreateChildValueLiteral()%>));<%=genModel.getNonNLS()%> - <%} else { String literal = createFeature.getCreateChildValueLiteral();%> - <%=createDataType.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.createFromString(<%=createDataType.getQualifiedClassifierAccessor()%>, <%=literal%>)));<%if (literal != null) {%><%=genModel.getNonNLS()%><%} else {%> // TODO: ensure this is a valid literal value<%}%> - <%}%> -<%@ include file="ItemProvider/newChildDescriptorsAttributeFeature.insert.javajetinc" fail="silent"%> -<%@ end %><%//ItemProvider/newChildDescriptorsAttributeFeature.override.javajetinc%> - <%}%> - <%}%> - } - - <%if (!genClass.getSharedClassCreateChildFeatures().isEmpty()) {%> - /** - * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public String getCreateChildText(Object owner, Object feature, Object child, <%=genModel.getImportedName(genModel.useGenerics() ? "java.util.Collection<?>" : "java.util.Collection")%> selection) - { - Object childFeature = feature; - Object childObject = child; - - <%if (genClass.hasFeatureMapCreateChildFeatures()) {%> - if (childFeature instanceof <%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> && <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.isFeatureMap((EStructuralFeature)childFeature)) - { - <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Entry entry = (FeatureMap.Entry)childObject; - childFeature = entry.getEStructuralFeature(); - childObject = entry.getValue(); - } - - <%}%> - boolean qualify = - <%for (Iterator<GenFeature> i = genClass.getSharedClassCreateChildFeatures().iterator(); i.hasNext();) { GenFeature createFeature = i.next();%> - childFeature == <%=createFeature.getQualifiedFeatureAccessor()%><%=i.hasNext() ? " ||" : ";"%> - <%}%> - - if (qualify) - { - return getString - ("_UI_CreateChild_text2",<%=genModel.getNonNLS()%> - new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); - } - return super.getCreateChildText(owner, feature, child, selection); - } - - <%}%> -<%}%> -<%if (genClass.getProviderExtendsGenClass() == null || genClass.getProviderExtendsGenClass().getGenPackage() != genPackage && (!genPackage.isExtensibleProviderFactory() || genClass.getProviderExtendsGenClass().getGenPackage().isExtensibleProviderFactory() != genPackage.isExtensibleProviderFactory())) {%> - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public <%=genModel.getImportedName("org.eclipse.emf.common.util.ResourceLocator")%> getResourceLocator() - { -<%if (genPackage.isExtensibleProviderFactory()) {%> - return ((<%=genModel.getImportedName("org.eclipse.emf.edit.provider.IChildCreationExtender")%>)adapterFactory).getResourceLocator(); -<%} else {%> - return <%=genPackage.getImportedEditPluginClassName()%>.INSTANCE; -<%}%> - } - -<%}%> -<%@ include file="ItemProvider/insert.javajetinc" fail="silent" %> -} -<%genModel.emitSortedImports();%> diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/edit/ItemProviderAdapterFactory.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/edit/ItemProviderAdapterFactory.javajet deleted file mode 100644 index a2dd2821093..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/edit/ItemProviderAdapterFactory.javajet +++ /dev/null @@ -1,561 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.edit" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="ItemProviderAdapterFactory" version="$Id: ItemProviderAdapterFactory.javajet,v 1.15 2010/04/28 20:38:09 khussey Exp $" %> -<% -/** - * <copyright> - * - * Copyright (c) 2002-2010 IBM Corporation and others. - * 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: - * IBM - Initial API and implementation - * - * </copyright> - */ -%> -<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel(); /* Trick to import java.util.* without warnings */Iterator.class.getName();%> -<%@ include file="../Header.javajetinc"%> -package <%=genPackage.getProviderPackageName()%>; - -<%genModel.addImport("org.eclipse.emf.common.notify.Adapter");%> -<%genModel.addImport("org.eclipse.emf.common.notify.Notification");%> -<%genModel.addImport("org.eclipse.emf.common.notify.Notifier");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.ChangeNotifier");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.ComposeableAdapterFactory");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.ComposedAdapterFactory");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IChangeNotifier");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IEditingDomainItemProvider");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IItemLabelProvider");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IItemPropertySource");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.INotifyChangedListener");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.IStructuredItemContentProvider");%> -<%genModel.addImport("org.eclipse.emf.edit.provider.ITreeItemContentProvider");%> -<%boolean useGenerics = genModel.useGenerics();%> -<%String _ArrayList = genModel.getImportedName(useGenerics ? "java.util.ArrayList<java.lang.Object>" : "java.util.ArrayList");%> -<%String _Collection = genModel.getImportedName(useGenerics ? "java.util.Collection<java.lang.Object>" : "java.util.Collection");%> -<%genModel.markImportLocation(stringBuffer);%> - -/** - * This is the factory that is used to provide the interfaces needed to support Viewers. - * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. - * The adapters also support Eclipse property sheets. - * Note that most of the adapters are shared among multiple instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class <%=genPackage.getItemProviderAdapterFactoryClassName()%> extends <%=genPackage.getImportedAdapterFactoryClassName()%> implements ComposeableAdapterFactory, IChangeNotifier<%if (genPackage.isDisposableProviderFactory()) {%>, <%=genModel.getImportedName("org.eclipse.emf.edit.provider.IDisposable")%><%}%><%if (genPackage.isExtensibleProviderFactory()) {%>, <%=genModel.getImportedName("org.eclipse.emf.edit.provider.IChildCreationExtender")%><%}%> -{ -<%if (genModel.hasCopyrightField()) {%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%> - -<%}%> - /** - * This keeps track of the root adapter factory that delegates to this adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComposedAdapterFactory parentAdapterFactory; - - /** - * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IChangeNotifier changeNotifier = new ChangeNotifier(); - -<%if (genPackage.isDisposableProviderFactory() && genPackage.hasStatefulProvider()) {%> - /** - * This keeps track of all the item providers created, so that they can be {@link #dispose disposed}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genModel.getImportedName("org.eclipse.emf.edit.provider.Disposable")%> disposable = new Disposable(); - -<%}%> -<%if (genPackage.isExtensibleProviderFactory()) {%> - /** - * This helps manage the child creation extenders. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ChildCreationExtenderManager")%> childCreationExtenderManager = new <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ChildCreationExtenderManager")%>(<%=genPackage.getImportedEditPluginClassName()%>.INSTANCE, <%=genPackage.getImportedPackageInterfaceName()%>.eNS_URI); - -<%}%> - /** - * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=_Collection%> supportedTypes = new <%=_ArrayList%>(); - - /** - * This constructs an instance. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=genPackage.getItemProviderAdapterFactoryClassName()%>() - { -<%for (String name : genPackage.getProviderSupportedTypes()) {%> - supportedTypes.add(<%=genModel.getImportedName(name)%>.class); -<%}%> - } - -<%for (GenPackage genDelegate : genPackage.getAdapterDelegatePackages()) {%> - /** - * This keeps track of the factory to which to delegate adapter creation for objects from that package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genDelegate.getImportedAdapterFactoryClassName()%> <%=genPackage.getUncapAdapterFactoryDelegateName(genDelegate)%> = null; - - /** - * This determines the delegate factory for the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genDelegate.getImportedAdapterFactoryClassName()%> get<%=genPackage.getAdapterFactoryDelegateName(genDelegate)%>() - { - if (<%=genPackage.getUncapAdapterFactoryDelegateName(genDelegate)%> == null) - { - <%=genModel.getImportedName("org.eclipse.emf.common.notify.AdapterFactory")%> rootAdapterFactory = getRootAdapterFactory(); - if (rootAdapterFactory instanceof ComposedAdapterFactory) - { - <%=genModel.getImportedName("org.eclipse.emf.common.notify.AdapterFactory")%> delegateAdapterFactory = - ((ComposedAdapterFactory)rootAdapterFactory).getFactoryForType(<%=genDelegate.getImportedAdapterFactoryClassName()%>.getPackage()); - if (delegateAdapterFactory instanceof <%=genDelegate.getImportedAdapterFactoryClassName()%>) - { - <%=genPackage.getUncapAdapterFactoryDelegateName(genDelegate)%> = (<%=genDelegate.getImportedAdapterFactoryClassName()%>)delegateAdapterFactory; - } - } - } - return <%=genPackage.getUncapAdapterFactoryDelegateName(genDelegate)%>; - } - -<%}%> -<%for (GenClass genClass : genPackage.getGenClasses()) {%> -<%if (!genClass.isAbstract() && genClass.getProvider() != GenProviderKind.NONE_LITERAL) {%> -<%if (genClass.isProviderSingleton()) {%> - /** - * This keeps track of the one adapter used for all {@link <%=genClass.getQualifiedInterfaceName()%>} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genClass.getProviderClassName()%> <%=genClass.getUncapName()%>ItemProvider; - - /** - * This creates an adapter for a {@link <%=genClass.getQualifiedInterfaceName()%>}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public Adapter create<%=genClass.getName()%>Adapter() - { - if (<%=genClass.getUncapName()%>ItemProvider == null) - { - <%=genClass.getUncapName()%>ItemProvider = new <%=genClass.getProviderClassName()%>(this); - } - - return <%=genClass.getUncapName()%>ItemProvider; - } - -<%} else {%> - /** - * This creates an adapter for a {@link <%=genClass.getQualifiedInterfaceName()%>}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public Adapter create<%=genClass.getName()%>Adapter() - { - return new <%=genClass.getProviderClassName()%>(this); - } - -<%}%> -<%}%> -<%}%> -<%for (GenClass genClass : genPackage.getAdapterDelegateSuperClasses()) {%> - /** - * <%=genClass.getName()%> of <%=genClass.getItemProviderAdapterFactoryClassName()%> - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Adapter create<%=genClass.getName()%>Adapter() - { - return - get<%=genClass.getItemProviderAdapterFactoryClassName()%>() == null ? - null : - get<%=genClass.getItemProviderAdapterFactoryClassName()%>().create<%=genClass.getName()%>Adapter(); - } - -<%}%> - /** - * This returns the root adapter factory that contains this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComposeableAdapterFactory getRootAdapterFactory() - { - return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); - } - - /** - * This sets the composed adapter factory that contains this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) - { - this.parentAdapterFactory = parentAdapterFactory; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public boolean isFactoryForType(Object type) - { - return supportedTypes.contains(type) || super.isFactoryForType(type); - } - - /** - * This implementation substitutes the factory itself as the key for the adapter. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public Adapter adapt(Notifier notifier, Object type) - { - return super.adapt(notifier, this); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public Object adapt(Object object, Object type) - { - if (isFactoryForType(type)) - { - Object adapter = super.adapt(object, type); - if (!(type instanceof Class<%if (genModel.useGenerics()) {%><?><%}%>) || <%if (genModel.getRuntimePlatform() == GenRuntimePlatform.GWT) {%><%=genModel.getImportedName("org.eclipse.emf.common.util.Reflect")%>.isInstance((Class<%if (genModel.useGenerics()) {%><?><%}%>)type, adapter)<%} else {%>(((Class<%if (genModel.useGenerics()) {%><?><%}%>)type).isInstance(adapter))<%}%>) - { - return adapter; - } - } - - return null; - } - -<%if (genPackage.isDisposableProviderFactory() && genPackage.hasStatefulProvider()) {%> - /** - * Associates an adapter with a notifier via the base implementation, then records it to ensure it will be disposed. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - protected void associate(Adapter adapter, Notifier target) - { - super.associate(adapter, target); - if (adapter != null) - { - disposable.add(adapter); - } - } - -<%}%> -<%if (genPackage.isExtensibleProviderFactory()) {%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=genModel.getImportedName(useGenerics ? "java.util.List<org.eclipse.emf.edit.provider.IChildCreationExtender>" : "java.util.List")%> getChildCreationExtenders() - { - return childCreationExtenderManager.getChildCreationExtenders(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=genModel.getImportedName(useGenerics ? "java.util.Collection<?>" : "java.util.Collection")%> getNewChildDescriptors(Object object, <%=genModel.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")%> editingDomain) - { - return childCreationExtenderManager.getNewChildDescriptors(object, editingDomain); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=genModel.getImportedName("org.eclipse.emf.common.util.ResourceLocator")%> getResourceLocator() - { - return childCreationExtenderManager; - } - -<%}%> - /** - * This adds a listener. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void addListener(INotifyChangedListener notifyChangedListener) - { - changeNotifier.addListener(notifyChangedListener); - } - - /** - * This removes a listener. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void removeListener(INotifyChangedListener notifyChangedListener) - { - changeNotifier.removeListener(notifyChangedListener); - } - - /** - * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void fireNotifyChanged(Notification notification) - { - changeNotifier.fireNotifyChanged(notification); - - if (parentAdapterFactory != null) - { - parentAdapterFactory.fireNotifyChanged(notification); - } - } - -<%if (genPackage.isDisposableProviderFactory()) {%> - /** - * This disposes all of the item providers created by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void dispose() - { -<%if (genPackage.hasStatefulProvider()) {%> - disposable.dispose(); -<%} else {%> -<%for (GenClass genClass : genPackage.getGenClasses()) {%> -<%if (!genClass.isAbstract() && genClass.isProviderSingleton()) {%> - if (<%=genClass.getUncapName()%>ItemProvider != null) <%=genClass.getUncapName()%>ItemProvider.dispose(); -<%}%> -<%}%> -<%}%> - } - -<%}%> -<%if (genPackage.isChildCreationExtenders()) {%> - <%for (Map.Entry<GenPackage, Map<GenClass, List<GenClass.ChildCreationData>>> packageEntry : genPackage.getExtendedChildCreationData().entrySet()) {%> - /** - * A child creation extender for the {@link <%=packageEntry.getKey().getImportedPackageInterfaceName()%>}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static class <%=genPackage.getChildCreationExtenderName(packageEntry.getKey())%> implements <%=genModel.getImportedName("org.eclipse.emf.edit.provider.IChildCreationExtender")%> - { - /** - * The switch for creating child descriptors specific to each extended class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static class CreationSwitch extends <%=genModel.getImportedName(packageEntry.getKey().getQualifiedSwitchClassName())%><%=useGenerics ? "<Object>" : ""%> - { - /** - * The child descriptors being populated. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genModel.getImportedName(useGenerics ? "java.util.List<Object>" : "java.util.List")%> newChildDescriptors; - - /** - * The domain in which to create the children. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genModel.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")%> editingDomain; - - /** - * Creates the a switch for populating child descriptors in the given domain. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CreationSwitch(<%=genModel.getImportedName(useGenerics ? "java.util.List<Object>" : "java.util.List")%> newChildDescriptors, <%=genModel.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")%> editingDomain) - { - this.newChildDescriptors = newChildDescriptors; - this.editingDomain = editingDomain; - } - <%for (Map.Entry<GenClass, List<GenClass.ChildCreationData>> classEntry : packageEntry.getValue().entrySet()) { GenClass genClass = classEntry.getKey();%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -<%if (genModel.useClassOverrideAnnotation()) {%> - @Override -<%}%> - public <%=genClass.getTypeParameters()%>Object case<%=genPackage.getClassUniqueName(genClass)%>(<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceTypeArguments()%> object) - { - <%for (GenClass.ChildCreationData childCreationData : classEntry.getValue()) { GenFeature createFeature = childCreationData.createFeature; GenFeature delegatedFeature = childCreationData.delegatedFeature; GenClassifier createClassifier = childCreationData.createClassifier;%> - <%if (createFeature.isFeatureMapType()) {%> - <%if (delegatedFeature.isReferenceType()) { GenClass createClass = (GenClass)createClassifier;%> -<%@ include file="ItemProvider/newChildDescriptorsReferenceDelegatedFeature.override.javajetinc" fail="alternative"%> -<%@ start %> - newChildDescriptors.add - (createChildParameter - (<%=createFeature.getQualifiedFeatureAccessor()%>, - <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.createEntry - (<%=delegatedFeature.getQualifiedFeatureAccessor()%>, - <%if (createClass.isMapEntry()) { %> - <%=createClass.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.create(<%=createClass.getQualifiedClassifierAccessor()%>)))); - <%} else {%> - <%=createClass.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.create<%=createClass.getName()%>()))); - <%}%> -<%@ include file="ItemProvider/newChildDescriptorsReferenceDelegatedFeature.insert.javajetinc" fail="silent"%> -<%@ end %><%//ItemProvider/newChildDescriptorsReferenceDelegatedFeature.override.javajetinc%> - <%} else { GenDataType createDataType = (GenDataType)createClassifier;%> -<%@ include file="ItemProvider/newChildDescriptorsAttributeDelegatedFeature.override.javajetinc" fail="alternative"%> -<%@ start %> - newChildDescriptors.add - (createChildParameter - (<%=createFeature.getQualifiedFeatureAccessor()%>, - <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.createEntry - (<%=delegatedFeature.getQualifiedFeatureAccessor()%>, - <%if (delegatedFeature.isEnumBasedType()) {%> - <%=delegatedFeature.getTypeGenEnum().getStaticValue(delegatedFeature.getEcoreFeature().getDefaultValueLiteral())%>))); - <%} else if (delegatedFeature.isStringBasedType()) {%> - <%=delegatedFeature.getCreateChildValueLiteral()%>)));<%=genModel.getNonNLS()%> - <%} else { String literal = delegatedFeature.getCreateChildValueLiteral();%> - <%=createDataType.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.createFromString(<%=createDataType.getQualifiedClassifierAccessor()%>, <%=literal%>))));<%if (literal != null) {%><%=genModel.getNonNLS()%><%} else {%> // TODO: ensure this is a valid literal value<%}%> - <%}%> -<%@ include file="ItemProvider/newChildDescriptorsAttributeDelegatedFeature.insert.javajetinc" fail="silent"%> -<%@ end %><%//ItemProvider/newChildDescriptorsAttributeDelegatedFeature.override.javajetinc%> - <%}%> - <%} else if (createFeature.isReferenceType()) { GenClass createClass = (GenClass)createClassifier;%> -<%@ include file="ItemProvider/newChildDescriptorsReferenceFeature.override.javajetinc" fail="alternative"%> -<%@ start %> - newChildDescriptors.add - (createChildParameter - (<%=createFeature.getQualifiedFeatureAccessor()%>, - <%if (createClass.isMapEntry()) { %> - <%=createClass.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.create(<%=createClass.getQualifiedClassifierAccessor()%>))); - <%} else {%> - <%=createClass.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.create<%=createClass.getName()%>())); - <%}%> -<%@ include file="ItemProvider/newChildDescriptorsReferenceFeature.insert.javajetinc" fail="silent"%> -<%@ end %><%//ItemProvider/newChildDescriptorsReferenceFeature.override.javajetinc %> - <%} else { GenDataType createDataType = (GenDataType)createClassifier;%> -<%@ include file="ItemProvider/newChildDescriptorsAttributeFeature.override.javajetinc" fail="alternative"%> -<%@ start %> - newChildDescriptors.add - (createChildParameter - (<%=createFeature.getQualifiedFeatureAccessor()%>, - <%if (createFeature.isEnumBasedType()) {%> - <%=createFeature.getTypeGenEnum().getStaticValue(createFeature.getEcoreFeature().getDefaultValueLiteral())%>)); - <%} else if (createFeature.isStringBasedType()) {%> - <%=createFeature.getCreateChildValueLiteral()%>));<%=genModel.getNonNLS()%> - <%} else { String literal = createFeature.getCreateChildValueLiteral();%> - <%=createDataType.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.createFromString(<%=createDataType.getQualifiedClassifierAccessor()%>, <%=literal%>)));<%if (literal != null) {%><%=genModel.getNonNLS()%><%} else {%> // TODO: ensure this is a valid literal value<%}%> - <%}%> -<%@ include file="ItemProvider/newChildDescriptorsAttributeFeature.insert.javajetinc" fail="silent"%> -<%@ end %><%//ItemProvider/newChildDescriptorsAttributeFeature.override.javajetinc%> - <%}%> - - <%}%> - return null; - } - - <%}%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genModel.getImportedName("org.eclipse.emf.edit.command.CommandParameter")%> createChildParameter(Object feature, Object child) - { - return new <%=genModel.getImportedName("org.eclipse.emf.edit.command.CommandParameter")%>(null, feature, child); - } - - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=_Collection%> getNewChildDescriptors(Object object, <%=genModel.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")%> editingDomain) - { - <%=_ArrayList%> result = new <%=_ArrayList%>(); - new CreationSwitch(result, editingDomain).doSwitch((<%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%>)object); - return result; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=genModel.getImportedName("org.eclipse.emf.common.util.ResourceLocator")%> getResourceLocator() - { - return <%=genPackage.getImportedEditPluginClassName()%>.INSTANCE; - } - } - - <%}%> -<%}%> -} -<%genModel.emitSortedImports();%> diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/model/AdapterFactoryClass.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/model/AdapterFactoryClass.javajet deleted file mode 100644 index 49809729ee6..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/model/AdapterFactoryClass.javajet +++ /dev/null @@ -1,172 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="AdapterFactoryClass" version="$Id: AdapterFactoryClass.javajet,v 1.13 2008/12/13 15:53:17 emerks Exp $" %> -<% -/** - * <copyright> - * - * Copyright (c) 2002-2006 IBM Corporation and others. - * 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: - * IBM - Initial API and implementation - * - * </copyright> - */ -%> -<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel(); /* Trick to import java.util.* without warnings */Iterator.class.getName();%> -<%@ include file="../Header.javajetinc"%> -package <%=genPackage.getUtilitiesPackageName()%>; - -<%genModel.addImport("org.eclipse.emf.common.notify.Adapter");%> -<%genModel.addImport("org.eclipse.emf.common.notify.Notifier");%> -<%genModel.addImport("org.eclipse.emf.common.notify.impl.AdapterFactoryImpl");%> -<%genModel.addImport("org.eclipse.emf.ecore.EObject");%> -<%if (!genPackage.hasJavaLangConflict() && !genPackage.getUtilitiesPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*");%> -<%String typeArgument = genModel.useGenerics() ? "<Adapter>" : "";%> -<%String returnType = genModel.useGenerics() ? "Adapter" : genModel.getImportedName("java.lang.Object");%> -<%String adapterCast = genModel.useGenerics() ? "" : "(Adapter)";%> -<%genModel.markImportLocation(stringBuffer);%> - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see <%=genPackage.getQualifiedPackageInterfaceName()%> - * @generated - */ -public class <%=genPackage.getAdapterFactoryClassName()%> extends AdapterFactoryImpl -{ -<%if (genModel.hasCopyrightField()) {%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%> - -<%}%> - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static <%=genPackage.getImportedPackageInterfaceName()%> modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=genPackage.getAdapterFactoryClassName()%>() - { - if (modelPackage == null) - { - modelPackage = <%=genPackage.getImportedPackageInterfaceName()%>.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - <%if (genModel.useClassOverrideAnnotation()) {%> - @Override - <%}%> - public boolean isFactoryForType(Object object) - { - if (object == modelPackage) - { - return true; - } - if (object instanceof EObject) - { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected <%=genPackage.getSwitchClassName()%><%=typeArgument%> modelSwitch = - new <%=genPackage.getSwitchClassName()%><%=typeArgument%>() - { -<%for (GenClass genClass : genPackage.getAllSwitchGenClasses()) {%> - <%if (genModel.useClassOverrideAnnotation()) {%> - @Override - <%}%> - public <%=genClass.getTypeParameters()%><%=returnType%> case<%=genPackage.getClassUniqueName(genClass)%>(<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceTypeArguments()%> object) - { - return create<%=genPackage.getClassUniqueName(genClass)%>Adapter(); - } -<%}%> - <%if (genModel.useClassOverrideAnnotation()) {%> - @Override - <%}%> - public <%=returnType%> defaultCase(EObject object) - { - return create<%=genPackage.getClassUniqueName(null)%>Adapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - <%if (genModel.useClassOverrideAnnotation()) {%> - @Override - <%}%> - public Adapter createAdapter(Notifier target) - { - return <%=adapterCast%>modelSwitch.doSwitch((EObject)target); - } - -<%for (GenClass genClass : genPackage.getAllSwitchGenClasses()) {%> - - /** - * Creates a new adapter for an object of class '{@link <%=genClass.getQualifiedInterfaceName()%> <em><%=genClass.getFormattedName()%></em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see <%=genClass.getQualifiedInterfaceName()%> - * @generated - */ - public Adapter create<%=genPackage.getClassUniqueName(genClass)%>Adapter() - { - return null; - } -<%}%> - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter create<%=genPackage.getClassUniqueName(null)%>Adapter() - { - return null; - } - -} //<%=genPackage.getAdapterFactoryClassName()%> -<%genModel.emitSortedImports();%> diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/model/SwitchClass.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/model/SwitchClass.javajet deleted file mode 100644 index ef6fd0eefa2..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates-orig/model/SwitchClass.javajet +++ /dev/null @@ -1,230 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="SwitchClass" version="$Id: SwitchClass.javajet,v 1.23 2011/01/20 01:10:53 emerks Exp $" %> -<% -/** - * <copyright> - * - * Copyright (c) 2002-2006 IBM Corporation and others. - * 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: - * IBM - Initial API and implementation - * - * </copyright> - */ -%> -<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();%> -<%boolean supportsComposition = genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF27_VALUE;%> -<%@ include file="../Header.javajetinc"%> -package <%=genPackage.getUtilitiesPackageName()%>; - -<%if (supportsComposition) {%> -<%genModel.addImport("org.eclipse.emf.ecore.EObject");%> -<%genModel.addImport("org.eclipse.emf.ecore.EPackage");%> -<%genModel.addImport("org.eclipse.emf.ecore.util.Switch");%> -<%} else {%> -<%genModel.addImport("org.eclipse.emf.ecore.EClass");%> -<%genModel.addImport("org.eclipse.emf.ecore.EObject");%> -<%}%> -<%if (!genPackage.hasJavaLangConflict() && !genPackage.getUtilitiesPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*");%> -<% -String templateParameterName = null; -if (genModel.useGenerics()) -{ - Set<String> usedNames = new HashSet<String>(); - for (GenEnum genEnum : genPackage.getGenEnums()) - { - usedNames.add(genEnum.getName()); - } - for (GenClass genClass : genPackage.getAllSwitchGenClasses()) - { - if (!genClass.isDynamic() && !genClass.isExternalInterface()) - { - usedNames.add(genClass.getName()); - } - for (GenTypeParameter genTypeParameter : genClass.getGenTypeParameters()) - { - usedNames.add(genTypeParameter.getName()); - } - } - templateParameterName = "T"; - for (int i = 1; usedNames.contains(templateParameterName); ++i) - { - templateParameterName = "T" + i; - } -} -%> -<%String templateParameters = genModel.useGenerics() ? "<" + templateParameterName + ">" : "";%> -<%String returnType = genModel.useGenerics() ? templateParameterName : genModel.getImportedName("java.lang.Object");%> -<%genModel.markImportLocation(stringBuffer);%> - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see <%=genPackage.getQualifiedPackageInterfaceName()%> - * @generated - */ -public class <%=genPackage.getSwitchClassName()%><%=templateParameters%><%if (supportsComposition){%> extends Switch<%=templateParameters%><%}%> -{ -<%if (genModel.hasCopyrightField()) {%> - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%> - -<%}%> - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static <%=genPackage.getImportedPackageInterfaceName()%> modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <%=genPackage.getSwitchClassName()%>() - { - if (modelPackage == null) - { - modelPackage = <%=genPackage.getImportedPackageInterfaceName()%>.eINSTANCE; - } - } - -<%if (supportsComposition) {%> - /** - * Checks whether this is a switch for the given package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @parameter ePackage the package in question. - * @return whether this is a switch for the given package. - * @generated - */ - @Override - protected boolean isSwitchFor(EPackage ePackage) - { - return ePackage == modelPackage; - } -<%} else {%> - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public <%=returnType%> doSwitch(EObject theEObject) - { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected <%=returnType%> doSwitch(EClass theEClass, EObject theEObject) - { - if (theEClass.eContainer() == modelPackage) - { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else - { - <%=genModel.getImportedName("java.util.List")%><%if (genModel.useGenerics()) {%><<%=genModel.getImportedName("org.eclipse.emf.ecore.EClass")%>><%}%> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(<%if (!genModel.useGenerics()) {%>(EClass)<%}%>eSuperTypes.get(0), theEObject); - } - } -<%}%> - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ -<%if (supportsComposition) {%> - @Override -<%}%> - protected <%=returnType%> doSwitch(int classifierID, EObject theEObject) - { - switch (classifierID) - { -<%for (GenClass genClass : genPackage.getGenClasses()) {%> -<%if (!genClass.isExternalInterface() && !genClass.isEObject() || genClass.isMapEntry()) { String result = "result".equals(genClass.getSafeUncapName()) ? "theResult" : "result"; %> - case <%=genPackage.getImportedPackageInterfaceName()%>.<%=genPackage.getClassifierID(genClass)%>: - { - <%if (genClass.isUncheckedCast() || genClass.isMapEntry() && genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50) {%>@SuppressWarnings("unchecked") <%}%><%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%> <%=genClass.getSafeUncapName()%> = (<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)theEObject; - <%=returnType%> <%=result%> = case<%=genPackage.getClassUniqueName(genClass)%>(<%=genClass.getSafeUncapName()%>); -<%for (GenClass baseGenClass : genClass.getSwitchGenClasses()) {%> - if (<%=result%> == null) <%=result%> = case<%=genPackage.getClassUniqueName(baseGenClass)%>(<%if (genClass.isMapEntry()) {%>(<%=baseGenClass.getImportedInterfaceName()%><%=baseGenClass.getInterfaceTypeArguments()%>)<%}%><%=genClass.getSafeUncapName()%>); -<%}%> - if (<%=result%> == null) <%=result%> = defaultCase(theEObject); - return <%=result%>; - } -<%}%> -<%}%> - default: return defaultCase(theEObject); - } - } -<%for (GenClass genClass : genPackage.getAllSwitchGenClasses()) {%> - - /** - * Returns the result of interpreting the object as an instance of '<em><%=genClass.getFormattedName()%></em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em><%=genClass.getFormattedName()%></em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public <%=genClass.getTypeParameters()%><%=returnType%> case<%=genPackage.getClassUniqueName(genClass)%>(<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceTypeArguments()%> object) - { - return null; - } -<%}%> - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ -<%if (supportsComposition) {%> - @Override -<%}%> - public <%=returnType%> defaultCase(EObject object) - { - return null; - } - -} //<%=genPackage.getSwitchClassName()%> -<%genModel.emitSortedImports();%> diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/ItemProvider.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/ItemProvider.javajet deleted file mode 100644 index a590b3972ef..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/ItemProvider.javajet +++ /dev/null @@ -1,727 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.edit" imports="org.eclipse.uml2.codegen.ecore.genmodel.util.* org.eclipse.emf.common.util.* org.eclipse.emf.ecore.EStructuralFeature org.eclipse.emf.common.util.EList org.eclipse.emf.ecore.EClass org.eclipse.papyrus.sysml.sysmloveruml.codegen.generationUtils.SysMLOverUMLHelper java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="ItemProvider" version="$Id: ItemProvider.javajet,v 1.44 2009/10/20 13:39:38 davidms Exp $" %>
-<%
-/**
- * <copyright>
- *
- * Copyright (c) 2002-2007 IBM Corporation and others.
- * 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:
- * IBM - Initial API and implementation
- *
- * </copyright>
- */
-%>
-<%GenClass genClass = (GenClass)argument; GenPackage genPackage = genClass.getGenPackage(); GenModel genModel=genPackage.getGenModel();%>
-<%@ include file="../Header.javajetinc"%>
-package <%=genPackage.getProviderPackageName()%>;
-
-<%genModel.addImport("org.eclipse.uml2.uml.UMLPackage");%>
-<%genModel.addImport("org.eclipse.uml2.uml.util.UMLUtil");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.AdapterFactory");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.Notification");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IEditingDomainItemProvider");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IItemLabelProvider");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IItemPropertySource");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IStructuredItemContentProvider");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.ITreeItemContentProvider");%>
-<%genModel.addImport("org.eclipse.uml2.uml.Stereotype");%>
-<%genModel.addImport("org.eclipse.uml2.uml.Class");%>
-<%genModel.addImport("org.eclipse.papyrus.sysml.edit.provider.IComposableAdapterFactory");%>
-<%genModel.addImport("org.eclipse.papyrus.sysml.edit.provider.IRootAdapterFactory");%>
-<%genModel.addImport("java.util.regex.Pattern");%>
-<%genModel.addImport("org.eclipse.papyrus.sysml.edit.provider.SysMLItemProviderAdapter");%>
-<%genModel.addImport("org.eclipse.uml2.uml.NamedElement");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.ComposedImage");%>
-<%genModel.addImport("java.util.Collections");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.ItemProviderAdapter");%>
-
-
-<%String _List = genModel.getImportedName(genModel.useGenerics() ? "java.util.List<org.eclipse.emf.edit.provider.IItemPropertyDescriptor>" : "java.util.List");%>
-<%genModel.markImportLocation(stringBuffer);%>
-<%boolean hasToImplementIVisibilityOverlayImage = false;%>
-/**
- * This is the item provider adapter for a {@link <%=genClass.getQualifiedInterfaceName()%>} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-public class <%=genClass.getProviderClassName()%>
- extends <%=genClass.getProviderBaseClassName() != null ? genClass.getProviderBaseClassName() : genModel.getImportedName("org.eclipse.papyrus.sysml.edit.provider.SysMLItemProviderAdapter")%>
- implements
-<%for (Iterator<String> i = genPackage.getProviderSupportedTypes().iterator(); i.hasNext(); ) {%>
- <%=genModel.getImportedName(i.next())%><%if (i.hasNext()){%>,<%}%>
-<%}%>
-<% if (genClass.getProviderBaseClassName() != null) {%>
- , IVisibilityOverlayImage
- <%genModel.addImport("org.eclipse.papyrus.sysml.edit.provider.IVisibilityOverlayImage");%>
- <%hasToImplementIVisibilityOverlayImage = true;%>
-<%}%>
-
-
-{
-
-/**
- * Pattern prefix of <%=genClass.getSafeUncapName()%>
- * @generated
- */
- private static Pattern <%=SysMLOverUMLHelper.getClassifierCorrectLabel(genClass.getEcoreClass())%>_PREFIX_PATTERN = Pattern.compile("(<%=genClass.getSafeUncapName()%>, |<<<%=genClass.getSafeUncapName()%>>>|, <%=genClass.getSafeUncapName()%>)");
- <%Map<EClass,String> patternNameMap = new HashMap<EClass,String>();%>
- <%for(EClass basedClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
- <%String patternName = SysMLOverUMLHelper.getClassifierCorrectLabel(basedClass)+"_PREFIX_PATTERN";%>
- /**
- * Get the prefix pattern of <%=patternName%>
- * @generated
- */
- <%patternNameMap.put(basedClass,patternName);%>
- private static Pattern <%=patternName%>= Pattern.compile("<%=SysMLOverUMLHelper.getElementTypeCorrectLabel(basedClass)%>");
- <%}%>
-
-<%if (genModel.hasCopyrightField()) {%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%>
-
-<%}%>
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=genClass.getProviderClassName()%>(AdapterFactory adapterFactory)
- {
- super(adapterFactory);
- }
-
-
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public <%=_List%> getPropertyDescriptors(Object object)
- {
- if(object instanceof <%=genClass.getName()%>) {
- if (itemPropertyDescriptors == null)
- {
- super.getPropertyDescriptors(object);
-
-<%for (GenFeature genFeature : genClass.getPropertyFeatures()) { %>
- add<%=genFeature.getCapName()%>PropertyDescriptor(object);
-<%}%>
- }
- }
-
- <%for(EClass basedClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
-
- /**
- * Handle <%=basedClass.getName()%> stereotyped by <%=genClass.getName()%>
- */
- if ( object instanceof <%=SysMLOverUMLHelper.getUMLInterfaceName(basedClass)%> ){
- <%=SysMLOverUMLHelper.getUMLInterfaceName(basedClass)%> element = (<%=SysMLOverUMLHelper.getUMLInterfaceName(basedClass)%>)object;
- /**
- * This is used to store all the property descriptors for a class stereotyped with a block.
- * Derived classes should add descriptors to this vector.
- */
- <%String name = "itemPropertyDescriptorsFor"+SysMLOverUMLHelper.getDisplayedClassName(basedClass);%>
- List<IItemPropertyDescriptor> <%=name%> = new ArrayList<IItemPropertyDescriptor>();
- ItemProviderAdapter ite = ((IComposableAdapterFactory)adapterFactory).getIRootAdapterFactory().getItemProvider(UMLPackage.Literals.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(basedClass)%>);
- final List<IItemPropertyDescriptor> propertyDescriptors = ite.getPropertyDescriptors(this);
-
- <%=name%>.addAll(propertyDescriptors);
- <%=genClass.getName()%> steApplication = UMLUtil.getStereotypeApplication(element, <%=genClass.getName()%>.class);
- if(steApplication != null) {
- <%for (GenFeature genFeature : genClass.getPropertyFeatures()) { %>
- <%for(EClass basedClass2 : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
- <%=name%>.add(create<%=genFeature.getCapName()%>PropertyDescriptorFor<%=basedClass2.getName()%>(steApplication));
- <%}%>
- <%}%>
-
- }
- return <%=name%>;
-
- }
- <%}%>
- return itemPropertyDescriptors;
- }
-
-<%for (GenFeature genFeature : genClass.getPropertyFeatures()) { %>
- /**
- * This adds a property descriptor for the <%=genFeature.getFormattedName()%> feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void add<%=genFeature.getCapName()%>PropertyDescriptor(Object object)
- {
-<%@ include file="ItemProvider/addPropertyDescriptor.override.javajetinc" fail="alternative" %>
-<%@ start %>
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((<%=genModel.getImportedName("org.eclipse.emf.edit.provider.ComposeableAdapterFactory")%>)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_feature"),<%=genModel.getNonNLS()%>
- <%if (genFeature.getPropertyDescription() == null || genFeature.getPropertyDescription().length() == 0) {%>
- getString("_UI_PropertyDescriptor_description", "_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_feature", "_UI_<%=genFeature.getGenClass().getName()%>_type"),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%><%=genModel.getNonNLS(3)%>
- <%} else {%>
- getString("_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_description"),<%=genModel.getNonNLS()%>
- <%}%>
- <%=genFeature.getQualifiedFeatureAccessor()%>,
- <%=genFeature.getProperty() == GenPropertyKind.EDITABLE_LITERAL ? "true" : "false"%>,
- <%=genFeature.isPropertyMultiLine() ? "true" : "false"%>,
- <%=genFeature.isPropertySortChoices() ? "true" : "false"%>,
- <%if (genFeature.isReferenceType()) {%>
- null,
- <%} else {%>
- <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ItemPropertyDescriptor")%>.<%=genFeature.getPropertyImageName()%>,
- <%}%>
- <%if (genFeature.getPropertyCategory() == null || genFeature.getPropertyCategory().length() == 0) {%>
- null,
- <%} else {%>
- getString("<%=genModel.getPropertyCategoryKey(genFeature.getPropertyCategory())%>"),<%=genModel.getNonNLS()%>
- <%}%>
- <%if (genFeature.getPropertyFilterFlags().isEmpty()) {%>
- null));
- <%} else {%>
- new String[] {
- <%for (Iterator<String> j = genFeature.getPropertyFilterFlags().iterator(); j.hasNext();) { String filterFlag = j.next();%>
- <%if (filterFlag != null && filterFlag.length() > 0) {%>
- "<%=filterFlag%>"<%if (j.hasNext()) {%>,<%}%><%=genModel.getNonNLS()%>
- <%}%>
- <%}%>
- }));
- <%}%>
-<%@ end %><%//ItemProvider/addPropertyDescriptor.override.javajetinc%>
- }
-
- <%for(EClass basedClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
- /**
- * This adds a property descriptor for the <%=genFeature.getFormattedName()%> feature for the UML element <%=basedClass.getName()%>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected ItemPropertyDescriptorDecorator create<%=genFeature.getCapName()%>PropertyDescriptorFor<%=basedClass.getName()%>(Object object)
- {<%@ include file="ItemProvider/addPropertyDescriptor.override.javajetinc" fail="alternative" %>
- <%@ start %>
- return new ItemPropertyDescriptorDecorator(object, createItemPropertyDescriptor
- (((<%=genModel.getImportedName("org.eclipse.emf.edit.provider.ComposeableAdapterFactory")%>)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_feature"),<%=genModel.getNonNLS()%>
- <%if (genFeature.getPropertyDescription() == null || genFeature.getPropertyDescription().length() == 0) {%>
- getString("_UI_PropertyDescriptor_description", "_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_feature", "_UI_<%=genFeature.getGenClass().getName()%>_type"),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%><%=genModel.getNonNLS(3)%>
- <%} else {%>
- getString("_UI_<%=genFeature.getGenClass().getName()%>_<%=genFeature.getName()%>_description"),<%=genModel.getNonNLS()%>
- <%}%>
- <%=genFeature.getQualifiedFeatureAccessor()%>,
- <%=genFeature.getProperty() == GenPropertyKind.EDITABLE_LITERAL ? "true" : "false"%>,
- <%=genFeature.isPropertyMultiLine() ? "true" : "false"%>,
- <%=genFeature.isPropertySortChoices() ? "true" : "false"%>,
- <%if (genFeature.isReferenceType()) {%>
- null,
- <%} else {%>
- <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ItemPropertyDescriptor")%>.<%=genFeature.getPropertyImageName()%>,
- <%}%>
- <%if (genFeature.getPropertyCategory() == null || genFeature.getPropertyCategory().length() == 0) {%>
- null,
- <%} else {%>
- getString("<%=genModel.getPropertyCategoryKey(genFeature.getPropertyCategory())%>"),<%=genModel.getNonNLS()%>
- <%}%>
- <%if (genFeature.getPropertyFilterFlags().isEmpty()) {%>
- null));
- <%} else {%>
- new String[] {
- <%for (Iterator<String> j = genFeature.getPropertyFilterFlags().iterator(); j.hasNext();) { String filterFlag = j.next();%>
- <%if (filterFlag != null && filterFlag.length() > 0) {%>
- "<%=filterFlag%>"<%if (j.hasNext()) {%>,<%}%><%=genModel.getNonNLS()%>
- <%}%>
- <%}%>
- })));
- <%}%>
-<%@ end %><%//ItemProvider/addPropertyDescriptor.override.javajetinc%>
- }
- <%}%>
-
-
-<%}%>
-<%if (!genClass.getChildrenFeatures().isEmpty()) {%>
- /**
- * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
- * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
- * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public <%=genModel.getImportedName(genModel.useGenerics() ? "java.util.Collection<? extends org.eclipse.emf.ecore.EStructuralFeature>" : "java.util.Collection")%> getChildrenFeatures(Object object)
- {
- if (childrenFeatures == null)
- {
- super.getChildrenFeatures(object);
-<%for (GenFeature genFeature : genClass.getChildrenFeatures()) { %>
- childrenFeatures.add(<%=genFeature.getQualifiedFeatureAccessor()%>);
-<%}%>
- }
- return childrenFeatures;
- }
-
-<%if (!genClass.getChildrenFeatures().isEmpty()) {%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- protected <%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> getChildFeature(Object object, Object child)
- {
- // Check the type of the specified child object and return the proper feature to use for
- // adding (see {@link AddCommand}) it as a child.
-
- return super.getChildFeature(object, child);
- }
-
-<%}%>
-<%}%>
-<%if (genClass.needsHasChildrenMethodOverride()) {%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public boolean hasChildren(Object object)
- {
- return hasChildren(object, <%=genModel.isOptimizedHasChildren()%>);
- }
-
-<%}%>
-<%if (genClass.isImage()) {%>
- /**
- * This returns <%=genClass.getName()%>.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public Object getImage(Object object)
- {
- Object composedImage = overlayImage(object, getResourceLocator().getImage("full/obj16/<%=genClass.getName()%>"));<%=genModel.getNonNLS()%>
- if(object instanceof NamedElement){
- ComposedImage aux = new ComposedImage(Collections.singletonList(composedImage));
- return (Object)composeVisibilityImage(object,aux);
- }
- return composedImage;
- }
-
-<%}%>
-<%if (genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF26_VALUE && !genModel.isCreationIcons()) {%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- protected boolean shouldComposeCreationImage()
- {
- return true;
- }
-
-<%}%>
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public String getText(Object object)
- {
- /**
- * Handle Stereotype item and stereoted element
- */
- <%=genClass.getImportedInterfaceName()%> <%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%> = null;
- <%for(EClass basedClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
- if ( object instanceof <%=SysMLOverUMLHelper.getUMLInterfaceName(basedClass)%> ){
- EObject steApplication = UMLUtil.getStereotypeApplication((<%=SysMLOverUMLHelper.getUMLInterfaceName(basedClass)%>) object, <%=genClass.getName()%>.class);
- Stereotype ste = UMLUtil.getStereotype(steApplication);
- if ( ste != null){
- IItemLabelProvider ite = (IItemLabelProvider)((IComposableAdapterFactory)adapterFactory).getIRootAdapterFactory().getItemProvider(UMLPackage.Literals.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(basedClass)%>);
- String result = ite.getText(object);
- result = <%=SysMLOverUMLHelper.getClassifierCorrectLabel(genClass.getEcoreClass())%>_PREFIX_PATTERN.matcher(result).replaceFirst("");
- return <%=patternNameMap.get(basedClass)%>.matcher(result).replaceFirst("<%=genClass.getEcoreClass().getName()%>");
- }
-
- }
- <%}%>
- if (<%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%> == null){
- <%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%> = (<%=genClass.getImportedInterfaceName()%>) object;
- }
-
-
-<%@ include file="ItemProvider/getText.override.javajetinc" fail="alternative" %>
-<%@ start %>
-<%if (genClass.isMapEntry()) {%>
- <%=genClass.getImportedInterfaceName()%><%if (genModel.useGenerics()) {%><?, ?><%}%> <%=genClass.getSafeUncapName()%> = (<%=genClass.getImportedInterfaceName()%><%if (genModel.useGenerics()) {%><?, ?><%}%>)<%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%>;
- <%if (!genClass.getMapEntryKeyFeature().isPropertyMultiLine() && !genClass.getMapEntryValueFeature().isPropertyMultiLine()) {%>
- return "" + <%=genClass.getSafeUncapName()%>.getKey() + " -> " + <%=genClass.getSafeUncapName()%>.getValue();<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%>
- <%} else {%>
- <%if (genClass.getMapEntryKeyFeature().isPropertyMultiLine()) {%>
- String key = crop("" + <%=genClass.getSafeUncapName()%>.getKey());<%=genModel.getNonNLS()%>
- <%} else {%>
- String key = "" + <%=genClass.getSafeUncapName()%>.getKey();<%=genModel.getNonNLS()%>
- <%}%>
- <%if (genClass.getMapEntryValueFeature().isPropertyMultiLine()) {%>
- String value = crop("" + <%=genClass.getSafeUncapName()%>.getValue());<%=genModel.getNonNLS()%>
- <%} else {%>
- String value = "" + <%=genClass.getSafeUncapName()%>.getValue();<%=genModel.getNonNLS()%>
- <%}%>
- return key + " -> " + value;<%=genModel.getNonNLS()%>
- <%}%>
-<%} else if (genClass.getLabelFeature() != null) { GenFeature labelFeature = genClass.getLabelFeature();%>
- <%if (labelFeature.isPrimitiveType() && !labelFeature.getGenClass().isDynamic() && !labelFeature.isSuppressedGetVisibility()) {%>
- <%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%> <%=genClass.getSafeUncapName()%> = (<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)<%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%>;
- return getString("_UI_<%=genClass.getName()%>_type") + " " + <%=genClass.getSafeUncapName()%>.<%=genClass.getLabelFeature().getGetAccessor()%>();<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%>
- <%} else {%>
- <%if (labelFeature.isStringType() && !labelFeature.getGenClass().isDynamic() && !labelFeature.isSuppressedGetVisibility()) {%>
- <%if (labelFeature.isPropertyMultiLine()) {%>
- String label = crop(((<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)<%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%>).<%=labelFeature.getGetAccessor()%>());
- <%} else {%>
- String label = ((<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)<%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%>).<%=labelFeature.getGetAccessor()%>();
- <%}%>
- <%} else {%>
- <%if (labelFeature.isSuppressedGetVisibility() || labelFeature.getGenClass().isDynamic()) {%>
- <%=genModel.getImportedName("java.lang.Object")%> labelValue = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%>)<%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%>).eGet(<%=labelFeature.getQualifiedFeatureAccessor()%>);
- <%} else {%>
- <%=labelFeature.getRawImportedType()%> labelValue = ((<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)<%=SysMLOverUMLHelper.getBasedClassVariableName(genClass.getEcoreClass())%>).<%=labelFeature.getGetAccessor()%>();
- <%}%>
- String label = labelValue == null ? null : labelValue.toString();
- <%}%>
- return label == null || label.length() == 0 ?
- getString("_UI_<%=genClass.getName()%>_type") :<%=genModel.getNonNLS()%>
- getString("_UI_<%=genClass.getName()%>_type") + " " + label;<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%>
- <%}%>
-<%} else {%>
- return getString("_UI_<%=genClass.getName()%>_type");<%=genModel.getNonNLS()%>
-<%}%>
-<%@ end %><%//ItemProvider/getText.override.javajetinc%>
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public void notifyChanged(Notification notification)
- {
- updateChildren(notification);
-<%if (!genClass.getLabelNotifyFeatures().isEmpty() || !genClass.getContentNotifyFeatures().isEmpty() || !genClass.getLabelAndContentNotifyFeatures().isEmpty()) {%>
-
- switch (notification.getFeatureID(<%=genClass.getRawImportedInterfaceName()%>.class))
- {
- <%if (!genClass.getLabelNotifyFeatures().isEmpty()) {%>
- <%for (GenFeature genFeature : genClass.getLabelNotifyFeatures()) { %>
- case <%=genClass.getQualifiedFeatureID(genFeature)%>:
- <%}%>
- fireNotifyChanged(new <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ViewerNotification")%>(notification, notification.getNotifier(), false, true));
- return;
- <%}%>
- <%if (!genClass.getContentNotifyFeatures().isEmpty()) {%>
- <%for (GenFeature genFeature : genClass.getContentNotifyFeatures()) { %>
- case <%=genClass.getQualifiedFeatureID(genFeature)%>:
- <%}%>
- fireNotifyChanged(new <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ViewerNotification")%>(notification, notification.getNotifier(), true, false));
- return;
- <%}%>
- <%if (!genClass.getLabelAndContentNotifyFeatures().isEmpty()) {%>
- <%for (GenFeature genFeature : genClass.getLabelAndContentNotifyFeatures()) { %>
- case <%=genClass.getQualifiedFeatureID(genFeature)%>:
- <%}%>
- fireNotifyChanged(new <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ViewerNotification")%>(notification, notification.getNotifier(), true, true));
- return;
- <%}%>
- }
-
-
-<%}%>
-
- /**
- * Notify UML element
- */
- if ((adapterFactory instanceof IComposableAdapterFactory) && ((IComposableAdapterFactory)adapterFactory).getIRootAdapterFactory() != null) {
-
- <%for(EClass basedClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
-
- /**
- * Handle <%=basedClass.getName()%> stereotyped by <%=genClass.getName()%>
- */
-
-
- if (notification.getFeatureID(<%=SysMLOverUMLHelper.getUMLInterfaceName(basedClass)%>.class) != Notification.NO_FEATURE_ID){
- ItemProviderAdapter ite = ((IComposableAdapterFactory)adapterFactory).getIRootAdapterFactory().getItemProvider(UMLPackage.Literals.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(basedClass)%>);
- ite.notifyChanged(notification);
- return;
-
- }
- <%}%>
- }
-
- super.notifyChanged(notification);
- }
-
-<%if (genModel.isCreationCommands()) {%>
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- protected void collectNewChildDescriptors(<%=genModel.getImportedName(genModel.useGenerics() ? "java.util.Collection<java.lang.Object>" : "java.util.Collection")%> newChildDescriptors, Object object)
- {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- <%for (GenClass.ChildCreationData childCreationData : genClass.getChildCreationData()) { GenFeature createFeature = childCreationData.createFeature; GenFeature delegatedFeature = childCreationData.delegatedFeature; GenClassifier createClassifier = childCreationData.createClassifier;%>
- <%if (createFeature.isFeatureMapType()) {%>
- <%if (delegatedFeature.isReferenceType()) { GenClass createClass = (GenClass)createClassifier;%>
-<%@ include file="ItemProvider/newChildDescriptorsReferenceDelegatedFeature.override.javajetinc" fail="alternative"%>
-<%@ start %>
-
- newChildDescriptors.add
- (createChildParameter
- (<%=createFeature.getQualifiedFeatureAccessor()%>,
- <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.createEntry
- (<%=delegatedFeature.getQualifiedFeatureAccessor()%>,
- <%if (createClass.isMapEntry()) { %>
- <%=createClass.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.create(<%=createClass.getQualifiedClassifierAccessor()%>))));
- <%} else {%>
- <%=createClass.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.create<%=createClass.getName()%>())));
- <%}%>
-<%@ include file="ItemProvider/newChildDescriptorsReferenceDelegatedFeature.insert.javajetinc" fail="silent"%>
-<%@ end %><%//ItemProvider/newChildDescriptorsReferenceDelegatedFeature.override.javajetinc%>
- <%} else { GenDataType createDataType = (GenDataType)createClassifier;%>
-<%@ include file="ItemProvider/newChildDescriptorsAttributeDelegatedFeature.override.javajetinc" fail="alternative"%>
-<%@ start %>
-
- newChildDescriptors.add
- (createChildParameter
- (<%=createFeature.getQualifiedFeatureAccessor()%>,
- <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.createEntry
- (<%=delegatedFeature.getQualifiedFeatureAccessor()%>,
- <%if (delegatedFeature.isEnumBasedType()) {%>
- <%=delegatedFeature.getTypeGenEnum().getStaticValue(delegatedFeature.getEcoreFeature().getDefaultValueLiteral())%>)));
- <%} else if (delegatedFeature.isStringBasedType()) {%>
- <%=delegatedFeature.getCreateChildValueLiteral()%>)));<%=genModel.getNonNLS()%>
- <%} else { String literal = delegatedFeature.getCreateChildValueLiteral();%>
- <%=createDataType.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.createFromString(<%=createDataType.getQualifiedClassifierAccessor()%>, <%=literal%>))));<%if (literal != null) {%><%=genModel.getNonNLS()%><%} else {%> // TODO: ensure this is a valid literal value<%}%>
- <%}%>
-<%@ include file="ItemProvider/newChildDescriptorsAttributeDelegatedFeature.insert.javajetinc" fail="silent"%>
-<%@ end %><%//ItemProvider/newChildDescriptorsAttributeDelegatedFeature.override.javajetinc%>
- <%}%>
- <%} else if (createFeature.isReferenceType()) { GenClass createClass = (GenClass)createClassifier;%>
-<%@ include file="ItemProvider/newChildDescriptorsReferenceFeature.override.javajetinc" fail="alternative"%>
-<%@ start %>
-
- newChildDescriptors.add
- (createChildParameter
- (<%=createFeature.getQualifiedFeatureAccessor()%>,
- <%if (createClass.isMapEntry()) { %>
- <%=createClass.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.create(<%=createClass.getQualifiedClassifierAccessor()%>)));
- <%} else {%>
- <%=createClass.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.create<%=createClass.getName()%>()));
- <%}%>
-<%@ include file="ItemProvider/newChildDescriptorsReferenceFeature.insert.javajetinc" fail="silent"%>
-<%@ end %><%//ItemProvider/newChildDescriptorsReferenceFeature.override.javajetinc %>
- <%} else { GenDataType createDataType = (GenDataType)createClassifier;%>
-<%@ include file="ItemProvider/newChildDescriptorsAttributeFeature.override.javajetinc" fail="alternative"%>
-<%@ start %>
-
- newChildDescriptors.add
- (createChildParameter
- (<%=createFeature.getQualifiedFeatureAccessor()%>,
- <%if (createFeature.isEnumBasedType()) {%>
- <%=createFeature.getTypeGenEnum().getStaticValue(createFeature.getEcoreFeature().getDefaultValueLiteral())%>));
- <%} else if (createFeature.isStringBasedType()) {%>
- <%=createFeature.getCreateChildValueLiteral()%>));<%=genModel.getNonNLS()%>
- <%} else { String literal = createFeature.getCreateChildValueLiteral();%>
- <%=createDataType.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.createFromString(<%=createDataType.getQualifiedClassifierAccessor()%>, <%=literal%>)));<%if (literal != null) {%><%=genModel.getNonNLS()%><%} else {%> // TODO: ensure this is a valid literal value<%}%>
- <%}%>
-<%@ include file="ItemProvider/newChildDescriptorsAttributeFeature.insert.javajetinc" fail="silent"%>
-<%@ end %><%//ItemProvider/newChildDescriptorsAttributeFeature.override.javajetinc%>
- <%}%>
- <%}%>
- }
-
- <%if (!genClass.getSharedClassCreateChildFeatures().isEmpty()) {%>
- /**
- * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public String getCreateChildText(Object owner, Object feature, Object child, <%=genModel.getImportedName(genModel.useGenerics() ? "java.util.Collection<?>" : "java.util.Collection")%> selection)
- {
- Object childFeature = feature;
- Object childObject = child;
-
- <%if (genClass.hasFeatureMapCreateChildFeatures()) {%>
- if (childFeature instanceof <%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> && <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.isFeatureMap((EStructuralFeature)childFeature))
- {
- <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Entry entry = (FeatureMap.Entry)childObject;
- childFeature = entry.getEStructuralFeature();
- childObject = entry.getValue();
- }
-
- <%}%>
- boolean qualify =
- <%for (Iterator<GenFeature> i = genClass.getSharedClassCreateChildFeatures().iterator(); i.hasNext();) { GenFeature createFeature = i.next();%>
- childFeature == <%=createFeature.getQualifiedFeatureAccessor()%><%=i.hasNext() ? " ||" : ";"%>
- <%}%>
-
- if (qualify)
- {
- return getString
- ("_UI_CreateChild_text2",<%=genModel.getNonNLS()%>
- new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
- }
- return super.getCreateChildText(owner, feature, child, selection);
- }
-
- <%}%>
-<%}%>
-<%if (genClass.getProviderExtendsGenClass() == null || genClass.getProviderExtendsGenClass().getGenPackage() != genPackage && (!genPackage.isExtensibleProviderFactory() || genClass.getProviderExtendsGenClass().getGenPackage().isExtensibleProviderFactory() != genPackage.isExtensibleProviderFactory())) {%>
- /**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public <%=genModel.getImportedName("org.eclipse.emf.common.util.ResourceLocator")%> getResourceLocator()
- {
-<%if (genPackage.isExtensibleProviderFactory()) {%>
- return ((<%=genModel.getImportedName("org.eclipse.emf.edit.provider.IChildCreationExtender")%>)adapterFactory).getResourceLocator();
-<%} else {%>
- return <%=genPackage.getImportedEditPluginClassName()%>.INSTANCE;
-<%}%>
- }
-
-<%}%>
-
-<% if(hasToImplementIVisibilityOverlayImage) {%>
- /**
- * Compose the image with specific visibility logo
- * Copied from UML implementation
- *
- * @param object
- * @param composedImage
- * @return {@link ComposedImage}
- */
- public ComposedImage composeVisibilityImage(Object object, ComposedImage composedImage) {
- NamedElement namedElement = (NamedElement)object;
-
- if(namedElement.isSetVisibility()) {
- composedImage.getImages().add(UMLEditPlugin.INSTANCE.getImage("full/ovr16/VisibilityKind_" //$NON-NLS-1$
- + namedElement.getVisibility().getName()));
- }
-
- return composedImage;
- }
-<%}%>
-
-
- /**
- * Override in order to handle has children for based class
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public Collection<?> getChildren(Object object) {
- Collection<Object> result = (Collection<Object>)super.getChildren(object);
- if (object instanceof EObject){
- EObject eObject = (EObject)object;
- /**
- * Handle based elements type
- */
- if(((IComposableAdapterFactory)adapterFactory).getIRootAdapterFactory() != null) {
- <%for(EClass basedClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
- /**
- * Handle <%=basedClass.getName()%> stereotyped by <%=genClass.getName()%>
- */
- if (UMLPackage.Literals.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(basedClass)%>.equals(eObject.eClass())){
- ItemProviderAdapter ite = ((IComposableAdapterFactory)adapterFactory).getIRootAdapterFactory().getItemProvider(UMLPackage.Literals.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(basedClass)%>);
- result.addAll((Collection<Object>)ite.getChildren(object));
- return result;
- }
- <%}%>
- }
- }
- return result;
- }
-
- /**
- * Override in order to handle has children for based class
- * @generated
- */
- @Override
- public boolean hasChildren(Object object) {
- if (object instanceof EObject){
- EObject eObject = (EObject)object;
- /**
- * Handle based elements type
- */
- if(((IComposableAdapterFactory)adapterFactory).getIRootAdapterFactory() != null) {
- <%for(EClass basedClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
- /**
- * Handle <%=basedClass.getName()%> stereotyped by <%=genClass.getName()%>
- */
- if (UMLPackage.Literals.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(basedClass)%>.equals(eObject.eClass())){
- ItemProviderAdapter ite = ((IComposableAdapterFactory)adapterFactory).getIRootAdapterFactory().getItemProvider(UMLPackage.Literals.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(basedClass)%>);
- return super.hasChildren(object) || ite.hasChildren(object);
- }
- <%}%>
- }
- }
- return super.hasChildren(object);
- }
-
-
-<%@ include file="ItemProvider/insert.javajetinc" fail="silent" %>
-}
-<%genModel.emitSortedImports();%>
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/ItemProviderAdapterFactory.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/ItemProviderAdapterFactory.javajet deleted file mode 100644 index ac057ef6766..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/ItemProviderAdapterFactory.javajet +++ /dev/null @@ -1,587 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.edit" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="ItemProviderAdapterFactory" version="$Id: ItemProviderAdapterFactory.javajet,v 1.15 2010/04/28 20:38:09 khussey Exp $" %>
-<%
-/**
- * <copyright>
- *
- * Copyright (c) 2002-2010 IBM Corporation and others.
- * 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:
- * IBM - Initial API and implementation
- *
- * </copyright>
- */
-%>
-<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel(); /* Trick to import java.util.* without warnings */Iterator.class.getName();%>
-<%@ include file="../Header.javajetinc"%>
-package <%=genPackage.getProviderPackageName()%>;
-<%genModel.addImport("org.eclipse.papyrus.sysml.edit.provider.IComposableAdapterFactory");%>
-<%genModel.addImport("org.eclipse.papyrus.sysml.edit.provider.IRootAdapterFactory");%>
-<%genModel.addImport("org.eclipse.uml2.uml.UMLPackage");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.Adapter");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.Notification");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.Notifier");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.ChangeNotifier");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.ComposeableAdapterFactory");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.ComposedAdapterFactory");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IChangeNotifier");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IEditingDomainItemProvider");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IItemLabelProvider");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IItemPropertySource");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.INotifyChangedListener");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.IStructuredItemContentProvider");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.ITreeItemContentProvider");%>
-<%boolean useGenerics = genModel.useGenerics();%>
-<%String _ArrayList = genModel.getImportedName(useGenerics ? "java.util.ArrayList<java.lang.Object>" : "java.util.ArrayList");%>
-<%String _Collection = genModel.getImportedName(useGenerics ? "java.util.Collection<java.lang.Object>" : "java.util.Collection");%>
-<%genModel.markImportLocation(stringBuffer);%>
-
-/**
- * This is the factory that is used to provide the interfaces needed to support Viewers.
- * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
- * The adapters also support Eclipse property sheets.
- * Note that most of the adapters are shared among multiple instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-public class <%=genPackage.getItemProviderAdapterFactoryClassName()%> extends <%=genPackage.getImportedAdapterFactoryClassName()%> implements ComposeableAdapterFactory, IChangeNotifier, IComposableAdapterFactory <%if (genPackage.isDisposableProviderFactory()) {%>, <%=genModel.getImportedName("org.eclipse.emf.edit.provider.IDisposable")%><%}%><%if (genPackage.isExtensibleProviderFactory()) {%>, <%=genModel.getImportedName("org.eclipse.emf.edit.provider.IChildCreationExtender")%><%}%>
-{
-/**
- * Get the root adapter factory ( SysMLOverULM layer )
- * @generated
- */
- protected IRootAdapterFactory rootAdapterFactory;
- /**
- * {@link this#rootAdapterFactory}
- * @generated
- */
- public IRootAdapterFactory getIRootAdapterFactory() {
- return rootAdapterFactory;
- }
- /**
- * {@link this#rootAdapterFactory}
- * @generated
- */
- public void setRootAdapterFactory(IRootAdapterFactory root) {
- if(root instanceof IRootAdapterFactory){
- rootAdapterFactory = (IRootAdapterFactory)root;
- } else {
- throw new RuntimeException(root+" do not implement IRootAdapterFactory");
- }
- }
-<%if (genModel.hasCopyrightField()) {%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%>
-
-<%}%>
- /**
- * This keeps track of the root adapter factory that delegates to this adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected ComposedAdapterFactory parentAdapterFactory;
-
- /**
- * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected IChangeNotifier changeNotifier = new ChangeNotifier();
-
-<%if (genPackage.isDisposableProviderFactory() && genPackage.hasStatefulProvider()) {%>
- /**
- * This keeps track of all the item providers created, so that they can be {@link #dispose disposed}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genModel.getImportedName("org.eclipse.emf.edit.provider.Disposable")%> disposable = new Disposable();
-
-<%}%>
-<%if (genPackage.isExtensibleProviderFactory()) {%>
- /**
- * This helps manage the child creation extenders.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ChildCreationExtenderManager")%> childCreationExtenderManager = new <%=genModel.getImportedName("org.eclipse.emf.edit.provider.ChildCreationExtenderManager")%>(<%=genPackage.getImportedEditPluginClassName()%>.INSTANCE, <%=genPackage.getImportedPackageInterfaceName()%>.eNS_URI);
-
-<%}%>
- /**
- * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=_Collection%> supportedTypes = new <%=_ArrayList%>();
-
- /**
- * This constructs an instance.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=genPackage.getItemProviderAdapterFactoryClassName()%>()
- {
-<%for (String name : genPackage.getProviderSupportedTypes()) {%>
- supportedTypes.add(<%=genModel.getImportedName(name)%>.class);
-<%}%>
- }
-
-<%for (GenPackage genDelegate : genPackage.getAdapterDelegatePackages()) {%>
- /**
- * This keeps track of the factory to which to delegate adapter creation for objects from that package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genDelegate.getImportedAdapterFactoryClassName()%> <%=genPackage.getUncapAdapterFactoryDelegateName(genDelegate)%> = null;
-
- /**
- * This determines the delegate factory for the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genDelegate.getImportedAdapterFactoryClassName()%> get<%=genPackage.getAdapterFactoryDelegateName(genDelegate)%>()
- {
- if (<%=genPackage.getUncapAdapterFactoryDelegateName(genDelegate)%> == null)
- {
- <%=genModel.getImportedName("org.eclipse.emf.common.notify.AdapterFactory")%> rootAdapterFactory = getRootAdapterFactory();
- if (rootAdapterFactory instanceof ComposedAdapterFactory)
- {
- <%=genModel.getImportedName("org.eclipse.emf.common.notify.AdapterFactory")%> delegateAdapterFactory =
- ((ComposedAdapterFactory)rootAdapterFactory).getFactoryForType(<%=genDelegate.getImportedAdapterFactoryClassName()%>.getPackage());
- if (delegateAdapterFactory instanceof <%=genDelegate.getImportedAdapterFactoryClassName()%>)
- {
- <%=genPackage.getUncapAdapterFactoryDelegateName(genDelegate)%> = (<%=genDelegate.getImportedAdapterFactoryClassName()%>)delegateAdapterFactory;
- }
- }
- }
- return <%=genPackage.getUncapAdapterFactoryDelegateName(genDelegate)%>;
- }
-
-<%}%>
-<%for (GenClass genClass : genPackage.getGenClasses()) {%>
-<%if (!genClass.isAbstract() && genClass.getProvider() != GenProviderKind.NONE_LITERAL) {%>
-<%if (genClass.isProviderSingleton()) {%>
- /**
- * This keeps track of the one adapter used for all {@link <%=genClass.getQualifiedInterfaceName()%>} instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genClass.getProviderClassName()%> <%=genClass.getUncapName()%>ItemProvider;
-
- /**
- * This creates an adapter for a {@link <%=genClass.getQualifiedInterfaceName()%>}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public Adapter create<%=genClass.getName()%>Adapter()
- {
- if (<%=genClass.getUncapName()%>ItemProvider == null)
- {
- <%=genClass.getUncapName()%>ItemProvider = new <%=genClass.getProviderClassName()%>(this);
- }
-
- return <%=genClass.getUncapName()%>ItemProvider;
- }
-
-<%} else {%>
- /**
- * This creates an adapter for a {@link <%=genClass.getQualifiedInterfaceName()%>}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public Adapter create<%=genClass.getName()%>Adapter()
- {
- return new <%=genClass.getProviderClassName()%>(this);
- }
-
-<%}%>
-<%}%>
-<%}%>
-<%for (GenClass genClass : genPackage.getAdapterDelegateSuperClasses()) {%>
- /**
- * <%=genClass.getName()%> of <%=genClass.getItemProviderAdapterFactoryClassName()%>
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Adapter create<%=genClass.getName()%>Adapter()
- {
- return
- get<%=genClass.getItemProviderAdapterFactoryClassName()%>() == null ?
- null :
- get<%=genClass.getItemProviderAdapterFactoryClassName()%>().create<%=genClass.getName()%>Adapter();
- }
-
-<%}%>
- /**
- * This returns the root adapter factory that contains this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ComposeableAdapterFactory getRootAdapterFactory()
- {
- return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
- }
-
- /**
- * This sets the composed adapter factory that contains this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)
- {
- this.parentAdapterFactory = parentAdapterFactory;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public boolean isFactoryForType(Object type)
- {
- return supportedTypes.contains(type) || super.isFactoryForType(type);
- }
-
- /**
- * This implementation substitutes the factory itself as the key for the adapter.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public Adapter adapt(Notifier notifier, Object type)
- {
- return super.adapt(notifier, this);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public Object adapt(Object object, Object type)
- {
- if (isFactoryForType(type))
- {
- Object adapter = super.adapt(object, type);
- if (!(type instanceof Class<%if (genModel.useGenerics()) {%><?><%}%>) || <%if (genModel.getRuntimePlatform() == GenRuntimePlatform.GWT) {%><%=genModel.getImportedName("org.eclipse.emf.common.util.Reflect")%>.isInstance((Class<%if (genModel.useGenerics()) {%><?><%}%>)type, adapter)<%} else {%>(((Class<%if (genModel.useGenerics()) {%><?><%}%>)type).isInstance(adapter))<%}%>)
- {
- return adapter;
- }
- }
-
- return null;
- }
-
-<%if (genPackage.isDisposableProviderFactory() && genPackage.hasStatefulProvider()) {%>
- /**
- * Associates an adapter with a notifier via the base implementation, then records it to ensure it will be disposed.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- protected void associate(Adapter adapter, Notifier target)
- {
- super.associate(adapter, target);
- if (adapter != null)
- {
- disposable.add(adapter);
- }
- }
-
-<%}%>
-<%if (genPackage.isExtensibleProviderFactory()) {%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=genModel.getImportedName(useGenerics ? "java.util.List<org.eclipse.emf.edit.provider.IChildCreationExtender>" : "java.util.List")%> getChildCreationExtenders()
- {
- return childCreationExtenderManager.getChildCreationExtenders();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=genModel.getImportedName(useGenerics ? "java.util.Collection<?>" : "java.util.Collection")%> getNewChildDescriptors(Object object, <%=genModel.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")%> editingDomain)
- {
- return childCreationExtenderManager.getNewChildDescriptors(object, editingDomain);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=genModel.getImportedName("org.eclipse.emf.common.util.ResourceLocator")%> getResourceLocator()
- {
- return childCreationExtenderManager;
- }
-
-<%}%>
- /**
- * This adds a listener.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void addListener(INotifyChangedListener notifyChangedListener)
- {
- changeNotifier.addListener(notifyChangedListener);
- }
-
- /**
- * This removes a listener.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void removeListener(INotifyChangedListener notifyChangedListener)
- {
- changeNotifier.removeListener(notifyChangedListener);
- }
-
- /**
- * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void fireNotifyChanged(Notification notification)
- {
- changeNotifier.fireNotifyChanged(notification);
-
- if (parentAdapterFactory != null)
- {
- parentAdapterFactory.fireNotifyChanged(notification);
- }
- }
-
-<%if (genPackage.isDisposableProviderFactory()) {%>
- /**
- * This disposes all of the item providers created by this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void dispose()
- {
-<%if (genPackage.hasStatefulProvider()) {%>
- disposable.dispose();
-<%} else {%>
-<%for (GenClass genClass : genPackage.getGenClasses()) {%>
-<%if (!genClass.isAbstract() && genClass.isProviderSingleton()) {%>
- if (<%=genClass.getUncapName()%>ItemProvider != null) <%=genClass.getUncapName()%>ItemProvider.dispose();
-<%}%>
-<%}%>
-<%}%>
- }
-
-<%}%>
-<%if (genPackage.isChildCreationExtenders()) {%>
- <%for (Map.Entry<GenPackage, Map<GenClass, List<GenClass.ChildCreationData>>> packageEntry : genPackage.getExtendedChildCreationData().entrySet()) {%>
- /**
- * A child creation extender for the {@link <%=packageEntry.getKey().getImportedPackageInterfaceName()%>}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static class <%=genPackage.getChildCreationExtenderName(packageEntry.getKey())%> implements <%=genModel.getImportedName("org.eclipse.emf.edit.provider.IChildCreationExtender")%>
- {
- /**
- * The switch for creating child descriptors specific to each extended class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static class CreationSwitch extends <%=genModel.getImportedName(packageEntry.getKey().getQualifiedSwitchClassName())%><%=useGenerics ? "<Object>" : ""%>
- {
- /**
- * The child descriptors being populated.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genModel.getImportedName(useGenerics ? "java.util.List<Object>" : "java.util.List")%> newChildDescriptors;
-
- /**
- * The domain in which to create the children.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genModel.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")%> editingDomain;
-
- /**
- * Creates the a switch for populating child descriptors in the given domain.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- CreationSwitch(<%=genModel.getImportedName(useGenerics ? "java.util.List<Object>" : "java.util.List")%> newChildDescriptors, <%=genModel.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")%> editingDomain)
- {
- this.newChildDescriptors = newChildDescriptors;
- this.editingDomain = editingDomain;
- }
- <%for (Map.Entry<GenClass, List<GenClass.ChildCreationData>> classEntry : packageEntry.getValue().entrySet()) { GenClass genClass = classEntry.getKey();%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-<%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
-<%}%>
- public <%=genClass.getTypeParameters()%>Object case<%=genPackage.getClassUniqueName(genClass)%>(<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceTypeArguments()%> object)
- {
- <%for (GenClass.ChildCreationData childCreationData : classEntry.getValue()) { GenFeature createFeature = childCreationData.createFeature; GenFeature delegatedFeature = childCreationData.delegatedFeature; GenClassifier createClassifier = childCreationData.createClassifier;%>
- <%if (createFeature.isFeatureMapType()) {%>
- <%if (delegatedFeature.isReferenceType()) { GenClass createClass = (GenClass)createClassifier;%>
-<%@ include file="ItemProvider/newChildDescriptorsReferenceDelegatedFeature.override.javajetinc" fail="alternative"%>
-<%@ start %>
- newChildDescriptors.add
- (createChildParameter
- (<%=createFeature.getQualifiedFeatureAccessor()%>,
- <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.createEntry
- (<%=delegatedFeature.getQualifiedFeatureAccessor()%>,
- <%if (createClass.isMapEntry()) { %>
- <%=createClass.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.create(<%=createClass.getQualifiedClassifierAccessor()%>))));
- <%} else {%>
- <%=createClass.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.create<%=createClass.getName()%>())));
- <%}%>
-<%@ include file="ItemProvider/newChildDescriptorsReferenceDelegatedFeature.insert.javajetinc" fail="silent"%>
-<%@ end %><%//ItemProvider/newChildDescriptorsReferenceDelegatedFeature.override.javajetinc%>
- <%} else { GenDataType createDataType = (GenDataType)createClassifier;%>
-<%@ include file="ItemProvider/newChildDescriptorsAttributeDelegatedFeature.override.javajetinc" fail="alternative"%>
-<%@ start %>
- newChildDescriptors.add
- (createChildParameter
- (<%=createFeature.getQualifiedFeatureAccessor()%>,
- <%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMapUtil")%>.createEntry
- (<%=delegatedFeature.getQualifiedFeatureAccessor()%>,
- <%if (delegatedFeature.isEnumBasedType()) {%>
- <%=delegatedFeature.getTypeGenEnum().getStaticValue(delegatedFeature.getEcoreFeature().getDefaultValueLiteral())%>)));
- <%} else if (delegatedFeature.isStringBasedType()) {%>
- <%=delegatedFeature.getCreateChildValueLiteral()%>)));<%=genModel.getNonNLS()%>
- <%} else { String literal = delegatedFeature.getCreateChildValueLiteral();%>
- <%=createDataType.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.createFromString(<%=createDataType.getQualifiedClassifierAccessor()%>, <%=literal%>))));<%if (literal != null) {%><%=genModel.getNonNLS()%><%} else {%> // TODO: ensure this is a valid literal value<%}%>
- <%}%>
-<%@ include file="ItemProvider/newChildDescriptorsAttributeDelegatedFeature.insert.javajetinc" fail="silent"%>
-<%@ end %><%//ItemProvider/newChildDescriptorsAttributeDelegatedFeature.override.javajetinc%>
- <%}%>
- <%} else if (createFeature.isReferenceType()) { GenClass createClass = (GenClass)createClassifier;%>
-<%@ include file="ItemProvider/newChildDescriptorsReferenceFeature.override.javajetinc" fail="alternative"%>
-<%@ start %>
- newChildDescriptors.add
- (createChildParameter
- (<%=createFeature.getQualifiedFeatureAccessor()%>,
- <%if (createClass.isMapEntry()) { %>
- <%=createClass.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.create(<%=createClass.getQualifiedClassifierAccessor()%>)));
- <%} else {%>
- <%=createClass.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.create<%=createClass.getName()%>()));
- <%}%>
-<%@ include file="ItemProvider/newChildDescriptorsReferenceFeature.insert.javajetinc" fail="silent"%>
-<%@ end %><%//ItemProvider/newChildDescriptorsReferenceFeature.override.javajetinc %>
- <%} else { GenDataType createDataType = (GenDataType)createClassifier;%>
-<%@ include file="ItemProvider/newChildDescriptorsAttributeFeature.override.javajetinc" fail="alternative"%>
-<%@ start %>
- newChildDescriptors.add
- (createChildParameter
- (<%=createFeature.getQualifiedFeatureAccessor()%>,
- <%if (createFeature.isEnumBasedType()) {%>
- <%=createFeature.getTypeGenEnum().getStaticValue(createFeature.getEcoreFeature().getDefaultValueLiteral())%>));
- <%} else if (createFeature.isStringBasedType()) {%>
- <%=createFeature.getCreateChildValueLiteral()%>));<%=genModel.getNonNLS()%>
- <%} else { String literal = createFeature.getCreateChildValueLiteral();%>
- <%=createDataType.getGenPackage().getQualifiedEFactoryInstanceAccessor()%>.createFromString(<%=createDataType.getQualifiedClassifierAccessor()%>, <%=literal%>)));<%if (literal != null) {%><%=genModel.getNonNLS()%><%} else {%> // TODO: ensure this is a valid literal value<%}%>
- <%}%>
-<%@ include file="ItemProvider/newChildDescriptorsAttributeFeature.insert.javajetinc" fail="silent"%>
-<%@ end %><%//ItemProvider/newChildDescriptorsAttributeFeature.override.javajetinc%>
- <%}%>
-
- <%}%>
- return null;
- }
-
- <%}%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genModel.getImportedName("org.eclipse.emf.edit.command.CommandParameter")%> createChildParameter(Object feature, Object child)
- {
- return new <%=genModel.getImportedName("org.eclipse.emf.edit.command.CommandParameter")%>(null, feature, child);
- }
-
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=_Collection%> getNewChildDescriptors(Object object, <%=genModel.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")%> editingDomain)
- {
- <%=_ArrayList%> result = new <%=_ArrayList%>();
- new CreationSwitch(result, editingDomain).doSwitch((<%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%>)object);
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=genModel.getImportedName("org.eclipse.emf.common.util.ResourceLocator")%> getResourceLocator()
- {
- return <%=genPackage.getImportedEditPluginClassName()%>.INSTANCE;
- }
- }
-
-
- <%}%>
-<%}%>
-}
-<%genModel.emitSortedImports();%>
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/SysMLAdapterFactoryRegistery.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/SysMLAdapterFactoryRegistery.javajet deleted file mode 100644 index 3694bc5580a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/edit/SysMLAdapterFactoryRegistery.javajet +++ /dev/null @@ -1,193 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="import java.util.HashMap org.eclipse.papyrus.sysml.sysmloveruml.codegen.generationUtils.SysMLOverUMLHelper org.eclipse.emf.ecore.EClass java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="SysMLadapterFactoryRegistryMap" version="$Id: SysMLadapterFactoryRegistryMap.javajet,v 1.13 2011/09/01 15:53:17 emerks Exp $" %>
-<%
-/*****************************************************************************
- * Copyright (c) 2011 Atos.
- *
- *
- * 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:
- * Atos - Initial API and implementation
- *
- *****************************************************************************/
-%>
-<%GenModel genModel = (GenModel)argument; /* Trick to import java.util.* without warnings */Iterator.class.getName();%>
-/*****************************************************************************
- * Copyright (c) 2011 Atos.
- *
- *
- * 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:
- * Atos - Initial API and implementation
- *****************************************************************************/
-package <%=SysMLOverUMLHelper.getAdapterFactoryRegistryPackageName()%>;
-<%genModel.addImport("org.eclipse.uml2.uml.Package");%>
-<%genModel.addImport("org.eclipse.emf.edit.provider.ItemProviderAdapter");%>
-<%genModel.addImport("org.eclipse.uml2.uml.Class");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.Adapter");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.Notifier");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.impl.AdapterFactoryImpl");%>
-<%genModel.addImport("org.eclipse.emf.ecore.EObject");%>
-<%genModel.addImport("org.eclipse.emf.ecore.EPackage");%>
-<%genModel.addImport("org.eclipse.uml2.uml.*");%>
-<%genModel.addImport("org.eclipse.papyrus.sysml.extendedelements.IComposableAdapterFactory");%>
-<%genModel.addImport("org.eclipse.uml2.uml.UMLPackage");%>
-
-
-<%genModel.addImport("org.eclipse.papyrus.sysml.extendedelements.AdapterFactoryImplExtended");%>
-<%for ( GenPackage genPackage : genModel.getAllGenPackagesWithConcreteClasses() ) { %>
- <%genModel.addImport(genPackage.getItemProviderAdapterFactoryClassName());%>
-<%}%>
-
-/**
- * Get a registry of all SysML Adapter Factory classified by the UML class their
- * correspond.
- *
- * Example:
- *
- * <Class.class> ->[ModelelementsItemProviderAdapterFactory,
- * BlocksAdapterItemProviderFactory, RequirementsAdapterItemProviderFactory]
- *
- * @generated
- */
-public class <%=SysMLOverUMLHelper.getAdapterFactoryRegistryClassName()%>
-{
- <%HashMap<GenPackage,String> varaibleStoreName = new HashMap<GenPackage,String>();%>
- <%for ( GenPackage genPackage : genModel.getAllGenPackagesWithConcreteClasses() ) { %>
- /**
- * Keep track of the item provider of type <%=genPackage.getItemProviderAdapterFactoryClassName()%>
- * @generated
- */
- <%varaibleStoreName.put(genPackage,genPackage.getUncapAdapterFactoryClassName()+"ItemProvider");%>
- protected <%=genPackage.getItemProviderAdapterFactoryClassName()%> <%=genPackage.getUncapAdapterFactoryClassName()%>ItemProvider;
- <%}%>
- /**
- * Registry for all SysML AdapterFactory
- * @generated
- */
- private List<AdapterFactory> adapterFactoryRegistry = new ArrayList<AdapterFactory>(<%=genModel.getAllGenPackagesWithConcreteClasses().size()%>);
-
-
- /**
- * Registry of all {@link AdapterFactory} classified by corresponding UML element
- * @generated
- */
- private HashMap<EClass,ArrayList<AdapterFactory>> adapterFactoryRegistryMap = new HashMap<EClass,ArrayList<AdapterFactory>>();
- /**
- * Default adapterFactory
- * @generated
- */
- private UMLItemProviderAdapterFactory defaultAdapterFactory = new UMLItemProviderAdapterFactory();
- /**
- * Constructor + initialize
- * @generated
- */
- private <%=SysMLOverUMLHelper.getAdapterFactoryRegistryClassName()%> (){
- /**
- * Initialize all AdapterFactories
- */
- <%for ( GenPackage genPackage : genModel.getAllGenPackagesWithConcreteClasses() ) { %>
- <%=varaibleStoreName.get(genPackage)%> = new <%=genPackage.getItemProviderAdapterFactoryClassName()%>();
- adapterFactoryRegistry.add(<%=varaibleStoreName.get(genPackage)%>);
- <%}%>
- <% TreeMap<String, Set<GenPackage>> result = SysMLOverUMLHelper.getSortedEClassBasedElementFromModel(genModel);%>
- <%for(Map.Entry<String,Set<GenPackage>> entry : result.entrySet()) {%>
- <%boolean isFirst = true;%>
- <%String key = entry.getKey();%>
- <%Set<GenPackage> value = entry.getValue();%>
- <% for (GenPackage genPackageAux : value) {%>
- <% if (isFirst) {%>
- <%isFirst = false;%>
- /**
- * AdapterFactories for the <%=key%> elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.<%=key%>,new ArrayList<AdapterFactory>(Collections.singletonList(<%=varaibleStoreName.get(genPackageAux)%>)));
- <%} else { %>
- adapterFactoryRegistryMap.get(UMLPackage.Literals.<%=key%>).add(<%=varaibleStoreName.get(genPackageAux)%>);
- <%}%>
- <%}%>
- <%}%>
- }
- /**
- * Singleton holder
- * @generated
- */
- private static class SingletonHolder {
- protected static <%=SysMLOverUMLHelper.getAdapterFactoryRegistryClassName()%> instance = null;
- static {
- instance = new <%=SysMLOverUMLHelper.getAdapterFactoryRegistryClassName()%>();
- }
- }
- /**
- * @generated
- */
- public static <%=SysMLOverUMLHelper.getAdapterFactoryRegistryClassName()%> getSingleton() {
- return SingletonHolder.instance;
- }
- /**
- * Get the default AdapterFactory
- * @return List<AdapterFactory> return the default adapter factory (UML)
- * @generated
- */
- public AdapterFactory getDefaultAdapterFactory() {
- return (AdapterFactory)defaultAdapterFactory;
- }
-
- /**
- * Get the list of all AdapterFactory for this type
- * @param Object element
- * @return List<AdapterFactory> List of all the adapter factories which can handle the object element
- * @generated
- */
- public List<AdapterFactory> getAdapterFactoriesForType(Object element){
- if (element instanceof EObject) {
- EObject eObject = (EObject) element;
- ArrayList<AdapterFactory> result = adapterFactoryRegistryMap.get(eObject.eClass());
- if ( result != null){
- return result;
- } else {
- return Collections.singletonList(getDefaultAdapterFactory());
- }
- } else {
- throw new RuntimeException("org.eclipse.papyrus.sysml.edit.utils.SysmlRegistryAdapterFactoryRegistery : This factory only works with EOBjects");
- }
- }
-
- /**
- * Set the the root AdapterFactory for all registered adapter factory
- * @param AdapterFactory The adapter factory which will be the root
- * @generated
- */
- public void setRootAdapterFactory(IRootAdapterFactory adapter){
- for (AdapterFactory adap : adapterFactoryRegistry) {
- if ( adap instanceof IComposableAdapterFactory){
- ((IComposableAdapterFactory)adap).setRootAdapterFactory(adapter);
- }
- }
- }
- /**
- * Get a map of all UML ItemProvider needed
- * @generated
- */
- public HashMap<EClass,ItemProviderAdapter> getUMLItemProviderClassifedByUMLElement(AdapterFactory rootAdapterFactory){
- HashMap<EClass,ItemProviderAdapter> result = new HashMap<EClass,ItemProviderAdapter>();
- <%for (EClass umlElement: SysMLOverUMLHelper.getAllUMLElementNameFromModel(genModel)) { %>
- result.put(UMLPackage.Literals.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(umlElement)%>,new <%=umlElement.getName()%>ItemProvider(rootAdapterFactory));
- <%}%>
- return result;
- }
-
-
-
-
-
-
-} //<%=SysMLOverUMLHelper.getAdapterFactoryRegistryPackageName()%>;
-<%genModel.emitSortedImports();%>
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/model/AdapterFactoryClass.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/model/AdapterFactoryClass.javajet deleted file mode 100644 index 7e857787e3a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/model/AdapterFactoryClass.javajet +++ /dev/null @@ -1,188 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="org.eclipse.papyrus.sysml.sysmloveruml.codegen.generationUtils.SysMLOverUMLHelper org.eclipse.emf.ecore.EClass java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="AdapterFactoryClass" version="$Id: AdapterFactoryClass.javajet,v 1.13 2008/12/13 15:53:17 emerks Exp $" %>
-<%
-/**
- * <copyright>
- *
- * Copyright (c) 2002-2006 IBM Corporation and others.
- * 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:
- * IBM - Initial API and implementation
- *
- * </copyright>
- */
-%>
-<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel(); /* Trick to import java.util.* without warnings */Iterator.class.getName();%>
-<%@ include file="../Header.javajetinc"%>
-package <%=genPackage.getUtilitiesPackageName()%>;
-<%genModel.addImport("org.eclipse.uml2.uml.Package");%>
-<%genModel.addImport("org.eclipse.uml2.uml.Class");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.Adapter");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.Notifier");%>
-<%genModel.addImport("org.eclipse.emf.common.notify.impl.AdapterFactoryImpl");%>
-<%genModel.addImport("org.eclipse.emf.ecore.EObject");%>
-<%genModel.addImport("org.eclipse.emf.ecore.EPackage");%>
-<%genModel.addImport("org.eclipse.uml2.uml.*");%>
-
-<%if (!genPackage.hasJavaLangConflict() && !genPackage.getUtilitiesPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*");%>
-<%String typeArgument = genModel.useGenerics() ? "<Adapter>" : "";%>
-<%String returnType = genModel.useGenerics() ? "Adapter" : genModel.getImportedName("java.lang.Object");%>
-<%String adapterCast = genModel.useGenerics() ? "" : "(Adapter)";%>
-<%genModel.markImportLocation(stringBuffer);%>
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see <%=genPackage.getQualifiedPackageInterfaceName()%>
- * @generated
- */
-public class <%=genPackage.getAdapterFactoryClassName()%> extends AdapterFactoryImpl
-{
-<%if (genModel.hasCopyrightField()) {%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%>
-
-<%}%>
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static <%=genPackage.getImportedPackageInterfaceName()%> modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=genPackage.getAdapterFactoryClassName()%>()
- {
- if (modelPackage == null)
- {
- modelPackage = <%=genPackage.getImportedPackageInterfaceName()%>.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- <%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
- <%}%>
- public boolean isFactoryForType(Object object)
- {
- if (object == modelPackage || object == UMLPackage.eINSTANCE)
- {
- return true;
- }
- if (object instanceof EObject)
- {
- EPackage ePackage = ((EObject)object).eClass().getEPackage() ;
- return ePackage != null && (ePackage == modelPackage || ePackage == UMLPackage.eINSTANCE);
- }
- return false;
- }
-
- /**
- * The switch that delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected <%=genPackage.getSwitchClassName()%><%=typeArgument%> modelSwitch =
- new <%=genPackage.getSwitchClassName()%><%=typeArgument%>()
- {
- <%for (GenClass genClass : genPackage.getGenClasses()) {%>
- <%for (EClass eClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
- @Override
- public <%=genClass.getTypeParameters()%><%=returnType%> <%=SysMLOverUMLHelper.getCaseXStereotypedByYLabelFunction(genClass,eClass)%>(<%=eClass.getName()%> <%=SysMLOverUMLHelper.getBasedClassVariableName(eClass)%>) {
- if(<%=SysMLOverUMLHelper.getIsXFromYLabelFunction(genClass,eClass)%>(<%=SysMLOverUMLHelper.getBasedClassVariableName(eClass)%>)){
- return create<%=genPackage.getClassUniqueName(genClass)%>Adapter();
- }
- return null;
- }
- <%}%>
- <%}%>
-<%for (GenClass genClass : genPackage.getAllSwitchGenClasses()) {%>
- <%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
- <%}%>
- public <%=genClass.getTypeParameters()%><%=returnType%> case<%=genPackage.getClassUniqueName(genClass)%>(<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceTypeArguments()%> object)
- {
- return create<%=genPackage.getClassUniqueName(genClass)%>Adapter();
- }
-<%}%>
- <%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
- <%}%>
- public <%=returnType%> defaultCase(EObject object)
- {
- return create<%=genPackage.getClassUniqueName(null)%>Adapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- <%if (genModel.useClassOverrideAnnotation()) {%>
- @Override
- <%}%>
- public Adapter createAdapter(Notifier target)
- {
- return <%=adapterCast%>modelSwitch.doSwitch((EObject)target);
- }
-
-<%for (GenClass genClass : genPackage.getAllSwitchGenClasses()) {%>
-
- /**
- * Creates a new adapter for an object of class '{@link <%=genClass.getQualifiedInterfaceName()%> <em><%=genClass.getFormattedName()%></em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see <%=genClass.getQualifiedInterfaceName()%>
- * @generated
- */
- public Adapter create<%=genPackage.getClassUniqueName(genClass)%>Adapter()
- {
- return null;
- }
-<%}%>
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter create<%=genPackage.getClassUniqueName(null)%>Adapter()
- {
- return null;
- }
-
-} //<%=genPackage.getAdapterFactoryClassName()%>
-<%genModel.emitSortedImports();%>
diff --git a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/model/SwitchClass.javajet b/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/model/SwitchClass.javajet deleted file mode 100644 index 166b6362e8a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.sysml.sysmloveruml.codegen/templates/model/SwitchClass.javajet +++ /dev/null @@ -1,306 +0,0 @@ -<%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="org.eclipse.emf.ecore.EClass java.util.* org.eclipse.papyrus.sysml.sysmloveruml.codegen.generationUtils.SysMLOverUMLHelper org.eclipse.emf.codegen.ecore.genmodel.*" class="SwitchClass" version="$Id: SwitchClass.javajet,v 1.23 2011/01/20 01:10:53 emerks Exp $" %>
-<%
-/**
- * <copyright>
- *
- * Copyright (c) 2002-2006 IBM Corporation and others.
- * 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:
- * IBM - Initial API and implementation
- *
- * </copyright>
- */
-%>
-<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();%>
-<%boolean supportsComposition = genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF27_VALUE;%>
-<%@ include file="../Header.javajetinc"%>
-package <%=genPackage.getUtilitiesPackageName()%>;
-
-<%genModel.addImport("org.eclipse.uml2.uml.Package");%>
-<%genModel.addImport("org.eclipse.uml2.uml.Class");%>
-<%genModel.addImport("org.eclipse.uml2.uml.*");%>
-<%genModel.addImport("org.eclipse.uml2.uml.util.UMLUtil");%>
-<%if (supportsComposition) {%>
-<%genModel.addImport("org.eclipse.emf.ecore.EObject");%>
-<%genModel.addImport("org.eclipse.emf.ecore.EPackage");%>
-<%genModel.addImport("org.eclipse.emf.ecore.util.Switch");%>
-<%} else {%>
-<%genModel.addImport("org.eclipse.emf.ecore.EClass");%>
-<%genModel.addImport("org.eclipse.emf.ecore.EObject");%>
-<%}%>
-<%if (!genPackage.hasJavaLangConflict() && !genPackage.getUtilitiesPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*");%>
-<%
-String templateParameterName = null;
-if (genModel.useGenerics())
-{
- Set<String> usedNames = new HashSet<String>();
- for (GenEnum genEnum : genPackage.getGenEnums())
- {
- usedNames.add(genEnum.getName());
- }
- for (GenClass genClass : genPackage.getAllSwitchGenClasses())
- {
- if (!genClass.isDynamic() && !genClass.isExternalInterface())
- {
- usedNames.add(genClass.getName());
- }
- for (GenTypeParameter genTypeParameter : genClass.getGenTypeParameters())
- {
- usedNames.add(genTypeParameter.getName());
- }
- }
- templateParameterName = "T";
- for (int i = 1; usedNames.contains(templateParameterName); ++i)
- {
- templateParameterName = "T" + i;
- }
-}
-%>
-<%String templateParameters = genModel.useGenerics() ? "<" + templateParameterName + ">" : "";%>
-<%String returnType = genModel.useGenerics() ? templateParameterName : genModel.getImportedName("java.lang.Object");%>
-<%genModel.markImportLocation(stringBuffer);%>
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see <%=genPackage.getQualifiedPackageInterfaceName()%>
- * @generated
- */
-public class <%=genPackage.getSwitchClassName()%><%=templateParameters%><%if (supportsComposition){%> extends Switch<%=templateParameters%><%}%>
-{
-<%if (genModel.hasCopyrightField()) {%>
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%>
-
-<%}%>
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static <%=genPackage.getImportedPackageInterfaceName()%> modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public <%=genPackage.getSwitchClassName()%>()
- {
- if (modelPackage == null)
- {
- modelPackage = <%=genPackage.getImportedPackageInterfaceName()%>.eINSTANCE;
- }
- }
-
-<%if (supportsComposition) {%>
- /**
- * Checks whether this is a switch for the given package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @parameter ePackage the package in question.
- * @return whether this is a switch for the given package.
- * @generated
- */
- @Override
- protected boolean isSwitchFor(EPackage ePackage)
- {
- /**
- * ePackage == UMLPackage.eINSTANCE in order to accept UML element
- */
- return ePackage == modelPackage || ePackage == UMLPackage.eINSTANCE;
- }
-<%} else {%>
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public <%=returnType%> doSwitch(EObject theEObject)
- {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected <%=returnType%> doSwitch(EClass theEClass, EObject theEObject)
- {
- if (theEClass.eContainer() == modelPackage)
- {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else
- {
- <%=genModel.getImportedName("java.util.List")%><%if (genModel.useGenerics()) {%><<%=genModel.getImportedName("org.eclipse.emf.ecore.EClass")%>><%}%> eSuperTypes = theEClass.getESuperTypes();
- return
- eSuperTypes.isEmpty() ?
- defaultCase(theEObject) :
- doSwitch(<%if (!genModel.useGenerics()) {%>(EClass)<%}%>eSuperTypes.get(0), theEObject);
- }
- }
-<%}%>
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
-<%if (supportsComposition) {%>
- @Override
-<%}%>
- protected <%=returnType%> doSwitch(int classifierID, EObject theEObject)
- {
- if(theEObject.eClass().getEPackage() == UMLPackage.eINSTANCE){
- switch(classifierID)
- {
- <%//BEGIN : Handling UML element %>
- <%String currentClassifier = "";%>
- <%TreeMap<String,List<GenClass>> sortedBasedElement = SysMLOverUMLHelper.getSortedBasedElementFromPackage(genPackage);%>
- <%for (Map.Entry<String,List<GenClass>> entry : sortedBasedElement.entrySet()){%>
- <%String key = entry.getKey();%>
- <%List<GenClass> value = entry.getValue();%>
- <%int ite = 0;%>
- <%for (GenClass genClass : value) { %>
- <% if (ite == 0) {%>
- case UMLPackage.<%=SysMLOverUMLHelper.getClassifierCorrectLabel(key)%>:{
- <%=key%> umlElement = (<%=key%>) theEObject;
- T result;
- <%}%>
- result = <%=SysMLOverUMLHelper.getCaseXStereotypedByYLabelFunction(genClass,key)%>(umlElement);
- if (result != null){
- return result;
- }
- <% if(ite == (value.size()-1)) {%>
- return null;
- }
- <%}%>
- <%ite++;%>
- <%}%>
- <%if(key.equals(sortedBasedElement.lastKey())){%>
- default :
- return defaultCase(theEObject);
- }
- <%}%>
- <%}%>
- <%// END : Handling UML element %>
-
- } else {
- switch (classifierID)
- {
-<%for (GenClass genClass : genPackage.getGenClasses()) {%>
- <%if (!genClass.isExternalInterface() && !genClass.isEObject() || genClass.isMapEntry()) { String result = "result".equals(genClass.getSafeUncapName()) ? "theResult" : "result"; %>
- case <%=genPackage.getImportedPackageInterfaceName()%>.<%=genPackage.getClassifierID(genClass)%>:
- {
- <%if (genClass.isUncheckedCast() || genClass.isMapEntry() && genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50) {%>@SuppressWarnings("unchecked") <%}%><%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%> <%=genClass.getSafeUncapName()%> = (<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceWildTypeArguments()%>)theEObject;
- <%=returnType%> <%=result%> = case<%=genPackage.getClassUniqueName(genClass)%>(<%=genClass.getSafeUncapName()%>);
- <%for (GenClass baseGenClass : genClass.getSwitchGenClasses()) {%>
- if (<%=result%> == null) <%=result%> = case<%=genPackage.getClassUniqueName(baseGenClass)%>(<%if (genClass.isMapEntry()) {%>(<%=baseGenClass.getImportedInterfaceName()%><%=baseGenClass.getInterfaceTypeArguments()%>)<%}%><%=genClass.getSafeUncapName()%>);
- <%}%>
- if (<%=result%> == null) <%=result%> = defaultCase(theEObject);
- return <%=result%>;
- }
- <%}%>
-<%}%>
- default: return defaultCase(theEObject);
- }
- }
- }
-<%for (GenClass genClass : genPackage.getAllSwitchGenClasses()) {%>
-
- /**
- * Returns the result of interpreting the object as an instance of '<em><%=genClass.getFormattedName()%></em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em><%=genClass.getFormattedName()%></em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public <%=genClass.getTypeParameters()%><%=returnType%> case<%=genPackage.getClassUniqueName(genClass)%>(<%=genClass.getImportedInterfaceName()%><%=genClass.getInterfaceTypeArguments()%> object)
- {
- return null;
- }
-<%}%>
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
-<%if (supportsComposition) {%>
- @Override
-<%}%>
- public <%=returnType%> defaultCase(EObject object)
- {
- return null;
- }
-
- <%for (GenClass genClass : genPackage.getGenClasses()) {%>
- <%for (EClass eClass : SysMLOverUMLHelper.getBasedElement(genClass.getEcoreClass())) {%>
- /**
- * Tell if the <%=eClass.getName()%> is a <%=genClass.getEcoreClass().getName()%> implementation
- * @param <%=eClass.getName()%>
- * @return
- * @generated
- */
- protected Boolean <%=SysMLOverUMLHelper.getIsXFromYLabelFunction(genClass,eClass) %>(<%=eClass.getName()%> <%=SysMLOverUMLHelper.getBasedClassVariableName(eClass)%>) {
- if(UMLUtil.getStereotypeApplication(<%=SysMLOverUMLHelper.getBasedClassVariableName(eClass)%>, <%=genPackage.getClassUniqueName(genClass)%>.class) != null) {
- return true;
- }
- return false;
- }
-
-
- /**
- * Returns the result of interpreting the object as an instance of '<em><%=genClass.getEcoreClass().getName()%></em>' from <%=eClass.getName()%> object. <!--
- * begin-user-doc --> This implementation returns null; returning a non-null result will
- * terminate the switch. <!-- end-user-doc -->
- *
- * @param object
- * the target of the switch.
- * @return the result of interpreting the object as an instance of '<em><%=genClass.getEcoreClass().getName()%></em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T <%=SysMLOverUMLHelper.getCaseXStereotypedByYLabelFunction(genClass,eClass)%>(<%=eClass.getName()%> <%=SysMLOverUMLHelper.getBasedClassVariableName(eClass)%>) {
- return null;
- }
- <%}%>
- <%}%>
-
-} //<%=genPackage.getSwitchClassName()%>
-<%genModel.emitSortedImports();%>
|