Search in sources :

Example 1 with TypesDefinition

use of org.obeonetwork.dsl.environment.TypesDefinition in project InformationSystem by ObeoNetwork.

the class TypesServices method collectAllContainers.

private void collectAllContainers(Collection<? extends EObject> elements, Collection<ObeoDSMObject> containers) {
    Collection<EObject> newContainers = new ArrayList<EObject>();
    for (EObject element : elements) {
        EObject container = element.eContainer();
        if (container instanceof NamespacesContainer || container instanceof TypesDefinition) {
            if (!containers.contains(container)) {
                containers.add((ObeoDSMObject) container);
                newContainers.add((EObject) container);
            }
        }
    }
    if (!newContainers.isEmpty()) {
        collectAllContainers(newContainers, containers);
    }
}
Also used : NamespacesContainer(org.obeonetwork.dsl.environment.NamespacesContainer) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) TypesDefinition(org.obeonetwork.dsl.environment.TypesDefinition)

Example 2 with TypesDefinition

use of org.obeonetwork.dsl.environment.TypesDefinition in project InformationSystem by ObeoNetwork.

the class BindingService method getAllStructuredTypes.

private Collection<StructuredType> getAllStructuredTypes(EObject any) {
    // Collect all structured types
    Collection<StructuredType> structuredTypes = new ArrayList<StructuredType>();
    // First, get all semantic resources in session
    Collection<Resource> semanticResources = getAllSemanticResourcesInSession(any);
    for (Resource resource : semanticResources) {
        TreeIterator<EObject> iterator = EcoreUtil.getAllContents(resource, true);
        while (iterator.hasNext()) {
            EObject eObject = (EObject) iterator.next();
            if (eObject instanceof StructuredType) {
                structuredTypes.add((StructuredType) eObject);
            } else {
                if (!(eObject instanceof TypesDefinition || eObject instanceof NamespacesContainer || isOverviewRootInstance(eObject))) {
                    iterator.prune();
                }
            }
        }
    }
    return structuredTypes;
}
Also used : NamespacesContainer(org.obeonetwork.dsl.environment.NamespacesContainer) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) Resource(org.eclipse.emf.ecore.resource.Resource) StructuredType(org.obeonetwork.dsl.environment.StructuredType) TypesDefinition(org.obeonetwork.dsl.environment.TypesDefinition)

Example 3 with TypesDefinition

use of org.obeonetwork.dsl.environment.TypesDefinition in project InformationSystem by ObeoNetwork.

the class TypesDefinitionTypesDefinitionPropertiesEditionComponent method initPart.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
    setInitializing(true);
    if (editingPart != null && key == partKey) {
        editingPart.setContext(elt, allResource);
        final TypesDefinition typesDefinition = (TypesDefinition) elt;
        final TypesDefinitionPropertiesEditionPart typesDefinitionPart = (TypesDefinitionPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(EnvironmentViewsRepository.TypesDefinition.Properties.description))
            typesDefinitionPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, typesDefinition.getDescription()));
    // init filters
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : TypesDefinitionPropertiesEditionPart(org.obeonetwork.dsl.environment.parts.TypesDefinitionPropertiesEditionPart) TypesDefinition(org.obeonetwork.dsl.environment.TypesDefinition)

Aggregations

TypesDefinition (org.obeonetwork.dsl.environment.TypesDefinition)3 ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)2 NamespacesContainer (org.obeonetwork.dsl.environment.NamespacesContainer)2 Resource (org.eclipse.emf.ecore.resource.Resource)1 StructuredType (org.obeonetwork.dsl.environment.StructuredType)1 TypesDefinitionPropertiesEditionPart (org.obeonetwork.dsl.environment.parts.TypesDefinitionPropertiesEditionPart)1