Skip to content

Commit

Permalink
add comment field to service model
Browse files Browse the repository at this point in the history
  • Loading branch information
MandKastner authored and azoitl committed Jan 17, 2025
1 parent 3e9b178 commit fce59f7
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -734,3 +734,4 @@ _UI_SimpleECState_simpleFBType_feature = Simple FB Type
_UI_SimpleFBType_simpleECStates_feature = Simple EC States
_UI_TextFunction_varargs_feature = Varargs
_UI_TextMethod_varargs_feature = Varargs
_UI_Service_comment_feature = Comment
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.fordiac.ide.model.data.provider.FordiacEditPlugin;
Expand Down Expand Up @@ -76,6 +77,28 @@ protected void addServiceSequencePropertyDescriptor(Object object) {
LibraryElementPackage.Literals.SERVICE__SERVICE_SEQUENCE, true, false, true, null, null, null));
}

/**
* This adds a property descriptor for the Comment feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addCommentPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Service_comment_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Service_comment_feature", "_UI_Service_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
LibraryElementPackage.Literals.SERVICE__COMMENT,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}

/** This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.fordiac.ide.model.data.InternalDataType;
import org.eclipse.fordiac.ide.model.data.provider.FordiacEditPlugin;
import org.eclipse.fordiac.ide.model.datatype.helper.InternalAttributeDeclarations;
import org.eclipse.fordiac.ide.model.libraryElement.Attribute;
import org.eclipse.fordiac.ide.model.libraryElement.LibraryElementPackage;
import org.eclipse.fordiac.ide.model.libraryElement.TypedConfigureableObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference lib.ecore#//Service/rightInterface"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference lib.ecore#//Service/leftInterface"/>
<genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference lib.ecore#//Service/serviceSequence"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute lib.ecore#//Service/comment"/>
<genOperations ecoreOperation="lib.ecore#//Service/getFBType" body="return (FBType) this.eContainer();"/>
</genClasses>
<genClasses ecoreClass="lib.ecore#//ServiceSequence">
Expand Down
2 changes: 2 additions & 0 deletions plugins/org.eclipse.fordiac.ide.model/model/lib.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,8 @@
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="comment" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"
defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ServiceSequence" eSuperTypes="#//INamedElement #//ConfigurableObject">
<eOperations name="getService" lowerBound="1" eType="#//Service">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6495,14 +6495,23 @@ public interface LibraryElementPackage extends EPackage {
*/
int SERVICE__SERVICE_SEQUENCE = 2;

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

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

/**
* The meta object id for the '{@link org.eclipse.fordiac.ide.model.libraryElement.impl.ServiceSequenceImpl <em>Service Sequence</em>}' class.
Expand Down Expand Up @@ -10715,6 +10724,17 @@ public interface LibraryElementPackage extends EPackage {
*/
EReference getService_ServiceSequence();

/**
* Returns the meta object for the attribute '{@link org.eclipse.fordiac.ide.model.libraryElement.Service#getComment <em>Comment</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Comment</em>'.
* @see org.eclipse.fordiac.ide.model.libraryElement.Service#getComment()
* @see #getService()
* @generated
*/
EAttribute getService_Comment();

/**
* Returns the meta object for class '{@link org.eclipse.fordiac.ide.model.libraryElement.ServiceSequence <em>Service Sequence</em>}'.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -13694,6 +13714,14 @@ interface Literals {
*/
EReference SERVICE__SERVICE_SEQUENCE = eINSTANCE.getService_ServiceSequence();

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

/**
* The meta object literal for the '{@link org.eclipse.fordiac.ide.model.libraryElement.impl.ServiceSequenceImpl <em>Service Sequence</em>}' class.
* <!-- begin-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* <li>{@link org.eclipse.fordiac.ide.model.libraryElement.Service#getRightInterface <em>Right Interface</em>}</li>
* <li>{@link org.eclipse.fordiac.ide.model.libraryElement.Service#getLeftInterface <em>Left Interface</em>}</li>
* <li>{@link org.eclipse.fordiac.ide.model.libraryElement.Service#getServiceSequence <em>Service Sequence</em>}</li>
* <li>{@link org.eclipse.fordiac.ide.model.libraryElement.Service#getComment <em>Comment</em>}</li>
* </ul>
*
* @see org.eclipse.fordiac.ide.model.libraryElement.LibraryElementPackage#getService()
Expand Down Expand Up @@ -96,6 +97,29 @@ public interface Service extends EObject {
*/
EList<ServiceSequence> getServiceSequence();

