Search in sources :

Example 1 with CreateEditingPolicy

use of org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy in project InformationSystem by ObeoNetwork.

the class TableForeignKeysPropertiesEditionComponent 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) {
    Table table = (Table) semanticObject;
    if (DatabaseViewsRepository.ForeignKeys.Properties.foreignKeys_ == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, foreignKeysSettings, 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) {
            foreignKeysSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            foreignKeysSettings.move(event.getNewIndex(), (ForeignKey) event.getNewValue());
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) Table(org.obeonetwork.dsl.database.Table) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) EObject(org.eclipse.emf.ecore.EObject) PropertiesEditingPolicy(org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy) CreateEditingPolicy(org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy) ForeignKey(org.obeonetwork.dsl.database.ForeignKey) EReferencePropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)

Example 2 with CreateEditingPolicy

use of org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy in project InformationSystem by ObeoNetwork.

the class StateMachineStateMachinePropertiesEditionComponent 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) {
    StateMachine stateMachine = (StateMachine) semanticObject;
    if (StatemachineViewsRepository.StateMachine_.Properties.description == event.getAffectedEditor()) {
        stateMachine.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (StatemachineViewsRepository.StateMachine_.Properties.keywords == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET) {
            stateMachine.getKeywords().clear();
            stateMachine.getKeywords().addAll(((EList) event.getNewValue()));
        }
    }
    if (StatemachineViewsRepository.StateMachine_.Properties.name == event.getAffectedEditor()) {
        stateMachine.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (StatemachineViewsRepository.StateMachine_.Properties.regions == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, regionsSettings, 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) {
            regionsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            regionsSettings.move(event.getNewIndex(), (Region) event.getNewValue());
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) BasicEList(org.eclipse.emf.common.util.BasicEList) EList(org.eclipse.emf.common.util.EList) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) StateMachine(org.obeonetwork.dsl.statemachine.StateMachine) EObject(org.eclipse.emf.ecore.EObject) Region(org.obeonetwork.dsl.statemachine.Region) 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 3 with CreateEditingPolicy

use of org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy in project InformationSystem by ObeoNetwork.

the class TransitionTransitionPropertiesEditionComponent 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) {
    Transition transition = (Transition) semanticObject;
    if (StatemachineViewsRepository.Transition.Properties.description == event.getAffectedEditor()) {
        transition.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (StatemachineViewsRepository.Transition.Properties.keywords == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET) {
            transition.getKeywords().clear();
            transition.getKeywords().addAll(((EList) event.getNewValue()));
        }
    }
    if (StatemachineViewsRepository.Transition.Properties.guard == event.getAffectedEditor()) {
        transition.setGuard((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (StatemachineViewsRepository.Transition.Properties.from == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET) {
            fromSettings.setToReference((AbstractState) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, fromSettings, 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();
                }
            }
        }
    }
    if (StatemachineViewsRepository.Transition.Properties.to == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET) {
            toSettings.setToReference((AbstractState) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, toSettings, 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 : BasicEList(org.eclipse.emf.common.util.BasicEList) EList(org.eclipse.emf.common.util.EList) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) Transition(org.obeonetwork.dsl.statemachine.Transition) 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 4 with CreateEditingPolicy

use of org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy in project InformationSystem by ObeoNetwork.

the class TaskTaskPropertiesEditionComponent 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) {
    Task task = (Task) semanticObject;
    if (GraalViewsRepository.Task.Properties.description == event.getAffectedEditor()) {
        task.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (GraalViewsRepository.Task.Properties.subActivities == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, subActivitiesSettings, 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) {
            subActivitiesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            subActivitiesSettings.move(event.getNewIndex(), (Loop) event.getNewValue());
        }
    }
    if (GraalViewsRepository.Task.Properties.actors == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            if (event.getNewValue() instanceof Actor) {
                actorsSettings.addToReference((EObject) event.getNewValue());
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            actorsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            actorsSettings.move(event.getNewIndex(), (Actor) event.getNewValue());
        }
    }
    if (GraalViewsRepository.Task.Properties.id == event.getAffectedEditor()) {
        task.setId((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (GraalViewsRepository.Task.Properties.name == event.getAffectedEditor()) {
        task.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (GraalViewsRepository.Task.Properties.uses == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            if (event.getNewValue() instanceof Task) {
                usesSettings.addToReference((EObject) event.getNewValue());
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            usesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            usesSettings.move(event.getNewIndex(), (Task) event.getNewValue());
        }
    }
    if (GraalViewsRepository.Task.Properties.preconditions == event.getAffectedEditor()) {
        task.setPreconditions((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (GraalViewsRepository.Task.Properties.postconditions == event.getAffectedEditor()) {
        task.setPostconditions((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
}
Also used : Loop(org.obeonetwork.graal.Loop) Task(org.obeonetwork.graal.Task) EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) EObject(org.eclipse.emf.ecore.EObject) Actor(org.obeonetwork.graal.Actor) 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 5 with CreateEditingPolicy

use of org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy in project InformationSystem by ObeoNetwork.

the class LoopLoopPropertiesEditionComponent 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) {
    Loop loop = (Loop) semanticObject;
    if (GraalViewsRepository.Loop.Properties.description == event.getAffectedEditor()) {
        loop.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (GraalViewsRepository.Loop.Properties.subActivities == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, subActivitiesSettings, 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) {
            subActivitiesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            subActivitiesSettings.move(event.getNewIndex(), (Loop) event.getNewValue());
        }
    }
    if (GraalViewsRepository.Loop.Properties.lowerBound == event.getAffectedEditor()) {
        loop.setLowerBound((EEFConverterUtil.createIntFromString(EcorePackage.Literals.EINT, (String) event.getNewValue())));
    }
    if (GraalViewsRepository.Loop.Properties.upperBound == event.getAffectedEditor()) {
        loop.setUpperBound((EEFConverterUtil.createIntFromString(EcorePackage.Literals.EINT, (String) event.getNewValue())));
    }
}
Also used : Loop(org.obeonetwork.graal.Loop) EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) EObject(org.eclipse.emf.ecore.EObject) 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

EReferencePropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)31 PropertiesEditingPolicy (org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy)31 CreateEditingPolicy (org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy)31 PropertiesEditingProvider (org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider)31 EObject (org.eclipse.emf.ecore.EObject)30 EObjectPropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext)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