Java Code Examples for org.eclipse.ui.presentations.IPresentablePart#setBounds()

The following examples show how to use org.eclipse.ui.presentations.IPresentablePart#setBounds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CTabFolderStackPresentation.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private void resizeSelectedPart()
{
    IPresentablePart part = getSite().getSelectedPart();
    
    if (part == null) return;
    
    CTabItem item = getItem(part);
    
    if (item == null) return;
    
    Rectangle bounds = tabFolder.getClientArea();
    
    
    bounds = item.getDisplay().map(tabFolder, partParent, bounds);

    part.setBounds(bounds);
}
 
Example 2
Source File: PGroupStackPresentation.java    From nebula with Eclipse Public License 2.0 3 votes vote down vote up
private void resizeSelectedPart()
{
    IPresentablePart part = getSite().getSelectedPart();
    
    if (part == null) return;
    
    Control partTB = part.getToolBar();
    
    Rectangle bounds = group.getClientArea();        
    
    Point partTBSize = new Point(0,0);
    if (partTB != null)
    {
        partTBSize = partTB.computeSize(bounds.width,SWT.DEFAULT);
   
        Rectangle tbBounds = new Rectangle(0,0,bounds.width,partTBSize.y);
        
        tbBounds = group.getDisplay().map(group.getChildren()[0], partTB.getParent(), tbBounds);
        
        partTB.setBounds(tbBounds);
        
        bounds.y += tbBounds.height;
        bounds.height -= tbBounds.height;        
    }
    
    bounds = group.getDisplay().map(group, partParent, bounds);

    part.setBounds(bounds);
}
 
Example 3
Source File: ExpandBarStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 3 votes vote down vote up
private void resizeSelectedPart()
{
    IPresentablePart part = getSite().getSelectedPart();
    
    if (part == null) return;
    
    Control partTB = part.getToolBar();
    
    Rectangle bounds = eBarItem.getControl().getBounds();        
    
    Point partTBSize = new Point(0,0);
    if (partTB != null)
    {
        partTBSize = partTB.computeSize(bounds.width,SWT.DEFAULT);
   
        Rectangle tbBounds = new Rectangle(0,0,bounds.width,partTBSize.y);
        
        tbBounds = eBar.getDisplay().map(eBarItem.getControl(), partTB.getParent(), tbBounds);
        
        partTB.setBounds(tbBounds);
        
        bounds.y += tbBounds.height;
        bounds.height -= tbBounds.height;        
    }
    
    bounds = eBar.getDisplay().map(eBar, partParent, bounds);

    part.setBounds(bounds);
}
 
Example 4
Source File: EmptyStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 3 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void setBounds(Rectangle bounds)
{
    borderComposite.setBounds(bounds);
    
    Rectangle clientArea = borderComposite.getClientArea();
    
    IPresentablePart part = getSite().getSelectedPart();
    
    if (part == null) return;
    
    Control partTB = part.getToolBar();
    
    Rectangle tbBounds = new Rectangle(0,0,0,0);
    
    if (partTB != null)
    {
        Point size = partTB.computeSize(clientArea.width, SWT.DEFAULT);
        
        tbBounds.width = size.x;
        tbBounds.height = Math.min(size.y, clientArea.height);

        tbBounds = borderComposite.getDisplay().map(borderComposite, partTB.getParent(), tbBounds);
        
        partTB.setBounds(tbBounds);
        
        clientArea.y += tbBounds.height;
        clientArea.height -= tbBounds.height;  
    }
    
    clientArea = borderComposite.getDisplay().map(borderComposite, partParent, clientArea);

    part.setBounds(clientArea);
}