@@ -540,8 +540,8 @@ private ToolItem showChevron() {
540
540
*/
541
541
private ToolItem getChevron (CTabFolder tabFolder ) {
542
542
for (Control child : tabFolder .getChildren ()) {
543
- if (child instanceof ToolBar ) {
544
- for (ToolItem toolItem : (( ToolBar ) child ) .getItems ()) {
543
+ if (child instanceof ToolBar toolBar ) {
544
+ for (ToolItem toolItem : toolBar .getItems ()) {
545
545
if ((toolItem .getStyle () & SWT .PUSH ) != 0
546
546
&& toolItem .getText ().isEmpty ()
547
547
&& SWT .getMessage ("SWT_ShowList" ).equals (toolItem .getToolTipText ())
@@ -561,25 +561,25 @@ private void checkElementOverlap(CTabFolder tabFolder) {
561
561
subControls .addAll (Arrays .asList (tabFolder .getItems ()));
562
562
for (int i = 0 ; i < subControls .size (); i ++) {
563
563
Rectangle boundsA = null ;
564
- if (subControls .get (i ) instanceof Control ) {
565
- if (!(( Control ) subControls . get ( i )) .isVisible ())
564
+ if (subControls .get (i ) instanceof Control c ) {
565
+ if (!c .isVisible ())
566
566
continue ;
567
- boundsA = (( Control ) subControls . get ( i )) .getBounds ();
568
- } else if (subControls .get (i ) instanceof CTabItem ) {
569
- if (!(( CTabItem ) subControls . get ( i )) .isShowing ())
567
+ boundsA = c .getBounds ();
568
+ } else if (subControls .get (i ) instanceof CTabItem cTab ) {
569
+ if (!cTab .isShowing ())
570
570
continue ;
571
- boundsA = (( CTabItem ) subControls . get ( i )) .getBounds ();
571
+ boundsA = cTab .getBounds ();
572
572
}
573
573
for (int j = i + 1 ; j < subControls .size (); j ++) {
574
574
Rectangle boundsB = null ;
575
- if (subControls .get (j ) instanceof Control ) {
576
- if (!(( Control ) subControls . get ( j )) .isVisible ())
575
+ if (subControls .get (j ) instanceof Control c ) {
576
+ if (!c .isVisible ())
577
577
continue ;
578
- boundsB = (( Control ) subControls . get ( j )) .getBounds ();
579
- } else if (subControls .get (j ) instanceof CTabItem ) {
580
- if (!(( CTabItem ) subControls . get ( j )) .isShowing ())
578
+ boundsB = c .getBounds ();
579
+ } else if (subControls .get (j ) instanceof CTabItem cTab ) {
580
+ if (!cTab .isShowing ())
581
581
continue ;
582
- boundsB = (( CTabItem ) subControls . get ( j )) .getBounds ();
582
+ boundsB = cTab .getBounds ();
583
583
}
584
584
assertFalse ("Overlap between <" + subControls .get (i ) + "> and <" + subControls .get (j ) + ">\n " + boundsA
585
585
+ " overlaps " + boundsB , boundsA .intersects (boundsB ));
@@ -608,8 +608,8 @@ private void assertTabElementsInLine() {
608
608
List <Rectangle > tabBarElementBounds = new ArrayList <>();
609
609
Arrays .stream (ctabFolder .getItems ()).filter (CTabItem ::isShowing ).map (this ::getBoundsInShell ).forEach (tabBarElementBounds ::add );
610
610
for (Control child : ctabFolder .getChildren ()) {
611
- if (child instanceof ToolBar ) {
612
- for (ToolItem toolItem : (( ToolBar ) child ) .getItems ()) {
611
+ if (child instanceof ToolBar toolBarChild ) {
612
+ for (ToolItem toolItem : toolBarChild .getItems ()) {
613
613
if (toolItem .getImage () != null ) {
614
614
tabBarElementBounds .add (getBoundsInShell (toolItem ));
615
615
}
@@ -632,15 +632,15 @@ private void assertTabElementsInLine() {
632
632
private Rectangle getBoundsInShell (Widget control ) {
633
633
Control parent ;
634
634
Rectangle bounds ;
635
- if (control instanceof Control ) {
636
- parent = (( Control ) control ) .getParent ();
637
- bounds = (( Control ) control ) .getBounds ();
638
- } else if (control instanceof CTabItem ) {
639
- parent = (( CTabItem ) control ) .getParent ();
640
- bounds = (( CTabItem ) control ) .getBounds ();
641
- } else if (control instanceof ToolItem ) {
642
- parent = (( ToolItem ) control ) .getParent ();
643
- bounds = (( ToolItem ) control ) .getBounds ();
635
+ if (control instanceof Control c ) {
636
+ parent = c .getParent ();
637
+ bounds = c .getBounds ();
638
+ } else if (control instanceof CTabItem cTab ) {
639
+ parent = cTab .getParent ();
640
+ bounds = cTab .getBounds ();
641
+ } else if (control instanceof ToolItem toolItem ) {
642
+ parent = toolItem .getParent ();
643
+ bounds = toolItem .getBounds ();
644
644
} else {
645
645
throw new UnsupportedOperationException ("Widget must provide bounds and parent" );
646
646
}
0 commit comments