Search in sources :

Example 6 with DAnalysis

use of org.eclipse.sirius.viewpoint.DAnalysis in project InformationSystem by ObeoNetwork.

the class ManifestServices method createImportExportData.

public MImportExportData createImportExportData(final Session session) {
    MImportExportData data = ManifestFactory.eINSTANCE.createMImportExportData();
    final DAnalysis mainAnalysis = getMainAnalysis(session);
    if (mainAnalysis != null) {
        executeInRecordingCommand(session, () -> {
            FeatureExtensionsManager.INSTANCE.saveFeatureExtensionData(ManifestFeatureExtension.FEATURE_EXTENSION_NAME, session, mainAnalysis, data);
        });
    }
    return data;
}
Also used : MImportExportData(org.obeonetwork.dsl.manifest.MImportExportData) DAnalysis(org.eclipse.sirius.viewpoint.DAnalysis)

Example 7 with DAnalysis

use of org.eclipse.sirius.viewpoint.DAnalysis in project InformationSystem by ObeoNetwork.

the class UIConfigurationServices method getSessionFromAnalysis.

/**
 * Retrieves the session corresponding to the specified viewpoint analysis
 * @param analysis Viewpoint analysis
 * @return Viewpoint session or null if no corresponding session has been found
 */
private static Session getSessionFromAnalysis(DAnalysis analysis) {
    // Retrieve the session using EObjectQuery
    EObjectQuery query = new EObjectQuery(analysis);
    Session existingSession = query.getSession();
    if (existingSession != null) {
        return existingSession;
    }
    // If it did not work, let's inspect the existing sessions
    for (Session session : SessionManager.INSTANCE.getSessions()) {
        if (session instanceof DAnalysisSessionEObject) {
            DAnalysisSessionEObject analysisSession = (DAnalysisSessionEObject) session;
            for (DAnalysis sessionAnalysis : analysisSession.getAnalyses()) {
                if (EcoreUtil.equals(analysis, sessionAnalysis)) {
                    return session;
                }
            }
        }
    }
    return null;
}
Also used : EObjectQuery(org.eclipse.sirius.business.api.query.EObjectQuery) DAnalysisSessionEObject(org.eclipse.sirius.viewpoint.DAnalysisSessionEObject) DAnalysis(org.eclipse.sirius.viewpoint.DAnalysis) Session(org.eclipse.sirius.business.api.session.Session)

Aggregations

DAnalysis (org.eclipse.sirius.viewpoint.DAnalysis)7 EObject (org.eclipse.emf.ecore.EObject)3 Session (org.eclipse.sirius.business.api.session.Session)3 EObjectQuery (org.eclipse.sirius.business.api.query.EObjectQuery)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 URI (org.eclipse.emf.common.util.URI)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 ViewpointQuery (org.eclipse.sirius.business.api.query.ViewpointQuery)1 ViewpointSelector (org.eclipse.sirius.business.api.session.ViewpointSelector)1 DAnalysisSession (org.eclipse.sirius.business.api.session.danalysis.DAnalysisSession)1 DTable (org.eclipse.sirius.table.metamodel.table.DTable)1 DTree (org.eclipse.sirius.tree.DTree)1 IEditingSession (org.eclipse.sirius.ui.business.api.session.IEditingSession)1 DAnalysisSessionEObject (org.eclipse.sirius.viewpoint.DAnalysisSessionEObject)1 DSemanticDecorator (org.eclipse.sirius.viewpoint.DSemanticDecorator)1 DView (org.eclipse.sirius.viewpoint.DView)1 Viewpoint (org.eclipse.sirius.viewpoint.description.Viewpoint)1 MImportExportData (org.obeonetwork.dsl.manifest.MImportExportData)1