Search in sources :

Example 46 with PropertiesEditingProvider

use of org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider in project InformationSystem by ObeoNetwork.

the class ViewElementViewElementPropertiesEditionComponent method updateSemanticModel.

/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 */
public void updateSemanticModel(final IPropertiesEditionEvent event) {
    ViewElement viewElement = (ViewElement) semanticObject;
    if (ViewViewsRepository.ViewElement.Properties.description == event.getAffectedEditor()) {
        viewElement.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (ViewViewsRepository.ViewElement.Properties.name == event.getAffectedEditor()) {
        viewElement.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (ViewViewsRepository.ViewElement.Properties.widget == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET) {
            widgetSettings.setToReference((Widget) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.ADD) {
            Widget eObject = ToolkitsFactory.eINSTANCE.createWidget();
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, eObject, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(eObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy != null) {
                    policy.execute();
                }
            }
            widgetSettings.setToReference(eObject);
        }
    }
    if (ViewViewsRepository.ViewElement.Properties.actions == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, actionsSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            actionsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            actionsSettings.move(event.getNewIndex(), (ViewAction) event.getNewValue());
        }
    }
    if (ViewViewsRepository.ViewElement.Properties.events == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, eventsSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            eventsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            eventsSettings.move(event.getNewIndex(), (ViewEvent) event.getNewValue());
        }
    }
    if (ViewViewsRepository.ViewElement.Properties.label == event.getAffectedEditor()) {
        viewElement.setLabel((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (ViewViewsRepository.ViewElement.Properties.required == event.getAffectedEditor()) {
        viewElement.setRequired((Boolean) event.getNewValue());
    }
    if (ViewViewsRepository.ViewElement.Properties.type == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET) {
            typeSettings.setToReference((Type) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, typeSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) ViewAction(org.obeonetwork.dsl.cinematic.view.ViewAction) EObject(org.eclipse.emf.ecore.EObject) ViewEvent(org.obeonetwork.dsl.cinematic.view.ViewEvent) Widget(org.obeonetwork.dsl.cinematic.toolkits.Widget) PropertiesEditingPolicy(org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy) CreateEditingPolicy(org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy) ViewElement(org.obeonetwork.dsl.cinematic.view.ViewElement) EReferencePropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)

Example 47 with PropertiesEditingProvider

use of org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider in project InformationSystem by ObeoNetwork.

the class CinematicRootCinematicRootPropertiesEditionComponent method updateSemanticModel.

/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 */
public void updateSemanticModel(final IPropertiesEditionEvent event) {
    CinematicRoot cinematicRoot = (CinematicRoot) semanticObject;
    if (CinematicViewsRepository.CinematicRoot.Properties.description == event.getAffectedEditor()) {
        cinematicRoot.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (CinematicViewsRepository.CinematicRoot.Properties.name == event.getAffectedEditor()) {
        cinematicRoot.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (CinematicViewsRepository.CinematicRoot.Properties.flows == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, flowsSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            flowsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            flowsSettings.move(event.getNewIndex(), (Flow) event.getNewValue());
        }
    }
    if (CinematicViewsRepository.CinematicRoot.Properties.viewContainers == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, viewContainersSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            viewContainersSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            viewContainersSettings.move(event.getNewIndex(), (ViewContainer) event.getNewValue());
        }
    }
    if (CinematicViewsRepository.CinematicRoot.Properties.subPackages == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, subPackagesSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            subPackagesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            subPackagesSettings.move(event.getNewIndex(), (Package) event.getNewValue());
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) EObject(org.eclipse.emf.ecore.EObject) CinematicRoot(org.obeonetwork.dsl.cinematic.CinematicRoot) PropertiesEditingPolicy(org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy) CreateEditingPolicy(org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy) EcorePackage(org.eclipse.emf.ecore.EcorePackage) Package(org.obeonetwork.dsl.cinematic.Package) EnvironmentPackage(org.obeonetwork.dsl.environment.EnvironmentPackage) CinematicPackage(org.obeonetwork.dsl.cinematic.CinematicPackage) EReferencePropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext) ViewContainer(org.obeonetwork.dsl.cinematic.view.ViewContainer) Flow(org.obeonetwork.dsl.cinematic.flow.Flow)

Example 48 with PropertiesEditingProvider

use of org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider in project InformationSystem by ObeoNetwork.

the class PackagePackage_PropertiesEditionComponent method updateSemanticModel.

/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 */
public void updateSemanticModel(final IPropertiesEditionEvent event) {
    Package package_ = (Package) semanticObject;
    if (CinematicViewsRepository.Package_.Properties.description == event.getAffectedEditor()) {
        package_.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (CinematicViewsRepository.Package_.Properties.name == event.getAffectedEditor()) {
        package_.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (CinematicViewsRepository.Package_.Properties.flows == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, flowsSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            flowsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            flowsSettings.move(event.getNewIndex(), (Flow) event.getNewValue());
        }
    }
    if (CinematicViewsRepository.Package_.Properties.viewContainers == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, viewContainersSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            viewContainersSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            viewContainersSettings.move(event.getNewIndex(), (ViewContainer) event.getNewValue());
        }
    }
    if (CinematicViewsRepository.Package_.Properties.subPackages == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, subPackagesSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            subPackagesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            subPackagesSettings.move(event.getNewIndex(), (Package) event.getNewValue());
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) EObject(org.eclipse.emf.ecore.EObject) EcorePackage(org.eclipse.emf.ecore.EcorePackage) Package(org.obeonetwork.dsl.cinematic.Package) EnvironmentPackage(org.obeonetwork.dsl.environment.EnvironmentPackage) CinematicPackage(org.obeonetwork.dsl.cinematic.CinematicPackage) PropertiesEditingPolicy(org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy) CreateEditingPolicy(org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy) EReferencePropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext) ViewContainer(org.obeonetwork.dsl.cinematic.view.ViewContainer) Flow(org.obeonetwork.dsl.cinematic.flow.Flow)

Example 49 with PropertiesEditingProvider

use of org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider in project InformationSystem by ObeoNetwork.

the class AbortStateAbortStatePropertiesEditionComponent method updateSemanticModel.

/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 */
public void updateSemanticModel(final IPropertiesEditionEvent event) {
    AbortState abortState = (AbortState) semanticObject;
    if (FlowViewsRepository.AbortState.Properties.description == event.getAffectedEditor()) {
        abortState.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (FlowViewsRepository.AbortState.Properties.actions == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, actionsSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            actionsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            actionsSettings.move(event.getNewIndex(), (FlowAction) event.getNewValue());
        }
    }
    if (FlowViewsRepository.AbortState.Properties.name == event.getAffectedEditor()) {
        abortState.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) FlowAction(org.obeonetwork.dsl.cinematic.flow.FlowAction) EObject(org.eclipse.emf.ecore.EObject) AbortState(org.obeonetwork.dsl.cinematic.flow.AbortState) PropertiesEditingPolicy(org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy) CreateEditingPolicy(org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy) EReferencePropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)

Example 50 with PropertiesEditingProvider

use of org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider in project InformationSystem by ObeoNetwork.

the class DecisionStateDecisionStatePropertiesEditionComponent method updateSemanticModel.

/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 */
public void updateSemanticModel(final IPropertiesEditionEvent event) {
    DecisionState decisionState = (DecisionState) semanticObject;
    if (FlowViewsRepository.DecisionState.Properties.description == event.getAffectedEditor()) {
        decisionState.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (FlowViewsRepository.DecisionState.Properties.actions == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, actionsSettings, editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy policy = provider.getPolicy(context);
                if (policy instanceof CreateEditingPolicy) {
                    policy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.EDIT) {
            EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
            PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
            if (provider != null) {
                PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
                if (editionPolicy != null) {
                    editionPolicy.execute();
                }
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            actionsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            actionsSettings.move(event.getNewIndex(), (FlowAction) event.getNewValue());
        }
    }
    if (FlowViewsRepository.DecisionState.Properties.name == event.getAffectedEditor()) {
        decisionState.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) FlowAction(org.obeonetwork.dsl.cinematic.flow.FlowAction) EObject(org.eclipse.emf.ecore.EObject) DecisionState(org.obeonetwork.dsl.cinematic.flow.DecisionState) PropertiesEditingPolicy(org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy) CreateEditingPolicy(org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy) EReferencePropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)

Aggregations

PropertiesEditingPolicy (org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy)109 PropertiesEditingProvider (org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider)109 EObjectPropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext)108 EReferencePropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)31 CreateEditingPolicy (org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy)31 EObject (org.eclipse.emf.ecore.EObject)30 FlowAction (org.obeonetwork.dsl.cinematic.flow.FlowAction)8 ViewContainer (org.obeonetwork.dsl.cinematic.view.ViewContainer)5 Table (org.obeonetwork.dsl.database.Table)5 Flow (org.obeonetwork.dsl.cinematic.flow.Flow)4 Widget (org.obeonetwork.dsl.cinematic.toolkits.Widget)3 ViewAction (org.obeonetwork.dsl.cinematic.view.ViewAction)3 ViewEvent (org.obeonetwork.dsl.cinematic.view.ViewEvent)3 BasicEList (org.eclipse.emf.common.util.BasicEList)2 EList (org.eclipse.emf.common.util.EList)2 EcorePackage (org.eclipse.emf.ecore.EcorePackage)2 CinematicPackage (org.obeonetwork.dsl.cinematic.CinematicPackage)2 Package (org.obeonetwork.dsl.cinematic.Package)2 ForeignKey (org.obeonetwork.dsl.database.ForeignKey)2 Index (org.obeonetwork.dsl.database.Index)2