]> git.argeo.org Git - lgpl/argeo-commons.git/blob - ui/jcr/AsyncUiEventListener.java
Prepare next development cycle
[lgpl/argeo-commons.git] / ui / jcr / AsyncUiEventListener.java
1 package org.argeo.eclipse.ui.jcr;
2
3 import javax.jcr.observation.EventIterator;
4 import javax.jcr.observation.EventListener;
5
6 import org.eclipse.ui.PlatformUI;
7
8 /** {@link EventListener} which simplifies running actions within the UI thread. */
9 public abstract class AsyncUiEventListener implements EventListener {
10 /** Called asynchronously in the UI thread. */
11 protected abstract void onEventInUiThread(EventIterator events);
12
13 public void onEvent(final EventIterator events) {
14 PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
15 public void run() {
16 onEventInUiThread(events);
17 }
18 });
19 }
20 }