diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl.edit/plugin.properties b/fr.centralesupelec.edf.riseclipse.iec61850.scl.edit/plugin.properties index c4011271c562d5d4c612eb26bf17223508d3ead4..3ee51b3e17999c68bc682ede13e9315ab902157c 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl.edit/plugin.properties +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl.edit/plugin.properties @@ -1294,3 +1294,5 @@ _UI_IRiseClipseConsole_type = IRise Clipse Console _UI_SclObject_explicitLinksBuilt_feature = Explicit Links Built _UI_LNodeType_ReferredByLNode_feature = Referred By LNode _UI_LNode_RefersToLNodeType_feature = Refers To LNode Type +_UI_LDevice_RefersToHigherLevelLDevice_feature = Refers To Higher Level LDevice +_UI_LDevice_RefersToLowerLevelLDevices_feature = Refers To Lower Level LDevices diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl.edit/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/provider/LDeviceItemProvider.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl.edit/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/provider/LDeviceItemProvider.java index 0cf301ff530e879633774524b58e521ed2706907..6a5456bb76027c1eab6ae104a34fdae9ea085571 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl.edit/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/provider/LDeviceItemProvider.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl.edit/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/provider/LDeviceItemProvider.java @@ -65,6 +65,8 @@ public class LDeviceItemProvider extends UnNamingItemProvider { addInstPropertyDescriptor( object ); addLdNamePropertyDescriptor( object ); addReferredByIEDNamePropertyDescriptor( object ); + addRefersToHigherLevelLDevicePropertyDescriptor( object ); + addRefersToLowerLevelLDevicesPropertyDescriptor( object ); } return itemPropertyDescriptors; } @@ -135,6 +137,50 @@ public class LDeviceItemProvider extends UnNamingItemProvider { null ) ); } + /** + * This adds a property descriptor for the Refers To Higher Level LDevice feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addRefersToHigherLevelLDevicePropertyDescriptor( Object object ) { + itemPropertyDescriptors.add( + createItemPropertyDescriptor( ( ( ComposeableAdapterFactory ) adapterFactory ).getRootAdapterFactory(), + getResourceLocator(), + getString( "_UI_LDevice_RefersToHigherLevelLDevice_feature" ), + getString( "_UI_PropertyDescriptor_description", + "_UI_LDevice_RefersToHigherLevelLDevice_feature", "_UI_LDevice_type" ), + SclPackage.eINSTANCE.getLDevice_RefersToHigherLevelLDevice(), + true, + false, + true, + null, + null, + null ) ); + } + + /** + * This adds a property descriptor for the Refers To Lower Level LDevices feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addRefersToLowerLevelLDevicesPropertyDescriptor( Object object ) { + itemPropertyDescriptors.add( + createItemPropertyDescriptor( ( ( ComposeableAdapterFactory ) adapterFactory ).getRootAdapterFactory(), + getResourceLocator(), + getString( "_UI_LDevice_RefersToLowerLevelLDevices_feature" ), + getString( "_UI_PropertyDescriptor_description", + "_UI_LDevice_RefersToLowerLevelLDevices_feature", "_UI_LDevice_type" ), + SclPackage.eINSTANCE.getLDevice_RefersToLowerLevelLDevices(), + true, + false, + true, + null, + 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 diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.ecore b/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.ecore index ba22ce5d712d61b5bd4ea669054012b1ac046fde..c21935001027657cb98572d8acde044bfc180d87 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.ecore +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.ecore @@ -1184,6 +1184,12 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="ReferredByIEDName" ordered="false" eType="#//IEDName" transient="true" unsettable="true" resolveProxies="false" eOpposite="#//IEDName/RefersToLDevice"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="RefersToHigherLevelLDevice" + ordered="false" eType="#//LDevice" transient="true" unsettable="true" resolveProxies="false" + eOpposite="#//LDevice/RefersToLowerLevelLDevices"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="RefersToLowerLevelLDevices" + ordered="false" upperBound="-1" eType="#//LDevice" transient="true" unsettable="true" + resolveProxies="false" eOpposite="#//LDevice/RefersToHigherLevelLDevice"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="LN" eSuperTypes="#//AnyLN"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.genmodel b/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.genmodel index 9a36ea531d05e8936fc276f07877e2518810bee1..9ef00ef9bd187ec2482b19cbde758af9525c43ca 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.genmodel +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.genmodel @@ -635,6 +635,8 @@ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference SCL.ecore#//LDevice/LN0"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference SCL.ecore#//LDevice/LN"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference SCL.ecore#//LDevice/ReferredByIEDName"/> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference SCL.ecore#//LDevice/RefersToHigherLevelLDevice"/> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference SCL.ecore#//LDevice/RefersToLowerLevelLDevices"/> <genOperations ecoreOperation="SCL.ecore#//LDevice/getNamespace"/> </genClasses> <genClasses ecoreClass="SCL.ecore#//LN"> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/LDevice.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/LDevice.java index a74a314ef1ddcc913465afa0ab83daa9b9462a81..4aafd189c0ea9b29afecb4efddaa87731fa3d1de 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/LDevice.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/LDevice.java @@ -42,6 +42,8 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.IED; * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getLN0 <em>LN0</em>}</li> * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getLN <em>LN</em>}</li> * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getReferredByIEDName <em>Referred By IED Name</em>}</li> + * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToHigherLevelLDevice <em>Refers To Higher Level LDevice</em>}</li> + * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToLowerLevelLDevices <em>Refers To Lower Level LDevices</em>}</li> * </ul> * * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage#getLDevice() @@ -340,6 +342,94 @@ public interface LDevice extends UnNaming { */ boolean isSetReferredByIEDName(); + /** + * Returns the value of the '<em><b>Refers To Higher Level LDevice</b></em>' reference. + * It is bidirectional and its opposite is '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToLowerLevelLDevices <em>Refers To Lower Level LDevices</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the value of the '<em>Refers To Higher Level LDevice</em>' reference. + * @see #isSetRefersToHigherLevelLDevice() + * @see #unsetRefersToHigherLevelLDevice() + * @see #setRefersToHigherLevelLDevice(LDevice) + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage#getLDevice_RefersToHigherLevelLDevice() + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToLowerLevelLDevices + * @model opposite="RefersToLowerLevelLDevices" resolveProxies="false" unsettable="true" transient="true" ordered="false" + * @generated + */ + LDevice getRefersToHigherLevelLDevice(); + + /** + * Sets the value of the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToHigherLevelLDevice <em>Refers To Higher Level LDevice</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Refers To Higher Level LDevice</em>' reference. + * @see #isSetRefersToHigherLevelLDevice() + * @see #unsetRefersToHigherLevelLDevice() + * @see #getRefersToHigherLevelLDevice() + * @generated + */ + void setRefersToHigherLevelLDevice( LDevice value ); + + /** + * Unsets the value of the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToHigherLevelLDevice <em>Refers To Higher Level LDevice</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSetRefersToHigherLevelLDevice() + * @see #getRefersToHigherLevelLDevice() + * @see #setRefersToHigherLevelLDevice(LDevice) + * @generated + */ + void unsetRefersToHigherLevelLDevice(); + + /** + * Returns whether the value of the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToHigherLevelLDevice <em>Refers To Higher Level LDevice</em>}' reference is set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return whether the value of the '<em>Refers To Higher Level LDevice</em>' reference is set. + * @see #unsetRefersToHigherLevelLDevice() + * @see #getRefersToHigherLevelLDevice() + * @see #setRefersToHigherLevelLDevice(LDevice) + * @generated + */ + boolean isSetRefersToHigherLevelLDevice(); + + /** + * Returns the value of the '<em><b>Refers To Lower Level LDevices</b></em>' reference list. + * The list contents are of type {@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice}. + * It is bidirectional and its opposite is '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToHigherLevelLDevice <em>Refers To Higher Level LDevice</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the value of the '<em>Refers To Lower Level LDevices</em>' reference list. + * @see #isSetRefersToLowerLevelLDevices() + * @see #unsetRefersToLowerLevelLDevices() + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage#getLDevice_RefersToLowerLevelLDevices() + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToHigherLevelLDevice + * @model opposite="RefersToHigherLevelLDevice" resolveProxies="false" unsettable="true" transient="true" ordered="false" + * @generated + */ + EList< LDevice > getRefersToLowerLevelLDevices(); + + /** + * Unsets the value of the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToLowerLevelLDevices <em>Refers To Lower Level LDevices</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSetRefersToLowerLevelLDevices() + * @see #getRefersToLowerLevelLDevices() + * @generated + */ + void unsetRefersToLowerLevelLDevices(); + + /** + * Returns whether the value of the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToLowerLevelLDevices <em>Refers To Lower Level LDevices</em>}' reference list is set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return whether the value of the '<em>Refers To Lower Level LDevices</em>' reference list is set. + * @see #unsetRefersToLowerLevelLDevices() + * @see #getRefersToLowerLevelLDevices() + * @generated + */ + boolean isSetRefersToLowerLevelLDevices(); + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/SclPackage.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/SclPackage.java index 45290fe748fd8d3770d24aacf15db27fd7a94005..938bb54af5a68be45b25ca6d6512c7166416107b 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/SclPackage.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/SclPackage.java @@ -12460,6 +12460,24 @@ public interface SclPackage extends EPackage { */ int LDEVICE__REFERRED_BY_IED_NAME = UN_NAMING_FEATURE_COUNT + 7; + /** + * The feature id for the '<em><b>Refers To Higher Level LDevice</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE = UN_NAMING_FEATURE_COUNT + 8; + + /** + * The feature id for the '<em><b>Refers To Lower Level LDevices</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES = UN_NAMING_FEATURE_COUNT + 9; + /** * The number of structural features of the '<em>LDevice</em>' class. * <!-- begin-user-doc --> @@ -12467,7 +12485,7 @@ public interface SclPackage extends EPackage { * @generated * @ordered */ - int LDEVICE_FEATURE_COUNT = UN_NAMING_FEATURE_COUNT + 8; + int LDEVICE_FEATURE_COUNT = UN_NAMING_FEATURE_COUNT + 10; /** * The operation id for the '<em>Build Explicit Links</em>' operation. @@ -27375,6 +27393,28 @@ public interface SclPackage extends EPackage { */ EReference getLDevice_ReferredByIEDName(); + /** + * Returns the meta object for the reference '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToHigherLevelLDevice <em>Refers To Higher Level LDevice</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Refers To Higher Level LDevice</em>'. + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToHigherLevelLDevice() + * @see #getLDevice() + * @generated + */ + EReference getLDevice_RefersToHigherLevelLDevice(); + + /** + * Returns the meta object for the reference list '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToLowerLevelLDevices <em>Refers To Lower Level LDevices</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Refers To Lower Level LDevices</em>'. + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getRefersToLowerLevelLDevices() + * @see #getLDevice() + * @generated + */ + EReference getLDevice_RefersToLowerLevelLDevices(); + /** * Returns the meta object for the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getNamespace() <em>Get Namespace</em>}' operation. * <!-- begin-user-doc --> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/LDeviceImpl.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/LDeviceImpl.java index 8fbdabe35874eb8d40473bb114b65617d9b64f19..3a4a2792460b8e30bfa5ae69b6c643b7344f6327 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/LDeviceImpl.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/LDeviceImpl.java @@ -31,6 +31,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.EObjectWithInverseEList; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.InternalEList; @@ -47,6 +48,8 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.LN; import fr.centralesupelec.edf.riseclipse.iec61850.scl.LN0; import fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage; import fr.centralesupelec.edf.riseclipse.iec61850.scl.Server; +import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole; + import java.lang.reflect.InvocationTargetException; /** @@ -65,6 +68,8 @@ import java.lang.reflect.InvocationTargetException; * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.impl.LDeviceImpl#getLN0 <em>LN0</em>}</li> * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.impl.LDeviceImpl#getLN <em>LN</em>}</li> * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.impl.LDeviceImpl#getReferredByIEDName <em>Referred By IED Name</em>}</li> + * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.impl.LDeviceImpl#getRefersToHigherLevelLDevice <em>Refers To Higher Level LDevice</em>}</li> + * <li>{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.impl.LDeviceImpl#getRefersToLowerLevelLDevices <em>Refers To Lower Level LDevices</em>}</li> * </ul> * * @generated @@ -176,6 +181,35 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { */ protected boolean referredByIEDNameESet; + /** + * The cached value of the '{@link #getRefersToHigherLevelLDevice() <em>Refers To Higher Level LDevice</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getRefersToHigherLevelLDevice() + * @generated + * @ordered + */ + protected LDevice refersToHigherLevelLDevice; + + /** + * This is true if the Refers To Higher Level LDevice reference has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean refersToHigherLevelLDeviceESet; + + /** + * The cached value of the '{@link #getRefersToLowerLevelLDevices() <em>Refers To Lower Level LDevices</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getRefersToLowerLevelLDevices() + * @generated + * @ordered + */ + protected EList< LDevice > refersToLowerLevelLDevices; + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -617,6 +651,160 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { return referredByIEDNameESet; } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public LDevice getRefersToHigherLevelLDevice() { + return refersToHigherLevelLDevice; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetRefersToHigherLevelLDevice( LDevice newRefersToHigherLevelLDevice, + NotificationChain msgs ) { + LDevice oldRefersToHigherLevelLDevice = refersToHigherLevelLDevice; + refersToHigherLevelLDevice = newRefersToHigherLevelLDevice; + boolean oldRefersToHigherLevelLDeviceESet = refersToHigherLevelLDeviceESet; + refersToHigherLevelLDeviceESet = true; + if( eNotificationRequired() ) { + ENotificationImpl notification = new ENotificationImpl( this, Notification.SET, + SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE, oldRefersToHigherLevelLDevice, + newRefersToHigherLevelLDevice, !oldRefersToHigherLevelLDeviceESet ); + if( msgs == null ) + msgs = notification; + else + msgs.add( notification ); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void setRefersToHigherLevelLDevice( LDevice newRefersToHigherLevelLDevice ) { + if( newRefersToHigherLevelLDevice != refersToHigherLevelLDevice ) { + NotificationChain msgs = null; + if( refersToHigherLevelLDevice != null ) + msgs = ( ( InternalEObject ) refersToHigherLevelLDevice ).eInverseRemove( this, + SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES, LDevice.class, msgs ); + if( newRefersToHigherLevelLDevice != null ) + msgs = ( ( InternalEObject ) newRefersToHigherLevelLDevice ).eInverseAdd( this, + SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES, LDevice.class, msgs ); + msgs = basicSetRefersToHigherLevelLDevice( newRefersToHigherLevelLDevice, msgs ); + if( msgs != null ) msgs.dispatch(); + } + else { + boolean oldRefersToHigherLevelLDeviceESet = refersToHigherLevelLDeviceESet; + refersToHigherLevelLDeviceESet = true; + if( eNotificationRequired() ) + eNotify( new ENotificationImpl( this, Notification.SET, + SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE, newRefersToHigherLevelLDevice, + newRefersToHigherLevelLDevice, !oldRefersToHigherLevelLDeviceESet ) ); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicUnsetRefersToHigherLevelLDevice( NotificationChain msgs ) { + LDevice oldRefersToHigherLevelLDevice = refersToHigherLevelLDevice; + refersToHigherLevelLDevice = null; + boolean oldRefersToHigherLevelLDeviceESet = refersToHigherLevelLDeviceESet; + refersToHigherLevelLDeviceESet = false; + if( eNotificationRequired() ) { + ENotificationImpl notification = new ENotificationImpl( this, Notification.UNSET, + SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE, oldRefersToHigherLevelLDevice, null, + oldRefersToHigherLevelLDeviceESet ); + if( msgs == null ) + msgs = notification; + else + msgs.add( notification ); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void unsetRefersToHigherLevelLDevice() { + if( refersToHigherLevelLDevice != null ) { + NotificationChain msgs = null; + msgs = ( ( InternalEObject ) refersToHigherLevelLDevice ).eInverseRemove( this, + SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES, LDevice.class, msgs ); + msgs = basicUnsetRefersToHigherLevelLDevice( msgs ); + if( msgs != null ) msgs.dispatch(); + } + else { + boolean oldRefersToHigherLevelLDeviceESet = refersToHigherLevelLDeviceESet; + refersToHigherLevelLDeviceESet = false; + if( eNotificationRequired() ) + eNotify( new ENotificationImpl( this, Notification.UNSET, + SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE, null, null, + oldRefersToHigherLevelLDeviceESet ) ); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean isSetRefersToHigherLevelLDevice() { + return refersToHigherLevelLDeviceESet; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EList< LDevice > getRefersToLowerLevelLDevices() { + if( refersToLowerLevelLDevices == null ) { + refersToLowerLevelLDevices = new EObjectWithInverseEList.Unsettable< LDevice >( LDevice.class, this, + SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES, + SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE ); + } + return refersToLowerLevelLDevices; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void unsetRefersToLowerLevelLDevices() { + if( refersToLowerLevelLDevices != null ) + ( ( InternalEList.Unsettable< ? > ) refersToLowerLevelLDevices ).unset(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean isSetRefersToLowerLevelLDevices() { + return refersToLowerLevelLDevices != null + && ( ( InternalEList.Unsettable< ? > ) refersToLowerLevelLDevices ).isSet(); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -798,6 +986,14 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { msgs = ( ( InternalEObject ) referredByIEDName ).eInverseRemove( this, SclPackage.IED_NAME__REFERS_TO_LDEVICE, IEDName.class, msgs ); return basicSetReferredByIEDName( ( IEDName ) otherEnd, msgs ); + case SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE: + if( refersToHigherLevelLDevice != null ) + msgs = ( ( InternalEObject ) refersToHigherLevelLDevice ).eInverseRemove( this, + SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES, LDevice.class, msgs ); + return basicSetRefersToHigherLevelLDevice( ( LDevice ) otherEnd, msgs ); + case SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES: + return ( ( InternalEList< InternalEObject > ) ( InternalEList< ? > ) getRefersToLowerLevelLDevices() ) + .basicAdd( otherEnd, msgs ); } return super.eInverseAdd( otherEnd, featureID, msgs ); } @@ -822,6 +1018,10 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { return ( ( InternalEList< ? > ) getLN() ).basicRemove( otherEnd, msgs ); case SclPackage.LDEVICE__REFERRED_BY_IED_NAME: return basicUnsetReferredByIEDName( msgs ); + case SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE: + return basicUnsetRefersToHigherLevelLDevice( msgs ); + case SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES: + return ( ( InternalEList< ? > ) getRefersToLowerLevelLDevices() ).basicRemove( otherEnd, msgs ); } return super.eInverseRemove( otherEnd, featureID, msgs ); } @@ -865,6 +1065,10 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { return getLN(); case SclPackage.LDEVICE__REFERRED_BY_IED_NAME: return getReferredByIEDName(); + case SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE: + return getRefersToHigherLevelLDevice(); + case SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES: + return getRefersToLowerLevelLDevices(); } return super.eGet( featureID, resolve, coreType ); } @@ -903,6 +1107,13 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { case SclPackage.LDEVICE__REFERRED_BY_IED_NAME: setReferredByIEDName( ( IEDName ) newValue ); return; + case SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE: + setRefersToHigherLevelLDevice( ( LDevice ) newValue ); + return; + case SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES: + getRefersToLowerLevelLDevices().clear(); + getRefersToLowerLevelLDevices().addAll( ( Collection< ? extends LDevice > ) newValue ); + return; } super.eSet( featureID, newValue ); } @@ -939,6 +1150,12 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { case SclPackage.LDEVICE__REFERRED_BY_IED_NAME: unsetReferredByIEDName(); return; + case SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE: + unsetRefersToHigherLevelLDevice(); + return; + case SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES: + unsetRefersToLowerLevelLDevices(); + return; } super.eUnset( featureID ); } @@ -967,6 +1184,10 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { return isSetLN(); case SclPackage.LDEVICE__REFERRED_BY_IED_NAME: return isSetReferredByIEDName(); + case SclPackage.LDEVICE__REFERS_TO_HIGHER_LEVEL_LDEVICE: + return isSetRefersToHigherLevelLDevice(); + case SclPackage.LDEVICE__REFERS_TO_LOWER_LEVEL_LDEVICES: + return isSetRefersToLowerLevelLDevices(); } return super.eIsSet( featureID ); } @@ -1016,4 +1237,99 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { return getParentServer().getParentAccessPoint().getParentIED(); } + @Override + protected void doBuildExplicitLinks( IRiseClipseConsole console ) { + //@formatter:off + + // see Issue #13 + super.doBuildExplicitLinks( console ); + + String messagePrefix = "[SCL links] while resolving link from LDevice on line " + getLineNumber() + ": "; + + // TODO: warning message ? + if( getLN0() == null ) return; + + // Look for DOI name="GrRef" in LN0 + List< DOI > grRef = + getLN0() + .getDOI() + .stream() + .filter( doi -> "GrRef".equals( doi.getName() )) + .collect( Collectors.toList() ); + + if( grRef.size() > 1 ) { + console.warning( messagePrefix, "found several DOI named GrRef in LN0" ); + return; + } + + if( grRef.size() == 0 ) { + console.info( "[SCL links] LDevice " + getInst() + " on line " + getLineNumber() + " is a root LDevice" ); + return; + } + // Look for DAI name="setSrcRef" in GrRef + List< DAI > setSrcRef = + grRef + .get( 0 ) + .getDAI() + .stream() + .filter( dai -> "setSrcRef".equals( dai.getName() )) + .collect( Collectors.toList() ); + + if( setSrcRef.size() == 0 ) { + console.warning( messagePrefix, "found no DAI named setSrcRef in GrRef on line " + grRef.get( 0 ).getLineNumber() ); + return; + } + if( setSrcRef.size() > 1 ) { + console.warning( messagePrefix, "found several DAI named setSrcRef in GrRef on line " + grRef.get( 0 ).getLineNumber() ); + return; + } + + if( setSrcRef.get( 0 ).getVal().size() == 0 ) { + console.warning( messagePrefix, "found no Val in setSrcRef on line " + setSrcRef.get( 0 ).getLineNumber() ); + return; + } + if( setSrcRef.get( 0 ).getVal().size() > 1 ) { + console.warning( messagePrefix, "found several Val in setSrcRef on line " + setSrcRef.get( 0 ).getLineNumber() ); + return; + } + + String higherLevelLDeviceName = setSrcRef.get( 0 ).getVal().get( 0 ).getValue(); + if(( higherLevelLDeviceName == null ) || ( higherLevelLDeviceName.length() <= 1 )) { + console.warning( messagePrefix, "found no Val or empty Val in setSrcRef on line " + setSrcRef.get( 0 ).getLineNumber() ); + return; + } + + // TODO: higherLevelLDeviceName may or must be prefixed by @ ? + if( ! higherLevelLDeviceName.startsWith( "@" )) { + console.warning( messagePrefix, "Val in setSrcRef on line " + setSrcRef.get( 0 ).getLineNumber() + " does not start with @" ); + } + else { + higherLevelLDeviceName = higherLevelLDeviceName.substring( 1 ); + } + + // Look for LDevice in same Server with name higherLevelLDeviceName + // Must be final or effectively final + String temp = higherLevelLDeviceName; + List< LDevice > lDevices = + getParentServer() + .getLDevice() + .stream() + .filter( ld -> temp.equals( ld.getInst() )) + .collect( Collectors.toList() ); + + if( lDevices.size() == 0 ) { + console.warning( messagePrefix, "found no LDevice named " + higherLevelLDeviceName ); + return; + } + if( lDevices.size() > 1 ) { + console.warning( messagePrefix, "found several LDevice " + higherLevelLDeviceName ); + return; + } + + console.info( "[SCL links] LDevice " + getInst() + " on line " + getLineNumber() + " has " + lDevices.get( 0 ).getInst() + " for higher level LDevice" ); + setRefersToHigherLevelLDevice( lDevices.get( 0 )); + + //@formatter:on + } + } //LDeviceImpl diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/SclPackageImpl.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/SclPackageImpl.java index 867d24c8346515ed4222973a47db84284bf6ae90..237b962d57687d2d7dde7a8c884fe1291326df5a 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/SclPackageImpl.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/SclPackageImpl.java @@ -6890,6 +6890,26 @@ public class SclPackageImpl extends EPackageImpl implements SclPackage { return ( EReference ) getLDevice().getEStructuralFeatures().get( 7 ); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EReference getLDevice_RefersToHigherLevelLDevice() { + return ( EReference ) getLDevice().getEStructuralFeatures().get( 8 ); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EReference getLDevice_RefersToLowerLevelLDevices() { + return ( EReference ) getLDevice().getEStructuralFeatures().get( 9 ); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/scl.ecore b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/scl.ecore index ba22ce5d712d61b5bd4ea669054012b1ac046fde..c21935001027657cb98572d8acde044bfc180d87 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/scl.ecore +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/scl.ecore @@ -1184,6 +1184,12 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="ReferredByIEDName" ordered="false" eType="#//IEDName" transient="true" unsettable="true" resolveProxies="false" eOpposite="#//IEDName/RefersToLDevice"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="RefersToHigherLevelLDevice" + ordered="false" eType="#//LDevice" transient="true" unsettable="true" resolveProxies="false" + eOpposite="#//LDevice/RefersToLowerLevelLDevices"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="RefersToLowerLevelLDevices" + ordered="false" upperBound="-1" eType="#//LDevice" transient="true" unsettable="true" + resolveProxies="false" eOpposite="#//LDevice/RefersToHigherLevelLDevice"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="LN" eSuperTypes="#//AnyLN"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"