Search in sources :

Example 1 with IEditingSession

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

the class BindingTreeEditor method init.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
 */
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    setSite(site);
    setInput(input);
    if (input instanceof SessionEditorInput) {
        final URI uri = ((SessionEditorInput) input).getURI();
        this.session = ((SessionEditorInput) input).getSession();
        setBindingEditorRepresentation(getBindingEditorRepresentation(uri, false));
    }
    if (session != null) {
        session.addListener(this);
    }
    final IEditingSession uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(this.session);
    uiSession.open();
    uiSession.attachEditor(this);
    setAccessor(SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(getBindingEditorRepresentation()));
    /*
		 * let's activate the model listening
		 */
    // final DTreeElementSynchronizer sync = new DTreeElementSynchronizerSpec(accessor, getInterpreter());
    // getTreeModel().activate(sync);
    /* Update title. Semantic tree could have been renamed */
    notify(PROP_TITLE);
}
Also used : SessionEditorInput(org.eclipse.sirius.ui.business.api.session.SessionEditorInput) IEditingSession(org.eclipse.sirius.ui.business.api.session.IEditingSession) URI(org.eclipse.emf.common.util.URI)

Example 2 with IEditingSession

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

the class BusinessProjectImporter method shouldSaveAndCloseEditorsOnTargetProject.

public boolean shouldSaveAndCloseEditorsOnTargetProject() {
    Session session = getTargetProject().getSession();
    if (session == null) {
        return false;
    }
    if (SessionStatus.DIRTY.equals(session.getStatus())) {
        return true;
    }
    IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
    if (uiSession != null) {
        return !uiSession.getEditors().isEmpty();
    }
    return false;
}
Also used : 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)

Example 3 with IEditingSession

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

the class DeleteInteractionHandler method closeEditor.

private void closeEditor(Session session, DRepresentation representation) {
    IEditingSession editingSession = SessionUIManager.INSTANCE.getUISession(session);
    if (editingSession != null) {
        DialectEditor editor = editingSession.getEditor(representation);
        if (editor != null) {
            DialectUIManager.INSTANCE.closeEditor(editor, false);
            editingSession.detachEditor(editor);
        }
    }
    return;
}
Also used : DialectEditor(org.eclipse.sirius.ui.business.api.dialect.DialectEditor) IEditingSession(org.eclipse.sirius.ui.business.api.session.IEditingSession)

Example 4 with IEditingSession

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

the class DeleteStateMachineHandler method closeEditor.

private void closeEditor(Session session, DRepresentation representation) {
    IEditingSession editingSession = SessionUIManager.INSTANCE.getUISession(session);
    if (editingSession != null) {
        DialectEditor editor = editingSession.getEditor(representation);
        if (editor != null) {
            DialectUIManager.INSTANCE.closeEditor(editor, false);
            editingSession.detachEditor(editor);
        }
    }
    return;
}
Also used : DialectEditor(org.eclipse.sirius.ui.business.api.dialect.DialectEditor) IEditingSession(org.eclipse.sirius.ui.business.api.session.IEditingSession)

Example 5 with IEditingSession

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

the class Activator method refreshDecorationsOnSession.

private void refreshDecorationsOnSession(final Session session, boolean forceRefresh) {
    if (!forceRefresh) {
        // Fail fast the decoration is disabled
        if (!ObjectWithRequirement.isDecoratorEnabled()) {
            return;
        }
    }
    IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
    // We look for open diagram editors to refresh the diagrams
    if (uiSession != null) {
        Collection<ISiriusEditor> editors = uiSession.getSiriusEditors();
        for (ISiriusEditor siriusEditor : editors) {
            if (siriusEditor instanceof DDiagramEditor) {
                DDiagramEditor diagramEditor = (DDiagramEditor) siriusEditor;
                DRepresentation representation = diagramEditor.getRepresentation();
                if (representation instanceof DSemanticDiagram) {
                    DSemanticDiagram diagram = (DSemanticDiagram) representation;
                    refreshDecorationsOnDiagram(diagram, session);
                }
            }
        }
    }
}
Also used : DDiagramEditor(org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor) DSemanticDiagram(org.eclipse.sirius.diagram.DSemanticDiagram) IEditingSession(org.eclipse.sirius.ui.business.api.session.IEditingSession) ISiriusEditor(org.eclipse.sirius.ui.business.api.editor.ISiriusEditor) DRepresentation(org.eclipse.sirius.viewpoint.DRepresentation)

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