public void update() { Rectangle rect = toolBar.getBounds(); if ( connectDropdown != null && !connectDropdown.isDisposed() ) { if ( spoon.rep != null ) { StringBuilder connectionLabel = new StringBuilder(); if ( spoon.rep.getUserInfo() != null ) { connectionLabel.append( spoon.rep.getUserInfo().getLogin() ); connectionLabel.append( " | " ); } StringBuilder connectionLabelTip = new StringBuilder( connectionLabel.toString() ); if ( repoConnectController != null && repoConnectController.getConnectedRepository() != null ) { connectionLabel.append( truncateName( spoon.getRepositoryName() ) ); connectionLabelTip.append( spoon.getRepositoryName() ); } connectDropdown.setText( connectionLabel.toString() ); connectDropdown.setToolTipText( connectionLabelTip.toString() ); } else { connectDropdown.setText( BaseMessages.getString( PKG, "RepositoryConnectMenu.Connect" ) ); } } // This fixes some SWT goofiness toolBar.pack(); toolBar.setBounds( rect ); }
@Override protected void layout(Composite composite, boolean changed) { boolean vertical = (getOrientation() & SWT.VERTICAL) != 0; int marginWidth = vertical | isPlain() ? 1 : simple ? 4 : 7; int marginHeight = !vertical | isPlain() ? 1 : simple ? 4 : 7; Point tsize = toolBarManager.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT, changed); Rectangle carea = composite.getClientArea(); int x = carea.x + (getLocation() == SideValue.LEFT ? 0 : marginWidth); int y = carea.y + marginHeight; if (vertical) { toolBarManager.getControl().setBounds(x, y, carea.width - marginWidth, tsize.y); } else { toolBarManager.getControl().setBounds(x, y, tsize.x, carea.height - marginHeight); } } }
chevron.setBounds (parent.fixRectangle ( itemBounds.x + width - CHEVRON_LEFT_MARGIN - CHEVRON_IMAGE_WIDTH - CHEVRON_HORIZONTAL_TRIM, itemBounds.y,
chevron.setBounds (parent.fixRectangle ( itemBounds.x + width - CHEVRON_LEFT_MARGIN - CHEVRON_IMAGE_WIDTH - CHEVRON_HORIZONTAL_TRIM, itemBounds.y,
chevron.setBounds (parent.fixRectangle ( itemBounds.x + width - CHEVRON_LEFT_MARGIN - CHEVRON_IMAGE_WIDTH - CHEVRON_HORIZONTAL_TRIM, itemBounds.y,
chevron.setBounds (parent.fixRectangle ( itemBounds.x + width - CHEVRON_LEFT_MARGIN - CHEVRON_IMAGE_WIDTH - CHEVRON_HORIZONTAL_TRIM, itemBounds.y,
chevron.setBounds( parent.fixRectangle( itemBounds.x + width - CHEVRON_LEFT_MARGIN - CHEVRON_IMAGE_WIDTH - CHEVRON_HORIZONTAL_TRIM, itemBounds.y, CHEVRON_IMAGE_WIDTH
if (tbsize != null && getToolBarAlignment() == SWT.TOP) { ToolBar tbar = toolBarManager.getControl(); tbar.setBounds(x + width - 1 - tbsize.x - HMARGIN, yloc + row1Height - 1 - tbsize.y, tbsize.x, tbsize.y); tbar.setBounds(x + width - 1 - tbsize.x - HMARGIN, yloc, tbsize.x, tbsize.y); tw = tbsize.x + SPACING;
if (tbsize != null && getToolBarAlignment() == SWT.TOP) { ToolBar tbar = toolBarManager.getControl(); tbar.setBounds(x + width - 1 - tbsize.x - HMARGIN, yloc + row1Height - 1 - tbsize.y, tbsize.x, tbsize.y); tbar.setBounds(x + width - 1 - tbsize.x - HMARGIN, yloc, tbsize.x, tbsize.y); tw = tbsize.x + SPACING;