Search in sources :

Example 1 with CompositePropertiesEditionPart

use of org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart in project InformationSystem by ObeoNetwork.

the class RiskPropertiesEditionComponent 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(benefitsSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(drawbacksSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(riskSettings);
        }
        final RiskPropertiesEditionPart riskPart = (RiskPropertiesEditionPart) editingPart;
        // init values
        if (benefitsSettings.getSignificantObject() != null && isAccessible(GraalextensionsViewsRepository.Risk.Properties.benefits)) {
            riskPart.initBenefits(EEFUtils.choiceOfValues(benefitsSettings.getSignificantObject(), GraalExtensionsPackage.eINSTANCE.getRisk_Benefits()), (Enumerator) benefitsSettings.getValue());
        }
        if (drawbacksSettings.getSignificantObject() != null && isAccessible(GraalextensionsViewsRepository.Risk.Properties.drawbacks)) {
            riskPart.initDrawbacks(EEFUtils.choiceOfValues(drawbacksSettings.getSignificantObject(), GraalExtensionsPackage.eINSTANCE.getRisk_Drawbacks()), (Enumerator) drawbacksSettings.getValue());
        }
        if (riskSettings.getSignificantObject() != null && isAccessible(GraalextensionsViewsRepository.Risk.Properties.risk_)) {
            riskPart.initRisk(EEFUtils.choiceOfValues(riskSettings.getSignificantObject(), GraalExtensionsPackage.eINSTANCE.getRisk_Risk()), (Enumerator) riskSettings.getValue());
        }
    // init filters
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : CompositePropertiesEditionPart(org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart) RiskPropertiesEditionPart(fr.gouv.mindef.safran.graalextensions.parts.RiskPropertiesEditionPart)

Example 2 with CompositePropertiesEditionPart

use of org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart in project InformationSystem by ObeoNetwork.

the class MetadataCptPropertiesEditionComponent 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(metadataSettings);
        }
        final ObeoDSMObject obeoDSMObject = (ObeoDSMObject) elt;
        final MetadatasPropertiesEditionPart metadatasPart = (MetadatasPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(EnvironmentViewsRepository.Metadatas.Properties.metadata)) {
            metadataSettings = new ReferencesTableSettings(obeoDSMObject, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Metadatas(), EnvironmentPackage.eINSTANCE.getMetaDataContainer_Metadatas());
            metadatasPart.initMetadata(metadataSettings);
        }
        // init filters
        if (isAccessible(EnvironmentViewsRepository.Metadatas.Properties.metadata)) {
            metadatasPart.addFilterToMetadata(new ViewerFilter() {

                /**
                 * {@inheritDoc}
                 *
                 * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
                 */
                public boolean select(Viewer viewer, Object parentElement, Object element) {
                    if (element instanceof String)
                        // $NON-NLS-1$
                        return element.equals("");
                    if (element instanceof MetaData)
                        return true;
                    return element instanceof Resource;
                }
            });
        // Start of user code for additional businessfilters for metadata
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) MetadatasPropertiesEditionPart(org.obeonetwork.dsl.environment.parts.MetadatasPropertiesEditionPart) CompositePropertiesEditionPart(org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart) MetaData(org.obeonetwork.dsl.environment.MetaData) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject) Resource(org.eclipse.emf.ecore.resource.Resource) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject)

Example 3 with CompositePropertiesEditionPart

use of org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart 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 4 with CompositePropertiesEditionPart

use of org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart 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)

Example 5 with CompositePropertiesEditionPart

use of org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart in project InformationSystem by ObeoNetwork.

the class TablePrimaryKeyPropertiesEditionComponent 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(pkNameSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(pkColumnsSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(pkCommentsSettings);
        }
        final Table table = (Table) elt;
        final PrimaryKeyPropertiesEditionPart primaryKeyPart = (PrimaryKeyPropertiesEditionPart) editingPart;
        // init values
        if (pkNameSettings.getValue() != null && isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.name))
            primaryKeyPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, pkNameSettings.getValue()));
        if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
            pkColumnsSettings = new ReferencesTableSettings(table, DatabasePackage.eINSTANCE.getTable_PrimaryKey(), DatabasePackage.eINSTANCE.getPrimaryKey_Columns());
            primaryKeyPart.initColumns(pkColumnsSettings);
        }
        if (pkCommentsSettings.getValue() != null && isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.comments))
            primaryKeyPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, pkCommentsSettings.getValue()));
        if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
            primaryKeyPart.addFilterToColumns(new EObjectStrictFilter(DatabasePackage.Literals.COLUMN));
        // Start of user code for additional businessfilters for pkColumns
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : EObjectStrictFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter) Table(org.obeonetwork.dsl.database.Table) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) CompositePropertiesEditionPart(org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart) PrimaryKeyPropertiesEditionPart(org.obeonetwork.dsl.database.parts.PrimaryKeyPropertiesEditionPart)

Aggregations

CompositePropertiesEditionPart (org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart)6 EObject (org.eclipse.emf.ecore.EObject)2 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)2 Viewer (org.eclipse.jface.viewers.Viewer)2 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)2 Reference (org.obeonetwork.dsl.environment.Reference)2 OppositePropertiesEditionPart (org.obeonetwork.dsl.environment.parts.OppositePropertiesEditionPart)2 RiskPropertiesEditionPart (fr.gouv.mindef.safran.graalextensions.parts.RiskPropertiesEditionPart)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 EObjectStrictFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter)1 EObjectFlatComboSettings (org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)1 Column (org.obeonetwork.dsl.database.Column)1 Sequence (org.obeonetwork.dsl.database.Sequence)1 Table (org.obeonetwork.dsl.database.Table)1 ColumnPropertiesEditionPart (org.obeonetwork.dsl.database.parts.ColumnPropertiesEditionPart)1 PrimaryKeyPropertiesEditionPart (org.obeonetwork.dsl.database.parts.PrimaryKeyPropertiesEditionPart)1 MetaData (org.obeonetwork.dsl.environment.MetaData)1 ObeoDSMObject (org.obeonetwork.dsl.environment.ObeoDSMObject)1 MetadatasPropertiesEditionPart (org.obeonetwork.dsl.environment.parts.MetadatasPropertiesEditionPart)1