Search in sources :

Example 6 with NativeTypesLibrary

use of org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary 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)

Example 7 with NativeTypesLibrary

use of org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary in project InformationSystem by ObeoNetwork.

the class TypeInstanceItemProvider method getUsedNativeTypesLibraries.

protected Collection<NativeTypesLibrary> getUsedNativeTypesLibraries(Object object) {
    final Collection<NativeTypesLibrary> nativeTypesLibraries = new ArrayList<NativeTypesLibrary>();
    if (object instanceof EObject) {
        EObject eObject = (EObject) object;
        final TypesLibraryUser user = getTypesLibraryUserFromParents(eObject);
        if (user != null && user.getUsedLibraries().isEmpty() == false) {
            for (TypesLibrary library : user.getUsedLibraries()) {
                if (library instanceof NativeTypesLibrary) {
                    nativeTypesLibraries.add((NativeTypesLibrary) library);
                }
            }
        }
    }
    return nativeTypesLibraries;
}
Also used : TypesLibraryUser(org.obeonetwork.dsl.typeslibrary.TypesLibraryUser) NativeTypesLibrary(org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) NativeTypesLibrary(org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary) TypesLibrary(org.obeonetwork.dsl.typeslibrary.TypesLibrary)

Aggregations

NativeTypesLibrary (org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary)7 EObject (org.eclipse.emf.ecore.EObject)3 NativeType (org.obeonetwork.dsl.typeslibrary.NativeType)3 TypesLibrary (org.obeonetwork.dsl.typeslibrary.TypesLibrary)3 ArrayList (java.util.ArrayList)2 DataBase (org.obeonetwork.dsl.database.DataBase)2 File (java.io.File)1 Timestamp (java.sql.Timestamp)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 URI (org.eclipse.emf.common.util.URI)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 EObjectPropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext)1 EReferencePropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext)1 PropertiesEditingPolicy (org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy)1 CreateEditingPolicy (org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy)1 PropertiesEditingProvider (org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider)1 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)1 Viewer (org.eclipse.jface.viewers.Viewer)1