|
Lines 436-442
Link Here
|
| 436 |
|
436 |
|
| 437 |
} |
437 |
} |
| 438 |
} ); |
438 |
} ); |
| 439 |
|
|
|
| 440 |
Composite corner = new Composite( buttonArea, SWT.NONE ); |
439 |
Composite corner = new Composite( buttonArea, SWT.NONE ); |
| 441 |
corner.setData( WidgetUtil.CUSTOM_VARIANT, "compTrans" ); |
440 |
corner.setData( WidgetUtil.CUSTOM_VARIANT, "compTrans" ); |
| 442 |
corner.setLayout( new FormLayout() ); |
441 |
corner.setLayout( new FormLayout() ); |
|
Lines 493-499
Link Here
|
| 493 |
buttonArea.setBackground( bg ); |
492 |
buttonArea.setBackground( bg ); |
| 494 |
Control[] children = buttonArea.getChildren(); |
493 |
Control[] children = buttonArea.getChildren(); |
| 495 |
buttonArea.setLayout( new FormLayout() ); |
494 |
buttonArea.setLayout( new FormLayout() ); |
| 496 |
|
|
|
| 497 |
for( int i = 0; i < children.length; i++ ) { |
495 |
for( int i = 0; i < children.length; i++ ) { |
| 498 |
Control child = children[ i ]; |
496 |
Control child = children[ i ]; |
| 499 |
if( child instanceof Button ) { |
497 |
if( child instanceof Button ) { |
|
Lines 541-550
Link Here
|
| 541 |
} |
539 |
} |
| 542 |
} |
540 |
} |
| 543 |
buttonArea.getParent().layout(); |
541 |
buttonArea.getParent().layout(); |
|
|
542 |
preventButtonOfOverflow(); |
| 544 |
} |
543 |
} |
| 545 |
|
544 |
|
| 546 |
} |
545 |
} |
| 547 |
|
546 |
|
|
|
547 |
private void preventButtonOfOverflow() { |
| 548 |
if( isOverflowNecessary() ) { |
| 549 |
showPartButton( currentPart ); |
| 550 |
} |
| 551 |
} |
| 552 |
|
| 548 |
private void checkHideSeparator( final Composite buttonArea ) { |
553 |
private void checkHideSeparator( final Composite buttonArea ) { |
| 549 |
int indexOf = buttonList.indexOf( buttonArea ); |
554 |
int indexOf = buttonList.indexOf( buttonArea ); |
| 550 |
for( int i = 0; i < buttonList.size(); i++ ) { |
555 |
for( int i = 0; i < buttonList.size(); i++ ) { |
|
Lines 618-624
Link Here
|
| 618 |
fdTabBg.top = new FormAttachment( 0 ); |
623 |
fdTabBg.top = new FormAttachment( 0 ); |
| 619 |
fdTabBg.bottom = new FormAttachment( 100 ); |
624 |
fdTabBg.bottom = new FormAttachment( 100 ); |
| 620 |
createConfArea( fdTabBg ); |
625 |
createConfArea( fdTabBg ); |
| 621 |
|
|
|
| 622 |
FormData fdLayout |
626 |
FormData fdLayout |
| 623 |
= stackBuilder.getPosition( ILayoutSetConstants.STACK_TABBG_POS ); |
627 |
= stackBuilder.getPosition( ILayoutSetConstants.STACK_TABBG_POS ); |
| 624 |
RowLayout layout = new RowLayout( SWT.HORIZONTAL ); |
628 |
RowLayout layout = new RowLayout( SWT.HORIZONTAL ); |
|
Lines 646-655
Link Here
|
| 646 |
} |
650 |
} |
| 647 |
|
651 |
|
| 648 |
private void manageOverflow() { |
652 |
private void manageOverflow() { |
| 649 |
int tabChildrenSize = getTabChildrenSize(); |
653 |
if( isOverflowNecessary() ) { |
| 650 |
if( tabChildrenSize > tabBg.getBounds().width |
|
|
| 651 |
&& moreThanOneChildVisible() ) |
| 652 |
{ |
| 653 |
hideLastVisibleButton(); |
654 |
hideLastVisibleButton(); |
| 654 |
manageOverflow(); |
655 |
manageOverflow(); |
| 655 |
} else { |
656 |
} else { |
|
Lines 657-662
Link Here
|
| 657 |
} |
658 |
} |
| 658 |
handleOverflowButton(); |
659 |
handleOverflowButton(); |
| 659 |
} |
660 |
} |
|
|
661 |
|
| 662 |
private boolean isOverflowNecessary() { |
| 663 |
int tabChildrenSize = getTabChildrenSize(); |
| 664 |
boolean childrenBiggerThanParent |
| 665 |
= tabChildrenSize > tabBg.getBounds().width; |
| 666 |
return childrenBiggerThanParent && moreThanOneChildVisible(); |
| 667 |
} |
| 660 |
|
668 |
|
| 661 |
private boolean moreThanOneChildVisible() { |
669 |
private boolean moreThanOneChildVisible() { |
| 662 |
boolean result = false; |
670 |
boolean result = false; |
|
Lines 817-825
Link Here
|
| 817 |
overflowButtons.add( children[ i ] ); |
825 |
overflowButtons.add( children[ i ] ); |
| 818 |
} |
826 |
} |
| 819 |
lastChildHidden = true; |
827 |
lastChildHidden = true; |
| 820 |
|
828 |
tabBg.layout( true, true ); |
| 821 |
tabBg.layout( true, true ); |
|
|
| 822 |
|
| 823 |
} |
829 |
} |
| 824 |
} |
830 |
} |
| 825 |
} |
831 |
} |
|
Lines 874-880
Link Here
|
| 874 |
fdConfArea.right = new FormAttachment( 100 ); |
880 |
fdConfArea.right = new FormAttachment( 100 ); |
| 875 |
fdConfArea.width = 28; |
881 |
fdConfArea.width = 28; |
| 876 |
fdTabBg.right = new FormAttachment( confArea ); |
882 |
fdTabBg.right = new FormAttachment( confArea ); |
| 877 |
|
|
|
| 878 |
confCorner = new Label( confArea, SWT.NONE ); |
883 |
confCorner = new Label( confArea, SWT.NONE ); |
| 879 |
Image cornerImage |
884 |
Image cornerImage |
| 880 |
= stackBuilder.getImage( ILayoutSetConstants.STACK_INACTIVE_CORNER ); |
885 |
= stackBuilder.getImage( ILayoutSetConstants.STACK_INACTIVE_CORNER ); |
|
Lines 884-890
Link Here
|
| 884 |
fdCorner.left = new FormAttachment( 0 ); |
889 |
fdCorner.left = new FormAttachment( 0 ); |
| 885 |
fdCorner.top = new FormAttachment( 0 ); |
890 |
fdCorner.top = new FormAttachment( 0 ); |
| 886 |
fdCorner.bottom = new FormAttachment( 100 ); |
891 |
fdCorner.bottom = new FormAttachment( 100 ); |
| 887 |
|
|
|
| 888 |
confButton = new Button( confArea, SWT.PUSH ); |
892 |
confButton = new Button( confArea, SWT.PUSH ); |
| 889 |
Image confImage |
893 |
Image confImage |
| 890 |
= stackBuilder.getImage( ILayoutSetConstants.STACK_CONF_INACTIVE ); |
894 |
= stackBuilder.getImage( ILayoutSetConstants.STACK_CONF_INACTIVE ); |
|
Lines 923-938
Link Here
|
| 923 |
|
927 |
|
| 924 |
public Control[] getTabList( final IPresentablePart part ) { |
928 |
public Control[] getTabList( final IPresentablePart part ) { |
| 925 |
ArrayList list = new ArrayList(); |
929 |
ArrayList list = new ArrayList(); |
| 926 |
if (getControl() != null) { |
930 |
if( getControl() != null ) { |
| 927 |
list.add(getControl()); |
931 |
list.add( getControl() ); |
| 928 |
} |
932 |
} |
| 929 |
if (part.getToolBar() != null) { |
933 |
if( part.getToolBar() != null ) { |
| 930 |
list.add(part.getToolBar()); |
934 |
list.add( part.getToolBar() ); |
| 931 |
} |
935 |
} |
| 932 |
if (part.getControl() != null) { |
936 |
if( part.getControl() != null ) { |
| 933 |
list.add(part.getControl()); |
937 |
list.add( part.getControl() ); |
| 934 |
} |
938 |
} |
| 935 |
return (Control[]) list.toArray(new Control[list.size()]); |
939 |
return ( Control[] )list.toArray( new Control[ list.size() ] ); |
| 936 |
} |
940 |
} |
| 937 |
|
941 |
|
| 938 |
public void removePart( final IPresentablePart oldPart ) { |
942 |
public void removePart( final IPresentablePart oldPart ) { |