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;
}
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;
}
Aggregations