Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2021-02-03 05:02:24 -0500
committerNiraj Modi2021-02-05 05:49:56 -0500
commitbae9ed02b080e68149b88f41b271b476173a0039 (patch)
tree7ba9baaacc831e8a22ecb15741685fbfa2beca56 /examples
parentb11dc98efbaf7917d056241a27f333cd4733257c (diff)
downloadeclipse.platform.swt-bae9ed02b080e68149b88f41b271b476173a0039.tar.gz
eclipse.platform.swt-bae9ed02b080e68149b88f41b271b476173a0039.tar.xz
eclipse.platform.swt-bae9ed02b080e68149b88f41b271b476173a0039.zip
[Cleanup] Use parseInt in swt examples
Instead of Integer.valueOf(i).intValue () we can use Integer.parseInt(i). Done via the Primitive parsing cleanup of JDT Change-Id: I64411dca9f8717f781f41324b09f450f1483b753 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/controlexample/Tab.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java20
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java16
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java4
4 files changed, 21 insertions, 21 deletions
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 8dea741e20..dae02bd126 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
@@ -1108,7 +1108,7 @@ abstract class Tab {
String strings[] = split(value, ',');
int[] ints = new int[strings.length];
for (int j = 0; j < strings.length; j++) {
- ints[j] = Integer.valueOf(strings[j]).intValue();
+ ints[j] = Integer.parseInt(strings[j]);
}
parameter = new Object[] {ints};
} else if (typeName.equals("[C")) {
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 bb537e6331..4051ca616d 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
@@ -376,7 +376,7 @@ class FormLayoutTab extends Tab {
if (data.left.control != null) {
TableItem item = table.getItem (i);
String controlString = item.getText (LEFT_COL);
- int index = Integer.valueOf(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue ();
+ int index = Integer.parseInt(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
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)) {
@@ -388,7 +388,7 @@ class FormLayoutTab extends Tab {
if (data.right.control != null) {
TableItem item = table.getItem (i);
String controlString = item.getText (RIGHT_COL);
- int index = Integer.valueOf (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
+ int index = Integer.parseInt (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
code.append ("\t\tdata.right = new FormAttachment (" + names [index] + ", " + data.right.offset + ", SWT." + alignmentString (data.right.alignment) + ");\n");
} else {
code.append ("\t\tdata.right = new FormAttachment (" + data.right.numerator + ", " + data.right.offset + ");\n");
@@ -398,7 +398,7 @@ class FormLayoutTab extends Tab {
if (data.top.control != null) {
TableItem item = table.getItem (i);
String controlString = item.getText (TOP_COL);
- int index = Integer.valueOf(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
+ int index = Integer.parseInt(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
code.append ("\t\tdata.top = new FormAttachment (" + names [index] + ", " + data.top.offset + ", SWT." + alignmentString (data.top.alignment) + ");\n");
} else {
if (data.bottom != null || (data.top.numerator != 0 ||data.top.offset != 0)) {
@@ -410,7 +410,7 @@ class FormLayoutTab extends Tab {
if (data.bottom.control != null) {
TableItem item = table.getItem (i);
String controlString = item.getText (BOTTOM_COL);
- int index = Integer.valueOf(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
+ int index = Integer.parseInt(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
code.append ("\t\tdata.bottom = new FormAttachment (" + names [index] + ", " + data.bottom.offset + ", SWT." + alignmentString (data.bottom.alignment) + ");\n");
} else {
code.append ("\t\tdata.bottom = new FormAttachment (" + data.bottom.numerator + ", " + data.bottom.offset + ");\n");
@@ -520,11 +520,11 @@ class FormLayoutTab extends Tab {
i++;
}
String end = control.substring (i);
- int index = Integer.valueOf(end).intValue ();
+ int index = Integer.parseInt(end);
Control attachControl = children [index];
int colon = attachment.indexOf (':');
try {
- offset = Integer.valueOf(attachment.substring (comma + 1, colon)).intValue ();
+ offset = Integer.parseInt(attachment.substring (comma + 1, colon));
} catch (NumberFormatException e) {
offset = 0;
}
@@ -533,12 +533,12 @@ class FormLayoutTab extends Tab {
} else {
/* Case where there is a position */
try {
- position = Integer.valueOf(attachment.substring (0,comma));
+ position = Integer.parseInt(attachment.substring (0,comma));
} catch (NumberFormatException e) {
position = 0;
}
try {
- offset = Integer.valueOf(attachment.substring (comma + 1));
+ offset = Integer.parseInt(attachment.substring (comma + 1));
} catch (NumberFormatException e) {
offset = 0;
}
@@ -557,8 +557,8 @@ class FormLayoutTab extends Tab {
int width, height;
String left, right, top, bottom;
for (int i = 0; i < children.length; i++) {
- width = Integer.valueOf(items [i].getText (WIDTH_COL)).intValue ();
- height = Integer.valueOf(items [i].getText (HEIGHT_COL)).intValue ();
+ width = Integer.parseInt(items [i].getText (WIDTH_COL));
+ height = Integer.parseInt(items [i].getText (HEIGHT_COL));
data = new FormData ();
if (width > 0) data.width = width;
if (height > 0) data.height = height;
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 80d6ede38f..1da79eb9a2 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
@@ -623,8 +623,8 @@ class GridLayoutTab extends Tab {
for (int i = 0; i < children.length; i++) {
data = new GridData ();
/* Set widthHint and heightHint */
- data.widthHint = Integer.valueOf(items [i].getText (WIDTH_COL)).intValue ();
- data.heightHint = Integer.valueOf(items [i].getText (HEIGHT_COL)).intValue ();
+ data.widthHint = Integer.parseInt(items [i].getText (WIDTH_COL));
+ data.heightHint = Integer.parseInt(items [i].getText (HEIGHT_COL));
/* Set vertical alignment and horizontal alignment */
hAlign = items [i].getText (HALIGN_COL);
if (hAlign.equals ("CENTER")) {
@@ -647,13 +647,13 @@ class GridLayoutTab extends Tab {
data.verticalAlignment = SWT.CENTER;
}
/* Set spans and indents */
- hSpan = Integer.valueOf (items [i].getText (HSPAN_COL));
+ hSpan = Integer.parseInt (items [i].getText (HSPAN_COL));
data.horizontalSpan = hSpan;
- vSpan = Integer.valueOf(items [i].getText (VSPAN_COL));
+ vSpan = Integer.parseInt(items [i].getText (VSPAN_COL));
data.verticalSpan = vSpan;
- hIndent = Integer.valueOf(items [i].getText (HINDENT_COL));
+ hIndent = Integer.parseInt(items [i].getText (HINDENT_COL));
data.horizontalIndent = hIndent;
- vIndent = Integer.valueOf(items [i].getText (VINDENT_COL));
+ vIndent = Integer.parseInt(items [i].getText (VINDENT_COL));
data.verticalIndent = vIndent;
/* Set grabs */
hGrab = items [i].getText (HGRAB_COL);
@@ -661,8 +661,8 @@ class GridLayoutTab extends Tab {
vGrab = items [i].getText (VGRAB_COL);
data.grabExcessVerticalSpace = vGrab.equals ("true");
/* Set minimum width and height */
- data.minimumWidth = Integer.valueOf(items [i].getText (MINWIDTH_COL));
- data.minimumHeight = Integer.valueOf(items [i].getText (MINHEIGHT_COL));
+ data.minimumWidth = Integer.parseInt(items [i].getText (MINWIDTH_COL));
+ data.minimumHeight = Integer.parseInt(items [i].getText (MINHEIGHT_COL));
/* Set exclude boolean */
exclude = items [i].getText (EXCLUDE_COL);
data.exclude = exclude.equals ("true");
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 41d3e61db6..16ca43520a 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
@@ -408,8 +408,8 @@ class RowLayoutTab extends Tab {
int width, height;
String exclude;
for (int i = 0; i < children.length; i++) {
- width = Integer.valueOf(items [i].getText (WIDTH_COL)).intValue ();
- height = Integer.valueOf(items [i].getText (HEIGHT_COL)).intValue ();
+ width = Integer.parseInt(items [i].getText (WIDTH_COL));
+ height = Integer.parseInt(items [i].getText (HEIGHT_COL));
data = new RowData (width, height);
exclude = items [i].getText (EXCLUDE_COL);
data.exclude = exclude.equals ("true");

Back to the top