Skip to content

Commit

Permalink
Merge pull request #320 from bsinno/feature/breakable
Browse files Browse the repository at this point in the history
add breakable keyword
  • Loading branch information
aedelmann authored Jun 30, 2016
2 parents 6ffd0b5 + 4ceb80d commit 7866bf8
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 4 deletions.
1 change: 1 addition & 0 deletions bundles/org.eclipse.vorto.core/model/Functionblock.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="returnType" eType="#//ReturnType"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="breakable" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ReturnType">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="multiplicity" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,23 @@ public interface FunctionblockPackage extends EPackage {
*/
int OPERATION__DESCRIPTION = 3;

/**
* The feature id for the '<em><b>Breakable</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int OPERATION__BREAKABLE = 4;

/**
* The number of structural features of the '<em>Operation</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int OPERATION_FEATURE_COUNT = 4;
int OPERATION_FEATURE_COUNT = 5;

/**
* The meta object id for the '{@link org.eclipse.vorto.core.api.model.functionblock.impl.ReturnTypeImpl <em>Return Type</em>}' class.
Expand Down Expand Up @@ -928,6 +937,17 @@ public interface FunctionblockPackage extends EPackage {
*/
EAttribute getOperation_Description();

/**
* Returns the meta object for the attribute '{@link org.eclipse.vorto.core.api.model.functionblock.Operation#isBreakable <em>Breakable</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Breakable</em>'.
* @see org.eclipse.vorto.core.api.model.functionblock.Operation#isBreakable()
* @see #getOperation()
* @generated
*/
EAttribute getOperation_Breakable();

/**
* Returns the meta object for class '{@link org.eclipse.vorto.core.api.model.functionblock.ReturnType <em>Return Type</em>}'.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -1340,6 +1360,14 @@ interface Literals {
*/
EAttribute OPERATION__DESCRIPTION = eINSTANCE.getOperation_Description();

/**
* The meta object literal for the '<em><b>Breakable</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute OPERATION__BREAKABLE = eINSTANCE.getOperation_Breakable();

/**
* The meta object literal for the '{@link org.eclipse.vorto.core.api.model.functionblock.impl.ReturnTypeImpl <em>Return Type</em>}' class.
* <!-- begin-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* <li>{@link org.eclipse.vorto.core.api.model.functionblock.Operation#getParams <em>Params</em>}</li>
* <li>{@link org.eclipse.vorto.core.api.model.functionblock.Operation#getReturnType <em>Return Type</em>}</li>
* <li>{@link org.eclipse.vorto.core.api.model.functionblock.Operation#getDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.vorto.core.api.model.functionblock.Operation#isBreakable <em>Breakable</em>}</li>
* </ul>
*
* @see org.eclipse.vorto.core.api.model.functionblock.FunctionblockPackage#getOperation()
Expand Down Expand Up @@ -120,4 +121,30 @@ public interface Operation extends EObject {
*/
void setDescription(String value);

/**
* Returns the value of the '<em><b>Breakable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Breakable</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Breakable</em>' attribute.
* @see #setBreakable(boolean)
* @see org.eclipse.vorto.core.api.model.functionblock.FunctionblockPackage#getOperation_Breakable()
* @model
* @generated
*/
boolean isBreakable();

