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