Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2016-12-19 15:25:13 +0000
committerLars Vogel2016-12-19 15:27:59 +0000
commitad9ceabecfb05a542f6a6880caf28cd0507de235 (patch)
treec16b4f1a11dfa3c42f64b4d6ae7c50dd3b2b8c81 /examples
parentf0890aa81ebbecdf2e03e940d69910d71353c6a6 (diff)
downloadeclipse.platform.swt-ad9ceabecfb05a542f6a6880caf28cd0507de235.tar.gz
eclipse.platform.swt-ad9ceabecfb05a542f6a6880caf28cd0507de235.tar.xz
eclipse.platform.swt-ad9ceabecfb05a542f6a6880caf28cd0507de235.zip
Bug 509454 - Use lambdas in org.eclipse.swt.examples for sorting and
ToolTipHelpTextHandler Change-Id: Ibdd333a69afed60f6e577348069cff8f02d310dc Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java8
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java27
2 files changed, 10 insertions, 25 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java
index 158a44f11d..dc421aa075 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java
@@ -14,7 +14,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.MissingResourceException;
@@ -382,12 +381,7 @@ static Image createImage(Device device, Color color) {
void createTabList(Composite parent) {
tabList = new Tree(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- Arrays.sort(tabs, new Comparator<GraphicsTab>() {
- @Override
- public int compare(GraphicsTab tab0, GraphicsTab tab1) {
- return tab0.getText().compareTo(tab1.getText());
- }
- });
+ Arrays.sort(tabs, (tab0, tab1) -> tab0.getText().compareTo(tab1.getText()));
HashSet<String> set = new HashSet<>();
for (GraphicsTab tab : tabs) {
set.add(tab.getCategory());
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
index 9ec69faa3d..0d5b1839d0 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
@@ -169,12 +169,9 @@ public class HoverHelp {
item.setText (getResourceString("ToolItem.text", new Object[] { Integer.valueOf(i) }));
item.setData ("TIP_TEXT", getResourceString("ToolItem.tooltip",
new Object[] { item.getText(), helpKey }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- @Override
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("ToolItem.help", new Object[] { item.getText() });
- }
+ item.setData ("TIP_HELPTEXTHANDLER", (ToolTipHelpTextHandler) widget -> {
+ Item item1 = (Item) widget;
+ return getResourceString("ToolItem.help", new Object[] { item1.getText() });
});
}
GridData gridData = new GridData();
@@ -190,12 +187,9 @@ public class HoverHelp {
item.setText (getResourceString("TableItem.text", new Object[] { Integer.valueOf(i) }));
item.setData ("TIP_TEXT", getResourceString("TableItem.tooltip",
new Object[] { item.getText(), helpKey }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- @Override
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("TableItem.help", new Object[] { item.getText() });
- }
+ item.setData ("TIP_HELPTEXTHANDLER", (ToolTipHelpTextHandler) widget -> {
+ Item item1 = (Item) widget;
+ return getResourceString("TableItem.help", new Object[] { item1.getText() });
});
}
table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
@@ -209,12 +203,9 @@ public class HoverHelp {
item.setText (getResourceString("TreeItem.text", new Object[] { Integer.valueOf(i) }));
item.setData ("TIP_TEXT", getResourceString("TreeItem.tooltip",
new Object[] { item.getText(), helpKey}));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- @Override
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("TreeItem.help", new Object[] { item.getText() });
- }
+ item.setData ("TIP_HELPTEXTHANDLER", (ToolTipHelpTextHandler) widget -> {
+ Item item1 = (Item) widget;
+ return getResourceString("TreeItem.help", new Object[] { item1.getText() });
});
}
tree.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));

Back to the top