diff options
Diffstat (limited to 'examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java')
-rw-r--r-- | examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java index c6eba0c91f..732ccc5295 100644 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 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,11 +10,22 @@ *******************************************************************************/ package org.eclipse.swt.examples.layoutexample; -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.custom.TableEditor; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; class StackLayoutTab extends Tab { /* Controls for setting layout parameters */ @@ -49,30 +60,28 @@ class StackLayoutTab extends Tab { /* Add TableEditors */ comboEditor = new TableEditor(table); nameEditor = new TableEditor(table); - table.addMouseListener (new MouseAdapter() { - @Override - public void mouseDown(MouseEvent e) { - resetEditors(); - index = table.getSelectionIndex(); - if (index == -1) return; - //set top layer of stack to the selected item - setTopControl (index); + table.addMouseListener(MouseListener.mouseDownAdapter(e -> { + resetEditors(); + index = table.getSelectionIndex(); + if (index == -1) + return; + // set top layer of stack to the selected item + setTopControl(index); - TableItem oldItem = comboEditor.getItem(); - newItem = table.getItem(index); - if (newItem == oldItem || newItem != lastSelected) { - lastSelected = newItem; - return; - } - table.showSelection(); - combo = new CCombo(table, SWT.READ_ONLY); - createComboEditor(combo, comboEditor); - - nameText = new Text(table, SWT.SINGLE); - nameText.setText(data.get(index)[NAME_COL]); - createTextEditor(nameText, nameEditor, NAME_COL); + TableItem oldItem = comboEditor.getItem(); + newItem = table.getItem(index); + if (newItem == oldItem || newItem != lastSelected) { + lastSelected = newItem; + return; } - }); + table.showSelection(); + combo = new CCombo(table, SWT.READ_ONLY); + createComboEditor(combo, comboEditor); + + nameText = new Text(table, SWT.SINGLE); + nameText.setText(data.get(index)[NAME_COL]); + createTextEditor(nameText, nameEditor, NAME_COL); + })); } /** @@ -89,23 +98,14 @@ class StackLayoutTab extends Tab { backButton.setText("<<"); backButton.setEnabled(false); backButton.setLayoutData(new GridData (SWT.END, SWT.CENTER, false, false)); - backButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setTopControl (currentLayer - 1); - } - }); + backButton.addSelectionListener(SelectionListener.widgetSelectedAdapter( e ->setTopControl (currentLayer - 1))); topControl = new Label (columnGroup, SWT.BORDER); topControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); advanceButton = new Button(columnGroup, SWT.PUSH); advanceButton.setText(">>"); advanceButton.setEnabled(false); - advanceButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setTopControl (currentLayer + 1); - } - }); + advanceButton + .addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> setTopControl(currentLayer + 1))); /* Controls the margins of the StackLayout */ Group marginGroup = new Group(controlGroup, SWT.NONE); |