|
Lines 28-33
Link Here
|
| 28 |
import org.eclipse.swt.events.ControlEvent; |
28 |
import org.eclipse.swt.events.ControlEvent; |
| 29 |
import org.eclipse.swt.events.DisposeEvent; |
29 |
import org.eclipse.swt.events.DisposeEvent; |
| 30 |
import org.eclipse.swt.events.DisposeListener; |
30 |
import org.eclipse.swt.events.DisposeListener; |
|
|
31 |
import org.eclipse.swt.events.MouseAdapter; |
| 32 |
import org.eclipse.swt.events.MouseEvent; |
| 31 |
import org.eclipse.swt.events.SelectionAdapter; |
33 |
import org.eclipse.swt.events.SelectionAdapter; |
| 32 |
import org.eclipse.swt.events.SelectionEvent; |
34 |
import org.eclipse.swt.events.SelectionEvent; |
| 33 |
import org.eclipse.swt.graphics.Color; |
35 |
import org.eclipse.swt.graphics.Color; |
|
Lines 418-439
Link Here
|
| 418 |
}; |
420 |
}; |
| 419 |
} ); |
421 |
} ); |
| 420 |
partButton.addListener( SWT.MouseDoubleClick, new Listener() { |
422 |
partButton.addListener( SWT.MouseDoubleClick, new Listener() { |
| 421 |
public void handleEvent( Event event ) { |
423 |
public void handleEvent( final Event event ) { |
| 422 |
IWorkbench workbench = PlatformUI.getWorkbench(); |
424 |
togglePartZoom( part ); |
| 423 |
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); |
|
|
| 424 |
IWorkbenchPage page = window.getActivePage(); |
| 425 |
page.toggleZoom( getReference( part ) ); |
| 426 |
if( toolBarLayer != null ) { |
| 427 |
toolBarLayer.setVisible( false ); |
| 428 |
} |
| 429 |
if( currentPart != null ) { |
| 430 |
currentPart.getControl().moveAbove( null ); |
| 431 |
Control toolBar = currentPart.getToolBar(); |
| 432 |
if( toolBar != null ) { |
| 433 |
toolBar.moveAbove( null ); |
| 434 |
} |
| 435 |
} |
| 436 |
|
| 437 |
} |
425 |
} |
| 438 |
} ); |
426 |
} ); |
| 439 |
Composite corner = new Composite( buttonArea, SWT.NONE ); |
427 |
Composite corner = new Composite( buttonArea, SWT.NONE ); |
|
Lines 454-459
Link Here
|
| 454 |
buttonPartMap.put( buttonArea, part ); |
442 |
buttonPartMap.put( buttonArea, part ); |
| 455 |
buttonList.add( buttonArea ); |
443 |
buttonList.add( buttonArea ); |
| 456 |
} |
444 |
} |
|
|
445 |
|
| 446 |
private void togglePartZoom( final IPresentablePart part ) { |
| 447 |
IWorkbench workbench = PlatformUI.getWorkbench(); |
| 448 |
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); |
| 449 |
IWorkbenchPage page = window.getActivePage(); |
| 450 |
page.toggleZoom( getReference( part ) ); |
| 451 |
if( toolBarLayer != null ) { |
| 452 |
toolBarLayer.setVisible( false ); |
| 453 |
} |
| 454 |
if( currentPart != null ) { |
| 455 |
currentPart.getControl().moveAbove( null ); |
| 456 |
Control toolBar = currentPart.getToolBar(); |
| 457 |
if( toolBar != null ) { |
| 458 |
toolBar.moveAbove( null ); |
| 459 |
} |
| 460 |
} |
| 461 |
} |
| 457 |
|
462 |
|
| 458 |
protected void activatePart( final IPresentablePart part ) { |
463 |
protected void activatePart( final IPresentablePart part ) { |
| 459 |
IWorkbench workbench = PlatformUI.getWorkbench(); |
464 |
IWorkbench workbench = PlatformUI.getWorkbench(); |
|
Lines 646-651
Link Here
|
| 646 |
manageOverflow(); |
651 |
manageOverflow(); |
| 647 |
}; |
652 |
}; |
| 648 |
} ); |
653 |
} ); |
|
|
654 |
addPartActivationListners(); |
| 655 |
} |
| 656 |
} |
| 657 |
|
| 658 |
private void addPartActivationListners() { |
| 659 |
addPartActivationListnerToControl( tabBg ); |
| 660 |
Map cornerMap = ( Map )stackBuilder.getAdapter( Map.class ); |
| 661 |
Object corner = cornerMap.get( StackPresentationBuider.LEFT ); |
| 662 |
addPartActivationListenerToCorner( corner ); |
| 663 |
corner = cornerMap.get( StackPresentationBuider.RIGHT ); |
| 664 |
addPartActivationListenerToCorner( corner ); |
| 665 |
} |
| 666 |
|
| 667 |
private void addPartActivationListenerToCorner( Object corner ) { |
| 668 |
if( corner != null && corner instanceof Label ) { |
| 669 |
Label cornerLabel = ( Label )corner; |
| 670 |
addPartActivationListnerToControl( cornerLabel ); |
| 671 |
} |
| 672 |
} |
| 673 |
|
| 674 |
private void addPartActivationListnerToControl( final Control control ) { |
| 675 |
control.addMouseListener( new MouseAdapter() { |
| 676 |
public void mouseUp( final MouseEvent e ) { |
| 677 |
activatePartWithTabbar(); |
| 678 |
} |
| 679 |
|
| 680 |
public void mouseDoubleClick( final MouseEvent e ) { |
| 681 |
togglePartZoom( currentPart ); |
| 682 |
} |
| 683 |
} ); |
| 684 |
} |
| 685 |
|
| 686 |
private void activatePartWithTabbar() { |
| 687 |
activatePart( currentPart ); |
| 688 |
if( toolBarLayer != null ) { |
| 689 |
toolBarLayer.setVisible( false ); |
| 690 |
} |
| 691 |
// move the toolbar on top |
| 692 |
currentPart.getControl().moveAbove( null ); |
| 693 |
Control toolBar = currentPart.getToolBar(); |
| 694 |
if( toolBar != null ) { |
| 695 |
toolBar.moveAbove( null ); |
| 649 |
} |
696 |
} |
| 650 |
} |
697 |
} |
| 651 |
|
698 |
|
|
Lines 885-890
Link Here
|
| 885 |
fdConfArea.width = 28; |
932 |
fdConfArea.width = 28; |
| 886 |
fdTabBg.right = new FormAttachment( confArea ); |
933 |
fdTabBg.right = new FormAttachment( confArea ); |
| 887 |
confCorner = new Label( confArea, SWT.NONE ); |
934 |
confCorner = new Label( confArea, SWT.NONE ); |
|
|
935 |
addPartActivationListnerToControl( confCorner ); |
| 888 |
Image cornerImage |
936 |
Image cornerImage |
| 889 |
= stackBuilder.getImage( ILayoutSetConstants.STACK_INACTIVE_CORNER ); |
937 |
= stackBuilder.getImage( ILayoutSetConstants.STACK_INACTIVE_CORNER ); |
| 890 |
confCorner.setImage( cornerImage ); |
938 |
confCorner.setImage( cornerImage ); |
|
Lines 904-912
Link Here
|
| 904 |
FormData fdConfPos |
952 |
FormData fdConfPos |
| 905 |
= stackBuilder.getPosition( ILayoutSetConstants.STACK_CONF_POS ); |
953 |
= stackBuilder.getPosition( ILayoutSetConstants.STACK_CONF_POS ); |
| 906 |
fdConfButton.right = fdConfPos.right; |
954 |
fdConfButton.right = fdConfPos.right; |
|
|
955 |
addPartActivationListnerToControl( confButton ); |
| 907 |
confButton.addSelectionListener( new SelectionAdapter(){ |
956 |
confButton.addSelectionListener( new SelectionAdapter(){ |
| 908 |
public void widgetSelected( SelectionEvent e ) { |
957 |
public void widgetSelected( final SelectionEvent e ) { |
| 909 |
activatePart( getSite().getSelectedPart() ); |
|
|
| 910 |
configAction.run(); |
958 |
configAction.run(); |
| 911 |
}; |
959 |
}; |
| 912 |
} ); |
960 |
} ); |
|
Lines 1313-1316
Link Here
|
| 1313 |
} |
1361 |
} |
| 1314 |
return result + WIDTH_SPACING; |
1362 |
return result + WIDTH_SPACING; |
| 1315 |
} |
1363 |
} |
|
|
1364 |
|
| 1316 |
} |
1365 |
} |