capint
2/16/2016 - 1:52 PM

EMF >> Access model in transaction

EMF >> Access model in transaction

//*** RunnableWithResult is an EMF Runnable to allow to return a result
RunnableWithResult<Image> run = new RunnableWithResult.Impl<Image>() {
			public void run() {
				setResult(CapellaTransactionalAdapterFactoryLabelProvider.super.getColumnImage(object, columnIndex));
			}};

//*** runExclusive is an EMF Transaction utility method for executing exclusive runnable
try {
  TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);
  if (null == editingDomain) {
  	run.run();
  	return run.getResult();
  }
  return TransactionUtil.runExclusive(editingDomain, run);
} catch (InterruptedException e) {
}