Search in sources :

Example 6 with FlowAction

use of org.obeonetwork.dsl.cinematic.flow.FlowAction in project InformationSystem by ObeoNetwork.

the class AsyncEventStateAsyncEventStatePropertiesEditionComponent 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 AsyncEventState asyncEventState = (AsyncEventState) elt;
        final AsyncEventStatePropertiesEditionPart asyncEventStatePart = (AsyncEventStatePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(FlowViewsRepository.AsyncEventState.Properties.description))
            asyncEventStatePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, asyncEventState.getDescription()));
        if (isAccessible(FlowViewsRepository.AsyncEventState.Properties.actions)) {
            actionsSettings = new ReferencesTableSettings(asyncEventState, FlowPackage.eINSTANCE.getFlowState_Actions());
            asyncEventStatePart.initActions(actionsSettings);
        }
        if (isAccessible(FlowViewsRepository.AsyncEventState.Properties.name))
            asyncEventStatePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, asyncEventState.getName()));
        if (isAccessible(FlowViewsRepository.AsyncEventState.Properties.actions)) {
            asyncEventStatePart.addFilterToActions(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) {
                    // $NON-NLS-1$
                    return (element instanceof String && element.equals("")) || (element instanceof FlowAction);
                }
            });
        // Start of user code for additional businessfilters for actions
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : AsyncEventState(org.obeonetwork.dsl.cinematic.flow.AsyncEventState) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) FlowAction(org.obeonetwork.dsl.cinematic.flow.FlowAction) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) AsyncEventStatePropertiesEditionPart(org.obeonetwork.dsl.cinematic.flow.parts.AsyncEventStatePropertiesEditionPart)

Example 7 with FlowAction

use of org.obeonetwork.dsl.cinematic.flow.FlowAction 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)

Example 8 with FlowAction

use of org.obeonetwork.dsl.cinematic.flow.FlowAction in project InformationSystem by ObeoNetwork.

the class FinalStateFinalStatePropertiesEditionComponent 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) {
    FinalState finalState = (FinalState) semanticObject;
    if (FlowViewsRepository.FinalState.Properties.description == event.getAffectedEditor()) {
        finalState.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (FlowViewsRepository.FinalState.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.FinalState.Properties.name == event.getAffectedEditor()) {
        finalState.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) PropertiesEditingPolicy(org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy) CreateEditingPolicy(org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy) FinalState(org.obeonetwork.dsl.cinematic.flow.FinalState) EReferencePropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)

Example 9 with FlowAction

use of org.obeonetwork.dsl.cinematic.flow.FlowAction in project InformationSystem by ObeoNetwork.

the class FinalStateFinalStatePropertiesEditionComponent 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 FinalState finalState = (FinalState) elt;
        final FinalStatePropertiesEditionPart finalStatePart = (FinalStatePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(FlowViewsRepository.FinalState.Properties.description))
            finalStatePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, finalState.getDescription()));
        if (isAccessible(FlowViewsRepository.FinalState.Properties.actions)) {
            actionsSettings = new ReferencesTableSettings(finalState, FlowPackage.eINSTANCE.getFlowState_Actions());
            finalStatePart.initActions(actionsSettings);
        }
        if (isAccessible(FlowViewsRepository.FinalState.Properties.name))
            finalStatePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, finalState.getName()));
        if (isAccessible(FlowViewsRepository.FinalState.Properties.actions)) {
            finalStatePart.addFilterToActions(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) {
                    // $NON-NLS-1$
                    return (element instanceof String && element.equals("")) || (element instanceof FlowAction);
                }
            });
        // Start of user code for additional businessfilters for actions
        // 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) FlowAction(org.obeonetwork.dsl.cinematic.flow.FlowAction) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) FinalStatePropertiesEditionPart(org.obeonetwork.dsl.cinematic.flow.parts.FinalStatePropertiesEditionPart) FinalState(org.obeonetwork.dsl.cinematic.flow.FinalState)

Example 10 with FlowAction

use of org.obeonetwork.dsl.cinematic.flow.FlowAction in project InformationSystem by ObeoNetwork.

the class AbortStateAbortStatePropertiesEditionComponent 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 AbortState abortState = (AbortState) elt;
        final AbortStatePropertiesEditionPart abortStatePart = (AbortStatePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(FlowViewsRepository.AbortState.Properties.description))
            abortStatePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, abortState.getDescription()));
        if (isAccessible(FlowViewsRepository.AbortState.Properties.actions)) {
            actionsSettings = new ReferencesTableSettings(abortState, FlowPackage.eINSTANCE.getFlowState_Actions());
            abortStatePart.initActions(actionsSettings);
        }
        if (isAccessible(FlowViewsRepository.AbortState.Properties.name))
            abortStatePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, abortState.getName()));
        if (isAccessible(FlowViewsRepository.AbortState.Properties.actions)) {
            abortStatePart.addFilterToActions(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) {
                    // $NON-NLS-1$
                    return (element instanceof String && element.equals("")) || (element instanceof FlowAction);
                }
            });
        // Start of user code for additional businessfilters for actions
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : AbortStatePropertiesEditionPart(org.obeonetwork.dsl.cinematic.flow.parts.AbortStatePropertiesEditionPart) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) FlowAction(org.obeonetwork.dsl.cinematic.flow.FlowAction) AbortState(org.obeonetwork.dsl.cinematic.flow.AbortState) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject)

Aggregations

FlowAction (org.obeonetwork.dsl.cinematic.flow.FlowAction)17 EObject (org.eclipse.emf.ecore.EObject)16 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)9 EObjectPropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext)8 EReferencePropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)8 PropertiesEditingPolicy (org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy)8 CreateEditingPolicy (org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy)8 PropertiesEditingProvider (org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider)8 Viewer (org.eclipse.jface.viewers.Viewer)8 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)8 EObjectFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter)2 AbortState (org.obeonetwork.dsl.cinematic.flow.AbortState)2 ActionState (org.obeonetwork.dsl.cinematic.flow.ActionState)2 AsyncEventState (org.obeonetwork.dsl.cinematic.flow.AsyncEventState)2 DecisionState (org.obeonetwork.dsl.cinematic.flow.DecisionState)2 FinalState (org.obeonetwork.dsl.cinematic.flow.FinalState)2 Flow (org.obeonetwork.dsl.cinematic.flow.Flow)2 InitialState (org.obeonetwork.dsl.cinematic.flow.InitialState)2 SubflowState (org.obeonetwork.dsl.cinematic.flow.SubflowState)2 ViewState (org.obeonetwork.dsl.cinematic.flow.ViewState)2