Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 313538 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rap/internal/design/example/stacks/ViewStackPresentation.java (-2 / +44 lines)
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 646-651 Link Here
646
          manageOverflow();
648
          manageOverflow();
647
        };
649
        };
648
      } );
650
      } );
651
      addPartActivationListners();
652
    }
653
  }
654
655
  private void addPartActivationListners() {
656
    addPartActivationListnerToControl( tabBg );
657
    Map cornerMap = ( Map )stackBuilder.getAdapter( Map.class );
658
    Object corner = cornerMap.get( StackPresentationBuider.LEFT );
659
    addPartActivationListenerToCorner( corner );    
660
    corner = cornerMap.get( StackPresentationBuider.RIGHT );
661
    addPartActivationListenerToCorner( corner );    
662
  }
663
664
  private void addPartActivationListenerToCorner( Object corner ) {
665
    if( corner != null && corner instanceof Label ) {
666
      Label cornerLabel = ( Label )corner;
667
      addPartActivationListnerToControl( cornerLabel );
668
    }
669
  }
670
671
  private void addPartActivationListnerToControl( final Control control ) {
672
    control.addMouseListener( new MouseAdapter() {
673
      public void mouseUp( final MouseEvent e ) {
674
        activatePartWithTabbar();
675
      }
676
    } );
677
  }
678
  
679
  private void activatePartWithTabbar() {
680
    activatePart( currentPart );
681
    if( toolBarLayer != null ) {
682
      toolBarLayer.setVisible( false );
683
    }
684
    // move the toolbar on top
685
    currentPart.getControl().moveAbove( null );
686
    Control toolBar = currentPart.getToolBar();
687
    if( toolBar != null ) {
688
      toolBar.moveAbove( null );
649
    }
689
    }
650
  }
690
  }
651
691
Lines 885-890 Link Here
885
      fdConfArea.width = 28;
925
      fdConfArea.width = 28;
886
      fdTabBg.right = new FormAttachment( confArea );
926
      fdTabBg.right = new FormAttachment( confArea );
887
      confCorner = new Label( confArea, SWT.NONE );
927
      confCorner = new Label( confArea, SWT.NONE );
928
      addPartActivationListnerToControl( confCorner );
888
      Image cornerImage
929
      Image cornerImage
889
        = stackBuilder.getImage( ILayoutSetConstants.STACK_INACTIVE_CORNER );
930
        = stackBuilder.getImage( ILayoutSetConstants.STACK_INACTIVE_CORNER );
890
      confCorner.setImage( cornerImage );
931
      confCorner.setImage( cornerImage );
Lines 904-912 Link Here
904
      FormData fdConfPos
945
      FormData fdConfPos
905
        = stackBuilder.getPosition( ILayoutSetConstants.STACK_CONF_POS );
946
        = stackBuilder.getPosition( ILayoutSetConstants.STACK_CONF_POS );
906
      fdConfButton.right = fdConfPos.right;
947
      fdConfButton.right = fdConfPos.right;
948
      addPartActivationListnerToControl( confButton );
907
      confButton.addSelectionListener( new SelectionAdapter(){
949
      confButton.addSelectionListener( new SelectionAdapter(){
908
        public void widgetSelected( SelectionEvent e ) {
950
        public void widgetSelected( final SelectionEvent e ) {
909
          activatePart( getSite().getSelectedPart() );
910
          configAction.run();
951
          configAction.run();
911
        };
952
        };
912
      } );
953
      } );
Lines 1313-1316 Link Here
1313
    }
1354
    }
1314
    return result + WIDTH_SPACING;
1355
    return result + WIDTH_SPACING;
1315
  }
1356
  }
1357
  
1316
}
1358
}

Return to bug 313538