类org.eclipse.ui.presentations.IPresentablePart源码实例Demo

下面列出了怎么用org.eclipse.ui.presentations.IPresentablePart的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: nebula   文件: PGroupStackPresentation.java
/** 
 * {@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();
}
 
源代码2 项目: nebula   文件: CTabFolderStackPresentation.java
/** 
 * {@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);
        }        
    });
}
 
/** 
 * {@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();
}
 
源代码4 项目: nebula   文件: PGroupStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    // TODO Auto-generated method stub
    return null;
}
 
源代码5 项目: nebula   文件: PGroupStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public void selectPart(IPresentablePart toSelect)
{
    toSelect.setVisible(true);
    if (toSelect.getToolBar() != null)
        toSelect.getToolBar().setVisible(true);
    resizeSelectedPart();
}
 
源代码6 项目: nebula   文件: PShelfStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    // TODO Auto-generated method stub
    return null;
}
 
源代码7 项目: nebula   文件: PShelfStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{
    getItem(oldPart).dispose();
    resizeSelectedPart();
    
    oldPart.setVisible(false);
    if (oldPart.getToolBar() != null)
        oldPart.getToolBar().setVisible(false);
}
 
源代码8 项目: nebula   文件: PShelfStackPresentation.java
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;
}
 
源代码9 项目: nebula   文件: PShelfStackPresentation.java
/** 
 * {@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();
}
 
源代码10 项目: nebula   文件: CTabFolderStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    // TODO Auto-generated method stub
    return null;
}
 
源代码11 项目: nebula   文件: CTabFolderStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{
    getItem(oldPart).dispose();
    resizeSelectedPart();
}
 
源代码12 项目: nebula   文件: CTabFolderStackPresentation.java
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;
}
 
源代码13 项目: nebula   文件: CTabFolderStackPresentation.java
/** 
 * {@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();
}
 
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    // TODO Auto-generated method stub
    return null;
}
 
/** 
 * {@inheritDoc}
 */
@Override
public void selectPart(IPresentablePart toSelect)
{
    toSelect.setVisible(true);
    if (toSelect.getToolBar() != null)
        toSelect.getToolBar().setVisible(true);
    resizeSelectedPart();
}
 
源代码16 项目: nebula   文件: EmptyStandaloneStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public void selectPart(IPresentablePart toSelect)
{
    toSelect.setVisible(true);
    if (toSelect.getToolBar() != null)
        toSelect.getToolBar().setVisible(true);
}
 
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);
}
 
源代码18 项目: tmxeditor8   文件: StandardEditorSystemMenu.java
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);
}
 
源代码19 项目: nebula   文件: PGroupStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{
}
 
源代码20 项目: nebula   文件: PShelfStackPresentation.java
/** 
 * {@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);
        }        
    });
}
 
源代码21 项目: nebula   文件: CTabFolderStackPresentation.java
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);
}
 
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{
}
 
源代码23 项目: nebula   文件: EmptyStandaloneStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public void addPart(IPresentablePart newPart, Object cookie)
{

}
 
源代码24 项目: nebula   文件: EmptyStandaloneStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public Control[] getTabList(IPresentablePart part)
{
    return null;
}
 
源代码25 项目: nebula   文件: EmptyStandaloneStackPresentation.java
/** 
 * {@inheritDoc}
 */
@Override
public void removePart(IPresentablePart oldPart)
{        
}
 
源代码26 项目: nebula   文件: PGroupStackPresentation.java
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);
}
 
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);
}
 
源代码28 项目: nebula   文件: EmptyStandaloneStackPresentation.java
/** 
 * {@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);
}
 
 类所在包
 类方法
 同包方法