diff options
37 files changed, 618 insertions, 2698 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/pom.xml b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/pom.xml index 30b7855832f..cfaa94bfb04 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/pom.xml +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/pom.xml @@ -11,4 +11,46 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**/*</include> + </includes> + <excludes> + <exclude>.gitignore</exclude> + </excludes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/.gitignore b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/.gitignore new file mode 100644 index 00000000000..c96a04f008e --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/.gitignore b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/.gitignore deleted file mode 100644 index 5205a6ea352..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/CppCodeGenerator.java diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.java deleted file mode 100644 index c27a5e407c9..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.java +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import java.util.Collection; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.Const; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.Modifier; -import org.eclipse.papyrus.cpp.codegen.xtend.CppDocumentation; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.DataType; -import org.eclipse.uml2.uml.Interface; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Signal; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.ValueSpecification; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppAttribute { - public static String CppStaticAttributes(final Classifier classifier) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// static attributes (if any)"); - _builder.newLine(); - { - Collection<Property> _ownedAttributes = CppAttribute.getOwnedAttributes(classifier); - for(final Property ownedAttribute : _ownedAttributes) { - { - boolean _and = false; - boolean _isStatic = ownedAttribute.isStatic(); - if (!_isStatic) { - _and = false; - } else { - boolean _hasStereotype = GenUtils.hasStereotype(ownedAttribute, Const.class); - boolean _not = (!_hasStereotype); - _and = _not; - } - if (_and) { - CharSequence _CppStaticAttributeImplementation = CppAttribute.CppStaticAttributeImplementation(ownedAttribute); - _builder.append(_CppStaticAttributeImplementation, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - String code = _builder.toString(); - return code; - } - - public static Collection<Property> getOwnedAttributes(final Classifier cl) { - Collection<Property> _xblockexpression = null; - { - final EList<Property> attributes = CppAttribute.getOwnedAttributesWNull(cl); - Collection<Property> _xifexpression = null; - boolean _equals = Objects.equal(attributes, null); - if (_equals) { - _xifexpression = CollectionLiterals.<Property>emptySet(); - } else { - _xifexpression = attributes; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - public static EList<Property> getOwnedAttributesWNull(final Classifier cl) { - EList<Property> _xifexpression = null; - if ((cl instanceof org.eclipse.uml2.uml.Class)) { - _xifexpression = ((org.eclipse.uml2.uml.Class) cl).getOwnedAttributes(); - } else { - EList<Property> _xifexpression_1 = null; - if ((cl instanceof DataType)) { - _xifexpression_1 = ((DataType) cl).getOwnedAttributes(); - } else { - EList<Property> _xifexpression_2 = null; - if ((cl instanceof Interface)) { - _xifexpression_2 = ((Interface) cl).getOwnedAttributes(); - } else { - EList<Property> _xifexpression_3 = null; - if ((cl instanceof Signal)) { - _xifexpression_3 = ((Signal) cl).getOwnedAttributes(); - } else { - _xifexpression_3 = null; - } - _xifexpression_2 = _xifexpression_3; - } - _xifexpression_1 = _xifexpression_2; - } - _xifexpression = _xifexpression_1; - } - return _xifexpression; - } - - public static CharSequence CppStaticAttributeImplementation(final Property attribute) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _CppElementDoc = CppDocumentation.CppElementDoc(attribute); - _builder.append(_CppElementDoc, ""); - _builder.newLineIfNotEmpty(); - Type _type = attribute.getType(); - String _cppQualifiedName = CppGenUtils.cppQualifiedName(_type); - _builder.append(_cppQualifiedName, ""); - String _modPtr = Modifier.modPtr(attribute); - _builder.append(_modPtr, ""); - String _modRef = Modifier.modRef(attribute); - _builder.append(_modRef, ""); - _builder.append(" "); - org.eclipse.uml2.uml.Class _class_ = attribute.getClass_(); - String _name = _class_.getName(); - _builder.append(_name, ""); - _builder.append("::"); - String _name_1 = attribute.getName(); - _builder.append(_name_1, ""); - String _modArray = Modifier.modArray(attribute); - _builder.append(_modArray, ""); - String _defaultValue = CppAttribute.defaultValue(attribute); - _builder.append(_defaultValue, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public static String defaultValue(final Property attribute) { - String _xifexpression = null; - boolean _and = false; - ValueSpecification _defaultValue = attribute.getDefaultValue(); - boolean _notEquals = (!Objects.equal(_defaultValue, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _isStatic = attribute.isStatic(); - _and = _isStatic; - } - if (_and) { - ValueSpecification _defaultValue_1 = attribute.getDefaultValue(); - String _stringValue = _defaultValue_1.stringValue(); - _xifexpression = ("=" + _stringValue); - } - return _xifexpression; - } - - public static CharSequence CppAttributeDeclaration(final Property attribute) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _CppElementDoc = CppDocumentation.CppElementDoc(attribute); - _builder.append(_CppElementDoc, ""); - _builder.newLineIfNotEmpty(); - String _staticValue = CppAttribute.staticValue(attribute); - _builder.append(_staticValue, ""); - _builder.append(" "); - String _modCVQualifier = Modifier.modCVQualifier(attribute); - _builder.append(_modCVQualifier, ""); - Type _type = attribute.getType(); - String _cppQualifiedName = CppGenUtils.cppQualifiedName(_type); - _builder.append(_cppQualifiedName, ""); - String _modPtr = Modifier.modPtr(attribute); - _builder.append(_modPtr, ""); - String _modRef = Modifier.modRef(attribute); - _builder.append(_modRef, ""); - _builder.append(" "); - String _name = attribute.getName(); - _builder.append(_name, ""); - String _modArray = Modifier.modArray(attribute); - _builder.append(_modArray, ""); - { - boolean _hasStereotype = GenUtils.hasStereotype(attribute, Const.class); - if (_hasStereotype) { - String _defaultValue = CppAttribute.defaultValue(attribute); - _builder.append(_defaultValue, ""); - } - } - _builder.append(";"); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public static String staticValue(final Property attribute) { - String _xifexpression = null; - boolean _isStatic = attribute.isStatic(); - if (_isStatic) { - _xifexpression = "static"; - } - return _xifexpression; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.java deleted file mode 100644 index 9108e7e0517..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import java.util.Collection; -import org.eclipse.papyrus.cpp.codegen.xtend.CppAttribute; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.VisibilityKind; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassAttributesDeclaration { - public static CharSequence CppClassAttributesDeclaration(final Classifier clazz, final VisibilityKind visibilityFilter) { - StringConcatenation _builder = new StringConcatenation(); - { - Collection<Property> _ownedAttributes = CppAttribute.getOwnedAttributes(clazz); - final Function1<Property, Boolean> _function = new Function1<Property, Boolean>() { - public Boolean apply(final Property it) { - VisibilityKind _visibility = it.getVisibility(); - return Boolean.valueOf(Objects.equal(_visibility, visibilityFilter)); - } - }; - Iterable<Property> _filter = IterableExtensions.<Property>filter(_ownedAttributes, _function); - for(final Property oa : _filter) { - CharSequence _CppAttributeDeclaration = CppAttribute.CppAttributeDeclaration(oa); - _builder.append(_CppAttributeDeclaration, ""); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.java deleted file mode 100644 index f5b18f1a887..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.Friend; -import org.eclipse.papyrus.C_Cpp.NoCodeGen; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassFriendDeclaration { - public static CharSequence CppClassFriendDeclaration(final Classifier friend) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("friend class "); - String _cppQualifiedName = CppGenUtils.cppQualifiedName(friend); - _builder.append(_cppQualifiedName, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public static void CppClassIncludeFriendDeclaration(final Classifier clazz) { - EList<Classifier> _usedClassifiers = GenUtils.getUsedClassifiers(clazz); - for (final Classifier uc : _usedClassifiers) { - boolean _and = false; - boolean _hasStereotype = GenUtils.hasStereotype(uc, Friend.class); - if (!_hasStereotype) { - _and = false; - } else { - boolean _hasStereotype_1 = GenUtils.hasStereotype(uc, NoCodeGen.class); - boolean _not = (!_hasStereotype_1); - _and = _not; - } - if (_and) { - CppClassFriendDeclaration.CppClassFriendDeclaration(uc); - } - } - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.java deleted file mode 100644 index 6823f4238c3..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.CppRoot; -import org.eclipse.papyrus.C_Cpp.External; -import org.eclipse.papyrus.C_Cpp.NoCodeGen; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.ClassUtils; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassIncludeDeclaration; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Enumeration; -import org.eclipse.uml2.uml.PrimitiveType; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassIncludeClassDeclaration { - public static String cppOwnerPackageIncludePath(final org.eclipse.uml2.uml.Package pkg) { - boolean _and = false; - boolean _notEquals = (!Objects.equal(pkg, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _hasStereotype = GenUtils.hasStereotype(pkg, CppRoot.class); - boolean _not = (!_hasStereotype); - _and = _not; - } - if (_and) { - String _fullPath = GenUtils.getFullPath(pkg); - String _plus = (_fullPath + "/Pkg_"); - String _name = pkg.getName(); - String _plus_1 = (_plus + _name); - return (_plus_1 + ".h"); - } else { - return null; - } - } - - public static Iterable<String> CppClassAllIncludesDeclarationBody(final Classifier classifier) { - EList<Classifier> _typesViaDependencies = GenUtils.getTypesViaDependencies(classifier); - return CppClassIncludeClassDeclaration.cppClassAllIncludes(classifier, _typesViaDependencies); - } - - public static Iterable<String> cppClassAllIncludes(final Classifier classifier, final EList<Classifier> list) { - List<String> newList = new ArrayList<String>(); - for (final Classifier cl : list) { - boolean _or = false; - boolean _and = false; - boolean _notEquals = (!Objects.equal(cl, classifier)); - if (!_notEquals) { - _and = false; - } else { - boolean _hasStereotype = GenUtils.hasStereotype(cl, NoCodeGen.class); - boolean _not = (!_hasStereotype); - _and = _not; - } - if (_and) { - _or = true; - } else { - boolean _hasStereotype_1 = GenUtils.hasStereotype(cl, External.class); - _or = _hasStereotype_1; - } - if (_or) { - boolean _or_1 = false; - if ((cl instanceof Enumeration)) { - _or_1 = true; - } else { - _or_1 = (cl instanceof PrimitiveType); - } - if (_or_1) { - boolean _and_1 = false; - Element _owner = cl.getOwner(); - boolean _notEquals_1 = (!Objects.equal(_owner, null)); - if (!_notEquals_1) { - _and_1 = false; - } else { - Element _owner_1 = cl.getOwner(); - _and_1 = (_owner_1 instanceof org.eclipse.uml2.uml.Package); - } - if (_and_1) { - Element _owner_2 = cl.getOwner(); - String includePath = CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(((org.eclipse.uml2.uml.Package) _owner_2)); - boolean _contains = newList.contains(includePath); - boolean _not_1 = (!_contains); - if (_not_1) { - newList.add(includePath); - } - } else { - } - } else { - List<String> _cppClassIncludes = CppClassIncludeDeclaration.cppClassIncludes(cl); - newList.addAll(_cppClassIncludes); - } - } else { - } - } - final Function1<String, Boolean> _function = new Function1<String, Boolean>() { - public Boolean apply(final String str) { - return Boolean.valueOf((!Objects.equal(str, null))); - } - }; - return IterableExtensions.<String>filter(newList, _function); - } - - public static Iterable<String> CppClassAllIncludes(final Classifier clazz) { - EList<Classifier> _includedClassifiers = ClassUtils.includedClassifiers(clazz); - return CppClassIncludeClassDeclaration.cppClassAllIncludes(clazz, _includedClassifiers); - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.java deleted file mode 100644 index cefecfbea8b..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.ExternLibrary; -import org.eclipse.papyrus.C_Cpp.External; -import org.eclipse.papyrus.C_Cpp.Template; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassIncludeDeclaration { - public static List<String> cppClassIncludes(final NamedElement ne) { - List<String> result = new ArrayList<String>(); - boolean _hasStereotypeTree = GenUtils.hasStereotypeTree(ne, ExternLibrary.class); - if (_hasStereotypeTree) { - ExternLibrary _applicationTree = GenUtils.<ExternLibrary>getApplicationTree(ne, ExternLibrary.class); - EList<String> _includes = _applicationTree.getIncludes(); - result = _includes; - } else { - String _includeName = CppClassIncludeDeclaration.includeName(ne); - result.add(_includeName); - } - return result; - } - - public static String includeName(final NamedElement ne) { - boolean _hasStereotypeTree = GenUtils.hasStereotypeTree(ne, Template.class); - if (_hasStereotypeTree) { - Template _stereotypeApplication = UMLUtil.<Template>getStereotypeApplication(ne, Template.class); - return _stereotypeApplication.getDeclaration(); - } else { - boolean _hasStereotypeTree_1 = GenUtils.hasStereotypeTree(ne, External.class); - if (_hasStereotypeTree_1) { - External _stereotypeApplication_1 = UMLUtil.<External>getStereotypeApplication(ne, External.class); - return _stereotypeApplication_1.getName(); - } else { - org.eclipse.uml2.uml.Package _nearestPackage = ne.getNearestPackage(); - String _fullPath = GenUtils.getFullPath(_nearestPackage); - String _plus = (_fullPath + "/"); - String _name = ne.getName(); - String _plus_1 = (_plus + _name); - String _plus_2 = (_plus_1 + "."); - String _headerSuffix = CppCodeGenUtils.getHeaderSuffix(); - return (_plus_2 + _headerSuffix); - } - } - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.java deleted file mode 100644 index c9ec4123d68..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.NoCodeGen; -import org.eclipse.papyrus.C_Cpp.Visibility; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.DirectedRelationship; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Generalization; -import org.eclipse.uml2.uml.InterfaceRealization; -import org.eclipse.uml2.uml.Relationship; -import org.eclipse.uml2.uml.util.UMLUtil; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassInheritedDeclarations { - public static CharSequence CppClassInheritedDeclarations(final Classifier clazz) { - StringConcatenation _builder = new StringConcatenation(); - { - Iterable<DirectedRelationship> _filteredRelationships = CppClassInheritedDeclarations.filteredRelationships(clazz); - int _length = ((Object[])Conversions.unwrapArray(_filteredRelationships, Object.class)).length; - boolean _greaterThan = (_length > 0); - if (_greaterThan) { - _builder.append(" : "); - } - } - _builder.newLineIfNotEmpty(); - { - Iterable<DirectedRelationship> _filteredRelationships_1 = CppClassInheritedDeclarations.filteredRelationships(clazz); - boolean _hasElements = false; - for(final DirectedRelationship fr : _filteredRelationships_1) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", \n", ""); - } - String _cppVisibility = CppClassInheritedDeclarations.getCppVisibility(fr); - _builder.append(_cppVisibility, ""); - _builder.append(" "); - EList<Element> _targets = fr.getTargets(); - Element _get = _targets.get(0); - String _cppQualifiedName = CppGenUtils.cppQualifiedName(((Classifier) _get)); - _builder.append(_cppQualifiedName, ""); - } - } - _builder.append("\t"); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public static Iterable<DirectedRelationship> filteredRelationships(final Classifier clazz) { - EList<DirectedRelationship> _sourceDirectedRelationships = clazz.getSourceDirectedRelationships(); - final Function1<DirectedRelationship, Boolean> _function = new Function1<DirectedRelationship, Boolean>() { - public Boolean apply(final DirectedRelationship it) { - boolean _and = false; - if (!((it instanceof Generalization) || (it instanceof InterfaceRealization))) { - _and = false; - } else { - EList<Element> _targets = it.getTargets(); - Element _get = _targets.get(0); - boolean _hasStereotype = GenUtils.hasStereotype(_get, NoCodeGen.class); - boolean _not = (!_hasStereotype); - _and = _not; - } - return Boolean.valueOf(_and); - } - }; - return IterableExtensions.<DirectedRelationship>filter(_sourceDirectedRelationships, _function); - } - - public static String getCppVisibility(final Relationship relationship) { - String _xifexpression = null; - boolean _hasStereotype = GenUtils.hasStereotype(relationship, Visibility.class); - if (_hasStereotype) { - Visibility _stereotypeApplication = UMLUtil.<Visibility>getStereotypeApplication(relationship, Visibility.class); - _xifexpression = ((Visibility) _stereotypeApplication).getValue(); - } else { - _xifexpression = "public"; - } - return _xifexpression; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.java deleted file mode 100644 index 9148b7ed64b..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import java.util.Collection; -import java.util.List; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.cpp.codegen.xtend.CppOperations; -import org.eclipse.uml2.uml.BehavioralFeature; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.OpaqueBehavior; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.VisibilityKind; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.IteratorExtensions; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassOperationsDeclaration { - public static CharSequence CppClassOperationsDeclaration(final Classifier clazz, final VisibilityKind visibilityFilter) { - StringConcatenation _builder = new StringConcatenation(); - { - Collection<Operation> _ownedOperations = CppOperations.getOwnedOperations(clazz); - final Function1<Operation, Boolean> _function = new Function1<Operation, Boolean>() { - public Boolean apply(final Operation it) { - VisibilityKind _visibility = it.getVisibility(); - return Boolean.valueOf(Objects.equal(_visibility, visibilityFilter)); - } - }; - Iterable<Operation> _filter = IterableExtensions.<Operation>filter(_ownedOperations, _function); - for(final Operation op : _filter) { - _builder.newLine(); - CharSequence _CppOperationDeclaration = CppOperations.CppOperationDeclaration(op); - _builder.append(_CppOperationDeclaration, ""); - _builder.newLineIfNotEmpty(); - } - } - { - TreeIterator<EObject> _eAllContents = clazz.eAllContents(); - List<EObject> _list = IteratorExtensions.<EObject>toList(_eAllContents); - Iterable<OpaqueBehavior> _filter_1 = Iterables.<OpaqueBehavior>filter(_list, OpaqueBehavior.class); - final Function1<OpaqueBehavior, Boolean> _function_1 = new Function1<OpaqueBehavior, Boolean>() { - public Boolean apply(final OpaqueBehavior it) { - VisibilityKind _visibility = it.getVisibility(); - return Boolean.valueOf(Objects.equal(_visibility, visibilityFilter)); - } - }; - Iterable<OpaqueBehavior> _filter_2 = IterableExtensions.<OpaqueBehavior>filter(_filter_1, _function_1); - for(final OpaqueBehavior b : _filter_2) { - { - BehavioralFeature _specification = b.getSpecification(); - boolean _equals = Objects.equal(_specification, null); - if (_equals) { - _builder.newLine(); - _builder.append("// opaque behavior without specification (typically from state machine)"); - _builder.newLine(); - CharSequence _CppBehaviorDeclaration = CppOperations.CppBehaviorDeclaration(b); - _builder.append(_CppBehaviorDeclaration, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.java deleted file mode 100644 index 36e5021d57c..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import java.util.Collection; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.C_Cpp.Inline; -import org.eclipse.papyrus.C_Cpp.NoCodeGen; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.xtend.CppOperations; -import org.eclipse.uml2.uml.BehavioralFeature; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.OpaqueBehavior; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.IteratorExtensions; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassOperationsImplementation { - public static CharSequence CppClassOperationsImplementation(final Classifier clazz, final boolean inline) { - StringConcatenation _builder = new StringConcatenation(); - { - Collection<Operation> _ownedOperations = CppOperations.getOwnedOperations(clazz); - final Function1<Operation, Boolean> _function = new Function1<Operation, Boolean>() { - public Boolean apply(final Operation it) { - boolean _and = false; - boolean _or = false; - boolean _hasStereotype = GenUtils.hasStereotype(it, NoCodeGen.class); - if (_hasStereotype) { - _or = true; - } else { - boolean _isAbstract = it.isAbstract(); - _or = _isAbstract; - } - boolean _not = (!_or); - if (!_not) { - _and = false; - } else { - boolean _hasStereotype_1 = GenUtils.hasStereotype(it, Inline.class); - boolean _equals = (_hasStereotype_1 == inline); - _and = _equals; - } - return Boolean.valueOf(_and); - } - }; - Iterable<Operation> _filter = IterableExtensions.<Operation>filter(_ownedOperations, _function); - boolean _hasElements = false; - for(final Operation ownedOperation : _filter) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate("\n", ""); - } - CharSequence _CppOperationImplementation = CppOperations.CppOperationImplementation(ownedOperation); - _builder.append(_CppOperationImplementation, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - TreeIterator<EObject> _eAllContents = clazz.eAllContents(); - Iterable<EObject> _iterable = IteratorExtensions.<EObject>toIterable(_eAllContents); - final Function1<EObject, Boolean> _function_1 = new Function1<EObject, Boolean>() { - public Boolean apply(final EObject it) { - boolean _and = false; - if (!(it instanceof OpaqueBehavior)) { - _and = false; - } else { - boolean _hasStereotype = GenUtils.hasStereotype(((OpaqueBehavior) it), Inline.class); - boolean _equals = (_hasStereotype == inline); - _and = _equals; - } - return Boolean.valueOf(_and); - } - }; - Iterable<EObject> _filter_1 = IterableExtensions.<EObject>filter(_iterable, _function_1); - for(final EObject b : _filter_1) { - { - BehavioralFeature _specification = ((OpaqueBehavior) b).getSpecification(); - boolean _equals = Objects.equal(_specification, null); - if (_equals) { - _builder.append("// opaque behavior without specification (typically from state machine)"); - _builder.newLine(); - CharSequence _CppBehaviorImplementation = CppOperations.CppBehaviorImplementation(((OpaqueBehavior) b)); - _builder.append(_CppBehaviorImplementation, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.java deleted file mode 100644 index 9968bbc3779..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.NoCodeGen; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.papyrus.cpp.codegen.xtend.CppEnumerations; -import org.eclipse.papyrus.cpp.codegen.xtend.CppPrimitiveTypes; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Enumeration; -import org.eclipse.uml2.uml.Namespace; -import org.eclipse.uml2.uml.PrimitiveType; -import org.eclipse.uml2.uml.VisibilityKind; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassTypeAndEnum { - public static CharSequence CppClassTypeAndEnum(final Classifier clazz) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _TypesAndEnumsForVisibility = CppClassTypeAndEnum.TypesAndEnumsForVisibility(clazz, VisibilityKind.PUBLIC_LITERAL); - String publicStr = _TypesAndEnumsForVisibility.toString(); - _builder.newLineIfNotEmpty(); - String _section = CppGenUtils.getSection(VisibilityKind.PUBLIC_LITERAL, publicStr); - _builder.append(_section, ""); - _builder.newLineIfNotEmpty(); - CharSequence _TypesAndEnumsForVisibility_1 = CppClassTypeAndEnum.TypesAndEnumsForVisibility(clazz, VisibilityKind.PROTECTED_LITERAL); - String protectedStr = _TypesAndEnumsForVisibility_1.toString(); - _builder.newLineIfNotEmpty(); - String _section_1 = CppGenUtils.getSection(VisibilityKind.PROTECTED_LITERAL, protectedStr); - _builder.append(_section_1, ""); - _builder.newLineIfNotEmpty(); - CharSequence _TypesAndEnumsForVisibility_2 = CppClassTypeAndEnum.TypesAndEnumsForVisibility(clazz, VisibilityKind.PRIVATE_LITERAL); - String privateStr = _TypesAndEnumsForVisibility_2.toString(); - _builder.newLineIfNotEmpty(); - String _section_2 = CppGenUtils.getSection(VisibilityKind.PRIVATE_LITERAL, privateStr); - _builder.append(_section_2, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public static CharSequence CppClassTypeAndEnumPackage(final org.eclipse.uml2.uml.Package pkg) { - CharSequence _xblockexpression = null; - { - VisibilityKind _get = VisibilityKind.get(VisibilityKind.PACKAGE); - CppClassTypeAndEnum.TypesAndEnumsForVisibility(pkg, _get); - VisibilityKind _get_1 = VisibilityKind.get(VisibilityKind.PUBLIC); - _xblockexpression = CppClassTypeAndEnum.TypesAndEnumsForVisibility(pkg, _get_1); - } - return _xblockexpression; - } - - public static CharSequence TypesAndEnumsForVisibility(final Namespace ne, final VisibilityKind visibilityFilter) { - StringConcatenation _builder = new StringConcatenation(); - { - EList<Element> _ownedElements = ne.getOwnedElements(); - for(final Element ownedElement : _ownedElements) { - CharSequence _TypeAndEnumForVisibility = CppClassTypeAndEnum.TypeAndEnumForVisibility(ownedElement, visibilityFilter); - _builder.append(_TypeAndEnumForVisibility, ""); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - public static CharSequence TypeAndEnumForVisibility(final Element element, final VisibilityKind visibilityFilter) { - boolean _and = false; - boolean _hasStereotype = GenUtils.hasStereotype(element, NoCodeGen.class); - boolean _not = (!_hasStereotype); - if (!_not) { - _and = false; - } else { - _and = (element instanceof Classifier); - } - if (_and) { - VisibilityKind elementVisibility = ((Classifier) element).getVisibility(); - int value = elementVisibility.getValue(); - int _value = visibilityFilter.getValue(); - boolean _equals = (value == _value); - if (_equals) { - if ((element instanceof Enumeration)) { - return CppEnumerations.CppEnumerationDefinition(((Enumeration) element)); - } else { - if ((element instanceof PrimitiveType)) { - return CppPrimitiveTypes.CppPrimitiveTypeDefinition(((PrimitiveType) element)); - } - } - } - } - return null; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.java deleted file mode 100644 index 4702d45f6f4..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.java +++ /dev/null @@ -1,623 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import java.util.Collection; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.Union; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.papyrus.cpp.codegen.xtend.CppAttribute; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassAttributesDeclaration; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassFriendDeclaration; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassIncludeClassDeclaration; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassInheritedDeclarations; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassOperationsDeclaration; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassOperationsImplementation; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassTypeAndEnum; -import org.eclipse.papyrus.cpp.codegen.xtend.CppDocumentation; -import org.eclipse.papyrus.cpp.codegen.xtend.CppIncludeUtil; -import org.eclipse.papyrus.cpp.codegen.xtend.CppOperations; -import org.eclipse.papyrus.cpp.codegen.xtend.CppTemplates; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.DataType; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.TemplateBinding; -import org.eclipse.uml2.uml.TemplateParameterSubstitution; -import org.eclipse.uml2.uml.ValueSpecification; -import org.eclipse.uml2.uml.VisibilityKind; -import org.eclipse.uml2.uml.profile.standard.Create; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * @author Ansgar Radermacher (ansgar.radermacher@cea.fr) - */ -@SuppressWarnings("all") -public class CppClassifierGenerator { - public static CharSequence generateHeaderCode(final Classifier classifier, final String commentHeader) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(commentHeader, ""); - _builder.newLineIfNotEmpty(); - _builder.append("AcceleoDriver.evaluate(cppInclude.getHeader(), classifier, null);"); - _builder.newLine(); - return _builder; - } - - public static CharSequence generateBindHeaderCode(final Classifier classifier) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#ifndef "); - String _fullNameUC = GenUtils.getFullNameUC(classifier); - _builder.append(_fullNameUC, ""); - _builder.append("_H"); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _fullNameUC_1 = GenUtils.getFullNameUC(classifier); - _builder.append(_fullNameUC_1, ""); - _builder.append("_H"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - String _name = classifier.getName(); - _builder.append(_name, " "); - _builder.append(" template binding header"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - _builder.newLine(); - org.eclipse.uml2.uml.Package _package = classifier.getPackage(); - String _cppOwnerPackageIncludePath = CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(_package); - String _includeDirective = CppIncludeUtil.includeDirective(_cppOwnerPackageIncludePath); - _builder.append(_includeDirective, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - List<String> _sortedIncludePathList = CppClassifierGenerator.getSortedIncludePathList(classifier); - for(final String path : _sortedIncludePathList) { - String _includeDirective_1 = CppIncludeUtil.includeDirective(path); - _builder.append(_includeDirective_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - String _CppIncludeHeader = CppIncludeUtil.CppIncludeHeader(classifier); - _builder.append(_CppIncludeHeader, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - EList<TemplateBinding> tb = classifier.getTemplateBindings(); - _builder.newLineIfNotEmpty(); - TemplateBinding templateElement = tb.get(0); - _builder.newLineIfNotEmpty(); - org.eclipse.uml2.uml.Package _package_1 = classifier.getPackage(); - String _fullPath = GenUtils.getFullPath(_package_1); - String _plus = (_fullPath + "/"); - Element _owner = templateElement.getOwner(); - String _name_1 = ((NamedElement) _owner).getName(); - String _plus_1 = (_plus + _name_1); - String _plus_2 = (_plus_1 + "."); - String _headerSuffix = CppCodeGenUtils.getHeaderSuffix(); - String _plus_3 = (_plus_2 + _headerSuffix); - String _includeDirective_2 = CppIncludeUtil.includeDirective(_plus_3); - _builder.append(_includeDirective_2, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _openNS = CppGenUtils.openNS(classifier); - _builder.append(_openNS, ""); - _builder.newLineIfNotEmpty(); - _builder.append("/************************************************************/"); - _builder.newLine(); - _builder.append("typedef "); - Element _owner_1 = templateElement.getOwner(); - String _name_2 = ((NamedElement) _owner_1).getName(); - _builder.append(_name_2, ""); - { - EList<TemplateParameterSubstitution> _parameterSubstitutions = templateElement.getParameterSubstitutions(); - for(final TemplateParameterSubstitution ps : _parameterSubstitutions) { - Object _CppTemplateBindingParameter = CppTemplates.CppTemplateBindingParameter(ps); - _builder.append(_CppTemplateBindingParameter, ""); - } - } - _builder.append(" "); - String _name_3 = classifier.getName(); - _builder.append(_name_3, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _closeNS = CppGenUtils.closeNS(classifier); - _builder.append(_closeNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - _builder.append("End of "); - String _name_4 = classifier.getName(); - _builder.append(_name_4, " "); - _builder.append(" template binding header"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - return _builder; - } - - public static List<String> getSortedIncludePathList(final Classifier classifier) { - Iterable<String> _CppClassAllIncludes = CppClassIncludeClassDeclaration.CppClassAllIncludes(classifier); - List<String> includePathList = IterableExtensions.<String>sort(_CppClassAllIncludes); - return includePathList; - } - - public static CharSequence generateBindBodyCode(final Classifier classifier) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#define "); - String _fullNameUC = GenUtils.getFullNameUC(classifier); - _builder.append(_fullNameUC, ""); - _builder.append("_BODY"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - String _name = classifier.getName(); - _builder.append(_name, " "); - _builder.append(" template binding body"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - _builder.newLine(); - String _CppIncludePreBody = CppIncludeUtil.CppIncludePreBody(classifier); - _builder.append(_CppIncludePreBody, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("// include associated header file"); - _builder.newLine(); - org.eclipse.uml2.uml.Package _package = classifier.getPackage(); - String _fullPath = GenUtils.getFullPath(_package); - String _plus = (_fullPath + "/"); - String _name_1 = classifier.getName(); - String _plus_1 = (_plus + _name_1); - String _plus_2 = (_plus_1 + "."); - String _headerSuffix = CppCodeGenUtils.getHeaderSuffix(); - String _plus_3 = (_plus_2 + _headerSuffix); - String _includeDirective = CppIncludeUtil.includeDirective(_plus_3); - _builder.append(_includeDirective, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _CppIncludeBody = CppIncludeUtil.CppIncludeBody(classifier); - _builder.append(_CppIncludeBody, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _openNS = CppGenUtils.openNS(classifier); - _builder.append(_openNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("// Derived includes directives"); - _builder.newLine(); - { - Iterable<String> _CppClassAllIncludes = CppClassIncludeClassDeclaration.CppClassAllIncludes(classifier); - List<String> _sort = IterableExtensions.<String>sort(_CppClassAllIncludes); - for(final String path : _sort) { - String _includeDirective_1 = CppIncludeUtil.includeDirective(path); - _builder.append(_includeDirective_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/************************************************************/"); - _builder.newLine(); - TemplateBinding tb = GenUtils.getTemplateBindings(((org.eclipse.uml2.uml.Class) classifier)); - _builder.newLineIfNotEmpty(); - EList<Element> _targets = tb.getTargets(); - Element templateElement = _targets.get(0); - _builder.newLineIfNotEmpty(); - _builder.append("template class "); - Element _owner = templateElement.getOwner(); - String _name_2 = ((NamedElement) _owner).getName(); - _builder.append(_name_2, ""); - _builder.append("<"); - { - EList<TemplateParameterSubstitution> _parameterSubstitutions = tb.getParameterSubstitutions(); - for(final TemplateParameterSubstitution ps : _parameterSubstitutions) { - Object _CppTemplateBindingParameter = CppTemplates.CppTemplateBindingParameter(ps); - _builder.append(_CppTemplateBindingParameter, ""); - } - } - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _closeNS = CppGenUtils.closeNS(classifier); - _builder.append(_closeNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - _builder.append("End of "); - String _name_3 = classifier.getName(); - _builder.append(_name_3, " "); - _builder.append(" template binding body"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - return _builder; - } - - public static CharSequence generateClassHeaderCode(final Classifier classifier) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#ifndef "); - String _fullNameUC = GenUtils.getFullNameUC(classifier); - _builder.append(_fullNameUC, ""); - _builder.append("_H"); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _fullNameUC_1 = GenUtils.getFullNameUC(classifier); - _builder.append(_fullNameUC_1, ""); - _builder.append("_H"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - String _name = classifier.getName(); - _builder.append(_name, " "); - _builder.append(" class header"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - _builder.newLine(); - org.eclipse.uml2.uml.Package _package = classifier.getPackage(); - String _cppOwnerPackageIncludePath = CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(_package); - String _includeDirective = CppIncludeUtil.includeDirective(_cppOwnerPackageIncludePath); - _builder.append(_includeDirective, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - List<String> _sortedIncludePathList = CppClassifierGenerator.getSortedIncludePathList(classifier); - for(final String path : _sortedIncludePathList) { - String _includeDirective_1 = CppIncludeUtil.includeDirective(path); - _builder.append(_includeDirective_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - String _CppIncludeHeader = CppIncludeUtil.CppIncludeHeader(classifier); - _builder.append(_CppIncludeHeader, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _openNS = CppGenUtils.openNS(classifier); - _builder.append(_openNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************/"); - _builder.newLine(); - CharSequence _CppElementDoc = CppDocumentation.CppElementDoc(classifier); - _builder.append(_CppElementDoc, ""); - _builder.newLineIfNotEmpty(); - CharSequence _templateSignature = CppTemplates.templateSignature(classifier); - _builder.append(_templateSignature, ""); - String _classUnionOrStruct = CppClassifierGenerator.classUnionOrStruct(classifier); - _builder.append(_classUnionOrStruct, ""); - _builder.append(" "); - String _name_1 = classifier.getName(); - _builder.append(_name_1, ""); - CharSequence _CppClassInheritedDeclarations = CppClassInheritedDeclarations.CppClassInheritedDeclarations(classifier); - _builder.append(_CppClassInheritedDeclarations, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - CppClassFriendDeclaration.CppClassIncludeFriendDeclaration(classifier); - CharSequence _CppClassTypeAndEnum = CppClassTypeAndEnum.CppClassTypeAndEnum(classifier); - _builder.append(_CppClassTypeAndEnum, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - VisibilityKind publicVisibility = VisibilityKind.PUBLIC_LITERAL; - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _defaultInitializer = CppClassifierGenerator.defaultInitializer(classifier); - String _section = CppGenUtils.getSection(publicVisibility, _defaultInitializer); - _builder.append(_section, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _CppClassAttributesDeclaration = CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, publicVisibility); - String _string = _CppClassAttributesDeclaration.toString(); - String _section_1 = CppGenUtils.getSection(publicVisibility, _string); - _builder.append(_section_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _CppClassOperationsDeclaration = CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, publicVisibility); - String _string_1 = _CppClassOperationsDeclaration.toString(); - String _section_2 = CppGenUtils.getSection(publicVisibility, _string_1); - _builder.append(_section_2, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - VisibilityKind protectedVisibility = VisibilityKind.PROTECTED_LITERAL; - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _CppClassAttributesDeclaration_1 = CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, protectedVisibility); - String _string_2 = _CppClassAttributesDeclaration_1.toString(); - String _section_3 = CppGenUtils.getSection(protectedVisibility, _string_2); - _builder.append(_section_3, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _CppClassOperationsDeclaration_1 = CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, protectedVisibility); - String _string_3 = _CppClassOperationsDeclaration_1.toString(); - String _section_4 = CppGenUtils.getSection(protectedVisibility, _string_3); - _builder.append(_section_4, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - VisibilityKind privateVisibility = VisibilityKind.PRIVATE_LITERAL; - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _CppClassAttributesDeclaration_2 = CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, privateVisibility); - String _string_4 = _CppClassAttributesDeclaration_2.toString(); - String _section_5 = CppGenUtils.getSection(privateVisibility, _string_4); - _builder.append(_section_5, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _CppClassOperationsDeclaration_2 = CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, privateVisibility); - String _string_5 = _CppClassOperationsDeclaration_2.toString(); - String _section_6 = CppGenUtils.getSection(privateVisibility, _string_5); - _builder.append(_section_6, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("};"); - _builder.newLine(); - _builder.append("/************************************************************/"); - _builder.newLine(); - _builder.append("/* External declarations (package visibility) */"); - _builder.newLine(); - VisibilityKind packageVisibility = VisibilityKind.PACKAGE_LITERAL; - _builder.newLineIfNotEmpty(); - CharSequence _CppClassAttributesDeclaration_3 = CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, packageVisibility); - _builder.append(_CppClassAttributesDeclaration_3, ""); - _builder.newLineIfNotEmpty(); - CharSequence _CppClassOperationsDeclaration_3 = CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, packageVisibility); - _builder.append(_CppClassOperationsDeclaration_3, ""); - _builder.newLineIfNotEmpty(); - _builder.append("/************************************************************/"); - _builder.newLine(); - _builder.newLine(); - { - boolean _isTemplate = CppTemplates.isTemplate(classifier); - if (_isTemplate) { - _builder.append("/************************************************************/"); - _builder.newLine(); - _builder.append("/* Template functions */"); - _builder.newLine(); - CharSequence _CppClassOperationsImplementation = CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, false); - _builder.append(_CppClassOperationsImplementation, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* Inline functions */"); - _builder.newLine(); - CharSequence _CppClassOperationsImplementation_1 = CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, true); - _builder.append(_CppClassOperationsImplementation_1, ""); - _builder.newLineIfNotEmpty(); - String _closeNS = CppGenUtils.closeNS(classifier); - _builder.append(_closeNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - _builder.append("End of "); - String _name_2 = classifier.getName(); - _builder.append(_name_2, " "); - _builder.append(" class header"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - return _builder; - } - - public static String classUnionOrStruct(final Classifier classifier) { - boolean _hasStereotype = GenUtils.hasStereotype(classifier, Union.class); - if (_hasStereotype) { - return "union"; - } else { - if ((classifier instanceof DataType)) { - CppGenUtils.resetVisibility(VisibilityKind.PUBLIC_LITERAL); - return "struct"; - } else { - CppGenUtils.resetVisibility(VisibilityKind.PRIVATE_LITERAL); - return "class"; - } - } - } - - /** - * default initializer for non-static attributes with a default value TODO: should be disabled by default, since non-static members can be initialized directly in C++ 011 - */ - public static String defaultInitializer(final Classifier classifier) { - StringConcatenation _builder = new StringConcatenation(); - { - Collection<Operation> _ownedOperations = CppOperations.getOwnedOperations(classifier); - final Function1<Operation, Boolean> _function = new Function1<Operation, Boolean>() { - public Boolean apply(final Operation it) { - return Boolean.valueOf(GenUtils.hasStereotype(it, Create.class)); - } - }; - Iterable<Operation> _filter = IterableExtensions.<Operation>filter(_ownedOperations, _function); - boolean _isEmpty = IterableExtensions.isEmpty(_filter); - if (_isEmpty) { - EList<Property> _attributes = classifier.getAttributes(); - final Function1<Property, Boolean> _function_1 = new Function1<Property, Boolean>() { - public Boolean apply(final Property it) { - boolean _and = false; - boolean _and_1 = false; - boolean _isStatic = it.isStatic(); - boolean _equals = (_isStatic == false); - if (!_equals) { - _and_1 = false; - } else { - ValueSpecification _defaultValue = it.getDefaultValue(); - boolean _notEquals = (!Objects.equal(_defaultValue, null)); - _and_1 = _notEquals; - } - if (!_and_1) { - _and = false; - } else { - ValueSpecification _defaultValue_1 = it.getDefaultValue(); - String _stringValue = _defaultValue_1.stringValue(); - boolean _notEquals_1 = (!Objects.equal(_stringValue, null)); - _and = _notEquals_1; - } - return Boolean.valueOf(_and); - } - }; - Iterable<Property> attributeList = IterableExtensions.<Property>filter(_attributes, _function_1); - _builder.newLineIfNotEmpty(); - { - boolean _isEmpty_1 = IterableExtensions.isEmpty(attributeList); - boolean _not = (!_isEmpty_1); - if (_not) { - String _name = classifier.getName(); - _builder.append(_name, ""); - _builder.append("() : "); - { - boolean _hasElements = false; - for(final Property a : attributeList) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _name_1 = a.getName(); - _builder.append(_name_1, ""); - _builder.append("("); - ValueSpecification _defaultValue = a.getDefaultValue(); - String _stringValue = _defaultValue.stringValue(); - _builder.append(_stringValue, ""); - _builder.append(")"); - } - } - _builder.append(" {}"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - } - } - String code = _builder.toString(); - return code.trim(); - } - - public static CharSequence generateClassBodyCode(final Classifier classifier) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#define "); - String _fullName = GenUtils.getFullName(classifier); - _builder.append(_fullName, ""); - _builder.append("_BODY"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - String _name = classifier.getName(); - _builder.append(_name, " "); - _builder.append(" class body"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - _builder.newLine(); - String _CppIncludePreBody = CppIncludeUtil.CppIncludePreBody(classifier); - _builder.append(_CppIncludePreBody, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("// include associated header file"); - _builder.newLine(); - org.eclipse.uml2.uml.Package _nearestPackage = classifier.getNearestPackage(); - String _fullPath = GenUtils.getFullPath(_nearestPackage); - String _plus = (_fullPath + "/"); - String _name_1 = classifier.getName(); - String _plus_1 = (_plus + _name_1); - String _plus_2 = (_plus_1 + "."); - String _headerSuffix = CppCodeGenUtils.getHeaderSuffix(); - String _plus_3 = (_plus_2 + _headerSuffix); - String _includeDirective = CppIncludeUtil.includeDirective(_plus_3); - _builder.append(_includeDirective, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("// Derived includes directives"); - _builder.newLine(); - { - Iterable<String> _CppClassAllIncludesDeclarationBody = CppClassIncludeClassDeclaration.CppClassAllIncludesDeclarationBody(classifier); - List<String> _sort = IterableExtensions.<String>sort(_CppClassAllIncludesDeclarationBody); - for(final String path : _sort) { - String _includeDirective_1 = CppIncludeUtil.includeDirective(path); - _builder.append(_includeDirective_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - String _CppIncludeBody = CppIncludeUtil.CppIncludeBody(classifier); - _builder.append(_CppIncludeBody, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _openNS = CppGenUtils.openNS(classifier); - _builder.append(_openNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _CppStaticAttributes = CppAttribute.CppStaticAttributes(classifier); - _builder.append(_CppStaticAttributes, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - boolean _isTemplate = classifier.isTemplate(); - boolean _not = (!_isTemplate); - if (_not) { - CharSequence _CppClassOperationsImplementation = CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, false); - _builder.append(_CppClassOperationsImplementation, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - String _closeNS = CppGenUtils.closeNS(classifier); - _builder.append(_closeNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - _builder.append("End of "); - String _name_2 = classifier.getName(); - _builder.append(_name_2, " "); - _builder.append(" class body"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.java deleted file mode 100644 index 22862ff2338..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.uml2.uml.Behavior; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Parameter; -import org.eclipse.uml2.uml.ParameterDirectionKind; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppDocumentation { - public static CharSequence CppElementDoc(final Element argument) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* "); - String _comments = GenUtils.getComments(argument); - String _replaceAll = _comments.replaceAll("\n", "\n * "); - _builder.append(_replaceAll, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - return _builder; - } - - public static CharSequence CppOperationDoc(final Operation operation) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* "); - String _comments = GenUtils.getComments(operation); - String _replaceAll = _comments.replaceAll("\n", "\n * "); - _builder.append(_replaceAll, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - { - EList<Parameter> _ownedParameters = operation.getOwnedParameters(); - for(final Parameter op : _ownedParameters) { - CharSequence _CppParamDoc = CppDocumentation.CppParamDoc(op); - _builder.append(_CppParamDoc, " "); - } - } - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - return _builder; - } - - public static CharSequence CppParamDoc(final Parameter parameter) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("* "); - { - ParameterDirectionKind _direction = parameter.getDirection(); - boolean _equals = Objects.equal(_direction, ParameterDirectionKind.RETURN_LITERAL); - if (_equals) { - _builder.append("@return"); - } else { - _builder.append("@param"); - } - } - _builder.append(" "); - String _name = parameter.getName(); - _builder.append(_name, ""); - _builder.append(" "); - String _comments = GenUtils.getComments(parameter); - String _replaceAll = _comments.replaceAll("\n", "\n * "); - _builder.append(_replaceAll, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public static CharSequence CppBehaviorDoc(final Behavior behavior) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* "); - String _comments = GenUtils.getComments(behavior); - String _replaceAll = _comments.replaceAll("\n", "\n * "); - _builder.append(_replaceAll, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* "); - { - EList<Parameter> _ownedParameters = behavior.getOwnedParameters(); - for(final Parameter op : _ownedParameters) { - CharSequence _CppParamDoc = CppDocumentation.CppParamDoc(op); - _builder.append(_CppParamDoc, " "); - } - } - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.java deleted file mode 100644 index 145f46a900e..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.CppInit; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.xtend.CppDocumentation; -import org.eclipse.uml2.uml.Enumeration; -import org.eclipse.uml2.uml.EnumerationLiteral; -import org.eclipse.uml2.uml.util.UMLUtil; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppEnumerations { - public static CharSequence CppEnumerationDefinition(final Enumeration enume) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _CppElementDoc = CppDocumentation.CppElementDoc(enume); - _builder.append(_CppElementDoc, ""); - _builder.newLineIfNotEmpty(); - _builder.append("enum "); - String _name = enume.getName(); - _builder.append(_name, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - EList<EnumerationLiteral> _ownedLiterals = enume.getOwnedLiterals(); - for(final EnumerationLiteral ownedLiteral : _ownedLiterals) { - _builder.append("\t"); - CharSequence _CppElementDoc_1 = CppDocumentation.CppElementDoc(ownedLiteral); - _builder.append(_CppElementDoc_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _name_1 = ownedLiteral.getName(); - _builder.append(_name_1, "\t"); - { - boolean _hasStereotype = GenUtils.hasStereotype(ownedLiteral, CppInit.class); - if (_hasStereotype) { - CppInit _stereotypeApplication = UMLUtil.<CppInit>getStereotypeApplication(ownedLiteral, CppInit.class); - int _value = _stereotypeApplication.getValue(); - _builder.append(_value, "\t"); - } - } - _builder.append(","); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.java deleted file mode 100644 index 1c47338c86e..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import org.eclipse.papyrus.C_Cpp.Include; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppIncludeUtil { - public static String includeDirective(final String path) { - boolean _and = false; - boolean _notEquals = (!Objects.equal(path, null)); - if (!_notEquals) { - _and = false; - } else { - int _length = path.length(); - boolean _greaterThan = (_length > 0); - _and = _greaterThan; - } - if (_and) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#include "); - String _plus = (_builder.toString() + "\""); - String _plus_1 = (_plus + path); - return (_plus_1 + "\""); - } - return null; - } - - public static String CppIncludeHeader(final NamedElement ne) { - boolean _hasStereotype = GenUtils.hasStereotype(ne, Include.class); - if (_hasStereotype) { - UMLUtil.<Include>getStereotypeApplication(ne, Include.class); - Include _stereotypeApplication = UMLUtil.<Include>getStereotypeApplication(ne, Include.class); - String header = _stereotypeApplication.getHeader(); - boolean _and = false; - boolean _notEquals = (!Objects.equal(header, null)); - if (!_notEquals) { - _and = false; - } else { - int _length = header.length(); - boolean _greaterThan = (_length > 0); - _and = _greaterThan; - } - if (_and) { - CharSequence _constIncludeHeaderStart = CppIncludeUtil.constIncludeHeaderStart(); - String _cleanCR = GenUtils.cleanCR(header); - String _plus = (_constIncludeHeaderStart + _cleanCR); - String _plus_1 = (_plus + "\n"); - CharSequence _constIncludeHeaderEnd = CppIncludeUtil.constIncludeHeaderEnd(); - String includeHeader = (_plus_1 + _constIncludeHeaderEnd); - return includeHeader; - } - } - return null; - } - - public static CharSequence constIncludeHeaderStart() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// Include from Include stereotype (header)"); - _builder.newLine(); - return _builder; - } - - public static CharSequence constIncludeHeaderEnd() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// End of Include stereotype (header)"); - _builder.newLine(); - return _builder; - } - - public static String CppIncludePreBody(final NamedElement ne) { - boolean _hasStereotype = GenUtils.hasStereotype(ne, Include.class); - if (_hasStereotype) { - Include _stereotypeApplication = UMLUtil.<Include>getStereotypeApplication(ne, Include.class); - String preBody = _stereotypeApplication.getPreBody(); - boolean _and = false; - boolean _notEquals = (!Objects.equal(preBody, null)); - if (!_notEquals) { - _and = false; - } else { - int _length = preBody.length(); - boolean _greaterThan = (_length > 0); - _and = _greaterThan; - } - if (_and) { - CharSequence _constIncludePreBodyStart = CppIncludeUtil.constIncludePreBodyStart(); - String _cleanCR = GenUtils.cleanCR(preBody); - String _plus = (_constIncludePreBodyStart + _cleanCR); - String _plus_1 = (_plus + "\n"); - CharSequence _constIncludePreBodyEnd = CppIncludeUtil.constIncludePreBodyEnd(); - String includePreBody = (_plus_1 + _constIncludePreBodyEnd); - return includePreBody; - } - } - return null; - } - - public static CharSequence constIncludePreBodyStart() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// Include from Include stereotype (pre-body)"); - _builder.newLine(); - return _builder; - } - - public static CharSequence constIncludePreBodyEnd() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// End of Include stereotype (pre-body)"); - _builder.newLine(); - return _builder; - } - - public static String CppIncludeBody(final NamedElement ne) { - boolean _hasStereotype = GenUtils.hasStereotype(ne, Include.class); - if (_hasStereotype) { - Include _stereotypeApplication = UMLUtil.<Include>getStereotypeApplication(ne, Include.class); - String body = _stereotypeApplication.getBody(); - boolean _and = false; - boolean _notEquals = (!Objects.equal(body, null)); - if (!_notEquals) { - _and = false; - } else { - int _length = body.length(); - boolean _greaterThan = (_length > 0); - _and = _greaterThan; - } - if (_and) { - CharSequence _constIncludeBodyStart = CppIncludeUtil.constIncludeBodyStart(); - String _cleanCR = GenUtils.cleanCR(body); - String _plus = (_constIncludeBodyStart + _cleanCR); - String _plus_1 = (_plus + "\n"); - CharSequence _constIncludeBodyEnd = CppIncludeUtil.constIncludeBodyEnd(); - String includeBody = (_plus_1 + _constIncludeBodyEnd); - return includeBody; - } - } - return null; - } - - public static CharSequence constIncludeBodyStart() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// Include from Include declaration (body)"); - _builder.newLine(); - return _builder; - } - - public static CharSequence constIncludeBodyEnd() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// End of Include declaration (body)"); - _builder.newLine(); - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.java deleted file mode 100644 index 79d1a53e9ad..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.java +++ /dev/null @@ -1,425 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import java.util.Collection; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.ConstInit; -import org.eclipse.papyrus.C_Cpp.Inline; -import org.eclipse.papyrus.C_Cpp.Virtual; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.Constants; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.Modifier; -import org.eclipse.papyrus.cpp.codegen.xtend.CppDocumentation; -import org.eclipse.papyrus.cpp.codegen.xtend.CppParameter; -import org.eclipse.papyrus.cpp.codegen.xtend.CppTemplates; -import org.eclipse.uml2.uml.Behavior; -import org.eclipse.uml2.uml.BehavioredClassifier; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.DataType; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interface; -import org.eclipse.uml2.uml.OpaqueBehavior; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Parameter; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.profile.standard.Create; -import org.eclipse.uml2.uml.profile.standard.Destroy; -import org.eclipse.uml2.uml.util.UMLUtil; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; - -@SuppressWarnings("all") -public class CppOperations { - public static CharSequence CppOperationImplementation(final Operation operation) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _CppOperationDoc = CppDocumentation.CppOperationDoc(operation); - _builder.append(_CppOperationDoc, ""); - _builder.newLineIfNotEmpty(); - { - String _name = operation.getName(); - boolean _equals = Objects.equal(_name, "main"); - if (_equals) { - String _CppReturnSpec = CppOperations.CppReturnSpec(operation); - _builder.append(_CppReturnSpec, ""); - String _name_1 = operation.getName(); - _builder.append(_name_1, ""); - _builder.append("("); - CharSequence _CppOperationParameters = CppParameter.CppOperationParameters(operation, false); - _builder.append(_CppOperationParameters, ""); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _body = GenUtils.getBody(operation, Constants.supportedLanguages); - _builder.append(_body, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("} "); - _builder.newLine(); - } else { - CharSequence _templateSignature = CppTemplates.templateSignature(operation); - _builder.append(_templateSignature, ""); - String _InlineTxt = CppOperations.InlineTxt(operation); - _builder.append(_InlineTxt, ""); - String _CppReturnSpec_1 = CppOperations.CppReturnSpec(operation); - _builder.append(_CppReturnSpec_1, ""); - EList<Classifier> _featuringClassifiers = operation.getFeaturingClassifiers(); - Classifier _get = _featuringClassifiers.get(0); - String _name_2 = _get.getName(); - _builder.append(_name_2, ""); - CharSequence _templateShortSignature = CppTemplates.templateShortSignature(operation); - _builder.append(_templateShortSignature, ""); - _builder.append("::"); - String _destructor = CppOperations.destructor(operation); - _builder.append(_destructor, ""); - String _name_3 = operation.getName(); - _builder.append(_name_3, ""); - _builder.append("("); - CharSequence _CppOperationParameters_1 = CppParameter.CppOperationParameters(operation, false); - _builder.append(_CppOperationParameters_1, ""); - _builder.append(")"); - CharSequence _throwss = CppOperations.throwss(operation); - _builder.append(_throwss, ""); - String _modCVQualifier = Modifier.modCVQualifier(operation); - _builder.append(_modCVQualifier, ""); - String _CppConstInit = CppOperations.CppConstInit(operation); - _builder.append(_CppConstInit, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _body_1 = GenUtils.getBody(operation, Constants.supportedLanguages); - _builder.append(_body_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - return _builder; - } - - public static String CppReturnSpec(final Operation operation) { - String _xifexpression = null; - boolean _or = false; - Type _type = operation.getType(); - boolean _equals = Objects.equal(_type, null); - if (_equals) { - _or = true; - } else { - boolean _isConsOrDestructor = CppOperations.isConsOrDestructor(operation); - _or = _isConsOrDestructor; - } - if (_or) { - _xifexpression = CppOperations.ConsDestructorOrVoid(operation); - } else { - Parameter _returnResult = operation.getReturnResult(); - String _modCVQualifier = Modifier.modCVQualifier(_returnResult); - String _plus = (_modCVQualifier + " "); - Type _type_1 = operation.getType(); - String _cppQualifiedName = CppGenUtils.cppQualifiedName(_type_1); - String _plus_1 = (_plus + _cppQualifiedName); - Parameter _returnResult_1 = operation.getReturnResult(); - String _modPtr = Modifier.modPtr(_returnResult_1); - String _plus_2 = (_plus_1 + _modPtr); - Parameter _returnResult_2 = operation.getReturnResult(); - String _modRef = Modifier.modRef(_returnResult_2); - String _plus_3 = (_plus_2 + _modRef); - _xifexpression = (_plus_3 + " "); - } - return _xifexpression; - } - - public static CharSequence CppReturnSpec(final Behavior behavior) { - StringConcatenation _builder = new StringConcatenation(); - { - Parameter _returnResult = GenUtils.returnResult(behavior); - boolean _equals = Objects.equal(_returnResult, null); - if (_equals) { - _builder.append("void "); - } else { - Parameter _returnResult_1 = GenUtils.returnResult(behavior); - String _modCVQualifier = Modifier.modCVQualifier(_returnResult_1); - _builder.append(_modCVQualifier, ""); - _builder.append(" "); - Parameter _returnResult_2 = GenUtils.returnResult(behavior); - Type _type = _returnResult_2.getType(); - String _cppQualifiedName = CppGenUtils.cppQualifiedName(_type); - _builder.append(_cppQualifiedName, ""); - Parameter _returnResult_3 = GenUtils.returnResult(behavior); - String _modPtr = Modifier.modPtr(_returnResult_3); - _builder.append(_modPtr, ""); - Parameter _returnResult_4 = GenUtils.returnResult(behavior); - String _modRef = Modifier.modRef(_returnResult_4); - _builder.append(_modRef, ""); - _builder.append(" "); - } - } - _builder.newLineIfNotEmpty(); - return _builder; - } - - public static CharSequence throwss(final Operation operation) { - StringConcatenation _builder = new StringConcatenation(); - { - EList<Type> _raisedExceptions = operation.getRaisedExceptions(); - int _length = ((Object[])Conversions.unwrapArray(_raisedExceptions, Object.class)).length; - boolean _greaterThan = (_length > 0); - if (_greaterThan) { - _builder.append("throws "); - { - EList<Type> _raisedExceptions_1 = operation.getRaisedExceptions(); - boolean _hasElements = false; - for(final Type re : _raisedExceptions_1) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", ""); - } - String _name = re.getName(); - _builder.append(_name, ""); - } - } - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - public static String ConsDestructorOrVoid(final Operation operation) { - String _xifexpression = null; - boolean _isConsOrDestructor = CppOperations.isConsOrDestructor(operation); - if (_isConsOrDestructor) { - _xifexpression = null; - } else { - _xifexpression = "void "; - } - return _xifexpression; - } - - public static boolean isConsOrDestructor(final Operation operation) { - boolean _or = false; - boolean _hasStereotype = GenUtils.hasStereotype(operation, Create.class); - if (_hasStereotype) { - _or = true; - } else { - boolean _hasStereotype_1 = GenUtils.hasStereotype(operation, Destroy.class); - _or = _hasStereotype_1; - } - return _or; - } - - public static String CppConstInit(final Operation operation) { - String _xifexpression = null; - boolean _and = false; - boolean _hasStereotype = GenUtils.hasStereotype(operation, ConstInit.class); - if (!_hasStereotype) { - _and = false; - } else { - boolean _hasStereotype_1 = GenUtils.hasStereotype(operation, Create.class); - _and = _hasStereotype_1; - } - if (_and) { - ConstInit _stereotypeApplication = UMLUtil.<ConstInit>getStereotypeApplication(operation, ConstInit.class); - _xifexpression = ((ConstInit) _stereotypeApplication).getInitialisation(); - } - return _xifexpression; - } - - public static Collection<Operation> getOwnedOperations(final Classifier cl) { - Collection<Operation> _xblockexpression = null; - { - final EList<Operation> operations = CppOperations.getOwnedOperationsWNull(cl); - Collection<Operation> _xifexpression = null; - boolean _equals = Objects.equal(operations, null); - if (_equals) { - _xifexpression = CollectionLiterals.<Operation>emptySet(); - } else { - _xifexpression = operations; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - public static EList<Operation> getOwnedOperationsWNull(final Classifier cl) { - EList<Operation> _xifexpression = null; - if ((cl instanceof org.eclipse.uml2.uml.Class)) { - _xifexpression = ((org.eclipse.uml2.uml.Class) cl).getOwnedOperations(); - } else { - EList<Operation> _xifexpression_1 = null; - if ((cl instanceof DataType)) { - _xifexpression_1 = ((DataType) cl).getOwnedOperations(); - } else { - EList<Operation> _xifexpression_2 = null; - if ((cl instanceof Interface)) { - _xifexpression_2 = ((Interface) cl).getOwnedOperations(); - } else { - _xifexpression_2 = null; - } - _xifexpression_1 = _xifexpression_2; - } - _xifexpression = _xifexpression_1; - } - return _xifexpression; - } - - public static CharSequence CppBehaviorImplementation(final OpaqueBehavior behavior) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _CppBehaviorDoc = CppDocumentation.CppBehaviorDoc(behavior); - _builder.append(_CppBehaviorDoc, ""); - _builder.newLineIfNotEmpty(); - CharSequence _CppReturnSpec = CppOperations.CppReturnSpec(behavior); - _builder.append(_CppReturnSpec, ""); - BehavioredClassifier _context = behavior.getContext(); - String _name = _context.getName(); - _builder.append(_name, ""); - _builder.append("::"); - String _name_1 = behavior.getName(); - _builder.append(_name_1, ""); - _builder.append("("); - CharSequence _CppBehaviorParameters = CppParameter.CppBehaviorParameters(behavior, false); - _builder.append(_CppBehaviorParameters, ""); - _builder.append(")"); - String _modCVQualifier = Modifier.modCVQualifier(behavior); - _builder.append(_modCVQualifier, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _bodyFromOB = GenUtils.getBodyFromOB(behavior, Constants.supportedLanguages); - _builder.append(_bodyFromOB, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - return _builder; - } - - public static CharSequence CppOperationDeclaration(final Operation operation) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _CppOperationDoc = CppDocumentation.CppOperationDoc(operation); - _builder.append(_CppOperationDoc, ""); - _builder.newLineIfNotEmpty(); - String _InlineTxt = CppOperations.InlineTxt(operation); - _builder.append(_InlineTxt, ""); - String _virtualTxt = CppOperations.virtualTxt(operation); - _builder.append(_virtualTxt, ""); - String _staticTxt = CppOperations.staticTxt(operation); - _builder.append(_staticTxt, ""); - String _CppReturnSpec = CppOperations.CppReturnSpec(operation); - _builder.append(_CppReturnSpec, ""); - String _destructor = CppOperations.destructor(operation); - _builder.append(_destructor, ""); - String _name = operation.getName(); - _builder.append(_name, ""); - _builder.append("("); - CharSequence _CppOperationParameters = CppParameter.CppOperationParameters(operation, true); - _builder.append(_CppOperationParameters, ""); - _builder.append(")"); - String _modCVQualifier = Modifier.modCVQualifier(operation); - _builder.append(_modCVQualifier, ""); - String _virtualSuffix = CppOperations.virtualSuffix(operation); - _builder.append(_virtualSuffix, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public static String InlineTxt(final Element element) { - String _xifexpression = null; - boolean _hasStereotype = GenUtils.hasStereotype(element, Inline.class); - if (_hasStereotype) { - _xifexpression = "inline "; - } - return _xifexpression; - } - - public static String virtualTxt(final Operation operation) { - String _xifexpression = null; - boolean _or = false; - boolean _or_1 = false; - Interface _interface = operation.getInterface(); - boolean _notEquals = (!Objects.equal(_interface, null)); - if (_notEquals) { - _or_1 = true; - } else { - boolean _isAbstract = operation.isAbstract(); - _or_1 = _isAbstract; - } - if (_or_1) { - _or = true; - } else { - boolean _hasStereotype = GenUtils.hasStereotype(operation, Virtual.class); - _or = _hasStereotype; - } - if (_or) { - _xifexpression = "virtual "; - } - return _xifexpression; - } - - public static String staticTxt(final Operation operation) { - String _xifexpression = null; - boolean _isStatic = operation.isStatic(); - if (_isStatic) { - _xifexpression = "static "; - } - return _xifexpression; - } - - public static String destructor(final Operation operation) { - String _xifexpression = null; - boolean _and = false; - boolean _hasStereotype = GenUtils.hasStereotype(operation, Destroy.class); - if (!_hasStereotype) { - _and = false; - } else { - String _name = operation.getName(); - boolean _startsWith = _name.startsWith("~"); - boolean _not = (!_startsWith); - _and = _not; - } - if (_and) { - _xifexpression = "~"; - } else { - _xifexpression = ""; - } - return _xifexpression; - } - - public static String virtualSuffix(final Operation operation) { - String _xifexpression = null; - boolean _or = false; - Interface _interface = operation.getInterface(); - boolean _notEquals = (!Objects.equal(_interface, null)); - if (_notEquals) { - _or = true; - } else { - boolean _isAbstract = operation.isAbstract(); - _or = _isAbstract; - } - if (_or) { - _xifexpression = " = 0"; - } - return _xifexpression; - } - - public static CharSequence CppBehaviorDeclaration(final Behavior behavior) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _CppBehaviorDoc = CppDocumentation.CppBehaviorDoc(behavior); - _builder.append(_CppBehaviorDoc, ""); - _builder.newLineIfNotEmpty(); - String _InlineTxt = CppOperations.InlineTxt(behavior); - _builder.append(_InlineTxt, ""); - CharSequence _CppReturnSpec = CppOperations.CppReturnSpec(behavior); - _builder.append(_CppReturnSpec, ""); - String _name = behavior.getName(); - _builder.append(_name, ""); - _builder.append("("); - CharSequence _CppBehaviorParameters = CppParameter.CppBehaviorParameters(behavior, true); - _builder.append(_CppBehaviorParameters, ""); - _builder.append(")"); - String _modCVQualifier = Modifier.modCVQualifier(behavior); - _builder.append(_modCVQualifier, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.java deleted file mode 100644 index 0503d1a7f25..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.java +++ /dev/null @@ -1,118 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassIncludeClassDeclaration; -import org.eclipse.papyrus.cpp.codegen.xtend.CppClassTypeAndEnum; -import org.eclipse.papyrus.cpp.codegen.xtend.CppIncludeUtil; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppPackageHeaderGenerator { - public static CharSequence generateCode(final org.eclipse.uml2.uml.Package pkg) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#ifndef PKG_"); - String _fullNameUC = GenUtils.getFullNameUC(pkg); - _builder.append(_fullNameUC, ""); - _builder.newLineIfNotEmpty(); - _builder.append("#define PKG_"); - String _fullNameUC_1 = GenUtils.getFullNameUC(pkg); - _builder.append(_fullNameUC_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - _builder.append("Pkg_"); - String _name = pkg.getName(); - _builder.append(_name, " "); - _builder.append(" package header"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - _builder.newLine(); - org.eclipse.uml2.uml.Package _nestingPackage = pkg.getNestingPackage(); - String _cppOwnerPackageIncludePath = CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(_nestingPackage); - String _includeDirective = CppIncludeUtil.includeDirective(_cppOwnerPackageIncludePath); - _builder.append(_includeDirective, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#ifndef _IN_"); - _builder.newLine(); - _builder.append("#define _IN_"); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - _builder.append("#ifndef _OUT_"); - _builder.newLine(); - _builder.append("#define _OUT_"); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - _builder.append("#ifndef _INOUT_"); - _builder.newLine(); - _builder.append("#define _INOUT_"); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("/* Package dependency header include */"); - _builder.newLine(); - { - EList<org.eclipse.uml2.uml.Package> _usedPackages = GenUtils.getUsedPackages(pkg); - for(final org.eclipse.uml2.uml.Package p : _usedPackages) { - String _fullPath = GenUtils.getFullPath(p); - String _plus = (_fullPath + "/Pkg_"); - String _name_1 = p.getName(); - String _plus_1 = (_plus + _name_1); - String _plus_2 = (_plus_1 + "."); - String _headerSuffix = CppCodeGenUtils.getHeaderSuffix(); - String path = (_plus_2 + _headerSuffix); - _builder.newLineIfNotEmpty(); - String _includeDirective_1 = CppIncludeUtil.includeDirective(path); - _builder.append(_includeDirective_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - String _CppIncludeHeader = CppIncludeUtil.CppIncludeHeader(pkg); - _builder.append(_CppIncludeHeader, ""); - _builder.newLineIfNotEmpty(); - String _openNS = CppGenUtils.openNS(pkg); - _builder.append(_openNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("// Types defined within the package"); - _builder.newLine(); - CharSequence _CppClassTypeAndEnumPackage = CppClassTypeAndEnum.CppClassTypeAndEnumPackage(pkg); - _builder.append(_CppClassTypeAndEnumPackage, ""); - _builder.newLineIfNotEmpty(); - String _closeNS = CppGenUtils.closeNS(pkg); - _builder.append(_closeNS, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/************************************************************"); - _builder.newLine(); - _builder.append(" "); - _builder.append("End of Pkg_"); - String _name_2 = pkg.getName(); - _builder.append(_name_2, " "); - _builder.append(" package header"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("************************************************************/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.java deleted file mode 100644 index d9c14dc75af..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import com.google.common.base.Objects; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.Modifier; -import org.eclipse.uml2.uml.Behavior; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Parameter; -import org.eclipse.uml2.uml.ParameterDirectionKind; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.ValueSpecification; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppParameter { - public static CharSequence CppOperationParameters(final Operation operation, final boolean showDefault) { - StringConcatenation _builder = new StringConcatenation(); - { - EList<Parameter> _ownedParameters = operation.getOwnedParameters(); - final Function1<Parameter, Boolean> _function = new Function1<Parameter, Boolean>() { - public Boolean apply(final Parameter it) { - ParameterDirectionKind _direction = it.getDirection(); - return Boolean.valueOf((!Objects.equal(_direction, ParameterDirectionKind.RETURN_LITERAL))); - } - }; - Iterable<Parameter> _filter = IterableExtensions.<Parameter>filter(_ownedParameters, _function); - boolean _hasElements = false; - for(final Parameter ownedParameter : _filter) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _CppParameter = CppParameter.CppParameter(ownedParameter, showDefault); - _builder.append(_CppParameter, ""); - } - } - return _builder; - } - - /** - * comment signature for a given behavior (e.g. effect within state machine) - */ - public static CharSequence CppBehaviorParameters(final Behavior behavior, final boolean showDefault) { - StringConcatenation _builder = new StringConcatenation(); - { - EList<Parameter> _ownedParameters = behavior.getOwnedParameters(); - final Function1<Parameter, Boolean> _function = new Function1<Parameter, Boolean>() { - public Boolean apply(final Parameter it) { - ParameterDirectionKind _direction = it.getDirection(); - return Boolean.valueOf((!Objects.equal(_direction, ParameterDirectionKind.RETURN_LITERAL))); - } - }; - Iterable<Parameter> _filter = IterableExtensions.<Parameter>filter(_ownedParameters, _function); - boolean _hasElements = false; - for(final Parameter ownedParameter : _filter) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _CppParameter = CppParameter.CppParameter(ownedParameter, showDefault); - _builder.append(_CppParameter, ""); - } - } - _builder.newLineIfNotEmpty(); - return _builder; - } - - /** - * C++ parameter. Default values are added, if parameter showDefault is true (implementation signature - */ - public static String CppParameter(final Parameter parameter, final boolean showDefault) { - String _modCVQualifier = Modifier.modCVQualifier(parameter); - Type _type = parameter.getType(); - String _cppQualifiedName = CppGenUtils.cppQualifiedName(_type); - String _plus = (_modCVQualifier + _cppQualifiedName); - String _modPtr = Modifier.modPtr(parameter); - String _plus_1 = (_plus + _modPtr); - String _modRef = Modifier.modRef(parameter); - String _plus_2 = (_plus_1 + _modRef); - String _plus_3 = (_plus_2 + " "); - String _name = parameter.getName(); - String _plus_4 = (_plus_3 + _name); - String _modArray = Modifier.modArray(parameter); - String _plus_5 = (_plus_4 + _modArray); - String _xifexpression = null; - if (showDefault) { - _xifexpression = CppParameter.defaultValue(parameter); - } else { - _xifexpression = ""; - } - return (_plus_5 + _xifexpression); - } - - public static String defaultValue(final Parameter parameter) { - String _xifexpression = null; - ValueSpecification _defaultValue = parameter.getDefaultValue(); - boolean _notEquals = (!Objects.equal(_defaultValue, null)); - if (_notEquals) { - ValueSpecification _defaultValue_1 = parameter.getDefaultValue(); - String _stringValue = _defaultValue_1.stringValue(); - _xifexpression = (" = " + _stringValue); - } else { - _xifexpression = ""; - } - return _xifexpression; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.java deleted file mode 100644 index 10387bedfdd..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import org.eclipse.papyrus.C_Cpp.Typedef; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.papyrus.cpp.codegen.xtend.CppDocumentation; -import org.eclipse.uml2.uml.PrimitiveType; -import org.eclipse.uml2.uml.util.UMLUtil; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppPrimitiveTypes { - /** - * Support two different kinds of primitive types - * (1) those that are native types of the programming language such as long - * For these, no additional definition has to be done and they should be referenced - * with their name only - * (2) those that correspond to a typedef (e.g. typedef long ErrorType). These require - * a typedef definition within the package and need to be referenced with their - * fully qualified name (e.g. MyPackage::ErrorType) - * (3) Sometimes the name of the type defined by a typedef does not appear at the end, e.g. - * when defining functionPointers such as "typedef int (*HandlerFct) (void*);" - * (a function with a void* argument returning int) - * Support this case via a specific 'typeName' constant that gets replaced by the name of the - * type - */ - public static CharSequence CppPrimitiveTypeDefinition(final PrimitiveType primitiveType) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _CppElementDoc = CppDocumentation.CppElementDoc(primitiveType); - _builder.append(_CppElementDoc, ""); - _builder.newLineIfNotEmpty(); - { - boolean _hasStereotype = GenUtils.hasStereotype(primitiveType, Typedef.class); - if (_hasStereotype) { - _builder.append("typedef "); - Typedef _stereotypeApplication = UMLUtil.<Typedef>getStereotypeApplication(primitiveType, Typedef.class); - String _definition = _stereotypeApplication.getDefinition(); - String _name = primitiveType.getName(); - String _replaceAll = _definition.replaceAll("typeName", _name); - _builder.append(_replaceAll, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - { - Typedef _stereotypeApplication_1 = UMLUtil.<Typedef>getStereotypeApplication(primitiveType, Typedef.class); - String _definition_1 = _stereotypeApplication_1.getDefinition(); - boolean _contains = _definition_1.contains("typeName"); - boolean _not = (!_contains); - if (_not) { - String _name_1 = primitiveType.getName(); - _builder.append(_name_1, "\t"); - } - } - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - } else { - String _stdtypes = CppGenUtils.getStdtypes(primitiveType); - _builder.append(_stdtypes, ""); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.newLine(); - } - } - return _builder; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.java deleted file mode 100644 index d55c752e96a..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * 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: - * CEA LIST - initial API and implementation - */ -package org.eclipse.papyrus.cpp.codegen.xtend; - -import java.util.Collection; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.LiteralInteger; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.ParameterableElement; -import org.eclipse.uml2.uml.TemplateParameter; -import org.eclipse.uml2.uml.TemplateParameterSubstitution; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -@SuppressWarnings("all") -public class CppTemplates { - public static CharSequence templateSignature(final Operation operation) { - Element _owner = operation.getOwner(); - return CppTemplates.templateSignature(((Classifier) _owner)); - } - - public static CharSequence templateSignature(final Classifier clazz) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _isTemplate = CppTemplates.isTemplate(clazz); - if (_isTemplate) { - _builder.append("template<"); - { - Collection<TemplateParameter> _templateParameters = GenUtils.getTemplateParameters(clazz); - boolean _hasElements = false; - for(final TemplateParameter templateParam : _templateParameters) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _templateTypeName = CppGenUtils.getTemplateTypeName(templateParam); - _builder.append(_templateTypeName, ""); - } - } - _builder.append(">"); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - public static CharSequence templateShortSignature(final Operation operation) { - Element _owner = operation.getOwner(); - return CppTemplates.templateShortSignature(((Classifier) _owner)); - } - - public static CharSequence templateShortSignature(final Classifier clazz) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _isTemplate = CppTemplates.isTemplate(clazz); - if (_isTemplate) { - _builder.append("<"); - { - Collection<TemplateParameter> _templateParameters = GenUtils.getTemplateParameters(clazz); - boolean _hasElements = false; - for(final TemplateParameter templateParam : _templateParameters) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _templateName = GenUtils.getTemplateName(templateParam); - _builder.append(_templateName, ""); - } - } - _builder.append(">"); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - public static boolean isTemplate(final Classifier clazz) { - Collection<TemplateParameter> _templateParameters = GenUtils.getTemplateParameters(clazz); - int _size = _templateParameters.size(); - return (_size > 0); - } - - public static Object CppTemplateBindingParameter(final TemplateParameterSubstitution tps) { - Object _xifexpression = null; - ParameterableElement _actual = tps.getActual(); - if ((_actual instanceof LiteralInteger)) { - ParameterableElement _actual_1 = tps.getActual(); - _xifexpression = Integer.valueOf(((LiteralInteger) _actual_1).getValue()); - } else { - ParameterableElement _actual_2 = tps.getActual(); - _xifexpression = ((NamedElement) _actual_2).getName(); - } - return ((Comparable<?>)_xifexpression); - } -} diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/pom.xml b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/pom.xml index f4cf595835c..f0435123c86 100644 --- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/pom.xml +++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/pom.xml @@ -11,4 +11,43 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/pom.xml b/plugins/developer/org.eclipse.papyrus.def/pom.xml index c3b832b0428..94dfd9121f6 100644 --- a/plugins/developer/org.eclipse.papyrus.def/pom.xml +++ b/plugins/developer/org.eclipse.papyrus.def/pom.xml @@ -11,4 +11,43 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/pom.xml b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/pom.xml index 8e80210ab0f..7f14e866e7d 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/pom.xml +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/pom.xml @@ -19,6 +19,20 @@ <artifactId>maven-compiler-plugin</artifactId> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> <groupId>org.eclipse.xtend</groupId> <artifactId>xtend-maven-plugin</artifactId> <executions> diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/pom.xml b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/pom.xml index 7739f339633..98e4590031e 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/pom.xml +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext/pom.xml index d40a314dd51..e747ce79e5c 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/pom.xml index c72e0406d06..5b07385d8a8 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/pom.xml index 3481fe839fc..16ff59f398a 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext/pom.xml index a64a56aa560..f63cfe8c0d6 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/pom.xml index ad47df74e42..d9ec76a4045 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/pom.xml index 1818e5c2f04..070ecc3ecab 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/pom.xml index 16ff74c0b71..f96bac2142f 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/pom.xml index e51f2473d31..38bd6618521 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/pom.xml @@ -11,4 +11,42 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext/pom.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext/pom.xml index 471ad8fd08f..3fd7e34a1d3 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext/pom.xml +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext/pom.xml @@ -11,4 +11,43 @@ <groupId>org.eclipse.papyrus</groupId> <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>xtend-gen</directory> + <includes> + <include>**</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.xtend</groupId> + <artifactId>xtend-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + <configuration> + <outputDirectory>xtend-gen</outputDirectory> + <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> + </configuration> + </plugin> + </plugins> + </build> </project>
\ No newline at end of file diff --git a/releng/top-pom-dev.xml b/releng/top-pom-dev.xml index 3ae017dc645..1a543658b96 100755 --- a/releng/top-pom-dev.xml +++ b/releng/top-pom-dev.xml @@ -24,7 +24,7 @@ <properties>
<tycho-version>0.22.0</tycho-version>
<tychoExtrasVersion>0.22.0</tychoExtrasVersion>
- <papyrus.repo.main>http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/mars/main/</papyrus.repo.main>
+ <papyrus.repo.main>http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/mars</papyrus.repo.main>
</properties>
<repositories>
<repository>
diff --git a/releng/top-pom-extras.xml b/releng/top-pom-extras.xml index 0e7b011d543..1877f35b256 100755 --- a/releng/top-pom-extras.xml +++ b/releng/top-pom-extras.xml @@ -151,6 +151,11 @@ <properties>
<tycho-version>0.22.0</tycho-version>
<tychoExtrasVersion>0.22.0</tychoExtrasVersion>
+ <xtext.version>2.7.3</xtext.version>
+ <java.source.version>1.6</java.source.version>
+ <java.target.version>1.6</java.target.version>
+ <papyrus.eclipse.target>mars</papyrus.eclipse.target>
+ <papyrus.repo.main>http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/${papyrus.eclipse.target}</papyrus.repo.main>
</properties>
<repositories>
<repository>
@@ -332,6 +337,41 @@ </pluginRepository>
</pluginRepositories>
<build>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.2</version>
+ <configuration>
+ <source>${java.source.version}</source>
+ <target>${java.target.version}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.9.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <version>${xtext.version}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -346,8 +386,8 @@ <artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>${java.source.version}</source>
+ <target>${java.target.version}</target>
<optimize>true</optimize>
<showWarnings>true</showWarnings>
</configuration>
@@ -573,6 +613,33 @@ </activation>
</profile>
-
+ <!-- profile dedicated to activate the repository linked to nightly artifacts, useful for daily life of developers -->
+ <profile>
+ <id>nightly</id>
+ <repositories>
+ <repository>
+ <id>papyrus</id>
+ <layout>p2</layout>
+ <url>${papyrus.repo.main}</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+ <activation>
+ <property>
+ <name>env</name>
+ <value>devnightly</value>
+ </property>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ </profile>
</profiles>
</project>
diff --git a/releng/top-pom-main.xml b/releng/top-pom-main.xml index 70555667bec..5c624ceb931 100755 --- a/releng/top-pom-main.xml +++ b/releng/top-pom-main.xml @@ -315,6 +315,7 @@ <xtext.version>2.7.3</xtext.version> <java.source.version>1.6</java.source.version> <java.target.version>1.6</java.target.version> + <papyrus.eclipse.target>mars</papyrus.eclipse.target> </properties> <repositories> <repository> @@ -743,6 +744,34 @@ </activation> </profile> - + <!-- nightly profile is usefull for developers that want to link to nightly build --> + <profile> + <id>nightly</id> + <repositories> + <repository> + <id>papyrus-nightly</id> + <layout>p2</layout> + <url>http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/${papyrus.eclipse.target}/ + </url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + <checksumPolicy>warn</checksumPolicy> + </releases> + <snapshots> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + <checksumPolicy>fail</checksumPolicy> + </snapshots> + </repository> + </repositories> + <activation> + <property> + <name>env</name> + <value>devnightly</value> + </property> + <activeByDefault>false</activeByDefault> + </activation> + </profile> </profiles> </project> |