Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-02-12 00:08:04 +0000
committerAlexander Kurtakov2016-02-12 00:08:04 +0000
commit901da5da4c367dfcf7525c18e299ca0c850bed73 (patch)
tree2167d3208cc36e4ff8a90db8632bd7b7f851fe23 /examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java
parent643731f5fac0d73886ec0a882195202f18994c6c (diff)
downloadeclipse.platform.swt-901da5da4c367dfcf7525c18e299ca0c850bed73.tar.gz
eclipse.platform.swt-901da5da4c367dfcf7525c18e299ca0c850bed73.tar.xz
eclipse.platform.swt-901da5da4c367dfcf7525c18e299ca0c850bed73.zip
Bug 485821 - Make examples/snippets use lambdas
Convert *Listener in snippets. (take 2) Change-Id: I9483e5868c7a1f628f8c1ccfd121afbf5bc6a9ce Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java')
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java
index b5b3741aa3..5f25f8ea5e 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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,7 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.snippets;
-/*
+/*
* Text snippet: type in one text, output to another
*
* For a list of all SWT example snippets see
@@ -18,9 +18,8 @@ package org.eclipse.swt.snippets;
*/
import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
public class Snippet243 {
@@ -30,13 +29,10 @@ public static void main(String [] args) {
shell.setLayout(new FillLayout ());
final Text text0 = new Text (shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
final Text text1 = new Text (shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- text0.addVerifyListener (new VerifyListener () {
- @Override
- public void verifyText (VerifyEvent event) {
- text1.setTopIndex (text0.getTopIndex ());
- text1.setSelection (event.start, event.end);
- text1.insert (event.text);
- }
+ text0.addVerifyListener (event -> {
+ text1.setTopIndex (text0.getTopIndex ());
+ text1.setSelection (event.start, event.end);
+ text1.insert (event.text);
});
shell.setBounds(10, 10, 200, 200);
shell.open ();

Back to the top