Search in sources :

Example 16 with ObeoDSMObject

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

the class LabelProvider method getNameFeatureValue.

public static String getNameFeatureValue(ObeoDSMObject dsmObject) {
    EStructuralFeature nameFeature = dsmObject.eClass().getEStructuralFeature("name");
    Object nameValue = dsmObject.eGet(nameFeature);
    if (nameValue != null && nameValue instanceof String) {
        return (String) nameValue;
    }
    return null;
}
Also used : EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject)

Example 17 with ObeoDSMObject

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

the class DocumentationLinkType method loadLinks.

/**
 * {@inheritDoc}
 * @see org.obeonetwork.tools.linker.LinkType#loadLinks(org.eclipse.emf.ecore.EObject)
 */
public List<EObjectLink> loadLinks(EObject source) {
    if (source instanceof ObeoDSMObject) {
        ObeoDSMObject element = (ObeoDSMObject) source;
        MetaDataContainer metadatas = element.getMetadatas();
        if (metadatas != null) {
            List<EObjectLink> result = new ArrayList<EObjectLink>();
            for (MetaData metadata : metadatas.getMetadatas()) {
                if (metadata instanceof Annotation) {
                    Annotation annotation = (Annotation) metadata;
                    if (annotation.getTitle() != null && annotation.getTitle().startsWith(DocumentationLink.DOCUMENTATION_ANNOTATION_TITLE)) {
                        DocumentationLink link = new DocumentationLinkImpl(annotation);
                        result.add(link);
                    }
                }
            }
            return result;
        }
    }
    return Collections.emptyList();
}
Also used : MetaData(org.obeonetwork.dsl.environment.MetaData) DocumentationLink(org.obeonetwork.tools.doc.core.DocumentationLink) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject) EObjectLink(org.obeonetwork.tools.linker.EObjectLink) ArrayList(java.util.ArrayList) MetaDataContainer(org.obeonetwork.dsl.environment.MetaDataContainer) Annotation(org.obeonetwork.dsl.environment.Annotation)

Example 18 with ObeoDSMObject

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

the class VersionPropertiesEditionComponent 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 ObeoDSMObject obeoDSMObject = (ObeoDSMObject) elt;
        final VersionPropertiesEditionPart versionPart = (VersionPropertiesEditionPart) editingPart;
        if (isAccessible(GraalextensionsViewsRepository.Version.Properties.version_)) {
            versionPart.setVersion(obeoDSMObject.getVersion());
        }
        if (isAccessible(GraalextensionsViewsRepository.Version.Properties.createdOn))
            versionPart.setCreatedOn(EEFConverterUtil.convertToString(EcorePackage.Literals.EDATE, obeoDSMObject.getCreatedOn()));
        if (isAccessible(GraalextensionsViewsRepository.Version.Properties.modifiedOn))
            versionPart.setModifiedOn(EEFConverterUtil.convertToString(EcorePackage.Literals.EDATE, obeoDSMObject.getModifiedOn()));
        // init filters
        // Start of user code  for version filter update
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (obeoDSMObject.getModifiedOn() != null && isAccessible(GraalextensionsViewsRepository.Version.Properties.modifiedOn))
            versionPart.setModifiedOn(simpleDateFormat.format(obeoDSMObject.getModifiedOn()));
        if (obeoDSMObject.getCreatedOn() != null && isAccessible(GraalextensionsViewsRepository.Version.Properties.createdOn))
            versionPart.setCreatedOn(simpleDateFormat.format(obeoDSMObject.getCreatedOn()));
    // End of user code
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : VersionPropertiesEditionPart(fr.gouv.mindef.safran.graalextensions.parts.VersionPropertiesEditionPart) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject) SimpleDateFormat(java.text.SimpleDateFormat)

Example 19 with ObeoDSMObject

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

the class TypesServices method getAllStructuredTypes.

public Collection<StructuredType> getAllStructuredTypes(EObject context, String typeName) {
    Collection<StructuredType> types = new ArrayList<StructuredType>();
    Collection<Resource> resources = ModelServices.getAllResources(context);
    for (Resource resource : resources) {
        for (EObject object : resource.getContents()) {
            if (object instanceof ObeoDSMObject) {
                types.addAll(internalGetAllChildrenStructuredTypes((ObeoDSMObject) object, typeName));
            }
        }
    }
    return types;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject) ArrayList(java.util.ArrayList) Resource(org.eclipse.emf.ecore.resource.Resource) StructuredType(org.obeonetwork.dsl.environment.StructuredType)

Example 20 with ObeoDSMObject

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

the class InteractionModelWizard method createInitialModel.

/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
protected EObject createInitialModel() {
    EClass eClass = (EClass) interactionPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
    EObject rootObject = interactionFactory.create(eClass);
    if (rootObject instanceof ObeoDSMObject) {
        ((ObeoDSMObject) rootObject).setCreatedOn(new Date());
    }
    return rootObject;
}
Also used : EClass(org.eclipse.emf.ecore.EClass) EObject(org.eclipse.emf.ecore.EObject) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject) Date(java.util.Date)

Aggregations

ObeoDSMObject (org.obeonetwork.dsl.environment.ObeoDSMObject)20 EObject (org.eclipse.emf.ecore.EObject)10 ArrayList (java.util.ArrayList)7 Behaviour (org.obeonetwork.dsl.environment.Behaviour)4 Risk (fr.gouv.mindef.safran.graalextensions.Risk)3 Date (java.util.Date)3 EClass (org.eclipse.emf.ecore.EClass)3 MetaData (org.obeonetwork.dsl.environment.MetaData)3 MetaDataContainer (org.obeonetwork.dsl.environment.MetaDataContainer)3 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 AdapterFactory (org.eclipse.emf.common.notify.AdapterFactory)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 ComposedAdapterFactory (org.eclipse.emf.edit.provider.ComposedAdapterFactory)2 Viewer (org.eclipse.jface.viewers.Viewer)2 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)2 Session (org.eclipse.sirius.business.api.session.Session)2 IPermissionAuthority (org.eclipse.sirius.ecore.extender.business.api.permission.IPermissionAuthority)2 LockStatus (org.eclipse.sirius.ecore.extender.business.api.permission.LockStatus)2 Shell (org.eclipse.swt.widgets.Shell)2