org.eclipse.ui.presentations.IPresentablePart Java Examples

The following examples show how to use org.eclipse.ui.presentations.IPresentablePart. 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: ExpandBarStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void addPart(final IPresentablePart newPart, Object cookie)
{ 
    updateItem(newPart);
    
    newPart.addPropertyListener(new IPropertyListener()
    {        
        public void propertyChanged(Object source, int propId)
        {
            updateItem(newPart);
        }        
    });
    
    resizeSelectedPart();
}
 
Example #2
Source File: PGroupStackPresentation.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void addPart(final IPresentablePart newPart, Object cookie)
{ 
    updateItem(newPart);
    
    newPart.addPropertyListener(new IPropertyListener()
    {        
        public void propertyChanged(Object source, int propId)
        {
            updateItem(newPart);
        }        
    });
    
    resizeSelectedPart();
}
 
Example #3
Source File: CTabFolderStackPresentation.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void addPart(final IPresentablePart newPart, Object cookie)
{
    ignoreSelection = true;
    final CTabItem item = new CTabItem(tabFolder,SWT.NONE);
    ignoreSelection = false;
    item.setData(DATAKEY_PART,newPart);
    
    updateItem(newPart);
    
    newPart.addPropertyListener(new IPropertyListener()
    {        
        public void propertyChanged(Object source, int propId)
        {
            updateItem(newPart);
        }        
    });
}
 
Example #4
Source File: CTabFolderStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void selectPart(IPresentablePart toSelect)
{
    tabFolder.setSelection(getItem(toSelect));
    
    IPresentablePart[] parts = getSite().getPartList();
    for (int i = 0; i < parts.length; i++)
    {
        parts[i].setVisible(parts[i] == toSelect);
    }
    
    resizeSelectedPart();
}
 
Example #5
Source File: StandardEditorSystemMenu.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void show(Control parent, Point displayCoordinates, IPresentablePart currentSelection) {
    restore.update();
    move.setTarget(currentSelection);
    move.update();
    minimize.update();
    maximize.update();
    close.setTarget(currentSelection);
    closeOthers.setTarget(currentSelection);
    closeAll.update();
    
    Menu aMenu = menuManager.createContextMenu(parent);
    menuManager.update(true);
    aMenu.setLocation(displayCoordinates.x, displayCoordinates.y);
    aMenu.setVisible(true);
}
 
Example #6
Source File: StandardEditorSystemMenu.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public void show(Control parent, Point displayCoordinates, IPresentablePart currentSelection) {
    restore.update();
    move.setTarget(currentSelection);
    move.update();
    minimize.update();
    maximize.update();
    close.setTarget(currentSelection);
    closeOthers.setTarget(currentSelection);
    closeAll.update();
    
    Menu aMenu = menuManager.createContextMenu(parent);
    menuManager.update(true);
    aMenu.setLocation(displayCoordinates.x, displayCoordinates.y);
    aMenu.setVisible(true);
}
 
Example #7
Source File: EmptyStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void selectPart(IPresentablePart toSelect)
{
    toSelect.setVisible(true);
    if (toSelect.getToolBar() != null)
        toSelect.getToolBar().setVisible(true);
}
 
Example #8
Source File: ExpandBarStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void selectPart(IPresentablePart toSelect)
{
    toSelect.setVisible(true);
    if (toSelect.getToolBar() != null)
        toSelect.getToolBar().setVisible(true);
    resizeSelectedPart();
}
 
Example #9
Source File: ExpandBarStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    // TODO Auto-generated method stub
    return null;
}
 
Example #10
Source File: CTabFolderStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private CTabItem getItem(IPresentablePart part)
{
    CTabItem[] items = tabFolder.getItems();
    for (int i = 0; i < items.length; i++)
    {
        if (items[i].getData(DATAKEY_PART) == part)
        {
            return items[i];
        }
    }
    return null;
}
 
Example #11
Source File: CTabFolderStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{
    getItem(oldPart).dispose();
    resizeSelectedPart();
}
 
Example #12
Source File: PShelfStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void selectPart(IPresentablePart toSelect)
{
    shelf.setSelection(getItem(toSelect));
    
    IPresentablePart[] parts = getSite().getPartList();
    for (int i = 0; i < parts.length; i++)
    {
        parts[i].setVisible(parts[i] == toSelect);
    }
    
    updateItem(toSelect);
    resizeSelectedPart();
}
 
Example #13
Source File: PGroupStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    // TODO Auto-generated method stub
    return null;
}
 
Example #14
Source File: PGroupStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void selectPart(IPresentablePart toSelect)
{
    toSelect.setVisible(true);
    if (toSelect.getToolBar() != null)
        toSelect.getToolBar().setVisible(true);
    resizeSelectedPart();
}
 
Example #15
Source File: PShelfStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    // TODO Auto-generated method stub
    return null;
}
 
Example #16
Source File: PShelfStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{
    getItem(oldPart).dispose();
    resizeSelectedPart();
    
    oldPart.setVisible(false);
    if (oldPart.getToolBar() != null)
        oldPart.getToolBar().setVisible(false);
}
 
Example #17
Source File: PShelfStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private PShelfItem getItem(IPresentablePart part)
{
    PShelfItem[] items = shelf.getItems();
    for (int i = 0; i < items.length; i++)
    {
        if (items[i].getData(DATAKEY_PART) == part)
        {
            return items[i];
        }
    }
    return null;
}
 
Example #18
Source File: CTabFolderStackPresentation.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    // TODO Auto-generated method stub
    return null;
}
 
Example #19
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 #20
Source File: PShelfStackPresentation.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void addPart(final IPresentablePart newPart, Object cookie)
{
    ignoreSelection = true;
    final PShelfItem item = new PShelfItem(shelf,SWT.NONE);
    ignoreSelection = false;
    item.setData(DATAKEY_PART,newPart);
    
    item.getBody().setLayout(null);        
    item.getBody().addListener(SWT.Paint, new Listener()
    {        
        public void handleEvent(Event e)
        {
            Integer separatorY = (Integer)item.getBody().getData(DATAKEY_SEPHEIGHT);
            if (separatorY == null) return;
            e.gc.setForeground(border);
            e.gc.drawLine(0,separatorY.intValue(),item.getBody().getSize().x,separatorY.intValue());
        }        
    });
    
    CLabel descLabel = new CLabel(item.getBody(),SWT.WRAP);
    item.setData(DATAKEY_DESCLABEL,descLabel);
    
    descLabel.setBackground(toolbarBackground);
    
    ToolBar tb = new ToolBar(item.getBody(),SWT.NONE);
    item.setData(DATAKEY_MENUTOOL,tb);
    
    tb.setBackground(toolbarBackground);
    
    updateItem(newPart);
    
    newPart.addPropertyListener(new IPropertyListener()
    {        
        public void propertyChanged(Object source, int propId)
        {
            updateItem(newPart);
        }        
    });
}
 
Example #21
Source File: ExpandBarStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{
}
 
Example #22
Source File: EmptyStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void addPart(IPresentablePart newPart, Object cookie)
{

}
 
Example #23
Source File: EmptyStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    return null;
}
 
Example #24
Source File: EmptyStandaloneStackPresentation.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{        
}
 
Example #25
Source File: PGroupStackPresentation.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{
}
 
Example #26
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 #27
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 #28
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);
}