diff --git a/widgets/calendarcombo/org.eclipse.nebula.widgets.calendarcombo/META-INF/MANIFEST.MF b/widgets/calendarcombo/org.eclipse.nebula.widgets.calendarcombo/META-INF/MANIFEST.MF
index 2950e6320..159d394b1 100644
--- a/widgets/calendarcombo/org.eclipse.nebula.widgets.calendarcombo/META-INF/MANIFEST.MF
+++ b/widgets/calendarcombo/org.eclipse.nebula.widgets.calendarcombo/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Nebula Calendar Combo Widget - Incubating
Bundle-SymbolicName: org.eclipse.nebula.widgets.calendarcombo
Bundle-Version: 1.0.0.qualifier
-Require-Bundle: org.eclipse.swt
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.calendarcombo
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: Eclipse Nebula
diff --git a/widgets/calendarcombo/org.eclipse.nebula.widgets.calendarcombo/src/org/eclipse/nebula/widgets/calendarcombo/CustomCombo.java b/widgets/calendarcombo/org.eclipse.nebula.widgets.calendarcombo/src/org/eclipse/nebula/widgets/calendarcombo/CustomCombo.java
index 030af57c2..90a170a52 100644
--- a/widgets/calendarcombo/org.eclipse.nebula.widgets.calendarcombo/src/org/eclipse/nebula/widgets/calendarcombo/CustomCombo.java
+++ b/widgets/calendarcombo/org.eclipse.nebula.widgets.calendarcombo/src/org/eclipse/nebula/widgets/calendarcombo/CustomCombo.java
@@ -30,7 +30,6 @@
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.swt.widgets.Widget;
/**
@@ -259,11 +258,7 @@ public void add(String string, int index) {
* @see #removeModifyListener
*/
public void addModifyListener(ModifyListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Modify, typedListener);
+ addTypedListener(listener, SWT.Modify);
}
/**
@@ -294,12 +289,7 @@ public void addModifyListener(ModifyListener listener) {
* @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
/**
@@ -325,11 +315,7 @@ public void addSelectionListener(SelectionListener listener) {
* @since 3.3
*/
public void addVerifyListener(VerifyListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Verify, typedListener);
+ addTypedListener(listener, SWT.Verify);
}
void arrowEvent(Event event) {
@@ -1417,10 +1403,7 @@ public void removeAll() {
* @see #addModifyListener
*/
public void removeModifyListener(ModifyListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Modify, listener);
+ removeTypedListener(SWT.Modify, listener);
}
/**
@@ -1442,11 +1425,8 @@ public void removeModifyListener(ModifyListener listener) {
* @see #addSelectionListener
*/
public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
/**
@@ -1470,10 +1450,7 @@ public void removeSelectionListener(SelectionListener listener) {
* @since 3.3
*/
public void removeVerifyListener(VerifyListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Verify, listener);
+ removeTypedListener(SWT.Verify, listener);
}
/**
diff --git a/widgets/carousel/org.eclipse.nebula.widgets.carousel/META-INF/MANIFEST.MF b/widgets/carousel/org.eclipse.nebula.widgets.carousel/META-INF/MANIFEST.MF
index 53c431024..ba3e63e8b 100644
--- a/widgets/carousel/org.eclipse.nebula.widgets.carousel/META-INF/MANIFEST.MF
+++ b/widgets/carousel/org.eclipse.nebula.widgets.carousel/META-INF/MANIFEST.MF
@@ -7,5 +7,5 @@ Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.nebula.widgets.carousel
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Automatic-Module-Name: org.eclipse.nebula.widgets.carousel
diff --git a/widgets/carousel/org.eclipse.nebula.widgets.carousel/src/org/eclipse/nebula/widgets/carousel/Carousel.java b/widgets/carousel/org.eclipse.nebula.widgets.carousel/src/org/eclipse/nebula/widgets/carousel/Carousel.java
index 29e6f1b6e..b56b7a98b 100644
--- a/widgets/carousel/org.eclipse.nebula.widgets.carousel/src/org/eclipse/nebula/widgets/carousel/Carousel.java
+++ b/widgets/carousel/org.eclipse.nebula.widgets.carousel/src/org/eclipse/nebula/widgets/carousel/Carousel.java
@@ -165,8 +165,7 @@ public void addImage(final Image image) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -219,8 +218,7 @@ public void removeImage(final Image image) {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
// ---- Getters & Setters
diff --git a/widgets/cdatetime/org.eclipse.nebula.widgets.cdatetime/META-INF/MANIFEST.MF b/widgets/cdatetime/org.eclipse.nebula.widgets.cdatetime/META-INF/MANIFEST.MF
index 30b270b3d..da83f0540 100644
--- a/widgets/cdatetime/org.eclipse.nebula.widgets.cdatetime/META-INF/MANIFEST.MF
+++ b/widgets/cdatetime/org.eclipse.nebula.widgets.cdatetime/META-INF/MANIFEST.MF
@@ -7,7 +7,7 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.swt,
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)",
org.eclipse.nebula.cwt;bundle-version="0.9.0";visibility:=reexport
Export-Package: org.eclipse.nebula.widgets.cdatetime
Automatic-Module-Name: org.eclipse.nebula.widgets.cdatetime
diff --git a/widgets/cdatetime/org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java b/widgets/cdatetime/org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java
index ca4f4909b..ed85a0f43 100644
--- a/widgets/cdatetime/org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java
+++ b/widgets/cdatetime/org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java
@@ -65,7 +65,6 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
/**
* The CDateTime provides both textual and graphical means selecting a
@@ -425,9 +424,7 @@ public CDateTime(Composite parent, int style) {
*/
public void addSelectionListener(SelectionListener listener) {
if (listener != null) {
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
}
@@ -1527,9 +1524,8 @@ protected void postClose(Shell popup) {
*/
public void removeSelectionListener(SelectionListener listener) {
if (listener != null) {
- TypedListener l = new TypedListener(listener);
- removeListener(SWT.Selection, l);
- removeListener(SWT.DefaultSelection, l);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
}
diff --git a/widgets/chips/org.eclipse.nebula.widgets.chips/META-INF/MANIFEST.MF b/widgets/chips/org.eclipse.nebula.widgets.chips/META-INF/MANIFEST.MF
index 30cd11839..a09795787 100644
--- a/widgets/chips/org.eclipse.nebula.widgets.chips/META-INF/MANIFEST.MF
+++ b/widgets/chips/org.eclipse.nebula.widgets.chips/META-INF/MANIFEST.MF
@@ -7,5 +7,5 @@ Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.nebula.widgets.chips
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Automatic-Module-Name: org.eclipse.nebula.widgets.chips
diff --git a/widgets/chips/org.eclipse.nebula.widgets.chips/src/org/eclipse/nebula/widgets/chips/Chips.java b/widgets/chips/org.eclipse.nebula.widgets.chips/src/org/eclipse/nebula/widgets/chips/Chips.java
index 8a7ce73c3..2dba7d467 100644
--- a/widgets/chips/org.eclipse.nebula.widgets.chips/src/org/eclipse/nebula/widgets/chips/Chips.java
+++ b/widgets/chips/org.eclipse.nebula.widgets.chips/src/org/eclipse/nebula/widgets/chips/Chips.java
@@ -411,8 +411,7 @@ public void addListener(final int eventType, final Listener listener) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -466,8 +465,7 @@ public void removeCloseListener(final CloseListener listener) {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
// ---- Getters & Setters
diff --git a/widgets/chips/org.eclipse.nebula.widgets.chips/src/org/eclipse/nebula/widgets/chips/CloseListener.java b/widgets/chips/org.eclipse.nebula.widgets.chips/src/org/eclipse/nebula/widgets/chips/CloseListener.java
index d1d595e0b..7f338ace3 100644
--- a/widgets/chips/org.eclipse.nebula.widgets.chips/src/org/eclipse/nebula/widgets/chips/CloseListener.java
+++ b/widgets/chips/org.eclipse.nebula.widgets.chips/src/org/eclipse/nebula/widgets/chips/CloseListener.java
@@ -12,7 +12,7 @@
*******************************************************************************/
package org.eclipse.nebula.widgets.chips;
-import org.eclipse.swt.internal.SWTEventListener;
+import java.util.EventListener;
/**
* Classes which implement this interface provide methods
@@ -28,9 +28,8 @@
*
* @see CloseEvent
*/
-@SuppressWarnings("restriction")
@FunctionalInterface
-public interface CloseListener extends SWTEventListener {
+public interface CloseListener extends EventListener {
/**
* Sent when a Chips widget is closed.
*
diff --git a/widgets/ctree/org.eclipse.nebula.widgets.ctree/META-INF/MANIFEST.MF b/widgets/ctree/org.eclipse.nebula.widgets.ctree/META-INF/MANIFEST.MF
index dc98c93e5..a3de9c7b8 100644
--- a/widgets/ctree/org.eclipse.nebula.widgets.ctree/META-INF/MANIFEST.MF
+++ b/widgets/ctree/org.eclipse.nebula.widgets.ctree/META-INF/MANIFEST.MF
@@ -5,6 +5,6 @@ Bundle-SymbolicName: org.eclipse.nebula.widgets.ctree
Bundle-Version: 0.8.0
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: org.eclipse.swt
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.ctree
Automatic-Module-Name: org.eclipse.nebula.widgets.ctree
diff --git a/widgets/ctree/org.eclipse.nebula.widgets.ctree/src/org/eclipse/nebula/widgets/ctree/CTree.java b/widgets/ctree/org.eclipse.nebula.widgets.ctree/src/org/eclipse/nebula/widgets/ctree/CTree.java
index ef9493001..ecc5d61c7 100644
--- a/widgets/ctree/org.eclipse.nebula.widgets.ctree/src/org/eclipse/nebula/widgets/ctree/CTree.java
+++ b/widgets/ctree/org.eclipse.nebula.widgets.ctree/src/org/eclipse/nebula/widgets/ctree/CTree.java
@@ -43,7 +43,6 @@
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.swt.widgets.Widget;
@@ -389,18 +388,14 @@ public void addPaintedItemListener(Listener listener) {
public void addSelectionListener(SelectionListener listener) {
checkWidget();
if (listener != null) {
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
}
public void addTreeListener(TreeListener listener) {
checkWidget ();
if(listener != null) {
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Collapse, typedListener);
- addListener (SWT.Expand, typedListener);
+ addTypedListener(listener, SWT.Collapse, SWT.Expand);
}
}
@@ -1367,16 +1362,16 @@ public void removePaintedItemListener(Listener listener) {
public void removeSelectionListener(SelectionListener listener) {
checkWidget();
if (listener != null) {
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
}
public void removeTreeListener(TreeListener listener) {
checkWidget ();
if(listener != null) {
- removeListener(SWT.Collapse, listener);
- removeListener(SWT.Expand, listener);
+ removeTypedListener(SWT.Collapse, listener);
+ removeTypedListener(SWT.Expand, listener);
}
}
diff --git a/widgets/ctreecombo/org.eclipse.nebula.widgets.ctreecombo/META-INF/MANIFEST.MF b/widgets/ctreecombo/org.eclipse.nebula.widgets.ctreecombo/META-INF/MANIFEST.MF
index 2520e7721..51e206a64 100644
--- a/widgets/ctreecombo/org.eclipse.nebula.widgets.ctreecombo/META-INF/MANIFEST.MF
+++ b/widgets/ctreecombo/org.eclipse.nebula.widgets.ctreecombo/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Bundle-SymbolicName: org.eclipse.nebula.widgets.ctreecombo
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: org.eclipse.swt,
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)",
org.eclipse.jface,
org.eclipse.core.runtime;bundle-version="3.13.0",
org.eclipse.core.databinding.observable
diff --git a/widgets/ctreecombo/org.eclipse.nebula.widgets.ctreecombo/src/org/eclipse/nebula/widgets/ctreecombo/CTreeCombo.java b/widgets/ctreecombo/org.eclipse.nebula.widgets.ctreecombo/src/org/eclipse/nebula/widgets/ctreecombo/CTreeCombo.java
index b30645d8f..38b91f77c 100644
--- a/widgets/ctreecombo/org.eclipse.nebula.widgets.ctreecombo/src/org/eclipse/nebula/widgets/ctreecombo/CTreeCombo.java
+++ b/widgets/ctreecombo/org.eclipse.nebula.widgets.ctreecombo/src/org/eclipse/nebula/widgets/ctreecombo/CTreeCombo.java
@@ -49,7 +49,6 @@
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.swt.widgets.Widget;
public class CTreeCombo extends Composite {
@@ -240,14 +239,7 @@ char _findMnemonic(String string) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- final TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
/**
@@ -1125,12 +1117,8 @@ public void removeAll() {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
/**
diff --git a/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/META-INF/MANIFEST.MF b/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/META-INF/MANIFEST.MF
index c48b16745..cec3d96da 100644
--- a/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/META-INF/MANIFEST.MF
+++ b/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/META-INF/MANIFEST.MF
@@ -7,7 +7,7 @@ Export-Package: org.eclipse.nebula.widgets.datechooser
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: Eclipse Nebula
Import-Package: org.eclipse.jface.layout,
- org.eclipse.swt,
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)",
org.eclipse.swt.events,
org.eclipse.swt.graphics,
org.eclipse.swt.internal,
diff --git a/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/src/org/eclipse/nebula/widgets/datechooser/AbstractCombo.java b/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/src/org/eclipse/nebula/widgets/datechooser/AbstractCombo.java
index e8e32cb9e..c5c2a2958 100644
--- a/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/src/org/eclipse/nebula/widgets/datechooser/AbstractCombo.java
+++ b/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/src/org/eclipse/nebula/widgets/datechooser/AbstractCombo.java
@@ -36,7 +36,6 @@
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
/**
* Abstract class for combo widgets composed of a Text
, a
@@ -201,11 +200,7 @@ static int checkStyle(int style) {
* @see #removeModifyListener
*/
public void addModifyListener(ModifyListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Modify, typedListener);
+ addTypedListener(listener, SWT.Modify);
}
/**
@@ -233,12 +228,7 @@ public void addModifyListener(ModifyListener listener) {
* @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
/**
@@ -261,11 +251,7 @@ public void addSelectionListener(SelectionListener listener) {
* @see #removeVerifyListener
*/
public void addVerifyListener(VerifyListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Verify, typedListener);
+ addTypedListener(listener, SWT.Verify);
}
/**
@@ -832,10 +818,7 @@ public void redraw(int x, int y, int width, int height, boolean all) {
* @see #addModifyListener
*/
public void removeModifyListener(ModifyListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Modify, listener);
+ removeTypedListener(SWT.Modify, listener);
}
/**
@@ -856,11 +839,8 @@ public void removeModifyListener(ModifyListener listener) {
* @see #addSelectionListener
*/
public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
/**
@@ -881,10 +861,7 @@ public void removeSelectionListener(SelectionListener listener) {
* @see #addVerifyListener
*/
public void removeVerifyListener(VerifyListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Verify, listener);
+ removeTypedListener(SWT.Verify, listener);
}
/**
diff --git a/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/src/org/eclipse/nebula/widgets/datechooser/DateChooser.java b/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/src/org/eclipse/nebula/widgets/datechooser/DateChooser.java
index 0ba897950..3e4d564f9 100644
--- a/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/src/org/eclipse/nebula/widgets/datechooser/DateChooser.java
+++ b/widgets/datechooser/org.eclipse.nebula.widgets.datechooser/src/org/eclipse/nebula/widgets/datechooser/DateChooser.java
@@ -47,7 +47,6 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.TypedListener;
/**
* Calendar widget. Presents the monthly view of a calendar for date picking.
@@ -356,12 +355,7 @@ public DateChooser(Composite parent, int style) {
* @see #removeSelectionListener
*/
public void addSelectionListener(SelectionListener lsnr) {
- checkWidget();
- if (lsnr == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- final TypedListener typedListener = new TypedListener(lsnr);
- addListener(SWT.Selection, typedListener);
+ addTypedListener(lsnr, SWT.Selection);
}
/**
@@ -1106,11 +1100,7 @@ private void removeSelectedDate(Date d, boolean refresh) {
* @see #addSelectionListener
*/
public void removeSelectionListener(SelectionListener lsnr) {
- checkWidget();
- if (lsnr == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Selection, lsnr);
+ removeTypedListener(SWT.Selection, lsnr);
}
/**
diff --git a/widgets/gallery/org.eclipse.nebula.widgets.gallery/META-INF/MANIFEST.MF b/widgets/gallery/org.eclipse.nebula.widgets.gallery/META-INF/MANIFEST.MF
index 6aa9e7e13..ed2cb5ec4 100644
--- a/widgets/gallery/org.eclipse.nebula.widgets.gallery/META-INF/MANIFEST.MF
+++ b/widgets/gallery/org.eclipse.nebula.widgets.gallery/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: Nebula Gallery Widget
Bundle-SymbolicName: org.eclipse.nebula.widgets.gallery
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: org.eclipse.swt,
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)",
org.eclipse.jface;resolution:=optional
Export-Package: org.eclipse.nebula.animation,
org.eclipse.nebula.animation.effects,
diff --git a/widgets/gallery/org.eclipse.nebula.widgets.gallery/src/org/eclipse/nebula/widgets/gallery/Gallery.java b/widgets/gallery/org.eclipse.nebula.widgets.gallery/src/org/eclipse/nebula/widgets/gallery/Gallery.java
index f0a04cea7..146b9d7b6 100644
--- a/widgets/gallery/org.eclipse.nebula.widgets.gallery/src/org/eclipse/nebula/widgets/gallery/Gallery.java
+++ b/widgets/gallery/org.eclipse.nebula.widgets.gallery/src/org/eclipse/nebula/widgets/gallery/Gallery.java
@@ -33,7 +33,6 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.TypedListener;
/**
*
@@ -309,13 +308,7 @@ public void setItemRenderer(AbstractGalleryItemRenderer itemRenderer) {
* @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
/**
@@ -341,9 +334,8 @@ public void addSelectionListener(SelectionListener listener) {
* @see #addSelectionListener(SelectionListener)
*/
public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
/**
@@ -353,8 +345,7 @@ public void removeSelectionListener(SelectionListener listener) {
* @param listener
*/
public void removeTreeListener(SelectionListener listener) {
- checkWidget();
- removeListener(SWT.Expand, listener);
+ removeTypedListener(SWT.Expand, listener);
}
/**
@@ -365,10 +356,7 @@ public void removeTreeListener(SelectionListener listener) {
* @param listener
*/
public void addTreeListener(TreeListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- addListener(SWT.Expand, new TypedListener(listener));
+ addTypedListener(listener, SWT.Expand);
}
/**
diff --git a/widgets/grid/org.eclipse.nebula.widgets.grid/META-INF/MANIFEST.MF b/widgets/grid/org.eclipse.nebula.widgets.grid/META-INF/MANIFEST.MF
index abbc835d1..d9a68439b 100644
--- a/widgets/grid/org.eclipse.nebula.widgets.grid/META-INF/MANIFEST.MF
+++ b/widgets/grid/org.eclipse.nebula.widgets.grid/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: Nebula Grid
Bundle-SymbolicName: org.eclipse.nebula.widgets.grid
Bundle-Version: 1.1.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: org.eclipse.swt,
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)",
org.eclipse.jface;resolution:=optional
Export-Package: org.eclipse.nebula.jface.gridviewer,
org.eclipse.nebula.jface.gridviewer.internal;x-internal:=true,
diff --git a/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java b/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java
index 3eda62d86..b4d302ec2 100644
--- a/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java
+++ b/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java
@@ -82,7 +82,6 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.TypedListener;
/**
* The Grid widget is a spreadsheet/table component that offers features not
@@ -956,12 +955,7 @@ public void setCellHeaderSelectionBackground(final Color cellSelectionBackground
*
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- addListener(SWT.Selection, new TypedListener(listener));
- addListener(SWT.DefaultSelection, new TypedListener(listener));
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
/**
@@ -987,13 +981,7 @@ public void addSelectionListener(final SelectionListener listener) {
* @see org.eclipse.swt.events.TreeEvent
*/
public void addTreeListener(final TreeListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- addListener(SWT.Expand, new TypedListener(listener));
- addListener(SWT.Collapse, new TypedListener(listener));
+ addTypedListener(listener, SWT.Expand, SWT.Collapse);
}
/**
@@ -3273,9 +3261,8 @@ public void disposeAllItems() {
*
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
/**
@@ -3295,9 +3282,8 @@ public void removeSelectionListener(final SelectionListener listener) {
*
*/
public void removeTreeListener(final TreeListener listener) {
- checkWidget();
- removeListener(SWT.Expand, listener);
- removeListener(SWT.Collapse, listener);
+ removeTypedListener(SWT.Expand, listener);
+ removeTypedListener(SWT.Collapse, listener);
}
/**
diff --git a/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumn.java b/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumn.java
index 7ce76c1a0..37deac928 100644
--- a/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumn.java
+++ b/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumn.java
@@ -37,7 +37,6 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.TypedListener;
/**
*
@@ -502,11 +501,7 @@ public int getSort() {
*
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- addListener(SWT.Selection, new TypedListener(listener));
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -526,8 +521,7 @@ public void addSelectionListener(final SelectionListener listener) {
*
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- this.removeListener(SWT.Selection, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
@@ -814,13 +808,7 @@ public void setFooterRenderer(final GridFooterRenderer footerRenderer) {
*
*/
public void addControlListener(final ControlListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- final TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Resize, typedListener);
- addListener(SWT.Move, typedListener);
+ addTypedListener(listener, SWT.Resize, SWT.Move);
}
/**
@@ -841,12 +829,8 @@ public void addControlListener(final ControlListener listener) {
*
*/
public void removeControlListener(final ControlListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Resize, listener);
- removeListener(SWT.Move, listener);
+ removeTypedListener(SWT.Resize, listener);
+ removeTypedListener(SWT.Move, listener);
}
/**
diff --git a/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumnGroup.java b/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumnGroup.java
index 3866f1c83..0cc1a31c4 100644
--- a/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumnGroup.java
+++ b/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumnGroup.java
@@ -25,7 +25,6 @@
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.TypedListener;
/**
*
@@ -122,11 +121,7 @@ private void init(int style) {
* @see #removeTreeListener
*/
public void addTreeListener(TreeListener listener) {
- checkWidget ();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Expand, typedListener);
- addListener (SWT.Collapse, typedListener);
+ addTypedListener(listener, SWT.Expand, SWT.Collapse);
}
/**
@@ -147,10 +142,8 @@ public void addTreeListener(TreeListener listener) {
* @see #addTreeListener
*/
public void removeTreeListener(TreeListener listener) {
- checkWidget ();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (SWT.Expand, listener);
- removeListener (SWT.Collapse, listener);
+ removeTypedListener(SWT.Expand, listener);
+ removeTypedListener(SWT.Collapse, listener);
}
/**
diff --git a/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridItem.java b/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridItem.java
index af2cea3f6..2ca68db22 100644
--- a/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridItem.java
+++ b/widgets/grid/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridItem.java
@@ -30,7 +30,6 @@
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.TypedListener;
/**
*
@@ -348,11 +347,7 @@ public void dispose() {
*
*/
public void addControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Resize, typedListener);
+ addTypedListener(listener, SWT.Resize);
}
/**
@@ -375,10 +370,7 @@ public void addControlListener(ControlListener listener) {
*
*/
public void removeControlListener(ControlListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Resize, listener);
+ removeTypedListener(SWT.Resize, listener);
}
/**
diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/META-INF/MANIFEST.MF b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/META-INF/MANIFEST.MF
index e7d8a1689..6583e7d0a 100644
--- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/META-INF/MANIFEST.MF
+++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.nebulaslider
Automatic-Module-Name: org.eclipse.nebula.widgets.nebulaslider
diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSlider.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSlider.java
index 5d0ec3a2f..5cf27aecd 100644
--- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSlider.java
+++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSlider.java
@@ -1,528 +1,526 @@
-/*******************************************************************************
- * Copyright (c) 2018-2024 Laurent CARON
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors: Laurent CARON (laurent.caron at gmail dot com) - Initial
- * implementation and API
- *******************************************************************************/
-package org.eclipse.nebula.widgets.opal.nebulaslider;
-
-import java.util.function.IntFunction;
-
-import org.eclipse.nebula.widgets.opal.commons.SelectionListenerUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values.
- * It is like an horizontal slider
- *
- * - Styles:
- * - (None)
- * - Events:
- * - Selection
- *
- */
-public class NebulaSlider extends Canvas {
-
- private NebulaSliderGraphicConfiguration renderer;
-
- private int minimum;
- private int maximum;
- private int value;
- private int xPosition;
- private int mouseDeltaX;
-
- private boolean moving = false;
-
- private IntFunction format;
-
- private int movingValue;
-
- /**
- * Constructs a new instance of this class given its parent and a style value
- * describing its behavior and appearance.
- *
- * The style value is either one of the style constants defined in class
- * SWT
which is applicable to instances of this class, or must be
- * built by bitwise OR'ing together (that is, using the
- * int
"|" operator) two or more of those SWT
style
- * constants. The class description lists the style constants that are
- * applicable to the class. Style bits are also inherited from superclasses.
- *
- *
- * @param parent a composite control which will be the parent of the new
- * instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException
- *
- * - ERROR_NULL_ARGUMENT - if the parent is null
- *
- * @exception SWTException
- *
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the
- * thread that created the parent
- * - ERROR_INVALID_SUBCLASS - if this class is not an allowed
- * subclass
- *
- *
- * @see Widget#getStyle()
- */
- public NebulaSlider(final Composite parent, final int style) {
- super(parent, checkStyle(style) | SWT.DOUBLE_BUFFERED);
-
- renderer = new NebularSliderDefaultConfiguration(this);
-
- minimum = Integer.MIN_VALUE;
- maximum = Integer.MAX_VALUE;
- value = 0;
- xPosition = -1;
-
- addPaintListener(e -> {
- paintControl(e.gc);
- });
- addMouseListeners();
- }
-
- private static int checkStyle(final int style) {
- if ((style & SWT.BORDER) != 0) {
- return style & ~SWT.BORDER;
- }
- return 0;
- }
-
- private void paintControl(final GC gc) {
- gc.setAdvanced(true);
- gc.setAntialias(SWT.ON);
-
- if (xPosition < 0) {
- // Compute xPosition
- xPosition = computeXPosition();
- }
- boolean enabled = isEnabled();
- drawBar(gc, enabled);
- drawSelectionPart(gc, enabled);
- drawSelector(gc, enabled);
- }
-
- private void drawBar(final GC gc, boolean enabled) {
- final Rectangle rect = getClientArea();
- gc.setForeground(getColor(renderer.getBarBorderColor(), enabled));
- gc.setBackground(getColor(renderer.getBarInsideColor(), enabled));
-
- final int hMargin = renderer.getHorizontalMargin();
- final int selectorWidth = renderer.getSelectorWidth();
- final int barHeight = renderer.getBarHeight();
-
- final int x = hMargin + selectorWidth / 2;
- final int y = (rect.height - barHeight) / 2;
- final int width = rect.width - hMargin * 2 - selectorWidth;
-
- gc.fillRoundRectangle(x, y, width, barHeight, barHeight, barHeight);
- gc.drawRoundRectangle(x, y, width, barHeight, barHeight, barHeight);
- }
-
- private void drawSelectionPart(final GC gc, boolean enabled) {
- final Rectangle rect = getClientArea();
- gc.setForeground(getColor(renderer.getBarBorderColor(), enabled));
- gc.setBackground(getColor(renderer.getBarSelectionColor(), enabled));
-
- final int barHeight = renderer.getBarHeight();
-
- final int x = renderer.getHorizontalMargin() + renderer.getSelectorWidth() / 2;
- final int y = (rect.height - barHeight) / 2;
-
- gc.fillRoundRectangle(x, y, xPosition, barHeight, barHeight, barHeight);
- gc.drawRoundRectangle(x, y, xPosition, barHeight, barHeight, barHeight);
- }
-
- private int computeXPosition() {
- final int originalWidth = getClientArea().width - renderer.getHorizontalMargin() * 2 - renderer.getSelectorWidth();
- final float coeff = value * 1f / (maximum - minimum);
- final int position = (int) (coeff * originalWidth);
- return position;
- }
-
- private void drawSelector(final GC gc, boolean enabled) {
- final Rectangle rect = getClientArea();
- gc.setForeground(getColor(renderer.getSelectorColorBorder(), enabled));
- gc.setBackground(getColor(renderer.getSelectorColor(), enabled));
-
- final int hMargin = renderer.getHorizontalMargin();
-
- final int selectorWidth = renderer.getSelectorWidth();
- final int selectorHeight = renderer.getSelectorHeight();
-
- final int y = (rect.height - selectorHeight) / 2;
-
- // Draw the body
- gc.fillRoundRectangle(hMargin + xPosition, y, selectorWidth, selectorHeight, selectorHeight, selectorHeight);
- gc.drawRoundRectangle(hMargin + xPosition, y, selectorWidth, selectorHeight, selectorHeight, selectorHeight);
-
- // Draw the arrows
- gc.setForeground(getColor(renderer.getArrowColor(), enabled));
- gc.setLineWidth(renderer.getArrowLineWidth());
- final int baseY = y + selectorHeight / 2;
- gc.drawLine(hMargin + xPosition + 10, baseY, hMargin + xPosition + 17, baseY - 7);
- gc.drawLine(hMargin + xPosition + 10, baseY, hMargin + xPosition + 17, baseY + 7);
-
- gc.drawLine(hMargin + xPosition + selectorWidth - 10, baseY, hMargin + xPosition + selectorWidth - 17, baseY - 7);
- gc.drawLine(hMargin + xPosition + selectorWidth - 10, baseY, hMargin + xPosition + selectorWidth - 17, baseY + 7);
-
- // And the value
- gc.setForeground(getColor(renderer.getSelectorTextColor(), enabled));
- gc.setFont(renderer.getTextFont());
- final String valueAsString = stringValueOf(value);
- final Point textSize = gc.textExtent(valueAsString);
-
- final int xText = hMargin + xPosition + selectorWidth / 2;
- final int yText = y + selectorHeight / 2;
-
- gc.drawText(valueAsString, xText - textSize.x / 2, yText - textSize.y / 2, true);
- }
-
- @Override
- public void setBounds(int x, int y, int width, int height) {
- xPosition = -1;
- super.setBounds(x, y, width, height);
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- if(!enabled && moving) {
- moving = false;
- }
- super.setEnabled(enabled);
- }
-
- private Color getColor(Color color, boolean enabled) {
- if(enabled) {
- return color;
- }
- // see https://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
- int red = color.getRed();
- int green = color.getGreen();
- int blue = color.getBlue();
- if(red == green && green == blue) {
- return color;
- }
- int g = (int)(0.299 * red + 0.587 * green + 0.114 * blue);
- return new Color(g, g, g);
- }
-
- private String stringValueOf(int value) {
- if(format != null) {
- return format.apply(value);
- }
- return String.valueOf(value);
- }
-
- /**
- * Set the format that should be used to format the given number to a string.
- *
- * @param format
- * the format or null
to use the default format.
- */
- public void setLabelFormatProvider(IntFunction format) {
- checkWidget();
- this.format = format;
- }
-
- public IntFunction getLabelFormatProvider() {
- checkWidget();
- return format;
- }
-
- private void addMouseListeners() {
-
- addListener(SWT.MouseDown, e -> {
- if(isEnabled()) {
- final int selectorWidth = renderer.getSelectorWidth();
- final int selectorHeight = renderer.getSelectorHeight();
-
- final int y = (getClientArea().height - selectorHeight) / 2;
- final Rectangle rect = new Rectangle(xPosition + renderer.getHorizontalMargin(), y, selectorWidth, selectorHeight);
- if (!rect.contains(e.x, e.y)) {
- return;
- }
- moving = true;
- movingValue = value;
- mouseDeltaX = xPosition - e.x;
- }
- });
- addListener(SWT.MouseDoubleClick, e -> {
- moving = false;
- mouseDeltaX = 0;
- });
-
- addListener(SWT.MouseUp, e -> {
- if(!moving) {
- return;
- }
- moving = false;
- mouseDeltaX = 0;
- if(movingValue != value) {
- SelectionListenerUtil.fireDefaultSelectionListeners(this, e);
- }
- redraw();
- });
-
- addListener(SWT.MouseMove, e -> {
- if (!moving) {
- return;
- }
-
- xPosition = e.x + mouseDeltaX;
- if (xPosition < 0) {
- xPosition = 0;
- }
- final int originalWidth = getClientArea().width - renderer.getHorizontalMargin() * 2 - renderer.getSelectorWidth();
-
- if (xPosition > originalWidth) {
- xPosition = originalWidth;
- }
-
- // Update value
- final float ratio = (float) xPosition / originalWidth;
- int value = (int)Math.floor(ratio * (maximum - minimum));
- if(this.value != value) {
- this.value = value;
- SelectionListenerUtil.fireSelectionListeners(this, e);
- }
- redraw();
-
- });
- }
-
-
-
- /**
- * Adds the listener to the collection of listeners who will be notified when
- * the control is selected by the user, by sending it one of the messages
- * defined in the SelectionListener
interface.
- *
- * widgetDefaultSelected
is not called.
- *
- *
- * @param listener the listener which should be notified when the control is
- * selected by the user,
- *
- * @exception IllegalArgumentException
- *
- * - ERROR_NULL_ARGUMENT - if the listener is null
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been
- * disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the
- * thread that created the receiver
- *
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
- public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
- }
-
- /**
- * @see org.eclipse.swt.widgets.Control#computeSize(int, int, boolean)
- */
- @Override
- public Point computeSize(final int wHint, final int hHint, final boolean changed) {
- return new Point(Math.max(300, wHint), renderer.getSelectorHeight() + 2);
- }
-
- /**
- * Removes the listener from the collection of listeners who will be notified
- * when the control is selected by the user.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException
- *
- * - ERROR_NULL_ARGUMENT - if the listener is null
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been
- * disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the
- * thread that created the receiver
- *
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
- public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
- }
-
- // ----------------------- Getters & Setters
-
- /**
- * Returns the minimum value which the receiver will allow.
- *
- * @return the minimum
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
- */
- public int getMinimum() {
- checkWidget();
- return minimum;
- }
-
- /**
- * Sets the minimum value. If this value is greater than the maximum, an exception is thrown
- *
- * @param value the new minimum
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
- */
- public void setMinimum(final int minimum) {
- checkWidget();
- if (minimum > maximum) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT, new IllegalArgumentException(String.format("Value %d is greater than the maximum value (%d)", minimum, maximum)));
- }
- this.minimum = minimum;
- redraw();
- update();
- }
-
- /**
- * Returns the maximum value which the receiver will allow.
- *
- * @return the maximum
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
- */
- public int getMaximum() {
- checkWidget();
- return maximum;
- }
-
- /**
- * Sets the maximum value. If this value is lower than the minimum, an exception is thrown
- *
- * @param value the new minimum
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
- */
- public void setMaximum(final int maximum) {
- checkWidget();
- if (maximum < minimum) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT, new IllegalArgumentException(String.format("Value %d is lower than the minimum value (%d)", maximum, minimum)));
- }
- this.maximum = maximum;
- redraw();
- update();
- }
-
- /**
- * Returns the receiver's value.
- *
- * @return the selection
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
- */
- public int getValue() {
- checkWidget();
- return value;
- }
-
- /**
- * Sets the receiver's value. If the value is lower to minimum or greater than the maximum, an exception is thrown
- *
- * @param value the new selection (must be zero or greater)
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
- */
- public void setValue(final int value) {
- checkWidget();
- if (value < minimum || value > maximum) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT, new IllegalArgumentException(String.format("Value %d is not int the range [%d - %d]", value, minimum, maximum)));
- }
- this.value = value;
- xPosition = -1;
- redraw();
- update();
- }
-
- /**
- * Return the current renderer for this widget
- *
- * @return the renderer
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
- */
- public NebulaSliderGraphicConfiguration getRenderer() {
- checkWidget();
- return renderer;
- }
-
- /**
- * Sets the renderer for this widget
- *
- * @param renderer the new renderer
- *
- * @exception SWTException
- *
- * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
- */
- public void setRenderer(final NebulaSliderGraphicConfiguration renderer) {
- checkWidget();
- this.renderer = renderer;
- redraw();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2018-2024 Laurent CARON
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors: Laurent CARON (laurent.caron at gmail dot com) - Initial
+ * implementation and API
+ *******************************************************************************/
+package org.eclipse.nebula.widgets.opal.nebulaslider;
+
+import java.util.function.IntFunction;
+
+import org.eclipse.nebula.widgets.opal.commons.SelectionListenerUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * Instances of this class are selectable user interface
+ * objects that represent a range of positive, numeric values.
+ * It is like an horizontal slider
+ *
+ * - Styles:
+ * - (None)
+ * - Events:
+ * - Selection
+ *
+ */
+public class NebulaSlider extends Canvas {
+
+ private NebulaSliderGraphicConfiguration renderer;
+
+ private int minimum;
+ private int maximum;
+ private int value;
+ private int xPosition;
+ private int mouseDeltaX;
+
+ private boolean moving = false;
+
+ private IntFunction format;
+
+ private int movingValue;
+
+ /**
+ * Constructs a new instance of this class given its parent and a style value
+ * describing its behavior and appearance.
+ *
+ * The style value is either one of the style constants defined in class
+ * SWT
which is applicable to instances of this class, or must be
+ * built by bitwise OR'ing together (that is, using the
+ * int
"|" operator) two or more of those SWT
style
+ * constants. The class description lists the style constants that are
+ * applicable to the class. Style bits are also inherited from superclasses.
+ *
+ *
+ * @param parent a composite control which will be the parent of the new
+ * instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException
+ *
+ * - ERROR_NULL_ARGUMENT - if the parent is null
+ *
+ * @exception SWTException
+ *
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the
+ * thread that created the parent
+ * - ERROR_INVALID_SUBCLASS - if this class is not an allowed
+ * subclass
+ *
+ *
+ * @see Widget#getStyle()
+ */
+ public NebulaSlider(final Composite parent, final int style) {
+ super(parent, checkStyle(style) | SWT.DOUBLE_BUFFERED);
+
+ renderer = new NebularSliderDefaultConfiguration(this);
+
+ minimum = Integer.MIN_VALUE;
+ maximum = Integer.MAX_VALUE;
+ value = 0;
+ xPosition = -1;
+
+ addPaintListener(e -> {
+ paintControl(e.gc);
+ });
+ addMouseListeners();
+ }
+
+ private static int checkStyle(final int style) {
+ if ((style & SWT.BORDER) != 0) {
+ return style & ~SWT.BORDER;
+ }
+ return 0;
+ }
+
+ private void paintControl(final GC gc) {
+ gc.setAdvanced(true);
+ gc.setAntialias(SWT.ON);
+
+ if (xPosition < 0) {
+ // Compute xPosition
+ xPosition = computeXPosition();
+ }
+ boolean enabled = isEnabled();
+ drawBar(gc, enabled);
+ drawSelectionPart(gc, enabled);
+ drawSelector(gc, enabled);
+ }
+
+ private void drawBar(final GC gc, boolean enabled) {
+ final Rectangle rect = getClientArea();
+ gc.setForeground(getColor(renderer.getBarBorderColor(), enabled));
+ gc.setBackground(getColor(renderer.getBarInsideColor(), enabled));
+
+ final int hMargin = renderer.getHorizontalMargin();
+ final int selectorWidth = renderer.getSelectorWidth();
+ final int barHeight = renderer.getBarHeight();
+
+ final int x = hMargin + selectorWidth / 2;
+ final int y = (rect.height - barHeight) / 2;
+ final int width = rect.width - hMargin * 2 - selectorWidth;
+
+ gc.fillRoundRectangle(x, y, width, barHeight, barHeight, barHeight);
+ gc.drawRoundRectangle(x, y, width, barHeight, barHeight, barHeight);
+ }
+
+ private void drawSelectionPart(final GC gc, boolean enabled) {
+ final Rectangle rect = getClientArea();
+ gc.setForeground(getColor(renderer.getBarBorderColor(), enabled));
+ gc.setBackground(getColor(renderer.getBarSelectionColor(), enabled));
+
+ final int barHeight = renderer.getBarHeight();
+
+ final int x = renderer.getHorizontalMargin() + renderer.getSelectorWidth() / 2;
+ final int y = (rect.height - barHeight) / 2;
+
+ gc.fillRoundRectangle(x, y, xPosition, barHeight, barHeight, barHeight);
+ gc.drawRoundRectangle(x, y, xPosition, barHeight, barHeight, barHeight);
+ }
+
+ private int computeXPosition() {
+ final int originalWidth = getClientArea().width - renderer.getHorizontalMargin() * 2 - renderer.getSelectorWidth();
+ final float coeff = value * 1f / (maximum - minimum);
+ final int position = (int) (coeff * originalWidth);
+ return position;
+ }
+
+ private void drawSelector(final GC gc, boolean enabled) {
+ final Rectangle rect = getClientArea();
+ gc.setForeground(getColor(renderer.getSelectorColorBorder(), enabled));
+ gc.setBackground(getColor(renderer.getSelectorColor(), enabled));
+
+ final int hMargin = renderer.getHorizontalMargin();
+
+ final int selectorWidth = renderer.getSelectorWidth();
+ final int selectorHeight = renderer.getSelectorHeight();
+
+ final int y = (rect.height - selectorHeight) / 2;
+
+ // Draw the body
+ gc.fillRoundRectangle(hMargin + xPosition, y, selectorWidth, selectorHeight, selectorHeight, selectorHeight);
+ gc.drawRoundRectangle(hMargin + xPosition, y, selectorWidth, selectorHeight, selectorHeight, selectorHeight);
+
+ // Draw the arrows
+ gc.setForeground(getColor(renderer.getArrowColor(), enabled));
+ gc.setLineWidth(renderer.getArrowLineWidth());
+ final int baseY = y + selectorHeight / 2;
+ gc.drawLine(hMargin + xPosition + 10, baseY, hMargin + xPosition + 17, baseY - 7);
+ gc.drawLine(hMargin + xPosition + 10, baseY, hMargin + xPosition + 17, baseY + 7);
+
+ gc.drawLine(hMargin + xPosition + selectorWidth - 10, baseY, hMargin + xPosition + selectorWidth - 17, baseY - 7);
+ gc.drawLine(hMargin + xPosition + selectorWidth - 10, baseY, hMargin + xPosition + selectorWidth - 17, baseY + 7);
+
+ // And the value
+ gc.setForeground(getColor(renderer.getSelectorTextColor(), enabled));
+ gc.setFont(renderer.getTextFont());
+ final String valueAsString = stringValueOf(value);
+ final Point textSize = gc.textExtent(valueAsString);
+
+ final int xText = hMargin + xPosition + selectorWidth / 2;
+ final int yText = y + selectorHeight / 2;
+
+ gc.drawText(valueAsString, xText - textSize.x / 2, yText - textSize.y / 2, true);
+ }
+
+ @Override
+ public void setBounds(int x, int y, int width, int height) {
+ xPosition = -1;
+ super.setBounds(x, y, width, height);
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if(!enabled && moving) {
+ moving = false;
+ }
+ super.setEnabled(enabled);
+ }
+
+ private Color getColor(Color color, boolean enabled) {
+ if(enabled) {
+ return color;
+ }
+ // see https://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
+ int red = color.getRed();
+ int green = color.getGreen();
+ int blue = color.getBlue();
+ if(red == green && green == blue) {
+ return color;
+ }
+ int g = (int)(0.299 * red + 0.587 * green + 0.114 * blue);
+ return new Color(g, g, g);
+ }
+
+ private String stringValueOf(int value) {
+ if(format != null) {
+ return format.apply(value);
+ }
+ return String.valueOf(value);
+ }
+
+ /**
+ * Set the format that should be used to format the given number to a string.
+ *
+ * @param format
+ * the format or null
to use the default format.
+ */
+ public void setLabelFormatProvider(IntFunction format) {
+ checkWidget();
+ this.format = format;
+ }
+
+ public IntFunction getLabelFormatProvider() {
+ checkWidget();
+ return format;
+ }
+
+ private void addMouseListeners() {
+
+ addListener(SWT.MouseDown, e -> {
+ if(isEnabled()) {
+ final int selectorWidth = renderer.getSelectorWidth();
+ final int selectorHeight = renderer.getSelectorHeight();
+
+ final int y = (getClientArea().height - selectorHeight) / 2;
+ final Rectangle rect = new Rectangle(xPosition + renderer.getHorizontalMargin(), y, selectorWidth, selectorHeight);
+ if (!rect.contains(e.x, e.y)) {
+ return;
+ }
+ moving = true;
+ movingValue = value;
+ mouseDeltaX = xPosition - e.x;
+ }
+ });
+ addListener(SWT.MouseDoubleClick, e -> {
+ moving = false;
+ mouseDeltaX = 0;
+ });
+
+ addListener(SWT.MouseUp, e -> {
+ if(!moving) {
+ return;
+ }
+ moving = false;
+ mouseDeltaX = 0;
+ if(movingValue != value) {
+ SelectionListenerUtil.fireDefaultSelectionListeners(this, e);
+ }
+ redraw();
+ });
+
+ addListener(SWT.MouseMove, e -> {
+ if (!moving) {
+ return;
+ }
+
+ xPosition = e.x + mouseDeltaX;
+ if (xPosition < 0) {
+ xPosition = 0;
+ }
+ final int originalWidth = getClientArea().width - renderer.getHorizontalMargin() * 2 - renderer.getSelectorWidth();
+
+ if (xPosition > originalWidth) {
+ xPosition = originalWidth;
+ }
+
+ // Update value
+ final float ratio = (float) xPosition / originalWidth;
+ int value = (int)Math.floor(ratio * (maximum - minimum));
+ if(this.value != value) {
+ this.value = value;
+ SelectionListenerUtil.fireSelectionListeners(this, e);
+ }
+ redraw();
+
+ });
+ }
+
+
+
+ /**
+ * Adds the listener to the collection of listeners who will be notified when
+ * the control is selected by the user, by sending it one of the messages
+ * defined in the SelectionListener
interface.
+ *
+ * widgetDefaultSelected
is not called.
+ *
+ *
+ * @param listener the listener which should be notified when the control is
+ * selected by the user,
+ *
+ * @exception IllegalArgumentException
+ *
+ * - ERROR_NULL_ARGUMENT - if the listener is null
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been
+ * disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the
+ * thread that created the receiver
+ *
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+ public void addSelectionListener(final SelectionListener listener) {
+ addTypedListener(listener, SWT.Selection);
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Control#computeSize(int, int, boolean)
+ */
+ @Override
+ public Point computeSize(final int wHint, final int hHint, final boolean changed) {
+ return new Point(Math.max(300, wHint), renderer.getSelectorHeight() + 2);
+ }
+
+ /**
+ * Removes the listener from the collection of listeners who will be notified
+ * when the control is selected by the user.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException
+ *
+ * - ERROR_NULL_ARGUMENT - if the listener is null
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been
+ * disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the
+ * thread that created the receiver
+ *
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+ public void removeSelectionListener(final SelectionListener listener) {
+ removeTypedListener(SWT.Selection, listener);
+ }
+
+ // ----------------------- Getters & Setters
+
+ /**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+ public int getMinimum() {
+ checkWidget();
+ return minimum;
+ }
+
+ /**
+ * Sets the minimum value. If this value is greater than the maximum, an exception is thrown
+ *
+ * @param value the new minimum
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+ public void setMinimum(final int minimum) {
+ checkWidget();
+ if (minimum > maximum) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT, new IllegalArgumentException(String.format("Value %d is greater than the maximum value (%d)", minimum, maximum)));
+ }
+ this.minimum = minimum;
+ redraw();
+ update();
+ }
+
+ /**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+ public int getMaximum() {
+ checkWidget();
+ return maximum;
+ }
+
+ /**
+ * Sets the maximum value. If this value is lower than the minimum, an exception is thrown
+ *
+ * @param value the new minimum
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+ public void setMaximum(final int maximum) {
+ checkWidget();
+ if (maximum < minimum) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT, new IllegalArgumentException(String.format("Value %d is lower than the minimum value (%d)", maximum, minimum)));
+ }
+ this.maximum = maximum;
+ redraw();
+ update();
+ }
+
+ /**
+ * Returns the receiver's value.
+ *
+ * @return the selection
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+ public int getValue() {
+ checkWidget();
+ return value;
+ }
+
+ /**
+ * Sets the receiver's value. If the value is lower to minimum or greater than the maximum, an exception is thrown
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+ public void setValue(final int value) {
+ checkWidget();
+ if (value < minimum || value > maximum) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT, new IllegalArgumentException(String.format("Value %d is not int the range [%d - %d]", value, minimum, maximum)));
+ }
+ this.value = value;
+ xPosition = -1;
+ redraw();
+ update();
+ }
+
+ /**
+ * Return the current renderer for this widget
+ *
+ * @return the renderer
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+ public NebulaSliderGraphicConfiguration getRenderer() {
+ checkWidget();
+ return renderer;
+ }
+
+ /**
+ * Sets the renderer for this widget
+ *
+ * @param renderer the new renderer
+ *
+ * @exception SWTException
+ *
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+ public void setRenderer(final NebulaSliderGraphicConfiguration renderer) {
+ checkWidget();
+ this.renderer = renderer;
+ redraw();
+ }
+
+}
diff --git a/widgets/opal/checkboxgroup/org.eclipse.nebula.widgets.opal.checkboxgroup/META-INF/MANIFEST.MF b/widgets/opal/checkboxgroup/org.eclipse.nebula.widgets.opal.checkboxgroup/META-INF/MANIFEST.MF
index d8b820ccc..0907f702f 100644
--- a/widgets/opal/checkboxgroup/org.eclipse.nebula.widgets.opal.checkboxgroup/META-INF/MANIFEST.MF
+++ b/widgets/opal/checkboxgroup/org.eclipse.nebula.widgets.opal.checkboxgroup/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.checkboxgroup
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.checkboxgroup
diff --git a/widgets/opal/checkboxgroup/org.eclipse.nebula.widgets.opal.checkboxgroup/src/org/eclipse/nebula/widgets/opal/checkboxgroup/CheckBoxGroup.java b/widgets/opal/checkboxgroup/org.eclipse.nebula.widgets.opal.checkboxgroup/src/org/eclipse/nebula/widgets/opal/checkboxgroup/CheckBoxGroup.java
index 656b05bcb..db2c7c897 100644
--- a/widgets/opal/checkboxgroup/org.eclipse.nebula.widgets.opal.checkboxgroup/src/org/eclipse/nebula/widgets/opal/checkboxgroup/CheckBoxGroup.java
+++ b/widgets/opal/checkboxgroup/org.eclipse.nebula.widgets.opal.checkboxgroup/src/org/eclipse/nebula/widgets/opal/checkboxgroup/CheckBoxGroup.java
@@ -157,8 +157,7 @@ public void activate() {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -207,8 +206,7 @@ public Layout getLayout() {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
diff --git a/widgets/opal/columnbrowser/org.eclipse.nebula.widgets.opal.columnbrowser/META-INF/MANIFEST.MF b/widgets/opal/columnbrowser/org.eclipse.nebula.widgets.opal.columnbrowser/META-INF/MANIFEST.MF
index 0c0dd6762..47644b833 100644
--- a/widgets/opal/columnbrowser/org.eclipse.nebula.widgets.opal.columnbrowser/META-INF/MANIFEST.MF
+++ b/widgets/opal/columnbrowser/org.eclipse.nebula.widgets.opal.columnbrowser/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.columnbrowser
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.columnbrowser
diff --git a/widgets/opal/columnbrowser/org.eclipse.nebula.widgets.opal.columnbrowser/src/org/eclipse/nebula/widgets/opal/columnbrowser/ColumnBrowserWidget.java b/widgets/opal/columnbrowser/org.eclipse.nebula.widgets.opal.columnbrowser/src/org/eclipse/nebula/widgets/opal/columnbrowser/ColumnBrowserWidget.java
index 1520ac907..bab19dc6b 100644
--- a/widgets/opal/columnbrowser/org.eclipse.nebula.widgets.opal.columnbrowser/src/org/eclipse/nebula/widgets/opal/columnbrowser/ColumnBrowserWidget.java
+++ b/widgets/opal/columnbrowser/org.eclipse.nebula.widgets.opal.columnbrowser/src/org/eclipse/nebula/widgets/opal/columnbrowser/ColumnBrowserWidget.java
@@ -325,8 +325,7 @@ void updateContent() {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -405,8 +404,7 @@ public ColumnItem getSelection() {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/opal/commons/org.eclipse.nebula.widgets.opal.commons/META-INF/MANIFEST.MF b/widgets/opal/commons/org.eclipse.nebula.widgets.opal.commons/META-INF/MANIFEST.MF
index 2aa95f613..a1f246a68 100644
--- a/widgets/opal/commons/org.eclipse.nebula.widgets.opal.commons/META-INF/MANIFEST.MF
+++ b/widgets/opal/commons/org.eclipse.nebula.widgets.opal.commons/META-INF/MANIFEST.MF
@@ -6,7 +6,7 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.equinox.common,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.commons,
org.eclipse.nebula.widgets.opal.commons.resources
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.commons
diff --git a/widgets/opal/commons/org.eclipse.nebula.widgets.opal.commons/src/org/eclipse/nebula/widgets/opal/commons/SelectionListenerUtil.java b/widgets/opal/commons/org.eclipse.nebula.widgets.opal.commons/src/org/eclipse/nebula/widgets/opal/commons/SelectionListenerUtil.java
index 7c265f40d..de135c6f1 100644
--- a/widgets/opal/commons/org.eclipse.nebula.widgets.opal.commons/src/org/eclipse/nebula/widgets/opal/commons/SelectionListenerUtil.java
+++ b/widgets/opal/commons/org.eclipse.nebula.widgets.opal.commons/src/org/eclipse/nebula/widgets/opal/commons/SelectionListenerUtil.java
@@ -18,7 +18,6 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TypedListener;
public class SelectionListenerUtil {
/**
@@ -27,11 +26,12 @@ public class SelectionListenerUtil {
* @param control control on which the selection listener is added
* @param listener listener to add
*/
+ @Deprecated(forRemoval = true)
public static void addSelectionListener(final Control control, final SelectionListener listener) {
if (listener == null) {
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
- TypedListener typedListener = new TypedListener(listener);
+ var typedListener = new org.eclipse.swt.widgets.TypedListener(listener);
control.addListener(SWT.Selection, typedListener);
}
@@ -41,20 +41,13 @@ public static void addSelectionListener(final Control control, final SelectionLi
* @param control control on which the selection listener is removed
* @param listener listener to remove
*/
+ @Deprecated(forRemoval = true)
public static void removeSelectionListener(final Control control, final SelectionListener listener) {
if (listener == null) {
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
- final Listener[] listeners = control.getListeners(SWT.Selection);
- for (Listener l : listeners) {
- if (l instanceof TypedListener) {
- TypedListener typedListener = (TypedListener) l;
- if (typedListener.getEventListener() == listener) {
- ReflectionUtils.callMethod(control, "removeListener", SWT.Selection, ((TypedListener) l).getEventListener());
- return;
- }
- }
- }
+ control.getTypedListeners(SWT.Selection, SelectionListener.class)
+ .forEach(l -> ReflectionUtils.callMethod(control, "removeListener", SWT.Selection, l));
}
/**
diff --git a/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/META-INF/MANIFEST.MF b/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/META-INF/MANIFEST.MF
index 289301e55..69e38a131 100644
--- a/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/META-INF/MANIFEST.MF
+++ b/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.duallist
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.duallist
diff --git a/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/src/org/eclipse/nebula/widgets/opal/duallist/DualList.java b/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/src/org/eclipse/nebula/widgets/opal/duallist/DualList.java
index e5ad6e93b..acec95235 100644
--- a/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/src/org/eclipse/nebula/widgets/opal/duallist/DualList.java
+++ b/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/src/org/eclipse/nebula/widgets/opal/duallist/DualList.java
@@ -306,11 +306,7 @@ public void add(final DLItem item, final int index) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -335,8 +331,7 @@ public void addSelectionListener(final SelectionListener listener) {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/src/org/eclipse/nebula/widgets/opal/duallist/SelectionChangeListener.java b/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/src/org/eclipse/nebula/widgets/opal/duallist/SelectionChangeListener.java
index 2a9da0c3f..c1470c123 100644
--- a/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/src/org/eclipse/nebula/widgets/opal/duallist/SelectionChangeListener.java
+++ b/widgets/opal/duallist/org.eclipse.nebula.widgets.opal.duallist/src/org/eclipse/nebula/widgets/opal/duallist/SelectionChangeListener.java
@@ -12,7 +12,7 @@
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.duallist;
-import org.eclipse.swt.internal.SWTEventListener;
+import java.util.EventListener;
/**
* Classes which implement this interface provide methods that deal with the
@@ -27,9 +27,8 @@
*
* @see SelectionChangeEvent
*/
-@SuppressWarnings("restriction")
@FunctionalInterface
-public interface SelectionChangeListener extends SWTEventListener {
+public interface SelectionChangeListener extends EventListener {
/**
* Sent when selection occurs in the control.
diff --git a/widgets/opal/horizontalspinner/org.eclipse.nebula.widgets.opal.horizontalspinner/META-INF/MANIFEST.MF b/widgets/opal/horizontalspinner/org.eclipse.nebula.widgets.opal.horizontalspinner/META-INF/MANIFEST.MF
index da922a1cb..80555298d 100644
--- a/widgets/opal/horizontalspinner/org.eclipse.nebula.widgets.opal.horizontalspinner/META-INF/MANIFEST.MF
+++ b/widgets/opal/horizontalspinner/org.eclipse.nebula.widgets.opal.horizontalspinner/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.horizontalspinner
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.horizontalspinner
diff --git a/widgets/opal/horizontalspinner/org.eclipse.nebula.widgets.opal.horizontalspinner/src/org/eclipse/nebula/widgets/opal/horizontalspinner/HorizontalSpinner.java b/widgets/opal/horizontalspinner/org.eclipse.nebula.widgets.opal.horizontalspinner/src/org/eclipse/nebula/widgets/opal/horizontalspinner/HorizontalSpinner.java
index e69f01d4f..ed8f8bd31 100644
--- a/widgets/opal/horizontalspinner/org.eclipse.nebula.widgets.opal.horizontalspinner/src/org/eclipse/nebula/widgets/opal/horizontalspinner/HorizontalSpinner.java
+++ b/widgets/opal/horizontalspinner/org.eclipse.nebula.widgets.opal.horizontalspinner/src/org/eclipse/nebula/widgets/opal/horizontalspinner/HorizontalSpinner.java
@@ -363,8 +363,7 @@ public void addModifyListener(final ModifyListener listener) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -627,8 +626,7 @@ public void removeModifyListener(final ModifyListener listener) {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/opal/launcher/org.eclipse.nebula.widgets.opal.launcher/META-INF/MANIFEST.MF b/widgets/opal/launcher/org.eclipse.nebula.widgets.opal.launcher/META-INF/MANIFEST.MF
index c5ebe0fd1..c5f03eca7 100644
--- a/widgets/opal/launcher/org.eclipse.nebula.widgets.opal.launcher/META-INF/MANIFEST.MF
+++ b/widgets/opal/launcher/org.eclipse.nebula.widgets.opal.launcher/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.launcher
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.launcher
diff --git a/widgets/opal/launcher/org.eclipse.nebula.widgets.opal.launcher/src/org/eclipse/nebula/widgets/opal/launcher/Launcher.java b/widgets/opal/launcher/org.eclipse.nebula.widgets.opal.launcher/src/org/eclipse/nebula/widgets/opal/launcher/Launcher.java
index de9a488c6..bbd57363e 100644
--- a/widgets/opal/launcher/org.eclipse.nebula.widgets.opal.launcher/src/org/eclipse/nebula/widgets/opal/launcher/Launcher.java
+++ b/widgets/opal/launcher/org.eclipse.nebula.widgets.opal.launcher/src/org/eclipse/nebula/widgets/opal/launcher/Launcher.java
@@ -152,8 +152,7 @@ private void addListenerToLabel(final LauncherLabel label) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -395,11 +394,7 @@ private void handleKeyPressedEvent(final Event event) {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/opal/rangeslider/org.eclipse.nebula.widgets.opal.rangeslider/META-INF/MANIFEST.MF b/widgets/opal/rangeslider/org.eclipse.nebula.widgets.opal.rangeslider/META-INF/MANIFEST.MF
index 256de7f9d..1f235853f 100644
--- a/widgets/opal/rangeslider/org.eclipse.nebula.widgets.opal.rangeslider/META-INF/MANIFEST.MF
+++ b/widgets/opal/rangeslider/org.eclipse.nebula.widgets.opal.rangeslider/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.rangeslider
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.rangeslider
diff --git a/widgets/opal/rangeslider/org.eclipse.nebula.widgets.opal.rangeslider/src/org/eclipse/nebula/widgets/opal/rangeslider/RangeSlider.java b/widgets/opal/rangeslider/org.eclipse.nebula.widgets.opal.rangeslider/src/org/eclipse/nebula/widgets/opal/rangeslider/RangeSlider.java
index ca857a628..12cce000f 100644
--- a/widgets/opal/rangeslider/org.eclipse.nebula.widgets.opal.rangeslider/src/org/eclipse/nebula/widgets/opal/rangeslider/RangeSlider.java
+++ b/widgets/opal/rangeslider/org.eclipse.nebula.widgets.opal.rangeslider/src/org/eclipse/nebula/widgets/opal/rangeslider/RangeSlider.java
@@ -1126,8 +1126,7 @@ private void translateValues(int amount) {
* @see #removeSelectionListener
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -1320,8 +1319,7 @@ public int getUpperValue() {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/opal/starrating/org.eclipse.nebula.widgets.opal.starrating/META-INF/MANIFEST.MF b/widgets/opal/starrating/org.eclipse.nebula.widgets.opal.starrating/META-INF/MANIFEST.MF
index 18faca184..a5207cbdb 100644
--- a/widgets/opal/starrating/org.eclipse.nebula.widgets.opal.starrating/META-INF/MANIFEST.MF
+++ b/widgets/opal/starrating/org.eclipse.nebula.widgets.opal.starrating/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.starrating
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.starrating
diff --git a/widgets/opal/starrating/org.eclipse.nebula.widgets.opal.starrating/src/org/eclipse/nebula/widgets/opal/starrating/StarRating.java b/widgets/opal/starrating/org.eclipse.nebula.widgets.opal.starrating/src/org/eclipse/nebula/widgets/opal/starrating/StarRating.java
index 4f7665f77..f896dae76 100644
--- a/widgets/opal/starrating/org.eclipse.nebula.widgets.opal.starrating/src/org/eclipse/nebula/widgets/opal/starrating/StarRating.java
+++ b/widgets/opal/starrating/org.eclipse.nebula.widgets.opal.starrating/src/org/eclipse/nebula/widgets/opal/starrating/StarRating.java
@@ -222,8 +222,7 @@ private void onDispose(final Event event) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -323,8 +322,7 @@ public SIZE getSizeOfStars() {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/opal/switchbutton/org.eclipse.nebula.widgets.opal.switchbutton/META-INF/MANIFEST.MF b/widgets/opal/switchbutton/org.eclipse.nebula.widgets.opal.switchbutton/META-INF/MANIFEST.MF
index 2e0870d12..a821daec8 100644
--- a/widgets/opal/switchbutton/org.eclipse.nebula.widgets.opal.switchbutton/META-INF/MANIFEST.MF
+++ b/widgets/opal/switchbutton/org.eclipse.nebula.widgets.opal.switchbutton/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.opal.switchbutton
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.switchbutton
diff --git a/widgets/opal/switchbutton/org.eclipse.nebula.widgets.opal.switchbutton/src/org/eclipse/nebula/widgets/opal/switchbutton/SwitchButton.java b/widgets/opal/switchbutton/org.eclipse.nebula.widgets.opal.switchbutton/src/org/eclipse/nebula/widgets/opal/switchbutton/SwitchButton.java
index bb3aab7d0..be25265e1 100644
--- a/widgets/opal/switchbutton/org.eclipse.nebula.widgets.opal.switchbutton/src/org/eclipse/nebula/widgets/opal/switchbutton/SwitchButton.java
+++ b/widgets/opal/switchbutton/org.eclipse.nebula.widgets.opal.switchbutton/src/org/eclipse/nebula/widgets/opal/switchbutton/SwitchButton.java
@@ -403,8 +403,7 @@ private void drawBorder() {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -429,8 +428,7 @@ public void addSelectionListener(final SelectionListener listener) {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/META-INF/MANIFEST.MF b/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/META-INF/MANIFEST.MF
index 71344fb5a..11456f1cf 100644
--- a/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/META-INF/MANIFEST.MF
+++ b/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: Nebula PGroup
Bundle-SymbolicName: org.eclipse.nebula.widgets.pgroup
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
-Require-Bundle: org.eclipse.swt
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.pgroup,
org.eclipse.nebula.widgets.pgroup.internal;x-internal:=true
Bundle-RequiredExecutionEnvironment: JavaSE-11
diff --git a/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/src/org/eclipse/nebula/widgets/pgroup/PGroup.java b/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/src/org/eclipse/nebula/widgets/pgroup/PGroup.java
index b4fcda2e4..4690b0d1c 100644
--- a/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/src/org/eclipse/nebula/widgets/pgroup/PGroup.java
+++ b/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/src/org/eclipse/nebula/widgets/pgroup/PGroup.java
@@ -37,7 +37,6 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.swt.widgets.Widget;
/**
@@ -692,13 +691,7 @@ private void onDispose()
*/
public void addExpandListener(ExpandListener listener)
{
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Expand, typedListener);
- addListener(SWT.Collapse, typedListener);
+ addTypedListener(listener, SWT.Expand, SWT.Collapse);
}
/**
@@ -720,12 +713,8 @@ public void addExpandListener(ExpandListener listener)
*/
public void removeExpandListener(ExpandListener listener)
{
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
-
- removeListener(SWT.Expand, listener);
- removeListener(SWT.Collapse, listener);
+ removeTypedListener(SWT.Expand, listener);
+ removeTypedListener(SWT.Collapse, listener);
}
/**
diff --git a/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/src/org/eclipse/nebula/widgets/pgroup/PGroupToolItem.java b/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/src/org/eclipse/nebula/widgets/pgroup/PGroupToolItem.java
index 3becfde58..46e2bff91 100644
--- a/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/src/org/eclipse/nebula/widgets/pgroup/PGroupToolItem.java
+++ b/widgets/pgroup/org.eclipse.nebula.widgets.pgroup/src/org/eclipse/nebula/widgets/pgroup/PGroupToolItem.java
@@ -18,7 +18,6 @@
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.TypedListener;
/**
* Instances of this class represent a selectable user interface object that
@@ -76,14 +75,12 @@ public boolean getSelection() {
}
public void addSelectionListener(SelectionListener listener) {
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
public void removeSelectionListener(SelectionListener listener) {
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
void setDropDownArea(Rectangle dropdownArea) {
diff --git a/widgets/pshelf/org.eclipse.nebula.widgets.pshelf/META-INF/MANIFEST.MF b/widgets/pshelf/org.eclipse.nebula.widgets.pshelf/META-INF/MANIFEST.MF
index e308ef1db..7665a1bca 100644
--- a/widgets/pshelf/org.eclipse.nebula.widgets.pshelf/META-INF/MANIFEST.MF
+++ b/widgets/pshelf/org.eclipse.nebula.widgets.pshelf/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: Nebula PShelf
Bundle-SymbolicName: org.eclipse.nebula.widgets.pshelf
Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: Eclipse Nebula
-Require-Bundle: org.eclipse.swt,
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)",
org.eclipse.jface,
org.eclipse.core.runtime,
org.eclipse.nebula.widgets.opal.commons
diff --git a/widgets/pshelf/org.eclipse.nebula.widgets.pshelf/src/org/eclipse/nebula/widgets/pshelf/PShelf.java b/widgets/pshelf/org.eclipse.nebula.widgets.pshelf/src/org/eclipse/nebula/widgets/pshelf/PShelf.java
index d9ce8278e..8d3bd00d9 100644
--- a/widgets/pshelf/org.eclipse.nebula.widgets.pshelf/src/org/eclipse/nebula/widgets/pshelf/PShelf.java
+++ b/widgets/pshelf/org.eclipse.nebula.widgets.pshelf/src/org/eclipse/nebula/widgets/pshelf/PShelf.java
@@ -25,7 +25,6 @@
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.TypedListener;
/**
*
@@ -594,11 +593,7 @@ public PShelfItem[] getItems()
* @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection,typedListener);
- addListener(SWT.DefaultSelection,typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
/**
@@ -619,11 +614,8 @@ public void addSelectionListener(SelectionListener listener) {
* @see #addSelectionListener
*/
public void removeSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
-
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection,listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection,listener);
}
/**
diff --git a/widgets/radiogroup/org.eclipse.nebula.widgets.radiogroup/META-INF/MANIFEST.MF b/widgets/radiogroup/org.eclipse.nebula.widgets.radiogroup/META-INF/MANIFEST.MF
index 6ac9c0d0b..1f6bc9590 100644
--- a/widgets/radiogroup/org.eclipse.nebula.widgets.radiogroup/META-INF/MANIFEST.MF
+++ b/widgets/radiogroup/org.eclipse.nebula.widgets.radiogroup/META-INF/MANIFEST.MF
@@ -6,7 +6,7 @@ Bundle-Version: 0.1.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.equinox.common,
- org.eclipse.swt,
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)",
org.eclipse.jface,
org.eclipse.core.databinding;bundle-version="1.2.0",
org.eclipse.core.databinding.property;bundle-version="1.2.0",
diff --git a/widgets/radiogroup/org.eclipse.nebula.widgets.radiogroup/src/org/eclipse/nebula/widgets/radiogroup/RadioGroup.java b/widgets/radiogroup/org.eclipse.nebula.widgets.radiogroup/src/org/eclipse/nebula/widgets/radiogroup/RadioGroup.java
index d884d46a9..3ccd4232e 100644
--- a/widgets/radiogroup/org.eclipse.nebula.widgets.radiogroup/src/org/eclipse/nebula/widgets/radiogroup/RadioGroup.java
+++ b/widgets/radiogroup/org.eclipse.nebula.widgets.radiogroup/src/org/eclipse/nebula/widgets/radiogroup/RadioGroup.java
@@ -26,7 +26,6 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.swt.widgets.Widget;
/**
@@ -199,13 +198,7 @@ void addItem(RadioItem item, int position) {
* @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- final TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
private int checkAddPosition(int position) {
@@ -573,9 +566,8 @@ void removeItem(RadioItem item) {
* @see #addSelectionListener
*/
public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
/**
diff --git a/widgets/roundedcheckbox/org.eclipse.nebula.widgets.roundedcheckbox/META-INF/MANIFEST.MF b/widgets/roundedcheckbox/org.eclipse.nebula.widgets.roundedcheckbox/META-INF/MANIFEST.MF
index f0df0e648..6bf18325a 100644
--- a/widgets/roundedcheckbox/org.eclipse.nebula.widgets.roundedcheckbox/META-INF/MANIFEST.MF
+++ b/widgets/roundedcheckbox/org.eclipse.nebula.widgets.roundedcheckbox/META-INF/MANIFEST.MF
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;bundle-version="1.0.0";visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Export-Package: org.eclipse.nebula.widgets.roundedcheckbox
Automatic-Module-Name: org.eclipse.nebula.widgets.roundedcheckbox
diff --git a/widgets/roundedcheckbox/org.eclipse.nebula.widgets.roundedcheckbox/src/org/eclipse/nebula/widgets/roundedcheckbox/RoundedCheckbox.java b/widgets/roundedcheckbox/org.eclipse.nebula.widgets.roundedcheckbox/src/org/eclipse/nebula/widgets/roundedcheckbox/RoundedCheckbox.java
index a90769fe0..65d2da3a7 100644
--- a/widgets/roundedcheckbox/org.eclipse.nebula.widgets.roundedcheckbox/src/org/eclipse/nebula/widgets/roundedcheckbox/RoundedCheckbox.java
+++ b/widgets/roundedcheckbox/org.eclipse.nebula.widgets.roundedcheckbox/src/org/eclipse/nebula/widgets/roundedcheckbox/RoundedCheckbox.java
@@ -240,8 +240,7 @@ private Color getAndDisposeColor(int r, int g, int b) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -391,8 +390,7 @@ public Color getUnselectedColor() {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/roundedswitch/org.eclipse.nebula.widgets.roundedswitch/META-INF/MANIFEST.MF b/widgets/roundedswitch/org.eclipse.nebula.widgets.roundedswitch/META-INF/MANIFEST.MF
index 99a0bc60e..7c52b854b 100644
--- a/widgets/roundedswitch/org.eclipse.nebula.widgets.roundedswitch/META-INF/MANIFEST.MF
+++ b/widgets/roundedswitch/org.eclipse.nebula.widgets.roundedswitch/META-INF/MANIFEST.MF
@@ -7,5 +7,5 @@ Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.nebula.widgets.roundedswitch
Require-Bundle: org.eclipse.nebula.widgets.opal.commons;visibility:=reexport,
- org.eclipse.swt
+ org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Automatic-Module-Name: org.eclipse.nebula.widgets.roundedswitch
diff --git a/widgets/roundedswitch/org.eclipse.nebula.widgets.roundedswitch/src/org/eclipse/nebula/widgets/roundedswitch/RoundedSwitch.java b/widgets/roundedswitch/org.eclipse.nebula.widgets.roundedswitch/src/org/eclipse/nebula/widgets/roundedswitch/RoundedSwitch.java
index 2b98aedfd..240248b80 100644
--- a/widgets/roundedswitch/org.eclipse.nebula.widgets.roundedswitch/src/org/eclipse/nebula/widgets/roundedswitch/RoundedSwitch.java
+++ b/widgets/roundedswitch/org.eclipse.nebula.widgets.roundedswitch/src/org/eclipse/nebula/widgets/roundedswitch/RoundedSwitch.java
@@ -253,8 +253,7 @@ private void onKeyPress(Event e) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.addSelectionListener(this, listener);
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -321,8 +320,7 @@ public boolean getSelection() {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- SelectionListenerUtil.removeSelectionListener(this, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**
diff --git a/widgets/tablecombo/org.eclipse.nebula.widgets.tablecombo/META-INF/MANIFEST.MF b/widgets/tablecombo/org.eclipse.nebula.widgets.tablecombo/META-INF/MANIFEST.MF
index 57cd96d45..eb71583d3 100644
--- a/widgets/tablecombo/org.eclipse.nebula.widgets.tablecombo/META-INF/MANIFEST.MF
+++ b/widgets/tablecombo/org.eclipse.nebula.widgets.tablecombo/META-INF/MANIFEST.MF
@@ -9,6 +9,6 @@ Export-Package: org.eclipse.nebula.jface.checktablecomboviewer,
org.eclipse.nebula.widgets.tablecombo
Automatic-Module-Name: org.eclipse.nebula.widgets.tablecombo
Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: org.eclipse.swt,
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)",
org.eclipse.jface;resolution:=optional
Bundle-Vendor: Eclipse Nebula
diff --git a/widgets/tablecombo/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/widgets/tablecombo/TableCombo.java b/widgets/tablecombo/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/widgets/tablecombo/TableCombo.java
index a3be4c993..6c64d05a9 100644
--- a/widgets/tablecombo/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/widgets/tablecombo/TableCombo.java
+++ b/widgets/tablecombo/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/widgets/tablecombo/TableCombo.java
@@ -57,7 +57,6 @@
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.swt.widgets.Widget;
/**
@@ -342,12 +341,7 @@ private static int checkStyle(final int style) {
* @see #removeModifyListener
*/
public void addModifyListener(final ModifyListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- final TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Modify, typedListener);
+ addTypedListener(listener, SWT.Modify);
}
/**
@@ -381,14 +375,7 @@ public void addModifyListener(final ModifyListener listener) {
* @see SelectionEvent
*/
public void addSelectionListener(final SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
-
- final TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ addTypedListener(listener, SWT.Selection, SWT.DefaultSelection);
}
/**
@@ -473,12 +460,7 @@ public void removeTextControlKeyListener(final KeyListener listener) {
* @since 3.3
*/
public void addVerifyListener(final VerifyListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- final TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Verify, typedListener);
+ addTypedListener(listener, SWT.Verify);
}
/**
@@ -1818,11 +1800,7 @@ public void redraw(final int x, final int y, final int width, final int height,
* @see #addModifyListener
*/
public void removeModifyListener(final ModifyListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Modify, listener);
+ removeTypedListener(SWT.Modify, listener);
}
/**
@@ -1848,12 +1826,8 @@ public void removeModifyListener(final ModifyListener listener) {
* @see #addSelectionListener
*/
public void removeSelectionListener(final SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
+ removeTypedListener(SWT.Selection, listener);
+ removeTypedListener(SWT.DefaultSelection, listener);
}
/**
@@ -1881,11 +1855,7 @@ public void removeSelectionListener(final SelectionListener listener) {
* @since 3.3
*/
public void removeVerifyListener(final VerifyListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Verify, listener);
+ removeTypedListener(SWT.Verify, listener);
}
/**
diff --git a/widgets/tiles/org.eclipse.nebula.widgets.tiles/META-INF/MANIFEST.MF b/widgets/tiles/org.eclipse.nebula.widgets.tiles/META-INF/MANIFEST.MF
index 83b21d5f1..a278fa7e6 100644
--- a/widgets/tiles/org.eclipse.nebula.widgets.tiles/META-INF/MANIFEST.MF
+++ b/widgets/tiles/org.eclipse.nebula.widgets.tiles/META-INF/MANIFEST.MF
@@ -6,5 +6,5 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Nebula
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.nebula.widgets.tiles
-Require-Bundle: org.eclipse.swt
+Require-Bundle: org.eclipse.swt;bundle-version="[3.126.0,4.0.0)"
Automatic-Module-Name: org.eclipse.nebula.widgets.tiles
diff --git a/widgets/tiles/org.eclipse.nebula.widgets.tiles/src/org/eclipse/nebula/widgets/tiles/Tiles.java b/widgets/tiles/org.eclipse.nebula.widgets.tiles/src/org/eclipse/nebula/widgets/tiles/Tiles.java
index 0c4faf57d..1e2ce4dd3 100644
--- a/widgets/tiles/org.eclipse.nebula.widgets.tiles/src/org/eclipse/nebula/widgets/tiles/Tiles.java
+++ b/widgets/tiles/org.eclipse.nebula.widgets.tiles/src/org/eclipse/nebula/widgets/tiles/Tiles.java
@@ -35,7 +35,6 @@
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.TypedListener;
/**
*
@@ -109,8 +108,7 @@ public Tiles(final Composite parent, final int style) {
* @param listener
*/
public void addSelectionListener(final SelectionListener listener) {
- super.checkWidget();
- addListener(SWT.Selection, new TypedListener(listener));
+ addTypedListener(listener, SWT.Selection);
}
/**
@@ -253,8 +251,7 @@ public T getSelectedItem() {
* @param listener
*/
public void removeSelectionListener(final SelectionListener listener) {
- super.checkWidget();
- removeListener(SWT.Selection, listener);
+ removeTypedListener(SWT.Selection, listener);
}
/**