Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java48
1 files changed, 36 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
index 0eda6178f2..384fe03089 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
@@ -1,14 +1,14 @@
package org.eclipse.swt.widgets;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import java.io.*;
import java.util.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
/**
* This class is intended for widgets that display data of
@@ -1657,22 +1657,46 @@ void select(SelectableItem item) {
* Select 'item' if it is not selected. Send a Selection event
* if the selection was changed.
* @param item - item that should be selected
+ * @param asyncNotify
+ * true=send the selection event asynchronously
+ * false=send the selection event immediately
*/
-void selectNotify(SelectableItem item) {
- Event event;
-
+void selectNotify(final SelectableItem item, boolean asyncNotify) {
if (isRemovingAll() == false) {
if (item.isSelected() == false) {
select(item);
setLastSelection(item, true);
update(); // looks better when event notification takes long to return
}
- event = new Event();
- event.item = item;
- notifyListeners(SWT.Selection, event);
+ if (asyncNotify == false) {
+ Event event = new Event();
+ event.item = item;
+ notifyListeners(SWT.Selection, event);
+ }
+ else {
+ getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ // Only send a selection event when the item has not been disposed.
+ // Fixes 1GE6XQA
+ if (item.isDisposed() == false) {
+ Event event = new Event();
+ event.item = item;
+ notifyListeners(SWT.Selection, event);
+ }
+ }
+ });
+ }
}
}
/**
+ * Select 'item' if it is not selected. Send a Selection event
+ * if the selection was changed.
+ * @param item - item that should be selected
+ */
+void selectNotify(SelectableItem item) {
+ selectNotify(item, false);
+}
+/**
* Select all items of the receiver starting at 'fromIndex'
* and including 'toIndex'.
*/
@@ -2024,4 +2048,4 @@ void toggleSelectionNotify(SelectableItem item) {
selectNotify(item);
}
}
-} \ No newline at end of file
+}

Back to the top