/**
* Sets the value of the '{@link org.eclipse.vorto.core.api.model.functionblock.Operation#isBreakable <em>Breakable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Breakable</em>' attribute.
* @see #isBreakable()
* @generated
*/
void setBreakable(boolean value);

} // Operation
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,15 @@ public EAttribute getOperation_Description() {
return (EAttribute)operationEClass.getEStructuralFeatures().get(3);
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getOperation_Breakable() {
return (EAttribute)operationEClass.getEStructuralFeatures().get(4);
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down Expand Up @@ -622,6 +631,7 @@ public void createPackageContents() {
createEReference(operationEClass, OPERATION__PARAMS);
createEReference(operationEClass, OPERATION__RETURN_TYPE);
createEAttribute(operationEClass, OPERATION__DESCRIPTION);
createEAttribute(operationEClass, OPERATION__BREAKABLE);

returnTypeEClass = createEClass(RETURN_TYPE);
createEAttribute(returnTypeEClass, RETURN_TYPE__MULTIPLICITY);
Expand Down Expand Up @@ -716,6 +726,7 @@ public void initializePackageContents() {
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$
initEAttribute(getOperation_Breakable(), ecorePackage.getEBoolean(), "breakable", 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); //$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$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* <li>{@link org.eclipse.vorto.core.api.model.functionblock.impl.OperationImpl#getParams <em>Params</em>}</li>
* <li>{@link org.eclipse.vorto.core.api.model.functionblock.impl.OperationImpl#getReturnType <em>Return Type</em>}</li>
* <li>{@link org.eclipse.vorto.core.api.model.functionblock.impl.OperationImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.vorto.core.api.model.functionblock.impl.OperationImpl#isBreakable <em>Breakable</em>}</li>
* </ul>
*
* @generated
Expand Down Expand Up @@ -100,6 +101,26 @@ public class OperationImpl extends MinimalEObjectImpl.Container implements Opera
*/
protected String description = DESCRIPTION_EDEFAULT;

/**
* The default value of the '{@link #isBreakable() <em>Breakable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isBreakable()
* @generated
* @ordered
*/
protected static final boolean BREAKABLE_EDEFAULT = false;

/**
* The cached value of the '{@link #isBreakable() <em>Breakable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isBreakable()
* @generated
* @ordered
*/
protected boolean breakable = BREAKABLE_EDEFAULT;

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down Expand Up @@ -216,6 +237,27 @@ public void setDescription(String newDescription) {
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.OPERATION__DESCRIPTION, oldDescription, description));
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isBreakable() {
return breakable;
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBreakable(boolean newBreakable) {
boolean oldBreakable = breakable;
breakable = newBreakable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.OPERATION__BREAKABLE, oldBreakable, breakable));
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down Expand Up @@ -248,6 +290,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) {
return getReturnType();
case FunctionblockPackage.OPERATION__DESCRIPTION:
return getDescription();
case FunctionblockPackage.OPERATION__BREAKABLE:
return isBreakable();
}
return super.eGet(featureID, resolve, coreType);
}
Expand All @@ -274,6 +318,9 @@ public void eSet(int featureID, Object newValue) {
case FunctionblockPackage.OPERATION__DESCRIPTION:
setDescription((String)newValue);
return;
case FunctionblockPackage.OPERATION__BREAKABLE:
setBreakable((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
Expand All @@ -298,6 +345,9 @@ public void eUnset(int featureID) {
case FunctionblockPackage.OPERATION__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case FunctionblockPackage.OPERATION__BREAKABLE:
setBreakable(BREAKABLE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
Expand All @@ -318,6 +368,8 @@ public boolean eIsSet(int featureID) {
return returnType != null;
case FunctionblockPackage.OPERATION__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case FunctionblockPackage.OPERATION__BREAKABLE:
return breakable != BREAKABLE_EDEFAULT;
}
return super.eIsSet(featureID);
}
Expand All @@ -336,6 +388,8 @@ public String toString() {
result.append(name);
result.append(", description: "); //$NON-NLS-1$
result.append(description);
result.append(", breakable: "); //$NON-NLS-1$
result.append(breakable);
result.append(')');
return result.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Fault:
;

Operation :
name=ID '(' (params += Param (',' params+=Param)*)?')' ('returns' returnType = ReturnType)? (description=STRING)?
(breakable ?= 'breakable')? name=ID '(' (params += Param (',' params+=Param)*)?')' ('returns' returnType = ReturnType)? (description=STRING)?
;

ReturnType :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class FunctionblockFormatter extends AbstractDeclarativeFormatter {
c.setNoSpace().after(f.propertyAccess.commaKeyword_5_3_0)

//Operation parameters.
c.setNoSpace().before(f.operationAccess.commaKeyword_2_1_0)
c.setLinewrap(1).after(f.operationAccess.commaKeyword_2_1_0)
c.setNoSpace().before(f.operationAccess.commaKeyword_3_1_0)
c.setLinewrap(1).after(f.operationAccess.commaKeyword_3_1_0)

}
}

0 comments on commit 7866bf8

Please sign in to comment.