use of org.eclipse.e4.ui.di.UISynchronize in project whole by wholeplatform.
the class DeriveModelRunnable method run.
@Override
public void run(IOperationProgressMonitor pm) throws InvocationTargetException, InterruptedException {
pm.beginTask("Deriving...", IOperationProgressMonitor.TOTAL_WORK);
try {
bm.wEnterScope();
bm.wDefValue("debug#reportModeEnabled", false);
final IEntity result = BehaviorUtils.apply(functionUri, bm.wGet("self"), bm);
UISynchronize synchronize = context.get(UISynchronize.class);
if (synchronize == null)
return;
synchronize.asyncExec(new Runnable() {
public void run() {
updateUI(result);
}
});
} catch (OperationCanceledException e) {
// gracefully terminate execution
} finally {
bm.wExitScope();
pm.endTask();
}
}
use of org.eclipse.e4.ui.di.UISynchronize in project whole by wholeplatform.
the class SelectNotationHandler method execute.
@Execute
public void execute(@Optional @Named(EDITORKIT_ID_PARAMETER_ID) String editorKitId, @Named(IServiceConstants.ACTIVE_SELECTION) IBindingManager bm, final IEntityPartViewer viewer, UISynchronize synchronize) {
IEditorKit editorKit = ReflectionFactory.getEditorKit(editorKitId);
final IEntity focusEntity = bm.wGet("focusEntity");
focusEntity.wGetModel().setEditorKit(editorKit);
ModelTransactionCommand command = new ModelTransactionCommand(focusEntity);
try {
command.begin();
IEntity fragmentRoot = EntityUtils.getLanguageFragmentRoot(focusEntity);
viewer.rebuildNotation(fragmentRoot);
command.commit();
if (command.canUndo())
viewer.getEditDomain().getCommandStack().execute(command);
} catch (Exception e) {
command.rollbackIfNeeded();
}
synchronize.asyncExec(new Runnable() {
public void run() {
viewer.selectAndReveal(focusEntity);
}
});
}
use of org.eclipse.e4.ui.di.UISynchronize 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.eclipse.e4.ui.di.UISynchronize in project whole by wholeplatform.
the class ModelMergeViewer method fireDirtyState.
protected void fireDirtyState(boolean state) {
final PropertyChangeEvent event = new PropertyChangeEvent(this, CompareEditorInput.DIRTY_STATE, false, state);
if (listenerList == null || listenerList.isEmpty())
return;
Runnable runnable = new Runnable() {
public void run() {
for (IPropertyChangeListener listener : listenerList) {
final IPropertyChangeListener propertyChangeListener = listener;
SafeRunner.run(new ISafeRunnable() {
public void run() throws Exception {
propertyChangeListener.propertyChange(event);
}
public void handleException(Throwable exception) {
}
});
}
}
};
UISynchronize uiSynchronize = getContext().get(UISynchronize.class);
if (uiSynchronize != null)
uiSynchronize.syncExec(runnable);
else
runnable.run();
}
use of org.eclipse.e4.ui.di.UISynchronize in project whole by wholeplatform.
the class ValidateModelRunnable method run.
@Override
public void run(IOperationProgressMonitor pm) throws InvocationTargetException, InterruptedException {
pm.beginTask("Validating...", IOperationProgressMonitor.TOTAL_WORK);
try {
UISynchronize synchronize = context.get(UISynchronize.class);
bm.wDefValue("decorationManager", new E4UIDecorationManager(synchronize, bm));
HandlersBehavior.validateModel(bm);
if (MarkerUtils.findMarkers((IResource) bm.wGetValue("file"), true).length > 0)
E4Utils.revealPart(context, "org.eclipse.ui.views.ProblemView");
} catch (OperationCanceledException e) {
// gracefully terminate execution
} finally {
pm.endTask();
}
}
Aggregations