Search in sources :

Example 1 with TypesLibraryUser

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

the class TestIsLogical method test.

@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if (receiver instanceof StructuredSelection) {
        StructuredSelection selection = (StructuredSelection) receiver;
        if (selection.size() == 1) {
            Object element = selection.getFirstElement();
            Resource resource = (element instanceof Resource) ? ((Resource) element) : getResourceFromSession(getModelURI(element));
            if (resource != null) {
                if (resource.getContents() != null && resource.getContents().isEmpty() == false) {
                    EObject root = resource.getContents().get(0);
                    if (root instanceof TypesLibraryUser) {
                        return ScaffoldingUtils.isValidInputForMld(root);
                    }
                }
            }
        }
    }
    return false;
}
Also used : TypesLibraryUser(org.obeonetwork.dsl.typeslibrary.TypesLibraryUser) DAnalysisSessionEObject(org.eclipse.sirius.viewpoint.DAnalysisSessionEObject) EObject(org.eclipse.emf.ecore.EObject) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Resource(org.eclipse.emf.ecore.resource.Resource) DAnalysisSessionEObject(org.eclipse.sirius.viewpoint.DAnalysisSessionEObject) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with TypesLibraryUser

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

the class TypesServices method getPhysicalTypesLibrary.

public TypesLibrary getPhysicalTypesLibrary(DatabaseElement element) {
    TypesLibraryUser tlu = getTypesLibraryUser(element);
    TypesLibrary physicalTypesLibrary = getTargetPhysicalTypesLibrary(tlu);
    return physicalTypesLibrary;
}
Also used : TypesLibraryUser(org.obeonetwork.dsl.typeslibrary.TypesLibraryUser) TypesLibrary(org.obeonetwork.dsl.typeslibrary.TypesLibrary)

Example 3 with TypesLibraryUser

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

TypesLibraryUser (org.obeonetwork.dsl.typeslibrary.TypesLibraryUser)3 EObject (org.eclipse.emf.ecore.EObject)2 TypesLibrary (org.obeonetwork.dsl.typeslibrary.TypesLibrary)2 ArrayList (java.util.ArrayList)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 DAnalysisSessionEObject (org.eclipse.sirius.viewpoint.DAnalysisSessionEObject)1 NativeTypesLibrary (org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary)1