Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2008-09-23 16:49:35 -0400
committerkmoore2008-09-23 16:49:35 -0400
commit0b1d125200a865b61f1dcc61e688ae30d61b7367 (patch)
treea4867ff9f0c4b8f0c7cfdcbeeedbe7e440346f80
parentaa785f0167b03dd7180ba9c78c45bc93ec581fc3 (diff)
downloadwebtools.dali-0b1d125200a865b61f1dcc61e688ae30d61b7367.tar.gz
webtools.dali-0b1d125200a865b61f1dcc61e688ae30d61b7367.tar.xz
webtools.dali-0b1d125200a865b61f1dcc61e688ae30d61b7367.zip
reversing patch from bug 232336 until we fix the problems it has uncovered
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTListChangeListenerWrapper.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTStateChangeListenerWrapper.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTTreeChangeListenerWrapper.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java26
10 files changed, 180 insertions, 52 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java
index 6b9b1b1558..c17e6c6bf7 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java
@@ -16,8 +16,6 @@ import org.eclipse.swt.widgets.Display;
/**
* Wrap another collection change listener and forward events to it on the SWT
* UI thread.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class SWTCollectionChangeListenerWrapper
implements CollectionChangeListener
@@ -33,19 +31,35 @@ public class SWTCollectionChangeListenerWrapper
}
public void itemsAdded(CollectionChangeEvent event) {
- this.executeOnUIThread(this.buildItemsAddedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.itemsAdded_(event);
+ } else {
+ this.executeOnUIThread(this.buildItemsAddedRunnable(event));
+ }
}
public void itemsRemoved(CollectionChangeEvent event) {
- this.executeOnUIThread(this.buildItemsRemovedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.itemsRemoved_(event);
+ } else {
+ this.executeOnUIThread(this.buildItemsRemovedRunnable(event));
+ }
}
public void collectionCleared(CollectionChangeEvent event) {
- this.executeOnUIThread(this.buildCollectionClearedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.collectionCleared_(event);
+ } else {
+ this.executeOnUIThread(this.buildCollectionClearedRunnable(event));
+ }
}
public void collectionChanged(CollectionChangeEvent event) {
- this.executeOnUIThread(this.buildCollectionChangedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.collectionChanged_(event);
+ } else {
+ this.executeOnUIThread(this.buildCollectionChangedRunnable(event));
+ }
}
private Runnable buildItemsAddedRunnable(final CollectionChangeEvent event) {
@@ -96,6 +110,10 @@ public class SWTCollectionChangeListenerWrapper
};
}
+ private boolean isExecutingUIThread() {
+ return Display.getCurrent() != null;
+ }
+
/**
* Display#asyncExec(Runnable) seems to work OK;
* but using #syncExec(Runnable) can somtimes make things
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTListChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTListChangeListenerWrapper.java
index 16e51c73b1..a9215f96d7 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTListChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTListChangeListenerWrapper.java
@@ -16,8 +16,6 @@ import org.eclipse.swt.widgets.Display;
/**
* Wrap another list change listener and forward events to it on the SWT
* UI thread.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class SWTListChangeListenerWrapper
implements ListChangeListener
@@ -33,27 +31,51 @@ public class SWTListChangeListenerWrapper
}
public void itemsAdded(ListChangeEvent event) {
- this.executeOnUIThread(this.buildItemsAddedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.itemsAdded_(event);
+ } else {
+ this.executeOnUIThread(this.buildItemsAddedRunnable(event));
+ }
}
public void itemsRemoved(ListChangeEvent event) {
- this.executeOnUIThread(this.buildItemsRemovedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.itemsRemoved_(event);
+ } else {
+ this.executeOnUIThread(this.buildItemsRemovedRunnable(event));
+ }
}
public void itemsMoved(ListChangeEvent event) {
- this.executeOnUIThread(this.buildItemsMovedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.itemsMoved_(event);
+ } else {
+ this.executeOnUIThread(this.buildItemsMovedRunnable(event));
+ }
}
public void itemsReplaced(ListChangeEvent event) {
- this.executeOnUIThread(this.buildItemsReplacedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.itemsReplaced_(event);
+ } else {
+ this.executeOnUIThread(this.buildItemsReplacedRunnable(event));
+ }
}
public void listCleared(ListChangeEvent event) {
- this.executeOnUIThread(this.buildCollectionClearedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.listCleared_(event);
+ } else {
+ this.executeOnUIThread(this.buildCollectionClearedRunnable(event));
+ }
}
public void listChanged(ListChangeEvent event) {
- this.executeOnUIThread(this.buildCollectionChangedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.listChanged_(event);
+ } else {
+ this.executeOnUIThread(this.buildCollectionChangedRunnable(event));
+ }
}
private Runnable buildItemsAddedRunnable(final ListChangeEvent event) {
@@ -128,6 +150,10 @@ public class SWTListChangeListenerWrapper
};
}
+ private boolean isExecutingUIThread() {
+ return Display.getCurrent() != null;
+ }
+
/**
* Display#asyncExec(Runnable) seems to work OK;
* but using #syncExec(Runnable) can somtimes make things
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java
index 58fc3b3c66..7db9ea70ec 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java
@@ -16,8 +16,6 @@ import org.eclipse.swt.widgets.Display;
/**
* Wrap another property change listener and forward events to it on the SWT
* UI thread.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class SWTPropertyChangeListenerWrapper
implements PropertyChangeListener
@@ -33,7 +31,11 @@ public class SWTPropertyChangeListenerWrapper
}
public void propertyChanged(PropertyChangeEvent event) {
- this.executeOnUIThread(this.buildRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.propertyChanged_(event);
+ } else {
+ this.executeOnUIThread(this.buildRunnable(event));
+ }
}
private Runnable buildRunnable(final PropertyChangeEvent event) {
@@ -44,6 +46,10 @@ public class SWTPropertyChangeListenerWrapper
};
}
+ private boolean isExecutingUIThread() {
+ return Display.getCurrent() != null;
+ }
+
/**
* Display#asyncExec(Runnable) seems to work OK;
* but using #syncExec(Runnable) can somtimes make things
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTStateChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTStateChangeListenerWrapper.java
index f334d66296..05c4b1ccca 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTStateChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTStateChangeListenerWrapper.java
@@ -16,8 +16,6 @@ import org.eclipse.swt.widgets.Display;
/**
* Wrap another state change listener and forward events to it on the SWT
* UI thread.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class SWTStateChangeListenerWrapper
implements StateChangeListener
@@ -33,7 +31,11 @@ public class SWTStateChangeListenerWrapper
}
public void stateChanged(StateChangeEvent event) {
- this.executeOnUIThread(this.buildRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.stateChanged_(event);
+ } else {
+ this.executeOnUIThread(this.buildRunnable(event));
+ }
}
private Runnable buildRunnable(final StateChangeEvent event) {
@@ -44,6 +46,10 @@ public class SWTStateChangeListenerWrapper
};
}
+ private boolean isExecutingUIThread() {
+ return Display.getCurrent() != null;
+ }
+
/**
* Display#asyncExec(Runnable) seems to work OK;
* but using #syncExec(Runnable) can somtimes make things
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTTreeChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTTreeChangeListenerWrapper.java
index 726f73846d..cfda0ee3dd 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTTreeChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/listeners/SWTTreeChangeListenerWrapper.java
@@ -16,8 +16,6 @@ import org.eclipse.swt.widgets.Display;
/**
* Wrap another tree change listener and forward events to it on the SWT
* UI thread.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class SWTTreeChangeListenerWrapper
implements TreeChangeListener
@@ -33,19 +31,35 @@ public class SWTTreeChangeListenerWrapper
}
public void nodeAdded(TreeChangeEvent event) {
- this.executeOnUIThread(this.buildNodeAddedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.nodeAdded_(event);
+ } else {
+ this.executeOnUIThread(this.buildNodeAddedRunnable(event));
+ }
}
public void nodeRemoved(TreeChangeEvent event) {
- this.executeOnUIThread(this.buildNodeRemovedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.nodeRemoved_(event);
+ } else {
+ this.executeOnUIThread(this.buildNodeRemovedRunnable(event));
+ }
}
public void treeCleared(TreeChangeEvent event) {
- this.executeOnUIThread(this.buildTreeClearedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.treeCleared_(event);
+ } else {
+ this.executeOnUIThread(this.buildTreeClearedRunnable(event));
+ }
}
public void treeChanged(TreeChangeEvent event) {
- this.executeOnUIThread(this.buildTreeChangedRunnable(event));
+ if (this.isExecutingUIThread()) {
+ this.treeChanged_(event);
+ } else {
+ this.executeOnUIThread(this.buildTreeChangedRunnable(event));
+ }
}
private Runnable buildNodeAddedRunnable(final TreeChangeEvent event) {
@@ -96,6 +110,10 @@ public class SWTTreeChangeListenerWrapper
};
}
+ private boolean isExecutingUIThread() {
+ return Display.getCurrent() != null;
+ }
+
/**
* Display#asyncExec(Runnable) seems to work OK;
* but using #syncExec(Runnable) can somtimes make things
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java
index d8cc166df1..297654ded7 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java
@@ -17,8 +17,6 @@ import org.eclipse.jpt.utility.model.listener.CollectionChangeListener;
/**
* Wrap another collection change listener and forward events to it on the AWT
* event queue.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class AWTCollectionChangeListenerWrapper
implements CollectionChangeListener
@@ -34,19 +32,35 @@ public class AWTCollectionChangeListenerWrapper
}
public void itemsAdded(CollectionChangeEvent event) {
- this.executeOnEventQueue(this.buildItemsAddedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.itemsAdded_(event);
+ } else {
+ this.executeOnEventQueue(this.buildItemsAddedRunnable(event));
+ }
}
public void itemsRemoved(CollectionChangeEvent event) {
- this.executeOnEventQueue(this.buildItemsRemovedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.itemsRemoved_(event);
+ } else {
+ this.executeOnEventQueue(this.buildItemsRemovedRunnable(event));
+ }
}
public void collectionCleared(CollectionChangeEvent event) {
- this.executeOnEventQueue(this.buildCollectionClearedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.collectionCleared_(event);
+ } else {
+ this.executeOnEventQueue(this.buildCollectionClearedRunnable(event));
+ }
}
public void collectionChanged(CollectionChangeEvent event) {
- this.executeOnEventQueue(this.buildCollectionChangedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.collectionChanged_(event);
+ } else {
+ this.executeOnEventQueue(this.buildCollectionChangedRunnable(event));
+ }
}
private Runnable buildItemsAddedRunnable(final CollectionChangeEvent event) {
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java
index ac28b92ebf..8c63c63664 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java
@@ -17,8 +17,6 @@ import org.eclipse.jpt.utility.model.listener.ListChangeListener;
/**
* Wrap another list change listener and forward events to it on the AWT
* event queue.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class AWTListChangeListenerWrapper
implements ListChangeListener
@@ -34,27 +32,51 @@ public class AWTListChangeListenerWrapper
}
public void itemsAdded(ListChangeEvent event) {
- this.executeOnEventQueue(this.buildItemsAddedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.itemsAdded_(event);
+ } else {
+ this.executeOnEventQueue(this.buildItemsAddedRunnable(event));
+ }
}
public void itemsRemoved(ListChangeEvent event) {
- this.executeOnEventQueue(this.buildItemsRemovedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.itemsRemoved_(event);
+ } else {
+ this.executeOnEventQueue(this.buildItemsRemovedRunnable(event));
+ }
}
public void itemsMoved(ListChangeEvent event) {
- this.executeOnEventQueue(this.buildItemsMovedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.itemsMoved_(event);
+ } else {
+ this.executeOnEventQueue(this.buildItemsMovedRunnable(event));
+ }
}
public void itemsReplaced(ListChangeEvent event) {
- this.executeOnEventQueue(this.buildItemsReplacedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.itemsReplaced_(event);
+ } else {
+ this.executeOnEventQueue(this.buildItemsReplacedRunnable(event));
+ }
}
public void listCleared(ListChangeEvent event) {
- this.executeOnEventQueue(this.buildListClearedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.listCleared_(event);
+ } else {
+ this.executeOnEventQueue(this.buildListClearedRunnable(event));
+ }
}
public void listChanged(ListChangeEvent event) {
- this.executeOnEventQueue(this.buildListChangedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.listChanged_(event);
+ } else {
+ this.executeOnEventQueue(this.buildListChangedRunnable(event));
+ }
}
private Runnable buildItemsAddedRunnable(final ListChangeEvent event) {
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java
index 7682773c93..171ac87ad2 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java
@@ -17,8 +17,6 @@ import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
/**
* Wrap another property change listener and forward events to it on the AWT
* event queue.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class AWTPropertyChangeListenerWrapper
implements PropertyChangeListener
@@ -35,7 +33,11 @@ public class AWTPropertyChangeListenerWrapper
}
public void propertyChanged(PropertyChangeEvent event) {
- this.executeOnEventQueue(this.buildRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.propertyChanged_(event);
+ } else {
+ this.executeOnEventQueue(this.buildRunnable(event));
+ }
}
private Runnable buildRunnable(final PropertyChangeEvent event) {
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java
index b59556d185..bb042ae023 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java
@@ -17,8 +17,6 @@ import org.eclipse.jpt.utility.model.listener.StateChangeListener;
/**
* Wrap another state change listener and forward events to it on the AWT
* event queue.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class AWTStateChangeListenerWrapper
implements StateChangeListener
@@ -34,7 +32,11 @@ public class AWTStateChangeListenerWrapper
}
public void stateChanged(StateChangeEvent event) {
- this.executeOnEventQueue(this.buildRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.stateChanged_(event);
+ } else {
+ this.executeOnEventQueue(this.buildRunnable(event));
+ }
}
private Runnable buildRunnable(final StateChangeEvent event) {
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java
index db0a0e342f..0186d5d065 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java
@@ -17,8 +17,6 @@ import org.eclipse.jpt.utility.model.listener.TreeChangeListener;
/**
* Wrap another tree change listener and forward events to it on the AWT
* event queue.
- * Forward *every* event asynchronously via the UI thread so the listener
- * receives in the same order they were generated.
*/
public class AWTTreeChangeListenerWrapper
implements TreeChangeListener
@@ -34,19 +32,35 @@ public class AWTTreeChangeListenerWrapper
}
public void nodeAdded(TreeChangeEvent event) {
- this.executeOnEventQueue(this.buildNodeAddedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.nodeAdded_(event);
+ } else {
+ this.executeOnEventQueue(this.buildNodeAddedRunnable(event));
+ }
}
public void nodeRemoved(TreeChangeEvent event) {
- this.executeOnEventQueue(this.buildNodeRemovedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.nodeRemoved_(event);
+ } else {
+ this.executeOnEventQueue(this.buildNodeRemovedRunnable(event));
+ }
}
public void treeCleared(TreeChangeEvent event) {
- this.executeOnEventQueue(this.buildTreeClearedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.treeCleared_(event);
+ } else {
+ this.executeOnEventQueue(this.buildTreeClearedRunnable(event));
+ }
}
public void treeChanged(TreeChangeEvent event) {
- this.executeOnEventQueue(this.buildTreeChangedRunnable(event));
+ if (EventQueue.isDispatchThread()) {
+ this.treeChanged_(event);
+ } else {
+ this.executeOnEventQueue(this.buildTreeChangedRunnable(event));
+ }
}
private Runnable buildNodeAddedRunnable(final TreeChangeEvent event) {

Back to the top