Search in sources :

Example 11 with Repository

use of org.obeonetwork.dsl.requirement.Repository in project InformationSystem by ObeoNetwork.

the class RepositoryPropertiesEditionComponent 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) {
    Repository repository = (Repository) semanticObject;
    if (RequirementViewsRepository.Repository.Repository_.name == event.getAffectedEditor()) {
        repository.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (RequirementViewsRepository.Repository.Repository_.mainCategories == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, mainCategoriesSettings, 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) {
            mainCategoriesSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            mainCategoriesSettings.move(event.getNewIndex(), (Category) event.getNewValue());
        }
    }
    if (RequirementViewsRepository.Repository.Repository_.referencedObject == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET)
            referencedObjectSettings.setToReference((List<EObject>) event.getNewValue());
    }
}
Also used : Repository(org.obeonetwork.dsl.requirement.Repository) RequirementViewsRepository(org.obeonetwork.dsl.requirement.parts.RequirementViewsRepository) 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) List(java.util.List) 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

Repository (org.obeonetwork.dsl.requirement.Repository)11 EObject (org.eclipse.emf.ecore.EObject)9 Category (org.obeonetwork.dsl.requirement.Category)7 Resource (org.eclipse.emf.ecore.resource.Resource)6 ArrayList (java.util.ArrayList)5 Requirement (org.obeonetwork.dsl.requirement.Requirement)5 List (java.util.List)4 LinkedList (java.util.LinkedList)2 RequirementViewsRepository (org.obeonetwork.dsl.requirement.parts.RequirementViewsRepository)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 AdapterFactory (org.eclipse.emf.common.notify.AdapterFactory)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)1 XMLResourceImpl (org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl)1 EObjectPropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext)1 EReferencePropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)1 EObjectStrictFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter)1