From c18c0d2bf28414ce3582d29288eb92bd3b62a444 Mon Sep 17 00:00:00 2001 From: Erle Czar Mantos Date: Wed, 30 Mar 2016 13:20:00 +0800 Subject: [PATCH 1/2] Allow users to add a description to the parameters of operations. This commit closes #119 Signed-off-by: Erle Czar Mantos --- .../model/Functionblock.ecore | 1 + .../functionblock/FunctionblockPackage.java | 48 ++++++++++- .../core/api/model/functionblock/Param.java | 27 ++++++ .../model/functionblock/impl/EventImpl.java | 2 +- .../impl/FunctionblockFactoryImpl.java | 2 +- .../impl/FunctionblockModelImpl.java | 12 +-- .../impl/FunctionblockPackageImpl.java | 85 +++++++++++-------- .../functionblock/impl/OperationImpl.java | 4 +- .../model/functionblock/impl/ParamImpl.java | 58 ++++++++++++- .../impl/PrimitiveParamImpl.java | 2 +- .../impl/ReturnPrimitiveTypeImpl.java | 2 +- .../functionblock/impl/ReturnTypeImpl.java | 2 +- .../util/FunctionblockSwitch.java | 2 +- .../editor/functionblock/Functionblock.xtext | 4 +- 14 files changed, 195 insertions(+), 56 deletions(-) diff --git a/bundles/org.eclipse.vorto.core/model/Functionblock.ecore b/bundles/org.eclipse.vorto.core/model/Functionblock.ecore index c69f530fbf..adaf75c9a5 100644 --- a/bundles/org.eclipse.vorto.core/model/Functionblock.ecore +++ b/bundles/org.eclipse.vorto.core/model/Functionblock.ecore @@ -60,6 +60,7 @@ + diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/FunctionblockPackage.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/FunctionblockPackage.java index 002b4fa32b..30415db485 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/FunctionblockPackage.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/FunctionblockPackage.java @@ -499,6 +499,15 @@ public interface FunctionblockPackage extends EPackage { */ int PARAM__NAME = 1; + /** + * The feature id for the 'Description' attribute. + * + * + * @generated + * @ordered + */ + int PARAM__DESCRIPTION = 2; + /** * The number of structural features of the 'Param' class. * @@ -506,7 +515,7 @@ public interface FunctionblockPackage extends EPackage { * @generated * @ordered */ - int PARAM_FEATURE_COUNT = 2; + int PARAM_FEATURE_COUNT = 3; /** * The meta object id for the '{@link org.eclipse.vorto.core.api.model.functionblock.impl.PrimitiveParamImpl Primitive Param}' class. @@ -536,6 +545,15 @@ public interface FunctionblockPackage extends EPackage { */ int PRIMITIVE_PARAM__NAME = PARAM__NAME; + /** + * The feature id for the 'Description' attribute. + * + * + * @generated + * @ordered + */ + int PRIMITIVE_PARAM__DESCRIPTION = PARAM__DESCRIPTION; + /** * The feature id for the 'Type' attribute. * @@ -582,6 +600,15 @@ public interface FunctionblockPackage extends EPackage { */ int REF_PARAM__NAME = PARAM__NAME; + /** + * The feature id for the 'Description' attribute. + * + * + * @generated + * @ordered + */ + int REF_PARAM__DESCRIPTION = PARAM__DESCRIPTION; + /** * The feature id for the 'Type' reference. * @@ -1000,6 +1027,17 @@ public interface FunctionblockPackage extends EPackage { */ EAttribute getParam_Name(); + /** + * Returns the meta object for the attribute '{@link org.eclipse.vorto.core.api.model.functionblock.Param#getDescription Description}'. + * + * + * @return the meta object for the attribute 'Description'. + * @see org.eclipse.vorto.core.api.model.functionblock.Param#getDescription() + * @see #getParam() + * @generated + */ + EAttribute getParam_Description(); + /** * Returns the meta object for class '{@link org.eclipse.vorto.core.api.model.functionblock.Event Event}'. * @@ -1350,6 +1388,14 @@ interface Literals { */ EAttribute PARAM__NAME = eINSTANCE.getParam_Name(); + /** + * The meta object literal for the 'Description' attribute feature. + * + * + * @generated + */ + EAttribute PARAM__DESCRIPTION = eINSTANCE.getParam_Description(); + /** * The meta object literal for the '{@link org.eclipse.vorto.core.api.model.functionblock.impl.EventImpl Event}' class. * diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/Param.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/Param.java index 3002d1a142..3106923126 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/Param.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/Param.java @@ -15,6 +15,7 @@ *
    *
  • {@link org.eclipse.vorto.core.api.model.functionblock.Param#isMultiplicity Multiplicity}
  • *
  • {@link org.eclipse.vorto.core.api.model.functionblock.Param#getName Name}
  • + *
  • {@link org.eclipse.vorto.core.api.model.functionblock.Param#getDescription Description}
  • *
* * @see org.eclipse.vorto.core.api.model.functionblock.FunctionblockPackage#getParam() @@ -74,4 +75,30 @@ public interface Param extends EObject { */ void setName(String value); + /** + * Returns the value of the 'Description' attribute. + * + *

+ * If the meaning of the 'Description' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Description' attribute. + * @see #setDescription(String) + * @see org.eclipse.vorto.core.api.model.functionblock.FunctionblockPackage#getParam_Description() + * @model + * @generated + */ + String getDescription(); + + /** + * Sets the value of the '{@link org.eclipse.vorto.core.api.model.functionblock.Param#getDescription Description}' attribute. + * + * + * @param value the new value of the 'Description' attribute. + * @see #getDescription() + * @generated + */ + void setDescription(String value); + } // Param diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/EventImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/EventImpl.java index 9fbbe6530b..b63f468ed7 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/EventImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/EventImpl.java @@ -214,7 +214,7 @@ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); + result.append(" (name: "); //$NON-NLS-1$ result.append(name); result.append(')'); return result.toString(); diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockFactoryImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockFactoryImpl.java index 705d7ec23e..17db026ad7 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockFactoryImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockFactoryImpl.java @@ -70,7 +70,7 @@ public EObject create(EClass eClass) { case FunctionblockPackage.PARAM: return createParam(); case FunctionblockPackage.EVENT: return createEvent(); default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockModelImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockModelImpl.java index b39ff79f99..c02967d407 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockModelImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockModelImpl.java @@ -615,17 +615,17 @@ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); + result.append(" (name: "); //$NON-NLS-1$ result.append(name); - result.append(", namespace: "); + result.append(", namespace: "); //$NON-NLS-1$ result.append(namespace); - result.append(", version: "); + result.append(", version: "); //$NON-NLS-1$ result.append(version); - result.append(", description: "); + result.append(", description: "); //$NON-NLS-1$ result.append(description); - result.append(", displayname: "); + result.append(", displayname: "); //$NON-NLS-1$ result.append(displayname); - result.append(", category: "); + result.append(", category: "); //$NON-NLS-1$ result.append(category); result.append(')'); return result.toString(); diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockPackageImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockPackageImpl.java index ce35488dec..f071781d8a 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockPackageImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockPackageImpl.java @@ -504,6 +504,15 @@ public EAttribute getParam_Name() { return (EAttribute)paramEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + public EAttribute getParam_Description() { + return (EAttribute)paramEClass.getEStructuralFeatures().get(2); + } + /** * * @@ -604,6 +613,7 @@ public void createPackageContents() { paramEClass = createEClass(PARAM); createEAttribute(paramEClass, PARAM__MULTIPLICITY); createEAttribute(paramEClass, PARAM__NAME); + createEAttribute(paramEClass, PARAM__DESCRIPTION); eventEClass = createEClass(EVENT); createEAttribute(eventEClass, EVENT__NAME); @@ -649,55 +659,56 @@ public void initializePackageContents() { refParamEClass.getESuperTypes().add(this.getParam()); // Initialize classes and features; add operations and parameters - initEClass(functionblockModelEClass, FunctionblockModel.class, "FunctionblockModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getFunctionblockModel_Functionblock(), this.getFunctionBlock(), null, "functionblock", null, 0, 1, FunctionblockModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getFunctionblockModel_Entities(), theDatatypePackage.getEntity(), null, "entities", null, 0, -1, FunctionblockModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getFunctionblockModel_Enums(), theDatatypePackage.getEnum(), null, "enums", null, 0, -1, FunctionblockModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(functionblockModelEClass, FunctionblockModel.class, "FunctionblockModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getFunctionblockModel_Functionblock(), this.getFunctionBlock(), null, "functionblock", null, 0, 1, FunctionblockModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFunctionblockModel_Entities(), theDatatypePackage.getEntity(), null, "entities", null, 0, -1, FunctionblockModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFunctionblockModel_Enums(), theDatatypePackage.getEnum(), null, "enums", null, 0, -1, FunctionblockModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(functionBlockEClass, FunctionBlock.class, "FunctionBlock", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getFunctionBlock_Configuration(), this.getConfiguration(), null, "configuration", null, 0, 1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getFunctionBlock_Status(), this.getStatus(), null, "status", null, 0, 1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getFunctionBlock_Fault(), this.getFault(), null, "fault", null, 0, 1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getFunctionBlock_Events(), this.getEvent(), null, "events", null, 0, -1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getFunctionBlock_Operations(), this.getOperation(), null, "operations", null, 0, -1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(functionBlockEClass, FunctionBlock.class, "FunctionBlock", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getFunctionBlock_Configuration(), this.getConfiguration(), null, "configuration", null, 0, 1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFunctionBlock_Status(), this.getStatus(), null, "status", null, 0, 1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFunctionBlock_Fault(), this.getFault(), null, "fault", null, 0, 1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFunctionBlock_Events(), this.getEvent(), null, "events", null, 0, -1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFunctionBlock_Operations(), this.getOperation(), null, "operations", null, 0, -1, FunctionBlock.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(configurationEClass, Configuration.class, "Configuration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getConfiguration_Properties(), theDatatypePackage.getProperty(), null, "properties", null, 0, -1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(configurationEClass, Configuration.class, "Configuration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getConfiguration_Properties(), theDatatypePackage.getProperty(), null, "properties", null, 0, -1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(statusEClass, Status.class, "Status", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getStatus_Properties(), theDatatypePackage.getProperty(), null, "properties", null, 0, -1, Status.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(statusEClass, Status.class, "Status", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getStatus_Properties(), theDatatypePackage.getProperty(), null, "properties", null, 0, -1, Status.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(faultEClass, Fault.class, "Fault", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getFault_Properties(), theDatatypePackage.getProperty(), null, "properties", null, 0, -1, Fault.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(faultEClass, Fault.class, "Fault", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getFault_Properties(), theDatatypePackage.getProperty(), null, "properties", null, 0, -1, Fault.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(operationEClass, Operation.class, "Operation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getOperation_Name(), ecorePackage.getEString(), "name", null, 0, 1, Operation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getOperation_Params(), this.getParam(), null, "params", null, 0, -1, Operation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getOperation_ReturnType(), this.getReturnType(), null, "returnType", null, 0, 1, Operation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getOperation_Description(), ecorePackage.getEString(), "description", null, 0, 1, Operation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(operationEClass, Operation.class, "Operation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getOperation_Name(), ecorePackage.getEString(), "name", null, 0, 1, Operation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getOperation_Params(), this.getParam(), null, "params", null, 0, -1, Operation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getOperation_ReturnType(), this.getReturnType(), null, "returnType", null, 0, 1, Operation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getOperation_Description(), ecorePackage.getEString(), "description", null, 0, 1, Operation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(returnTypeEClass, ReturnType.class, "ReturnType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getReturnType_Multiplicity(), ecorePackage.getEBoolean(), "multiplicity", null, 0, 1, ReturnType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(returnTypeEClass, ReturnType.class, "ReturnType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getReturnType_Multiplicity(), ecorePackage.getEBoolean(), "multiplicity", null, 0, 1, ReturnType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(returnObjectTypeEClass, ReturnObjectType.class, "ReturnObjectType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getReturnObjectType_ReturnType(), theDatatypePackage.getType(), null, "returnType", null, 0, 1, ReturnObjectType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(returnObjectTypeEClass, ReturnObjectType.class, "ReturnObjectType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getReturnObjectType_ReturnType(), theDatatypePackage.getType(), null, "returnType", null, 0, 1, ReturnObjectType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(returnPrimitiveTypeEClass, ReturnPrimitiveType.class, "ReturnPrimitiveType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getReturnPrimitiveType_ReturnType(), theDatatypePackage.getPrimitiveType(), "returnType", null, 0, 1, ReturnPrimitiveType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(returnPrimitiveTypeEClass, ReturnPrimitiveType.class, "ReturnPrimitiveType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getReturnPrimitiveType_ReturnType(), theDatatypePackage.getPrimitiveType(), "returnType", null, 0, 1, ReturnPrimitiveType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(primitiveParamEClass, PrimitiveParam.class, "PrimitiveParam", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPrimitiveParam_Type(), theDatatypePackage.getPrimitiveType(), "type", null, 0, 1, PrimitiveParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(primitiveParamEClass, PrimitiveParam.class, "PrimitiveParam", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getPrimitiveParam_Type(), theDatatypePackage.getPrimitiveType(), "type", null, 0, 1, PrimitiveParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(refParamEClass, RefParam.class, "RefParam", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getRefParam_Type(), theDatatypePackage.getType(), null, "type", null, 0, 1, RefParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(refParamEClass, RefParam.class, "RefParam", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getRefParam_Type(), theDatatypePackage.getType(), null, "type", null, 0, 1, RefParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(paramEClass, Param.class, "Param", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getParam_Multiplicity(), ecorePackage.getEBoolean(), "multiplicity", null, 0, 1, Param.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getParam_Name(), ecorePackage.getEString(), "name", null, 0, 1, Param.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(paramEClass, Param.class, "Param", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getParam_Multiplicity(), ecorePackage.getEBoolean(), "multiplicity", null, 0, 1, Param.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getParam_Name(), ecorePackage.getEString(), "name", null, 0, 1, Param.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getParam_Description(), ecorePackage.getEString(), "description", null, 0, 1, Param.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEClass(eventEClass, Event.class, "Event", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getEvent_Name(), ecorePackage.getEString(), "name", null, 0, 1, Event.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getEvent_Properties(), theDatatypePackage.getProperty(), null, "properties", null, 0, -1, Event.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(eventEClass, Event.class, "Event", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getEvent_Name(), ecorePackage.getEString(), "name", null, 0, 1, Event.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getEvent_Properties(), theDatatypePackage.getProperty(), null, "properties", null, 0, -1, Event.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ // Create resource createResource(eNS_URI); diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/OperationImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/OperationImpl.java index bbd9d02bdb..b323a8da9a 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/OperationImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/OperationImpl.java @@ -332,9 +332,9 @@ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); + result.append(" (name: "); //$NON-NLS-1$ result.append(name); - result.append(", description: "); + result.append(", description: "); //$NON-NLS-1$ result.append(description); result.append(')'); return result.toString(); diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ParamImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ParamImpl.java index 9f27a27d01..84c5555547 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ParamImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ParamImpl.java @@ -22,6 +22,7 @@ *
    *
  • {@link org.eclipse.vorto.core.api.model.functionblock.impl.ParamImpl#isMultiplicity Multiplicity}
  • *
  • {@link org.eclipse.vorto.core.api.model.functionblock.impl.ParamImpl#getName Name}
  • + *
  • {@link org.eclipse.vorto.core.api.model.functionblock.impl.ParamImpl#getDescription Description}
  • *
* * @generated @@ -67,6 +68,26 @@ public class ParamImpl extends MinimalEObjectImpl.Container implements Param { */ protected String name = NAME_EDEFAULT; + /** + * The default value of the '{@link #getDescription() Description}' attribute. + * + * + * @see #getDescription() + * @generated + * @ordered + */ + protected static final String DESCRIPTION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDescription() Description}' attribute. + * + * + * @see #getDescription() + * @generated + * @ordered + */ + protected String description = DESCRIPTION_EDEFAULT; + /** * * @@ -128,6 +149,27 @@ public void setName(String newName) { eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.PARAM__NAME, oldName, name)); } + /** + * + * + * @generated + */ + public String getDescription() { + return description; + } + + /** + * + * + * @generated + */ + public void setDescription(String newDescription) { + String oldDescription = description; + description = newDescription; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.PARAM__DESCRIPTION, oldDescription, description)); + } + /** * * @@ -140,6 +182,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return isMultiplicity(); case FunctionblockPackage.PARAM__NAME: return getName(); + case FunctionblockPackage.PARAM__DESCRIPTION: + return getDescription(); } return super.eGet(featureID, resolve, coreType); } @@ -158,6 +202,9 @@ public void eSet(int featureID, Object newValue) { case FunctionblockPackage.PARAM__NAME: setName((String)newValue); return; + case FunctionblockPackage.PARAM__DESCRIPTION: + setDescription((String)newValue); + return; } super.eSet(featureID, newValue); } @@ -176,6 +223,9 @@ public void eUnset(int featureID) { case FunctionblockPackage.PARAM__NAME: setName(NAME_EDEFAULT); return; + case FunctionblockPackage.PARAM__DESCRIPTION: + setDescription(DESCRIPTION_EDEFAULT); + return; } super.eUnset(featureID); } @@ -192,6 +242,8 @@ public boolean eIsSet(int featureID) { return multiplicity != MULTIPLICITY_EDEFAULT; case FunctionblockPackage.PARAM__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case FunctionblockPackage.PARAM__DESCRIPTION: + return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); } return super.eIsSet(featureID); } @@ -206,10 +258,12 @@ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); - result.append(" (multiplicity: "); + result.append(" (multiplicity: "); //$NON-NLS-1$ result.append(multiplicity); - result.append(", name: "); + result.append(", name: "); //$NON-NLS-1$ result.append(name); + result.append(", description: "); //$NON-NLS-1$ + result.append(description); result.append(')'); return result.toString(); } diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/PrimitiveParamImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/PrimitiveParamImpl.java index fbc68529ef..cddbac3b8d 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/PrimitiveParamImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/PrimitiveParamImpl.java @@ -155,7 +155,7 @@ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); - result.append(" (type: "); + result.append(" (type: "); //$NON-NLS-1$ result.append(type); result.append(')'); return result.toString(); diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ReturnPrimitiveTypeImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ReturnPrimitiveTypeImpl.java index 2272543c41..e85e377d07 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ReturnPrimitiveTypeImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ReturnPrimitiveTypeImpl.java @@ -155,7 +155,7 @@ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); - result.append(" (returnType: "); + result.append(" (returnType: "); //$NON-NLS-1$ result.append(returnType); result.append(')'); return result.toString(); diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ReturnTypeImpl.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ReturnTypeImpl.java index bc10ac3bcb..2e85d61a08 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ReturnTypeImpl.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/ReturnTypeImpl.java @@ -154,7 +154,7 @@ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); - result.append(" (multiplicity: "); + result.append(" (multiplicity: "); //$NON-NLS-1$ result.append(multiplicity); result.append(')'); return result.toString(); diff --git a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/util/FunctionblockSwitch.java b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/util/FunctionblockSwitch.java index 0cb86ccfb2..7bebabe615 100644 --- a/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/util/FunctionblockSwitch.java +++ b/bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/util/FunctionblockSwitch.java @@ -49,7 +49,7 @@ public FunctionblockSwitch() { * Checks whether this is a switch for the given package. * * - * @parameter ePackage the package in question. + * @param ePackage the package in question. * @return whether this is a switch for the given package. * @generated */ diff --git a/bundles/org.eclipse.vorto.editor.functionblock/src/org/eclipse/vorto/editor/functionblock/Functionblock.xtext b/bundles/org.eclipse.vorto.editor.functionblock/src/org/eclipse/vorto/editor/functionblock/Functionblock.xtext index 2a48a94436..c3854ced94 100644 --- a/bundles/org.eclipse.vorto.editor.functionblock/src/org/eclipse/vorto/editor/functionblock/Functionblock.xtext +++ b/bundles/org.eclipse.vorto.editor.functionblock/src/org/eclipse/vorto/editor/functionblock/Functionblock.xtext @@ -88,11 +88,11 @@ ReturnPrimitiveType : ; PrimitiveParam: - (multiplicity ?= 'multiple')? name = ID 'as' type = PrimitiveType + (multiplicity ?= 'multiple')? name = ID 'as' type = PrimitiveType (description=STRING)? ; RefParam: - (multiplicity ?= 'multiple')? name = ID 'as' type = [datatype::Type|QualifiedName] + (multiplicity ?= 'multiple')? name = ID 'as' type = [datatype::Type|QualifiedName] (description=STRING)? ; Param: From 8f8bdd0eedfffea58155f8e0b737a37e62b73a0b Mon Sep 17 00:00:00 2001 From: Erle Czar Mantos Date: Wed, 30 Mar 2016 13:49:31 +0800 Subject: [PATCH 2/2] Modify the formatter to make multiple parameters on operations more readable. Signed-off-by: Erle Czar Mantos --- .../functionblock/formatting/FunctionblockFormatter.xtend | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.vorto.editor.functionblock/src/org/eclipse/vorto/editor/functionblock/formatting/FunctionblockFormatter.xtend b/bundles/org.eclipse.vorto.editor.functionblock/src/org/eclipse/vorto/editor/functionblock/formatting/FunctionblockFormatter.xtend index a19f77a6a8..6dde6bf91b 100644 --- a/bundles/org.eclipse.vorto.editor.functionblock/src/org/eclipse/vorto/editor/functionblock/formatting/FunctionblockFormatter.xtend +++ b/bundles/org.eclipse.vorto.editor.functionblock/src/org/eclipse/vorto/editor/functionblock/formatting/FunctionblockFormatter.xtend @@ -64,6 +64,8 @@ class FunctionblockFormatter extends AbstractDeclarativeFormatter { c.setNoSpace().before(first) c.setNoSpace().after(first) c.setNoSpace().before(second) + c.setIndentationIncrement().after(first) + c.setIndentationDecrement().before(second) ] //Constraint block @@ -82,7 +84,7 @@ class FunctionblockFormatter extends AbstractDeclarativeFormatter { //Operation parameters. c.setNoSpace().before(f.operationAccess.commaKeyword_2_1_0) - c.setNoSpace().after(f.operationAccess.commaKeyword_2_1_0) + c.setLinewrap(1).after(f.operationAccess.commaKeyword_2_1_0) } }