Search in sources :

Example 1 with ISynchronizableRunnable

use of org.whole.lang.e4.ui.jobs.ISynchronizableRunnable in project whole by wholeplatform.

the class DerivedLinkableSelectionListener method updateViewerContents.

protected void updateViewerContents(boolean relink) {
    if (lastSelection == null)
        return;
    if (shareEditDomain && relink) {
        IEntityPartViewer toViewer = (IEntityPartViewer) lastSelection.wGetValue("viewer");
        viewer.linkEditDomain(toViewer);
        fireViewerLinked(toViewer);
    }
    if (!changeTracker.testChangedAndUpdate(lastSelection, lastSelection.wGet("self")))
        return;
    if (functionUri != null) {
        ISynchronizableRunnable runnable = new DeriveModelRunnable(context, lastSelection, LABEL, functionUri, functionIsTransactional, resultShowingPolicy) {

            @Override
            protected void updateUI(IEntity result) {
                super.updateUI(result);
                if (result != null)
                    fireContentsDerived(result);
            }
        };
        runnable.asyncExec("Executing " + LABEL + " operation...");
    } else {
        IEntity newContents = lastSelection.wGet("self");
        if (viewer.getEntityContents() != newContents)
            viewer.setContents(newContents);
    }
    if (isSynchronizeSelection() && lastSelection.wIsSet("primarySelectedEntity")) {
        IEntity selectedEntities = lastSelection.wGet("selectedEntities");
        List<IEntity> selection = new ArrayList<>();
        for (int i = 0, size = selectedEntities.wSize(); i < size; i++) selection.add(selectedEntities.wGet(i));
        viewer.selectAndReveal(selection);
    }
}
Also used : ISynchronizableRunnable(org.whole.lang.e4.ui.jobs.ISynchronizableRunnable) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) DeriveModelRunnable(org.whole.lang.e4.ui.jobs.DeriveModelRunnable) IEntityPartViewer(org.whole.lang.ui.viewers.IEntityPartViewer)

Example 2 with ISynchronizableRunnable

use of org.whole.lang.e4.ui.jobs.ISynchronizableRunnable in project whole by wholeplatform.

the class AbstractModelTextAction method run.

@Override
public void run() {
    ESelectionService selectionService = getContext().get(ESelectionService.class);
    IBindingManager bm = (IBindingManager) selectionService.getSelection();
    ISynchronizableRunnable runnable = new TextualFunctionRunnable(getContext(), bm, getText(), getBehaviorUri());
    runnable.syncExec(3000);
}
Also used : TextualFunctionRunnable(org.whole.lang.e4.ui.jobs.TextualFunctionRunnable) ISynchronizableRunnable(org.whole.lang.e4.ui.jobs.ISynchronizableRunnable) IBindingManager(org.whole.lang.bindings.IBindingManager) ESelectionService(org.eclipse.e4.ui.workbench.modeling.ESelectionService)

Example 3 with ISynchronizableRunnable

use of org.whole.lang.e4.ui.jobs.ISynchronizableRunnable in project whole by wholeplatform.

the class AbstractModelTextAction method calculateEnabled.

protected boolean calculateEnabled(IBindingManager bm) {
    IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
    if (!Tools.TEXTUAL.isActive(viewer) || !(ModelObserver.getObserver(bm.wGet("focusEntity"), viewer.getEditPartRegistry()) instanceof ITextualEntityPart))
        return false;
    IEclipseContext context = (IEclipseContext) bm.wGetValue("eclipse#eclipseContext");
    ISynchronizableRunnable runnable = new FunctionRunnable(context, bm, getText(), getEnablementUri());
    IEntity result = runnable.syncExec(3000).getResult();
    return result != null && result.wBooleanValue();
}
Also used : ISynchronizableRunnable(org.whole.lang.e4.ui.jobs.ISynchronizableRunnable) ITextualEntityPart(org.whole.lang.ui.editparts.ITextualEntityPart) IEntity(org.whole.lang.model.IEntity) IEclipseContext(org.eclipse.e4.core.contexts.IEclipseContext) FunctionRunnable(org.whole.lang.e4.ui.jobs.FunctionRunnable) TextualFunctionRunnable(org.whole.lang.e4.ui.jobs.TextualFunctionRunnable) IEntityPartViewer(org.whole.lang.ui.viewers.IEntityPartViewer)

Example 4 with ISynchronizableRunnable

use of org.whole.lang.e4.ui.jobs.ISynchronizableRunnable in project whole by wholeplatform.

the class E4SampleGraphicalPart method execute.

protected void execute() {
    if (behaviorModel == null || selfBindings == null)
        return;
    else {
        ISynchronizableRunnable runnable = new ExecuteSampleModelRunnable(context, behaviorLabel, contextModel, selfBindings, selfModel, bm, behaviorModel);
        runnable.asyncExec("Executing " + behaviorLabel + " operation...");
    }
}
Also used : ISynchronizableRunnable(org.whole.lang.e4.ui.jobs.ISynchronizableRunnable) ExecuteSampleModelRunnable(org.whole.lang.e4.ui.jobs.ExecuteSampleModelRunnable)

Aggregations

ISynchronizableRunnable (org.whole.lang.e4.ui.jobs.ISynchronizableRunnable)4 TextualFunctionRunnable (org.whole.lang.e4.ui.jobs.TextualFunctionRunnable)2 IEntity (org.whole.lang.model.IEntity)2 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)2 ArrayList (java.util.ArrayList)1 IEclipseContext (org.eclipse.e4.core.contexts.IEclipseContext)1 ESelectionService (org.eclipse.e4.ui.workbench.modeling.ESelectionService)1 IBindingManager (org.whole.lang.bindings.IBindingManager)1 DeriveModelRunnable (org.whole.lang.e4.ui.jobs.DeriveModelRunnable)1 ExecuteSampleModelRunnable (org.whole.lang.e4.ui.jobs.ExecuteSampleModelRunnable)1 FunctionRunnable (org.whole.lang.e4.ui.jobs.FunctionRunnable)1 ITextualEntityPart (org.whole.lang.ui.editparts.ITextualEntityPart)1