Search in sources :

Example 6 with IEditingSession

use of org.eclipse.sirius.ui.business.api.session.IEditingSession in project InformationSystem by ObeoNetwork.

the class BusinessProjectImporter method saveAndCloseEditorsOnTargetProject.

private void saveAndCloseEditorsOnTargetProject(IProgressMonitor parentMonitor) throws CoreException {
    SubMonitor monitor = SubMonitor.convert(parentMonitor, 3);
    if (shouldSaveAndCloseEditorsOnTargetProject()) {
        // Save session if needed
        Session session = ImporterUtil.getSession(getTargetProject());
        if (session.getStatus().equals(SessionStatus.DIRTY)) {
            session.save(monitor.newChild(1));
        }
        // Close diagrams
        IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
        if (uiSession != null) {
            Collection<DialectEditor> editors = uiSession.getEditors();
            if (!editors.isEmpty()) {
                uiSession.closeEditors(true, editors);
            }
        }
    }
}
Also used : DialectEditor(org.eclipse.sirius.ui.business.api.dialect.DialectEditor) SubMonitor(org.eclipse.core.runtime.SubMonitor) IEditingSession(org.eclipse.sirius.ui.business.api.session.IEditingSession) UserSession(org.eclipse.sirius.ui.business.api.session.UserSession) Session(org.eclipse.sirius.business.api.session.Session) IEditingSession(org.eclipse.sirius.ui.business.api.session.IEditingSession)

Aggregations

IEditingSession (org.eclipse.sirius.ui.business.api.session.IEditingSession)6 DialectEditor (org.eclipse.sirius.ui.business.api.dialect.DialectEditor)3 Session (org.eclipse.sirius.business.api.session.Session)2 UserSession (org.eclipse.sirius.ui.business.api.session.UserSession)2 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 URI (org.eclipse.emf.common.util.URI)1 DSemanticDiagram (org.eclipse.sirius.diagram.DSemanticDiagram)1 DDiagramEditor (org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor)1 ISiriusEditor (org.eclipse.sirius.ui.business.api.editor.ISiriusEditor)1 SessionEditorInput (org.eclipse.sirius.ui.business.api.session.SessionEditorInput)1 DRepresentation (org.eclipse.sirius.viewpoint.DRepresentation)1