Search in sources :

Example 1 with OppositePropertiesEditionPart

use of org.obeonetwork.dsl.environment.parts.OppositePropertiesEditionPart in project InformationSystem by ObeoNetwork.

the class ReferenceOppositePropertiesEditionComponent method initPart.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
    setInitializing(true);
    if (editingPart != null && key == partKey) {
        editingPart.setContext(elt, allResource);
        if (editingPart instanceof CompositePropertiesEditionPart) {
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeNameSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeReferencedTypeSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeMultiplicitySettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeIsCompositeSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeNavigableSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeIdentifierSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeDescriptionSettings);
        }
        final Reference reference = (Reference) elt;
        final OppositePropertiesEditionPart oppositePart = (OppositePropertiesEditionPart) editingPart;
        // init values
        if (oppositeNameSettings.getValue() != null && isAccessible(EnvironmentViewsRepository.Opposite.Properties.name))
            oppositePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, oppositeNameSettings.getValue()));
        // FIXME NO VALID CASE INTO template public updater(editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent) in widgetControl.mtl module, with the values : oppositeReferencedType, Opposite, reference.
        if (oppositeMultiplicitySettings.getSignificantObject() != null && isAccessible(EnvironmentViewsRepository.Opposite.Properties.multiplicity)) {
            oppositePart.initMultiplicity(EEFUtils.choiceOfValues(oppositeMultiplicitySettings.getSignificantObject(), EnvironmentPackage.eINSTANCE.getProperty_Multiplicity()), (Enumerator) oppositeMultiplicitySettings.getValue());
        }
        if (isAccessible(EnvironmentViewsRepository.Opposite.Properties.isComposite)) {
            oppositePart.setIsComposite((Boolean) oppositeIsCompositeSettings.getValue());
        }
        if (isAccessible(EnvironmentViewsRepository.Opposite.Properties.navigable)) {
            oppositePart.setNavigable((Boolean) oppositeNavigableSettings.getValue());
        }
        if (isAccessible(EnvironmentViewsRepository.Opposite.Properties.identifier)) {
            oppositePart.setIdentifier((Boolean) oppositeIdentifierSettings.getValue());
        }
        if (oppositeDescriptionSettings.getValue() != null && isAccessible(EnvironmentViewsRepository.Opposite.Properties.description))
            oppositePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, oppositeDescriptionSettings.getValue()));
    // init filters
    // FIXME NO VALID CASE INTO template public filterUpdater(editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent) in widgetControl.mtl module, with the values : oppositeReferencedType, Opposite, reference.
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : OppositePropertiesEditionPart(org.obeonetwork.dsl.environment.parts.OppositePropertiesEditionPart) CompositePropertiesEditionPart(org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart) Reference(org.obeonetwork.dsl.environment.Reference)

Example 2 with OppositePropertiesEditionPart

use of org.obeonetwork.dsl.environment.parts.OppositePropertiesEditionPart in project InformationSystem by ObeoNetwork.

the class ReferenceOppositePropertiesEditionComponentSpec method initPart.

@Override
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
    setInitializing(true);
    if (editingPart != null && key == partKey) {
        editingPart.setContext(elt, allResource);
        if (editingPart instanceof CompositePropertiesEditionPart) {
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeNameSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeReferencedTypeSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeMultiplicitySettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeIsCompositeSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeNavigableSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeIdentifierSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(oppositeDescriptionSettings);
        }
        final OppositePropertiesEditionPart oppositePart = (OppositePropertiesEditionPart) editingPart;
        if (elt != null && elt instanceof Reference) {
            // init values
            if (oppositeNameSettings.getValue() != null && isAccessible(EnvironmentViewsRepository.Opposite.Properties.name))
                oppositePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, oppositeNameSettings.getValue()));
            if (oppositeMultiplicitySettings.getSignificantObject() != null && isAccessible(EnvironmentViewsRepository.Opposite.Properties.multiplicity)) {
                oppositePart.initMultiplicity(EEFUtils.choiceOfValues(oppositeMultiplicitySettings.getSignificantObject(), EnvironmentPackage.eINSTANCE.getProperty_Multiplicity()), (Enumerator) oppositeMultiplicitySettings.getValue());
            }
            if (isAccessible(EnvironmentViewsRepository.Opposite.Properties.isComposite)) {
                oppositePart.setIsComposite((Boolean) oppositeIsCompositeSettings.getValue());
            }
            if (isAccessible(EnvironmentViewsRepository.Opposite.Properties.navigable)) {
                oppositePart.setNavigable((Boolean) oppositeNavigableSettings.getValue());
            }
            if (isAccessible(EnvironmentViewsRepository.Opposite.Properties.identifier)) {
                oppositePart.setIdentifier((Boolean) oppositeIdentifierSettings.getValue());
            }
            if (oppositeDescriptionSettings.getValue() != null && isAccessible(EnvironmentViewsRepository.Opposite.Properties.description))
                oppositePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, oppositeDescriptionSettings.getValue()));
            if (this.oppositeReferencedTypeSettings.getSignificantObject() != null && isAccessible(EnvironmentViewsRepository.Opposite.Properties.referencedType)) {
                oppositePart.setReferencedType((EObject) this.oppositeReferencedTypeSettings.getValue());
            }
        } else {
        // no value
        }
    }
    setInitializing(false);
}
Also used : OppositePropertiesEditionPart(org.obeonetwork.dsl.environment.parts.OppositePropertiesEditionPart) CompositePropertiesEditionPart(org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart) Reference(org.obeonetwork.dsl.environment.Reference)

Aggregations

CompositePropertiesEditionPart (org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart)2 Reference (org.obeonetwork.dsl.environment.Reference)2 OppositePropertiesEditionPart (org.obeonetwork.dsl.environment.parts.OppositePropertiesEditionPart)2