Search in sources :

Example 1 with BindingTreeEditor

use of org.obeonetwork.dsl.environment.binding.dialect.ui.editor.BindingTreeEditor in project InformationSystem by ObeoNetwork.

the class BindingDialectUIServices method openEditor.

@Override
public IEditorPart openEditor(Session session, DRepresentation representation, IProgressMonitor monitor) {
    if (representation instanceof DBindingEditor) {
        monitor.beginTask("Opening binding editor", 1);
        URI uri = EcoreUtil.getURI(representation);
        final TransactionalEditingDomain domain = session.getTransactionalEditingDomain();
        final IEditorInput editorInput = new SessionEditorInput(uri, getEditorName(representation), session);
        RunnableWithResult<IEditorPart> runnable = new RunnableWithResult.Impl<IEditorPart>() {

            @Override
            public void run() {
                final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                    setResult(page.openEditor(editorInput, BindingTreeEditor.ID));
                } catch (final PartInitException e) {
                // silent catch
                }
            }
        };
        PlatformUI.getWorkbench().getDisplay().syncExec(runnable);
        Object result = runnable.getResult();
        if (result instanceof IEditorPart && canHandleEditor((IEditorPart) result)) {
            // Activation of the refresh of the DBindingEditor property page
            if (result instanceof BindingTreeEditor) {
                // TODO v�rifier s'il faut enlever des choses
                doRefresh((DBindingEditor) representation, domain);
            }
            return (IEditorPart) result;
        }
        monitor.worked(1);
        monitor.done();
    }
    return null;
}
Also used : SessionEditorInput(org.eclipse.sirius.ui.business.api.session.SessionEditorInput) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) DBindingEditor(org.obeonetwork.dsl.environment.bindingdialect.DBindingEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) EObject(org.eclipse.emf.ecore.EObject) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) URI(org.eclipse.emf.common.util.URI) IEditorInput(org.eclipse.ui.IEditorInput) BindingTreeEditor(org.obeonetwork.dsl.environment.binding.dialect.ui.editor.BindingTreeEditor)

Aggregations

URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 SessionEditorInput (org.eclipse.sirius.ui.business.api.session.SessionEditorInput)1 IEditorInput (org.eclipse.ui.IEditorInput)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 PartInitException (org.eclipse.ui.PartInitException)1 BindingTreeEditor (org.obeonetwork.dsl.environment.binding.dialect.ui.editor.BindingTreeEditor)1 DBindingEditor (org.obeonetwork.dsl.environment.bindingdialect.DBindingEditor)1