Search in sources :

Example 1 with DeriveModelRunnable

use of org.whole.lang.e4.ui.jobs.DeriveModelRunnable 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)

Aggregations

ArrayList (java.util.ArrayList)1 DeriveModelRunnable (org.whole.lang.e4.ui.jobs.DeriveModelRunnable)1 ISynchronizableRunnable (org.whole.lang.e4.ui.jobs.ISynchronizableRunnable)1 IEntity (org.whole.lang.model.IEntity)1 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)1