@@ -445,8 +445,7 @@ void fixClippings () {
445
445
if (fixClipHandle == 0 || fixClipMap .isEmpty ()) {
446
446
return ;
447
447
} else {
448
- Control [] children = _getChildren ();
449
- for (Control child : children ) {
448
+ for (Control child : _getChildren ()) {
450
449
if (fixClipMap .containsKey (child )) {
451
450
long [] childHandles = fixClipMap .get (child );
452
451
for (long widget : childHandles ) {
@@ -604,9 +603,7 @@ Composite findDeferredControl () {
604
603
Menu [] findMenus (Control control ) {
605
604
if (control == this ) return new Menu [0 ];
606
605
Menu result [] = super .findMenus (control );
607
- Control [] children = _getChildren ();
608
- for (int i =0 ; i <children .length ; i ++) {
609
- Control child = children [i ];
606
+ for (Control child : _getChildren ()) {
610
607
Menu [] menuList = child .findMenus (control );
611
608
if (menuList .length != 0 ) {
612
609
Menu [] newResult = new Menu [result .length + menuList .length ];
@@ -621,9 +618,8 @@ Composite findDeferredControl () {
621
618
@ Override
622
619
void fixChildren (Shell newShell , Shell oldShell , Decorations newDecorations , Decorations oldDecorations , Menu [] menus ) {
623
620
super .fixChildren (newShell , oldShell , newDecorations , oldDecorations , menus );
624
- Control [] children = _getChildren ();
625
- for (int i =0 ; i <children .length ; i ++) {
626
- children [i ].fixChildren (newShell , oldShell , newDecorations , oldDecorations , menus );
621
+ for (Control child : _getChildren ()) {
622
+ child .fixChildren (newShell , oldShell , newDecorations , oldDecorations , menus );
627
623
}
628
624
}
629
625
@@ -638,19 +634,17 @@ void fixParentGdkResource() {
638
634
639
635
@ Override
640
636
void fixModal (long group , long modalGroup ) {
641
- Control [] controls = _getChildren ();
642
- for (int i = 0 ; i < controls .length ; i ++) {
643
- controls [i ].fixModal (group , modalGroup );
637
+ for (Control control : _getChildren ()) {
638
+ control .fixModal (group , modalGroup );
644
639
}
645
640
}
646
641
647
642
@ Override
648
643
void fixStyle () {
649
644
super .fixStyle ();
650
645
if (scrolledHandle == 0 ) fixStyle (handle );
651
- Control [] children = _getChildren ();
652
- for (int i = 0 ; i < children .length ; i ++) {
653
- children [i ].fixStyle ();
646
+ for (Control child : _getChildren ()) {
647
+ child .fixStyle ();
654
648
}
655
649
}
656
650
@@ -865,14 +859,14 @@ public boolean getLayoutDeferred () {
865
859
if (tabList == null ) {
866
860
int count = 0 ;
867
861
Control [] list =_getChildren ();
868
- for (int i = 0 ; i < list . length ; i ++ ) {
869
- if (list [ i ] .isTabGroup ()) count ++;
862
+ for (Control element : list ) {
863
+ if (element .isTabGroup ()) count ++;
870
864
}
871
865
tabList = new Control [count ];
872
866
int index = 0 ;
873
- for (int i = 0 ; i < list . length ; i ++ ) {
874
- if (list [ i ] .isTabGroup ()) {
875
- tabList [index ++] = list [ i ] ;
867
+ for (Control element : list ) {
868
+ if (element .isTabGroup ()) {
869
+ tabList [index ++] = element ;
876
870
}
877
871
}
878
872
}
@@ -1337,9 +1331,8 @@ void markLayout (boolean changed, boolean all) {
1337
1331
if (changed ) state |= LAYOUT_CHANGED ;
1338
1332
}
1339
1333
if (all ) {
1340
- Control [] children = _getChildren ();
1341
- for (int i =0 ; i <children .length ; i ++) {
1342
- children [i ].markLayout (changed , all );
1334
+ for (Control child : _getChildren ()) {
1335
+ child .markLayout (changed , all );
1343
1336
}
1344
1337
}
1345
1338
}
@@ -1380,9 +1373,7 @@ void moveBelow (long child, long sibling) {
1380
1373
1381
1374
@ Override
1382
1375
void moveChildren (int oldWidth ) {
1383
- Control [] children = _getChildren ();
1384
- for (int i = 0 ; i < children .length ; i ++) {
1385
- Control child = children [i ];
1376
+ for (Control child : _getChildren ()) {
1386
1377
long topHandle = child .topHandle ();
1387
1378
GtkAllocation allocation = new GtkAllocation ();
1388
1379
GTK .gtk_widget_get_allocation (topHandle , allocation );
@@ -1416,15 +1407,14 @@ void moveChildren(int oldWidth) {
1416
1407
}
1417
1408
1418
1409
Point minimumSize (int wHint , int hHint , boolean changed ) {
1419
- Control [] children = _getChildren ();
1420
1410
/*
1421
1411
* Since getClientArea can be overridden by subclasses, we cannot
1422
1412
* call getClientAreaInPixels directly.
1423
1413
*/
1424
1414
Rectangle clientArea = getClientArea ();
1425
1415
int width = 0 , height = 0 ;
1426
- for (int i = 0 ; i < children . length ; i ++ ) {
1427
- Rectangle rect = children [ i ] .getBounds ();
1416
+ for (Control child : _getChildren () ) {
1417
+ Rectangle rect = child .getBounds ();
1428
1418
width = Math .max (width , rect .x - clientArea .x + rect .width );
1429
1419
height = Math .max (height , rect .y - clientArea .y + rect .height );
1430
1420
}
@@ -1543,9 +1533,7 @@ void propagateDraw (long container, long cairo) {
1543
1533
@ Override
1544
1534
void redrawChildren () {
1545
1535
super .redrawChildren ();
1546
- Control [] children = _getChildren ();
1547
- for (int i = 0 ; i < children .length ; i ++) {
1548
- Control child = children [i ];
1536
+ for (Control child : _getChildren ()) {
1549
1537
if ((child .state & PARENT_BACKGROUND ) != 0 ) {
1550
1538
child .redrawWidget (0 , 0 , 0 , 0 , true , false , true );
1551
1539
child .redrawChildren ();
@@ -1598,9 +1586,7 @@ void removeControl (Control control) {
1598
1586
@ Override
1599
1587
void reskinChildren (int flags ) {
1600
1588
super .reskinChildren (flags );
1601
- Control [] children = _getChildren ();
1602
- for (int i =0 ; i <children .length ; i ++) {
1603
- Control child = children [i ];
1589
+ for (Control child : _getChildren ()) {
1604
1590
if (child != null ) child .reskin (flags );
1605
1591
}
1606
1592
}
@@ -1633,9 +1619,8 @@ void resizeHandle (int width, int height) {
1633
1619
public void setBackgroundMode (int mode ) {
1634
1620
checkWidget ();
1635
1621
backgroundMode = mode ;
1636
- Control [] children = _getChildren ();
1637
- for (int i = 0 ; i < children .length ; i ++) {
1638
- children [i ].updateBackgroundMode ();
1622
+ for (Control child : _getChildren ()) {
1623
+ child .updateBackgroundMode ();
1639
1624
}
1640
1625
}
1641
1626
@@ -1676,9 +1661,7 @@ && getVisible() && !GTK.gtk_widget_get_visible(topHandle) //if SWT State is not
1676
1661
@ Override
1677
1662
public boolean setFocus () {
1678
1663
checkWidget ();
1679
- Control [] children = _getChildren ();
1680
- for (int i =0 ; i <children .length ; i ++) {
1681
- Control child = children [i ];
1664
+ for (Control child : _getChildren ()) {
1682
1665
if (child .getVisible () && child .setFocus ()) return true ;
1683
1666
}
1684
1667
return super .setFocus ();
@@ -1741,9 +1724,8 @@ void setOrientation (boolean create) {
1741
1724
if (!create ) {
1742
1725
int flags = SWT .RIGHT_TO_LEFT | SWT .LEFT_TO_RIGHT ;
1743
1726
int orientation = style & flags ;
1744
- Control [] children = _getChildren ();
1745
- for (int i =0 ; i <children .length ; i ++) {
1746
- children [i ].setOrientation (orientation );
1727
+ for (Control child : _getChildren ()) {
1728
+ child .setOrientation (orientation );
1747
1729
}
1748
1730
if (((style & SWT .RIGHT_TO_LEFT ) != 0 ) != ((style & SWT .MIRRORED ) != 0 )) {
1749
1731
moveChildren (-1 );
@@ -1768,9 +1750,7 @@ boolean setTabGroupFocus (boolean next) {
1768
1750
if ((state & CANVAS ) != 0 ) takeFocus = hooksKeys ();
1769
1751
if (socketHandle != 0 ) takeFocus = true ;
1770
1752
if (takeFocus && setTabItemFocus (next )) return true ;
1771
- Control [] children = _getChildren ();
1772
- for (int i =0 ; i <children .length ; i ++) {
1773
- Control child = children [i ];
1753
+ for (Control child : _getChildren ()) {
1774
1754
/*
1775
1755
* It is unlikely but possible that a child is disposed at this point, for more
1776
1756
* details refer bug 381668.
@@ -1840,9 +1820,7 @@ boolean checkSubwindow () {
1840
1820
boolean translateMnemonic (Event event , Control control ) {
1841
1821
if (super .translateMnemonic (event , control )) return true ;
1842
1822
if (control != null ) {
1843
- Control [] children = _getChildren ();
1844
- for (int i =0 ; i <children .length ; i ++) {
1845
- Control child = children [i ];
1823
+ for (Control child : _getChildren ()) {
1846
1824
if (child .translateMnemonic (event , control )) return true ;
1847
1825
}
1848
1826
}
@@ -1867,9 +1845,8 @@ boolean translateTraversal (long event) {
1867
1845
@ Override
1868
1846
void updateBackgroundMode () {
1869
1847
super .updateBackgroundMode ();
1870
- Control [] children = _getChildren ();
1871
- for (int i = 0 ; i < children .length ; i ++) {
1872
- children [i ].updateBackgroundMode ();
1848
+ for (Control child : _getChildren ()) {
1849
+ child .updateBackgroundMode ();
1873
1850
}
1874
1851
}
1875
1852
@@ -1888,9 +1865,8 @@ void updateLayout (boolean all) {
1888
1865
}
1889
1866
if (all ) {
1890
1867
state &= ~LAYOUT_CHILD ;
1891
- Control [] children = _getChildren ();
1892
- for (int i =0 ; i <children .length ; i ++) {
1893
- children [i ].updateLayout (all );
1868
+ for (Control child : _getChildren ()) {
1869
+ child .updateLayout (all );
1894
1870
}
1895
1871
}
1896
1872
}
0 commit comments