diff options
author | Karsten Thoms | 2017-09-12 19:29:25 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-09-15 10:44:27 +0000 |
commit | 181919e5b8cdbec2c1f51f16259e108bc6061c68 (patch) | |
tree | 0f6420e0db695da2e6c70dbe721f64448f5e2ba0 /examples | |
parent | 1b5ea6f7ef4fc785f50caae9062862fc535eb1f7 (diff) | |
download | eclipse.platform.swt-181919e5b8cdbec2c1f51f16259e108bc6061c68.tar.gz eclipse.platform.swt-181919e5b8cdbec2c1f51f16259e108bc6061c68.tar.xz eclipse.platform.swt-181919e5b8cdbec2c1f51f16259e108bc6061c68.zip |
Bug 522211 - Use valueOf instead of Number constructor
Change-Id: Ic45b2ab3338b364a26c38b29b4c5adcd6de54ec9
Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
Diffstat (limited to 'examples')
6 files changed, 27 insertions, 27 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java index 0b454abb06..25ab801cdd 100644 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java @@ -1704,7 +1704,7 @@ boolean headerUpdateToolTip (int x) { toolTipLabel.setText (tooltip); CTableColumn column = getOrderedColumns () [computeColumnIntersect (x, 0)]; - toolTipShell.setData (new Integer (column.getIndex ())); + toolTipShell.setData (Integer.valueOf (column.getIndex ())); Point labelSize = toolTipLabel.computeSize (SWT.DEFAULT, SWT.DEFAULT, true); labelSize.x += 2; labelSize.y += 2; toolTipLabel.setSize (labelSize); diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java index 3e89da63cf..64bca7414f 100644 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java @@ -1094,9 +1094,9 @@ abstract class Tab { } else if (typeName.equals("int")) { parameter = new Object[] {Integer.valueOf(value)}; } else if (typeName.equals("long")) { - parameter = new Object[] {new Long(value)}; + parameter = new Object[] {Long.valueOf(value)}; } else if (typeName.equals("char")) { - parameter = new Object[] {value.length() == 1 ? new Character(value.charAt(0)) : new Character('\0')}; + parameter = new Object[] {value.length() == 1 ? Character.valueOf(value.charAt(0)) : Character.valueOf('\0')}; } else if (typeName.equals("boolean")) { parameter = new Object[] {Boolean.valueOf(value)}; } else if (typeName.equals("java.lang.String")) { diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java index f5baaeae8b..887db699d6 100644 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java @@ -1703,7 +1703,7 @@ public class ImageAnalyzer { string = createMsg(bundle.getString("Transparent_pixel_value"), pixelInfo(imageData.transparentPixel)); transparentPixelLabel.setText(string); - string = createMsg(bundle.getString("Time_to_load_value"), new Long(loadTime)); + string = createMsg(bundle.getString("Time_to_load_value"), Long.valueOf(loadTime)); timeToLoadLabel.setText(string); string = createMsg(bundle.getString("Animation_size_value"), diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java index b8e4394d0b..908a2be7a9 100644 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java @@ -373,7 +373,7 @@ class FormLayoutTab extends Tab { if (data.left.control != null) { TableItem item = table.getItem (i); String controlString = item.getText (LEFT_COL); - int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); + int index = Integer.valueOf(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); code.append ("\t\tdata.left = new FormAttachment (" + names [index] + ", " + data.left.offset + ", SWT." + alignmentString (data.left.alignment) + ");\n"); } else { if (data.right != null || (data.left.numerator != 0 ||data.left.offset != 0)) { @@ -468,12 +468,12 @@ class FormLayoutTab extends Tab { nameText.setText (oldItem.getText (NAME_COL)); } try { - new Integer (widthText.getText ()).intValue (); + Integer.parseInt(widthText.getText ()); } catch (NumberFormatException e) { widthText.setText (oldItem.getText (WIDTH_COL)); } try { - Integer.valueOf(heightText.getText()).intValue(); + Integer.parseInt(heightText.getText()); } catch(NumberFormatException e) { heightText.setText (oldItem.getText(HEIGHT_COL)); } @@ -517,11 +517,11 @@ class FormLayoutTab extends Tab { i++; } String end = control.substring (i); - int index = new Integer (end).intValue (); + int index = Integer.valueOf(end).intValue (); Control attachControl = children [index]; int colon = attachment.indexOf (':'); try { - offset = new Integer (attachment.substring (comma + 1, colon)).intValue (); + offset = Integer.valueOf(attachment.substring (comma + 1, colon)).intValue (); } catch (NumberFormatException e) { offset = 0; } @@ -554,8 +554,8 @@ class FormLayoutTab extends Tab { int width, height; String left, right, top, bottom; for (int i = 0; i < children.length; i++) { - width = new Integer (items [i].getText (WIDTH_COL)).intValue (); - height = new Integer (items [i].getText (HEIGHT_COL)).intValue (); + width = Integer.valueOf(items [i].getText (WIDTH_COL)).intValue (); + height = Integer.valueOf(items [i].getText (HEIGHT_COL)).intValue (); data = new FormData (); if (width > 0) data.width = width; if (height > 0) data.height = height; @@ -744,7 +744,7 @@ class FormLayoutTab extends Tab { if (positionInput.length() == 0) positionInput = "0"; try { - new Integer(positionInput).intValue(); + Integer.parseInt(positionInput); } catch (NumberFormatException except) { positionInput = "0"; } @@ -752,7 +752,7 @@ class FormLayoutTab extends Tab { if (offsetInput.length() == 0) offsetInput = "0"; try { - new Integer(offsetInput).intValue(); + Integer.parseInt(offsetInput); } catch (NumberFormatException except) { offsetInput = "0"; } diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java index f275a6997e..33e123e311 100644 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java @@ -540,42 +540,42 @@ class GridLayoutTab extends Tab { nameText.setText (oldItem.getText (NAME_COL)); } try { - new Integer (widthText.getText ()).intValue (); + Integer.parseInt(widthText.getText ()); } catch (NumberFormatException e) { widthText.setText (oldItem.getText (WIDTH_COL)); } try { - new Integer (heightText.getText ()).intValue (); + Integer.parseInt(heightText.getText ()); } catch (NumberFormatException e) { heightText.setText (oldItem.getText (HEIGHT_COL)); } try { - new Integer (hSpan.getText ()).intValue (); + Integer.parseInt(hSpan.getText ()); } catch (NumberFormatException e) { hSpan.setText (oldItem.getText (HSPAN_COL)); } try { - new Integer (vSpan.getText ()).intValue (); + Integer.parseInt(vSpan.getText ()); } catch (NumberFormatException e) { vSpan.setText (oldItem.getText (VSPAN_COL)); } try { - new Integer (hIndent.getText ()).intValue (); + Integer.parseInt(hIndent.getText ()); } catch (NumberFormatException e) { hIndent.setText (oldItem.getText (HINDENT_COL)); } try { - new Integer (vIndent.getText ()).intValue (); + Integer.parseInt(vIndent.getText ()); } catch (NumberFormatException e) { vIndent.setText (oldItem.getText (VINDENT_COL)); } try { - new Integer (minWidthText.getText ()).intValue (); + Integer.parseInt(minWidthText.getText ()); } catch (NumberFormatException e) { minWidthText.setText (oldItem.getText (MINWIDTH_COL)); } try { - new Integer (minHeightText.getText ()).intValue (); + Integer.parseInt(minHeightText.getText ()); } catch (NumberFormatException e) { minHeightText.setText (oldItem.getText (MINHEIGHT_COL)); } @@ -620,8 +620,8 @@ class GridLayoutTab extends Tab { for (int i = 0; i < children.length; i++) { data = new GridData (); /* Set widthHint and heightHint */ - data.widthHint = new Integer (items [i].getText (WIDTH_COL)).intValue (); - data.heightHint = new Integer (items [i].getText (HEIGHT_COL)).intValue (); + data.widthHint = Integer.valueOf(items [i].getText (WIDTH_COL)).intValue (); + data.heightHint = Integer.valueOf(items [i].getText (HEIGHT_COL)).intValue (); /* Set vertical alignment and horizontal alignment */ hAlign = items [i].getText (HALIGN_COL); if (hAlign.equals ("CENTER")) { diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java index 49b11139ce..1f7422e8c8 100644 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java @@ -370,12 +370,12 @@ class RowLayoutTab extends Tab { nameText.setText(oldItem.getText(NAME_COL)); } try { - new Integer (widthText.getText ()).intValue (); + Integer.parseInt(widthText.getText ()); } catch (NumberFormatException e) { widthText.setText (oldItem.getText (WIDTH_COL)); } try { - new Integer (heightText.getText ()).intValue (); + Integer.parseInt(heightText.getText ()); } catch (NumberFormatException e) { heightText.setText (oldItem.getText (HEIGHT_COL)); } @@ -405,8 +405,8 @@ class RowLayoutTab extends Tab { int width, height; String exclude; for (int i = 0; i < children.length; i++) { - width = new Integer (items [i].getText (WIDTH_COL)).intValue (); - height = new Integer (items [i].getText (HEIGHT_COL)).intValue (); + width = Integer.valueOf(items [i].getText (WIDTH_COL)).intValue (); + height = Integer.valueOf(items [i].getText (HEIGHT_COL)).intValue (); data = new RowData (width, height); exclude = items [i].getText (EXCLUDE_COL); data.exclude = exclude.equals ("true"); |