Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java38
-rw-r--r--bundles/org.eclipse.swt/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.swt/pom.xml4
4 files changed, 48 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java
index 1f5211de99..73267ca91b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,6 +19,13 @@ package org.eclipse.swt.events;
* extend this class and override only the methods which they are
* interested in.
* </p>
+ * <p>
+ * An alternative to this class are the static helper methods
+ * {@link ControlListener#controlMovedAdapter(java.util.function.Consumer)}
+ * and
+ * {@link ControlListener#controlResizedAdapter(java.util.function.Consumer)},
+ * which accept a lambda expression or a method reference that implements the event consumer.
+ * </p>
*
* @see ControlListener
* @see ControlEvent
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java
index 214ae80641..c77aff377c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java
@@ -11,7 +11,9 @@
package org.eclipse.swt.events;
-import org.eclipse.swt.internal.SWTEventListener;
+import java.util.function.*;
+
+import org.eclipse.swt.internal.*;
/**
* Classes which implement this interface provide methods
@@ -45,4 +47,38 @@ public void controlMoved(ControlEvent e);
* @param e an event containing information about the resize
*/
public void controlResized(ControlEvent e);
+
+/**
+ * Static helper method to create a <code>ControlListener</code> for the
+ * {@link #controlMoved(ControlEvent e)}) method, given a lambda expression or a method reference.
+ *
+ * @param c the consumer of the event
+ * @return ControlListener
+ * @since 3.107
+ */
+public static ControlListener controlMovedAdapter(Consumer<ControlEvent> c) {
+ return new ControlAdapter() {
+ @Override
+ public void controlMoved(ControlEvent e) {
+ c.accept(e);
+ }
+ };
+}
+
+/**
+ * Static helper method to create a <code>ControlListener</code> for the
+ * {@link #controlResized(ControlEvent e)}) method, given a lambda expression or a method reference.
+ *
+ * @param c the consumer of the event
+ * @return ControlListener
+ * @since 3.107
+ */
+public static ControlListener controlResizedAdapter(Consumer<ControlEvent> c) {
+ return new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ c.accept(e);
+ }
+ };
+}
}
diff --git a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
index 04fe47182d..861620223c 100644
--- a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt; singleton:=true
-Bundle-Version: 3.106.100.qualifier
+Bundle-Version: 3.107.0.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
DynamicImport-Package: org.eclipse.swt.accessibility2
diff --git a/bundles/org.eclipse.swt/pom.xml b/bundles/org.eclipse.swt/pom.xml
index 04c2226f89..cfe631fb74 100644
--- a/bundles/org.eclipse.swt/pom.xml
+++ b/bundles/org.eclipse.swt/pom.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><!--
- Copyright (c) 2012, 2013 Eclipse Foundation and others.
+ Copyright (c) 2012, 2017 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt</artifactId>
- <version>3.106.100-SNAPSHOT</version>
+ <version>3.107.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<forceContextQualifier>v20170808-1903</forceContextQualifier>

Back to the top