本文整理了Java中org.eclipse.swt.widgets.ToolBar
类的一些代码示例,展示了ToolBar
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ToolBar
类的具体详情如下:
包路径:org.eclipse.swt.widgets.ToolBar
类名称:ToolBar
[英]Instances of this class support the layout of selectable tool bar items.
The item children that may be added to instances of this class must be of type ToolItem
.
Note that although this class is a subclass of Composite
, it does not make sense to add Control
children to it, or set a layout on it.
Styles: FLAT, RIGHT, HORIZONTAL, VERTICAL Events: (none)
Note: Only one of the styles HORIZONTAL and VERTICAL may be specified.
IMPORTANT: This class is not intended to be subclassed.
[中]此类实例支持可选工具栏项的布局。
可以添加到此类实例的项子项必须是[$0$]类型。
请注意,尽管该类是Composite
的子类,但向其添加Control
子类或在其上设置布局是没有意义的。
样式:平面、右侧、水平、垂直事件:(无)
注:只能指定水平和垂直两种样式中的一种。
重要提示:这个类不是子类。
代码示例来源:origin: pentaho/pentaho-kettle
wFilesTab.setText( BaseMessages.getString( PKG, "JobCopyFiles.Tab.Files.Label" ) );
Composite wFilesComp = new Composite( wTabFolder, SWT.NONE );
props.setLook( wFilesComp );
filesLayout.marginWidth = 3;
filesLayout.marginHeight = 3;
wFilesComp.setLayout( filesLayout );
fdFilesComp.right = new FormAttachment( 100, 0 );
fdFilesComp.bottom = new FormAttachment( 100, 0 );
wFilesComp.setLayoutData( fdFilesComp );
wFilesComp.layout();
ToolBar tb = new ToolBar( wFilesComp, SWT.HORIZONTAL | SWT.FLAT );
props.setLook( tb );
FormData fdTb = new FormData();
fdTb.right = new FormAttachment( 100, 0 );
fdTb.top = new FormAttachment( wFilesComp, margin );
tb.setLayoutData( fdTb );
deleteToolItem = new ToolItem( tb, SWT.PUSH );
deleteToolItem.setImage( GUIResource.getInstance().getImageDelete() );
deleteToolItem.setToolTipText( BaseMessages.getString( PKG, "JobCopyFiles.FilenameDelete.Tooltip" ) );
deleteToolItem.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent arg0 ) {
代码示例来源:origin: pentaho/pentaho-kettle
public void newFileDropDown() {
// Drop down a list below the "New" icon (new.png)
// First problem: where is that icon?
XulToolbarbutton button = (XulToolbarbutton) this.mainToolbar.getElementById( "file-new" );
Object object = button.getManagedObject();
if ( object instanceof ToolItem ) {
// OK, let's determine the location of this widget...
//
ToolItem item = (ToolItem) object;
Rectangle bounds = item.getBounds();
org.eclipse.swt.graphics.Point p =
item.getParent().toDisplay( new org.eclipse.swt.graphics.Point( bounds.x, bounds.y ) );
fileMenus.setLocation( p.x, p.y + bounds.height );
fileMenus.setVisible( true );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void renderConnectButton() {
connectButton = new ToolItem( toolBar, toolBar.getItems().length );
connectButton.setText( BaseMessages.getString( PKG, "RepositoryConnectMenu.Connect" ) );
connectButton.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent selectionEvent ) {
new RepositoryDialog( spoon.getShell(), repoConnectController ).openCreation();
renderAndUpdate();
}
} );
}
代码示例来源:origin: pentaho/pentaho-kettle
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 );
}
代码示例来源:origin: pentaho/pentaho-kettle
toolbarLeft = new ToolBar( shell, SWT.WRAP );
FormData fdToolbarLeft = new FormData();
fdToolbarLeft.top = new FormAttachment( 0, MARGIN );
toolbarLeft.setLayoutData( fdToolbarLeft );
toolbarLeft.setCursor( cursorEnabled );
toolbarLeft.setBackground( toolbarLeft.getParent().getBackground() );
tltmBack = new ToolItem( toolbarLeft, SWT.PUSH );
tltmBack.setImage( imageBackEnabled );
tltmBack.setDisabledImage( imageBackDisabled );
tltmBack.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Back" ) );
tltmBack.setEnabled( false );
toolbarRight = new ToolBar( shell, SWT.WRAP );
FormData fdToolbarRight = new FormData();
fdToolbarRight.top = new FormAttachment( 0, MARGIN );
fdToolbarRight.right = new FormAttachment( 100, -1 * TOOL_ITEM_SPACING );
toolbarRight.setLayoutData( fdToolbarRight );
toolbarRight.setCursor( cursorEnabled );
toolbarRight.setBackground( toolbarRight.getParent().getBackground() );
代码示例来源:origin: pentaho/pentaho-kettle
swtToolbar.setBackground( GUIResource.getInstance().getColorDemoGray() );
swtToolbar.pack();
ToolItem runItem = new ToolItem( swtToolbar, SWT.DROP_DOWN, 0 );
runItem.setImage( GUIResource.getInstance().getImage( "ui/images/run.svg" ) );
runItem.setToolTipText( BaseMessages.getString( PKG, "Spoon.Tooltip.RunTranformation" ) );
runItem.addSelectionListener( new SelectionAdapter() {
sep.setWidth( 80 );
sep.setControl( zoomLabel );
swtToolbar.pack();
} catch ( Throwable t ) {
log.logError( Const.getStackTracker( t ) );
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
private ToolBar createHelpImageButton(Composite parent, Image image) {
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
toolBar.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
fHelpButton = new ToolItem(toolBar, SWT.CHECK);
fHelpButton.setImage(image);
fHelpButton.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$
fHelpButton.addSelectionListener(widgetSelectedAdapter(e -> helpPressed()));
return toolBar;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private ToolBar addViewMenu(final Composite parent) {
fToolBar= new ToolBar(parent, SWT.FLAT);
final ToolItem menuButton = new ToolItem(fToolBar, SWT.PUSH, 0);
fMenuImage= JavaPluginImages.DESC_ELCL_VIEW_MENU.createImage();
menuButton.setImage(fMenuImage);
menuButton.setToolTipText(ReorgMessages.RenameInformationPopup_menu);
fToolBar.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
showMenu(fToolBar);
}
});
menuButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
showMenu(fToolBar);
}
});
fToolBar.pack();
return fToolBar;
}
代码示例来源:origin: pentaho/pentaho-kettle
ToolBar treeTb = new ToolBar( shell, SWT.HORIZONTAL | SWT.FLAT );
props.setLook( treeTb );
wfilter = new ToolItem( treeTb, SWT.SEPARATOR );
searchText = new Text( treeTb, SWT.SEARCH | SWT.CANCEL );
props.setLook( searchText );
searchText.setToolTipText( BaseMessages.getString( PKG, "EnterSelectionDialog.FilterString.ToolTip" ) );
wfilter.setControl( searchText );
wfilter.setWidth( 120 );
wbRegex = new ToolItem( treeTb, SWT.CHECK );
fd.right = new FormAttachment( 100 );
fd.top = new FormAttachment( 0, 0 );
treeTb.setLayoutData( fd );
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private void createViewMenu(Composite parent) {
fToolBar= new ToolBar(parent, SWT.FLAT);
fToolItem= new ToolItem(fToolBar, SWT.PUSH, 0);
GridData data= new GridData();
data.horizontalAlignment= GridData.END;
fToolBar.setLayoutData(data);
fToolItem.setImage(JavaPluginImages.get(JavaPluginImages.IMG_ELCL_VIEW_MENU));
fToolItem.setDisabledImage(JavaPluginImages.get(JavaPluginImages.IMG_DLCL_VIEW_MENU));
fToolItem.setToolTipText(JavaUIMessages.TypeSelectionComponent_menu);
fToolItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
showViewMenu();
}
});
fMenuManager= new MenuManager();
fillViewMenu(fMenuManager);
// ICommandService commandService= (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
// IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
}
代码示例来源:origin: pentaho/pentaho-kettle
ToolBar treeTb = new ToolBar( shell, SWT.HORIZONTAL | SWT.FLAT );
props.setLook( treeTb );
fdTreeTb = new FormData();
fdTreeTb.left = new FormAttachment( 0, 0 );
fdTreeTb.top = new FormAttachment( 0, 0 );
treeTb.setLayoutData( fdTreeTb );
exportToXML = new ToolItem( treeTb, SWT.PUSH );
exportToXML.setImage( GUIResource.getInstance().getImageExport() );
exportToXML.setText( BaseMessages.getString( PKG, "RepositoryExplorerDialog.ToolItem.ExportToXML.Label" ) );
exportToXML.setToolTipText( BaseMessages.getString(
PKG, "RepositoryExplorerDialog.ToolItem.ExportToXML.Tooltip" ) );
代码示例来源:origin: pentaho/pentaho-kettle
sep3.setLayoutData( fdSep3 );
ToolBar treeTb = new ToolBar( this, SWT.HORIZONTAL | SWT.FLAT );
props.setLook( treeTb, Props.WIDGET_STYLE_TOOLBAR );
expandAll = new ToolItem( treeTb, SWT.PUSH );
expandAll.setImage( GUIResource.getInstance().getImageExpandAll() );
collapseAll = new ToolItem( treeTb, SWT.PUSH );
collapseAll.setImage( GUIResource.getInstance().getImageCollapseAll() );
treeTb.setLayoutData( fdTreeToolbar );
ToolBar selectionFilterTb = new ToolBar( this, SWT.HORIZONTAL | SWT.FLAT );
props.setLook( selectionFilterTb, Props.WIDGET_STYLE_TOOLBAR );
selectionFilterTb.setLayoutData( fdSelectionFilterToolbar );
代码示例来源:origin: com.eclipsesource.tabris/tabris
private void createPageSwitcher() {
pageSwitcher = new ToolBar( uiParent, SWT.NONE );
pageSwitcher.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
pageSwitcher.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, false, false ) );
ToolItem pageSwitcherDropDown = new ToolItem( pageSwitcher, SWT.DROP_DOWN );
pageSwitcherDropDown.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
pageSwitcherDropDown.addListener( SWT.Selection, new PageSwitcherSelectionListener() );
pageSwitcherMenu = new Menu( uiParent.getShell(), SWT.POP_UP );
pageSwitcherMenu.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
private void createFeedback() {
dragShell = new Shell(SWT.NO_TRIM | SWT.NO_BACKGROUND);
dragShell.setAlpha(175);
ToolBar dragTB = new ToolBar(dragShell, SWT.RIGHT);
ToolItem newTI = new ToolItem(dragTB, SWT.RADIO);
newTI.setText(dragItem.getText());
newTI.setImage(dragItem.getImage());
dragTB.pack();
dragShell.pack();
dragShell.setVisible(true);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
static ToolItem createToolItem(Composite parent, Images images) {
ToolBar toolBar= new ToolBar(parent, SWT.FLAT);
ToolItem item= new ToolItem(toolBar, SWT.PUSH);
item.setToolTipText(FormatterMessages.ModifyDialog_modifyAll_tooltip);
item.setImage(images.get(JavaPluginImages.DESC_ELCL_MODIFYALL));
return item;
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.tips.ui
private void showStartupOptions(final Menu menu) {
Rectangle rect = fStartupItem.getBounds();
Point pt = new Point(rect.x, rect.y + rect.height);
pt = ftoolBar.toDisplay(pt);
menu.setLocation(pt.x, pt.y);
menu.setVisible(true);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
boolean isTabGroup () {
ToolItem [] tabList = parent._getTabItemList ();
if (tabList != null) {
for (int i=0; i<tabList.length; i++) {
if (tabList [i] == this) return true;
}
}
if ((style & SWT.SEPARATOR) != 0) return true;
int index = parent.indexOf (this);
if (index == 0) return true;
ToolItem previous = parent.getItem (index - 1);
return (previous.getStyle () & SWT.SEPARATOR) != 0;
}
代码示例来源:origin: org.xworker/xworker_swt
@Override
public Control remove(ToolBar parent, Control control) {
for(ToolItem item : parent.getItems()){
if(item.getControl() == control){
Thing parentThing = Designer.getThing(parent);
Thing itemThing = Designer.getThing(item);
parentThing.removeChild(itemThing);
parentThing.save();
ItemInfo itemInfo = getItemIndex(parent, control);
int index = itemInfo != null ? itemInfo.index : -1;
item.dispose();
control.dispose();
ToolBarCreator.initToolBar(parent);
if(index != -1){
if(index > 0 && parent.getItemCount() > index - 1){
return parent.getItem(index - 1).getControl();
}if(parent.getItemCount() > index){
return parent.getItem(index).getControl();
}
}
return parent;
}
}
return null;
}
代码示例来源:origin: pentaho/pentaho-kettle
private void addToolBar() {
try {
XulLoader loader = new KettleXulLoader();
loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
ResourceBundle bundle = GlobalMessages.getBundle( "org/pentaho/di/ui/spoon/messages/messages" );
XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_PREVIEW_TOOLBAR, bundle );
xulDomContainer.addEventHandler( this );
toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );
ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR );
swtToolBar.layout( true, true );
swtToolBar.pack();
firstRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-first" );
lastRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-last" );
offRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-off" );
PropsUI.getInstance().setLook( (Control) firstRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
PropsUI.getInstance().setLook( (Control) lastRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
PropsUI.getInstance().setLook( (Control) offRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
} catch ( Throwable t ) {
log.logError( toString(), Const.getStackTracker( t ) );
new ErrorDialog( transPreviewComposite.getShell(),
BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_PREVIEW_TOOLBAR ),
new Exception( t ) );
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public static LineWrapPreference create(Composite parentComposite, String label, String key, String wrapBeforeKey, Images images) {
ToolBar toolBar= new ToolBar(parentComposite, SWT.FLAT);
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
LineWrapPreference lineWrapPreference= new LineWrapPreference(toolBar, label, key, wrapBeforeKey, images);
lineWrapPreference.addLabel(label, true, 0);
return lineWrapPreference;
}
内容来源于网络,如有侵权,请联系作者删除!