/**
* Returns the value of the '<em><b>Comment</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Comment</em>' attribute.
* @see #setComment(String)
* @see org.eclipse.fordiac.ide.model.libraryElement.LibraryElementPackage#getService_Comment()
* @model default="" dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
String getComment();

/**
* Sets the value of the '{@link org.eclipse.fordiac.ide.model.libraryElement.Service#getComment <em>Comment</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Comment</em>' attribute.
* @see #getComment()
* @generated
*/
void setComment(String value);

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,16 @@ public EReference getService_ServiceSequence() {
return (EReference)serviceEClass.getEStructuralFeatures().get(2);
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EAttribute getService_Comment() {
return (EAttribute)serviceEClass.getEStructuralFeatures().get(3);
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
Expand Down Expand Up @@ -4118,6 +4128,7 @@ public void createPackageContents() {
createEReference(serviceEClass, SERVICE__RIGHT_INTERFACE);
createEReference(serviceEClass, SERVICE__LEFT_INTERFACE);
createEReference(serviceEClass, SERVICE__SERVICE_SEQUENCE);
createEAttribute(serviceEClass, SERVICE__COMMENT);

serviceSequenceEClass = createEClass(SERVICE_SEQUENCE);
createEReference(serviceSequenceEClass, SERVICE_SEQUENCE__SERVICE_TRANSACTION);
Expand Down Expand Up @@ -5241,6 +5252,7 @@ public void initializePackageContents() {
initEReference(getService_RightInterface(), this.getServiceInterface(), null, "rightInterface", null, 0, 1, Service.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(getService_LeftInterface(), this.getServiceInterface(), null, "leftInterface", null, 0, 1, Service.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(getService_ServiceSequence(), this.getServiceSequence(), null, "serviceSequence", null, 0, -1, Service.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(getService_Comment(), theXMLTypePackage.getString(), "comment", "", 0, 1, Service.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$

addEOperation(serviceEClass, this.getFBType(), "getFBType", 1, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* <li>{@link org.eclipse.fordiac.ide.model.libraryElement.impl.ServiceImpl#getRightInterface <em>Right Interface</em>}</li>
* <li>{@link org.eclipse.fordiac.ide.model.libraryElement.impl.ServiceImpl#getLeftInterface <em>Left Interface</em>}</li>
* <li>{@link org.eclipse.fordiac.ide.model.libraryElement.impl.ServiceImpl#getServiceSequence <em>Service Sequence</em>}</li>
* <li>{@link org.eclipse.fordiac.ide.model.libraryElement.impl.ServiceImpl#getComment <em>Comment</em>}</li>
* </ul>
*
* @generated
Expand Down Expand Up @@ -84,6 +85,26 @@ public class ServiceImpl extends EObjectImpl implements Service {
*/
protected EList<ServiceSequence> serviceSequence;

/**
* The default value of the '{@link #getComment() <em>Comment</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getComment()
* @generated
* @ordered
*/
protected static final String COMMENT_EDEFAULT = ""; //$NON-NLS-1$

/**
* The cached value of the '{@link #getComment() <em>Comment</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getComment()
* @generated
* @ordered
*/
protected String comment = COMMENT_EDEFAULT;

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down Expand Up @@ -252,6 +273,29 @@ public EList<ServiceSequence> getServiceSequence() {
return serviceSequence;
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getComment() {
return comment;
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setComment(String newComment) {
String oldComment = comment;
comment = newComment;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LibraryElementPackage.SERVICE__COMMENT, oldComment, comment));
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down Expand Up @@ -297,6 +341,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) {
return basicGetLeftInterface();
case LibraryElementPackage.SERVICE__SERVICE_SEQUENCE:
return getServiceSequence();
case LibraryElementPackage.SERVICE__COMMENT:
return getComment();
default:
return super.eGet(featureID, resolve, coreType);
}
Expand All @@ -321,6 +367,9 @@ public void eSet(int featureID, Object newValue) {
getServiceSequence().clear();
getServiceSequence().addAll((Collection<? extends ServiceSequence>)newValue);
return;
case LibraryElementPackage.SERVICE__COMMENT:
setComment((String)newValue);
return;
default:
super.eSet(featureID, newValue);
return;
Expand All @@ -344,6 +393,9 @@ public void eUnset(int featureID) {
case LibraryElementPackage.SERVICE__SERVICE_SEQUENCE:
getServiceSequence().clear();
return;
case LibraryElementPackage.SERVICE__COMMENT:
setComment(COMMENT_EDEFAULT);
return;
default:
super.eUnset(featureID);
return;
Expand All @@ -364,9 +416,27 @@ public boolean eIsSet(int featureID) {
return leftInterface != null;
case LibraryElementPackage.SERVICE__SERVICE_SEQUENCE:
return serviceSequence != null && !serviceSequence.isEmpty();
case LibraryElementPackage.SERVICE__COMMENT:
return COMMENT_EDEFAULT == null ? comment != null : !COMMENT_EDEFAULT.equals(comment);
default:
return super.eIsSet(featureID);
}
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();

StringBuilder result = new StringBuilder(super.toString());
result.append(" (comment: "); //$NON-NLS-1$
result.append(comment);
result.append(')');
return result.toString();
}

} //ServiceImpl

0 comments on commit fce59f7

Please sign in to comment.