Search in sources :

Example 61 with PropertiesEditingProvider

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

the class ForeignKeyPropertiesEditionComponent 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) {
    ForeignKey foreignKey = (ForeignKey) semanticObject;
    if (DatabaseViewsRepository.ForeignKey.Properties.name == event.getAffectedEditor()) {
        foreignKey.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (DatabaseViewsRepository.ForeignKey.Properties.target == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET) {
            targetSettings.setToReference((Table) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.ADD) {
            Table eObject = DatabaseFactory.eINSTANCE.createTable();
            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();
                }
            }
            targetSettings.setToReference(eObject);
        }
    }
    if (DatabaseViewsRepository.ForeignKey.Properties.elements == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, elementsSettings, 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) {
            elementsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            elementsSettings.move(event.getNewIndex(), (ForeignKeyElement) event.getNewValue());
        }
    }
    if (DatabaseViewsRepository.ForeignKey.Properties.comments == event.getAffectedEditor()) {
        foreignKey.setComments((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
}
Also used : ForeignKeyElement(org.obeonetwork.dsl.database.ForeignKeyElement) 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 62 with PropertiesEditingProvider

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

the class IndexPropertiesEditionComponent 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) {
    Index index = (Index) semanticObject;
    if (DatabaseViewsRepository.Index.Properties.name == event.getAffectedEditor()) {
        index.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (DatabaseViewsRepository.Index.Properties.qualifier == event.getAffectedEditor()) {
        index.setQualifier((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (DatabaseViewsRepository.Index.Properties.unique == event.getAffectedEditor()) {
        index.setUnique((Boolean) event.getNewValue());
    }
    if (DatabaseViewsRepository.Index.Properties.cardinality == event.getAffectedEditor()) {
        index.setCardinality((EEFConverterUtil.createIntFromString(EcorePackage.Literals.EINT, (String) event.getNewValue())));
    }
    if (DatabaseViewsRepository.Index.Properties.indexType == event.getAffectedEditor()) {
        index.setIndexType((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (DatabaseViewsRepository.Index.Properties.comments == event.getAffectedEditor()) {
        index.setComments((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (DatabaseViewsRepository.Index.Properties.elements == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, elementsSettings, 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) {
            elementsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            elementsSettings.move(event.getNewIndex(), (IndexElement) 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) Index(org.obeonetwork.dsl.database.Index) 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) IndexElement(org.obeonetwork.dsl.database.IndexElement)

Example 63 with PropertiesEditingProvider

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

the class TableConstraintsPropertiesEditionComponent 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.Constraints.Properties.constraints_ == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, constraintsSettings, 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) {
            constraintsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            constraintsSettings.move(event.getNewIndex(), (Constraint) 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) Constraint(org.obeonetwork.dsl.database.Constraint) 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)

Example 64 with PropertiesEditingProvider

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

the class TableIndexesPropertiesEditionComponent 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.Indexes.Properties.indexes_ == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, indexesSettings, 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) {
            indexesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            indexesSettings.move(event.getNewIndex(), (Index) 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) Index(org.obeonetwork.dsl.database.Index) 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 65 with PropertiesEditingProvider

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

the class TableTablePropertiesEditionComponent 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.Table.Properties.name == event.getAffectedEditor()) {
        table.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (DatabaseViewsRepository.Table.Properties.columns == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, columnsSettings, 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) {
            columnsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            columnsSettings.move(event.getNewIndex(), (Column) event.getNewValue());
        }
    }
    if (DatabaseViewsRepository.Table.Properties.comments == event.getAffectedEditor()) {
        table.setComments((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) 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) Column(org.obeonetwork.dsl.database.Column) 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

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