Search in sources :

Example 56 with PropertiesEditingPolicy

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

the class CategoryPropertiesEditionComponent 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) {
    Category category = (Category) semanticObject;
    if (RequirementViewsRepository.Category.Category_.id == event.getAffectedEditor()) {
        category.setId((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (RequirementViewsRepository.Category.Category_.name == event.getAffectedEditor()) {
        category.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (RequirementViewsRepository.Category.Category_.requirements == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, requirementsSettings, 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) {
            requirementsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            requirementsSettings.move(event.getNewIndex(), (Requirement) event.getNewValue());
        }
    }
    if (RequirementViewsRepository.Category.Category_.subCategories == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, subCategoriesSettings, 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) {
            subCategoriesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            subCategoriesSettings.move(event.getNewIndex(), (Category) event.getNewValue());
        }
    }
}
Also used : Requirement(org.obeonetwork.dsl.requirement.Requirement) EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) Category(org.obeonetwork.dsl.requirement.Category) 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)

Example 57 with PropertiesEditingPolicy

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

the class EntityPropertiesEditionPartForm method editAssociatedTypes.

/**
 */
protected void editAssociatedTypes(EObject element) {
    EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(propertiesEditionComponent.getEditingContext(), propertiesEditionComponent, element, adapterFactory);
    PropertiesEditingProvider provider = (PropertiesEditingProvider) adapterFactory.adapt(element, PropertiesEditingProvider.class);
    if (provider != null) {
        PropertiesEditingPolicy policy = provider.getPolicy(context);
        if (policy != null) {
            policy.execute();
            associatedTypes.refresh();
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) PropertiesEditingPolicy(org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy)

Example 58 with PropertiesEditingPolicy

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

the class ViewContainerViewContainerPropertiesEditionComponent 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) {
    ViewContainer viewContainer = (ViewContainer) semanticObject;
    if (ViewViewsRepository.ViewContainer.Properties.description == event.getAffectedEditor()) {
        viewContainer.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (ViewViewsRepository.ViewContainer.Properties.name == event.getAffectedEditor()) {
        viewContainer.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (ViewViewsRepository.ViewContainer.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.ViewContainer.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.ViewContainer.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.ViewContainer.Properties.label == event.getAffectedEditor()) {
        viewContainer.setLabel((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (ViewViewsRepository.ViewContainer.Properties.ownedElements == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, ownedElementsSettings, 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) {
            ownedElementsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            ownedElementsSettings.move(event.getNewIndex(), (AbstractViewElement) event.getNewValue());
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) AbstractViewElement(org.obeonetwork.dsl.cinematic.view.AbstractViewElement) 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) ViewContainer(org.obeonetwork.dsl.cinematic.view.ViewContainer) EReferencePropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)

Example 59 with PropertiesEditingPolicy

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

the class ComplexNamedTypePropertiesEditionComponent 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) {
    ComplexNamedType complexNamedType = (ComplexNamedType) semanticObject;
    if (TypeslibraryViewsRepository.ComplexNamedType.Properties.name == event.getAffectedEditor()) {
        complexNamedType.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (TypeslibraryViewsRepository.ComplexNamedType.Properties.types == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, typesSettings, 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) {
            typesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            typesSettings.move(event.getNewIndex(), (UserDefinedType) event.getNewValue());
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) ComplexNamedType(org.obeonetwork.dsl.typeslibrary.ComplexNamedType) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) EObject(org.eclipse.emf.ecore.EObject) UserDefinedType(org.obeonetwork.dsl.typeslibrary.UserDefinedType) 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 60 with PropertiesEditingPolicy

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

the class NativeTypesLibraryPropertiesEditionComponent 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) {
    NativeTypesLibrary nativeTypesLibrary = (NativeTypesLibrary) semanticObject;
    if (TypeslibraryViewsRepository.NativeTypesLibrary.Properties.name == event.getAffectedEditor()) {
        nativeTypesLibrary.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (TypeslibraryViewsRepository.NativeTypesLibrary.Properties.nativeTypes == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, nativeTypesSettings, 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) {
            nativeTypesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            nativeTypesSettings.move(event.getNewIndex(), (NativeType) event.getNewValue());
        }
    }
}
Also used : EObjectPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext) PropertiesEditingProvider(org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider) NativeTypesLibrary(org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary) EObject(org.eclipse.emf.ecore.EObject) NativeType(org.obeonetwork.dsl.typeslibrary.NativeType) 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