Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-08-16 14:26:37 +0000
committerAlexander Kurtakov2017-08-16 14:29:09 +0000
commit353102c1044a3c74003f428b4a2954b9c2ffa3b9 (patch)
treeddc5438fe0e0f65665139e6aab6495daaa1aab7e /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets
parent3d437018e83f5495163427612f671fd452804c4d (diff)
downloadeclipse.platform.swt-353102c1044a3c74003f428b4a2954b9c2ffa3b9.tar.gz
eclipse.platform.swt-353102c1044a3c74003f428b4a2954b9c2ffa3b9.tar.xz
eclipse.platform.swt-353102c1044a3c74003f428b4a2954b9c2ffa3b9.zip
Bug 521018 - [api] Provide helpers to use lambda expressions for
CTabFolder2Listener Add helper methods. Change-Id: I976cb4b00cdda4c49750cceca0116944475085d4 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Adapter.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Listener.java89
2 files changed, 94 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Adapter.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Adapter.java
index 5cabe06049..d474e041b2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Adapter.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Adapter.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
@@ -18,6 +18,11 @@ package org.eclipse.swt.custom;
* 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 in
+ * {@link CTabFolder2Listener},
+ * which accept a lambda expression or a method reference that implements the event consumer.
+ * </p>
*
* @see CTabFolder2Listener
* @see CTabFolderEvent
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Listener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Listener.java
index e2796def11..928bda967f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Listener.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Listener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.swt.custom;
+import java.util.function.*;
+
import org.eclipse.swt.internal.*;
/**
@@ -109,4 +111,89 @@ public void restore(CTabFolderEvent event);
* @see CTabFolder#setSelection(CTabItem)
*/
public void showList(CTabFolderEvent event);
+
+/**
+ * Static helper method to create a <code>CTabFolder2Listener</code> for the
+ * {@link #close(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
+ *
+ * @param c the consumer of the event
+ * @return CTabFolder2Listener
+ * @since 3.107
+ */
+public static CTabFolder2Listener closeAdapter(Consumer<CTabFolderEvent> c) {
+ return new CTabFolder2Adapter() {
+ @Override
+ public void close(CTabFolderEvent e) {
+ c.accept(e);
+ }
+ };
+}
+
+/**
+ * Static helper method to create a <code>CTabFolder2Listener</code> for the
+ * {@link #minimize(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
+ *
+ * @param c the consumer of the event
+ * @return CTabFolder2Listener
+ * @since 3.107
+ */
+public static CTabFolder2Listener minimizeAdapter(Consumer<CTabFolderEvent> c) {
+ return new CTabFolder2Adapter() {
+ @Override
+ public void minimize(CTabFolderEvent e) {
+ c.accept(e);
+ }
+ };
+}
+
+/**
+ * Static helper method to create a <code>CTabFolder2Listener</code> for the
+ * {@link #maximize(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
+ *
+ * @param c the consumer of the event
+ * @return CTabFolder2Listener
+ * @since 3.107
+ */
+public static CTabFolder2Listener maximizeAdapter(Consumer<CTabFolderEvent> c) {
+ return new CTabFolder2Adapter() {
+ @Override
+ public void maximize(CTabFolderEvent e) {
+ c.accept(e);
+ }
+ };
+}
+
+/**
+ * Static helper method to create a <code>CTabFolder2Listener</code> for the
+ * {@link #restore(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
+ *
+ * @param c the consumer of the event
+ * @return CTabFolder2Listener
+ * @since 3.107
+ */
+public static CTabFolder2Listener restoreAdapter(Consumer<CTabFolderEvent> c) {
+ return new CTabFolder2Adapter() {
+ @Override
+ public void restore(CTabFolderEvent e) {
+ c.accept(e);
+ }
+ };
+}
+
+/**
+ * Static helper method to create a <code>CTabFolder2Listener</code> for the
+ * {@link #showList(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
+ *
+ * @param c the consumer of the event
+ * @return CTabFolder2Listener
+ * @since 3.107
+ */
+public static CTabFolder2Listener showListAdapter(Consumer<CTabFolderEvent> c) {
+ return new CTabFolder2Adapter() {
+ @Override
+ public void showList(CTabFolderEvent e) {
+ c.accept(e);
+ }
+ };
+}
}

Back to the top