Search in sources :

Example 1 with RiskPropertiesEditionPart

use of fr.gouv.mindef.safran.graalextensions.parts.RiskPropertiesEditionPart in project InformationSystem by ObeoNetwork.

the class CustomRiskPropertiesEditionComponent 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);
        final ObeoDSMObject obeoDSMObject = (ObeoDSMObject) elt;
        final Risk riskObject = getRiskObject(obeoDSMObject);
        final RiskPropertiesEditionPart riskPart = (RiskPropertiesEditionPart) editingPart;
        // init values
        if (riskObject != null) {
            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());
            }
        } else {
            riskPart.initBenefits(BenefitsLevel.values(), BenefitsLevel.UNDEFINED);
            riskPart.initDrawbacks(DrawbacksLevel.values(), DrawbacksLevel.UNDEFINED);
            riskPart.initRisk(RiskLevel.values(), RiskLevel.UNDEFINED);
        }
    // init filters
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject) Risk(fr.gouv.mindef.safran.graalextensions.Risk) RiskPropertiesEditionPart(fr.gouv.mindef.safran.graalextensions.parts.RiskPropertiesEditionPart)

Example 2 with RiskPropertiesEditionPart

use of fr.gouv.mindef.safran.graalextensions.parts.RiskPropertiesEditionPart 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)

Aggregations

RiskPropertiesEditionPart (fr.gouv.mindef.safran.graalextensions.parts.RiskPropertiesEditionPart)2 Risk (fr.gouv.mindef.safran.graalextensions.Risk)1 CompositePropertiesEditionPart (org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart)1 ObeoDSMObject (org.obeonetwork.dsl.environment.ObeoDSMObject)1