use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class RevertHandler method execute.
@Execute
public void execute(EPartService partService, IModelInput modelInput, @Named(IServiceConstants.ACTIVE_SELECTION) IBindingManager bm) {
if (E4Utils.isLegacyApplication()) {
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
viewer.setContents((IModelInput) bm.wGetValue("modelInput"), null);
} else {
AbstractE4Part part = (AbstractE4Part) partService.getActivePart().getObject();
part.getViewer().setContents(modelInput, null);
}
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class AbstractRunnableWithProgress method asyncExec.
public void asyncExec(String message) {
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
EntityEditDomain editDomain = viewer.getEditDomain();
if (isTransactional())
editDomain.setDisabled(true);
EntityEditDomainJob.asyncExec(message, editDomain, this);
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class AbstractRunnableWithProgress method run.
@Override
public void run(IProgressMonitor monitor) {
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
try {
final IOperationProgressMonitor pm = new OperationProgressMonitorAdapter(monitor);
bm.wDefValue("progressMonitor", pm);
run(pm);
} catch (Exception e) {
E4Utils.suspendOrReportException(context, SuspensionKind.ERROR, "Model operation error", "Error while executing " + label + " operation", e, bm);
} finally {
monitor.done();
if (isTransactional())
context.get(UISynchronize.class).syncExec(() -> viewer.getEditDomain().setDisabled(false));
}
return;
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class AbstractRunnableWithProgress method syncExec.
public synchronized IBindingScope syncExec(long timeout) {
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
EntityEditDomain editDomain = viewer.getEditDomain();
UISynchronize uiSynchronize = context.get(UISynchronize.class);
try {
context.set(UISynchronize.class, NoUISynchronize.instance);
EntityEditDomainJob.syncExec("boh", editDomain, this);
} finally {
context.set(UISynchronize.class, uiSynchronize);
}
return bm;
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class FunctionRunnable method run.
@Override
public void run(IOperationProgressMonitor pm) throws InvocationTargetException, InterruptedException {
// FIXME workaround for missing caret update events (no selection update is performed)
E4Utils.defineCaretBindings(bm);
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
CommandStack commandStack = viewer.getEditDomain().getCommandStack();
ModelTransactionCommand mtc = new ModelTransactionCommand(bm.wGet("self"), label);
IEntity result = null;
pm.beginTask("Executing function " + functionUri + "...", IOperationProgressMonitor.TOTAL_WORK);
try {
mtc.begin();
result = BehaviorUtils.apply(functionUri, bm.wGet("self"), bm);
mtc.commit();
if (mtc.canUndo())
commandStack.execute(mtc);
} catch (OperationCanceledException e) {
mtc.rollbackIfNeeded();
} catch (RuntimeException e) {
mtc.rollbackIfNeeded();
throw e;
} finally {
bm.setResult(result);
pm.endTask();
}
}
Aggregations