本文整理汇总了Java中org.eclipse.swt.widgets.ToolBar类的典型用法代码示例。如果您正苦于以下问题:Java ToolBar类的具体用法?Java ToolBar怎么用?Java ToolBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolBar类属于org.eclipse.swt.widgets包,在下文中一共展示了ToolBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ToolBarNavigator
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
public ToolBarNavigator ( final Composite parent, final int style, final ViewManager viewManager )
{
this.viewManager = viewManager;
this.toolbar = new ToolBar ( parent, style );
this.resourceManager = new LocalResourceManager ( JFaceResources.getResources ( parent.getDisplay () ) );
this.toolbar.addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
handleDispose ();
}
} );
viewManager.addViewManagerListener ( this );
}
示例2: createContent
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
private void createContent() {
toolBar = new ToolBar(this, SWT.HORIZONTAL);
toolBar.setEnabled(false);
GridLayout layout = new GridLayout();
GridData layoutData = new GridData(SWT.FILL, SWT.TOP, true, false);
toolBar.setLayout(layout);
toolBar.setLayoutData(layoutData);
ToolItem cancelProcessToolItem = new ToolItem(toolBar, SWT.PUSH);
cancelProcessToolItem.setText(resourceBundle.getString("cancel_process"));
cancelProcessToolItem.addListener(SWT.Selection, event -> {
listeners.forEach(DBProcessInfoViewListener::dbProcessInfoViewCancelProcessToolItemClicked);
});
ToolItem terminateProcessToolItem = new ToolItem(toolBar, SWT.PUSH);
terminateProcessToolItem.setText(resourceBundle.getString("kill_process"));
terminateProcessToolItem.addListener(SWT.Selection, event -> {
listeners.forEach(DBProcessInfoViewListener::dbProcessInfoViewTerminateProcessToolItemClicked);
});
processInfoText = new Text(this, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL);
GridData textLayoutData = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
textLayoutData.heightHint = 200;
processInfoText.setLayoutData(textLayoutData);
}
示例3: deleteToolItem
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
private void deleteToolItem(ToolBar toolBar) {
ToolItem tltmDelete = new ToolItem(toolBar, SWT.NONE);
tltmDelete.setWidth(5);
tltmDelete.setImage(ImagePathConstant.DELETE_BUTTON.getImageFromRegistry());
tltmDelete.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (TableItem tableItem : inputFieldTable.getSelection()) {
inputFields.remove(String.valueOf(tableItem.getData()));
}
inputFieldTableViewer.refresh();
dialog.refreshErrorLogs();
addCusrsorToLastRow();
}
});
}
示例4: createContent
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
private void createContent() {
toolBar = new ToolBar(this, SWT.HORIZONTAL);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
SashForm sashForm = new SashForm(this, SWT.HORIZONTAL);
sashForm.SASH_WIDTH = 2;
sashForm.setLayoutData(layoutData);
sashForm.setLayout(layout);
createLeftPanel(sashForm);
createRightPanel(sashForm);
sashForm.setSashWidth(2);
sashForm.setWeights(new int[] {15, 85});
}
示例5: createTagComposite
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
/**
* Creates the actual GUI widgets.
*/
private static Composite createTagComposite(Composite parent, TagVM tagVm, TagToolItemConfigurator configurator) {
Composite tagContainer = new Composite(parent, SWT.BORDER);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
tagContainer.setLayout(layout);
Label tagLabel = new Label(tagContainer, SWT.NONE);
tagLabel.setText(tagVm.getName());
GridData gdl = new GridData();
gdl.verticalAlignment = GridData.CENTER;
tagLabel.setLayoutData(gdl);
ToolBar toolBar = new ToolBar(tagContainer, SWT.FLAT);
Rectangle clientArea = tagContainer.getClientArea();
toolBar.setLocation(clientArea.x, clientArea.y);
configurator.setupToolbar(toolBar, tagVm);
toolBar.pack();
return tagContainer;
}
示例6: createToolItem
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
public ToolItem createToolItem(final ToolBar toolbar) {
configureResources();
item = new ToolItem(toolbar, SWT.RADIO);
item.setImage(getImage());
item.setToolTipText(getToolTip());
item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
js.showPage(JSmoothPage.this);
ToolItem[] items = toolbar.getItems();
for (int i = 0; i < items.length; i++) {
if (items[i] != item) items[i].setSelection(false);
}
}
});
return item;
}
示例7: createComposites
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
private void createComposites(Composite parent) {
ToolBar toolBar = new ToolBar(parent, SWT.VERTICAL | SWT.FLAT | SWT.WRAP);
toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true , true));
Composite option = new Composite(parent,SWT.NONE);
option.setLayout(new FormLayout());
initOptions(toolBar,option);
Point optionSize = computeOptionsSize(0 , toolBar.computeSize(SWT.DEFAULT,SWT.DEFAULT).y );
option.setLayoutData(new GridData(optionSize.x,optionSize.y));
if( this.options.size() > 0 ){
select((Option)this.options.get(0));
}
}
示例8: main
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
ToolBar bar = new ToolBar(shell, SWT.BORDER|SWT.VERTICAL);
for (int i = 0; i < 4; i++) {
ToolItem item = new ToolItem(bar, 0);
// item.setText("Item " + i);
item.setImage(Images.APPLICATION);
}
bar.pack();
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
示例9: createContents
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
protected Control createContents(Composite parent) {
// --- Create the window title. ---
getShell().setText("CoolBar Test");
String asCoolItemSection[] = { "File", "Formatting", "Search" };
CoolBar composite = new CoolBar(parent, SWT.NONE);
for (int idxCoolItem = 0; idxCoolItem < 3; ++idxCoolItem) {
CoolItem item = new CoolItem(composite, SWT.NONE);
ToolBar tb = new ToolBar(composite, SWT.FLAT);
for (int idxItem = 0; idxItem < 3; ++idxItem) {
ToolItem ti = new ToolItem(tb, SWT.NONE);
ti
.setText(asCoolItemSection[idxCoolItem] + " Item #"
+ idxItem);
}
Point p = tb.computeSize(SWT.DEFAULT, SWT.DEFAULT);
tb.setSize(p);
Point p2 = item.computeSize(p.x, p.y);
item.setControl(tb);
item.setSize(p2);
}
return composite;
}
示例10: CanvasToolBarNew
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
public CanvasToolBarNew(CanvasWidget parent, ToolBar mainTb, ToolBar viewTb, ToolBar editTb, int style) {
Assert.assertNotNull("mainTb must be given!", mainTb);
// Assert.assertNotNull("viewTb must be given!", viewTb);
Assert.assertNotNull("editTb must be given!", editTb);
this.mainTb = mainTb;
this.viewTb = viewTb;
this.editTb = editTb;
this.canvasWidget = parent;
// initMainTb(mainTb);
createViewItems(mainTb);
createEditItems(editTb);
addListeners();
updateButtonVisibility();
}
示例11: toggleToolbarVisiblity
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
public void toggleToolbarVisiblity(ToolBar tb, boolean show) {
if (tb != bar1 && tb != bar2)
return;
if (!show) {
tb.setParent(SWTUtil.dummyShell);
} else {
tb.setParent(this);
}
if (tb == bar1) {
tb.moveAbove(null);
} else {
tb.moveAbove(canvas);
}
pack();
}
示例12: createUI_20_GalleryToolbars
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
/**
* fill gallery actionbar
*
* @param galleryActionBarContainer
*/
private void createUI_20_GalleryToolbars(final Composite galleryActionBarContainer) {
/*
* toolbar actions
*/
_galleryToolbar = new ToolBar(galleryActionBarContainer, SWT.FLAT);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(_galleryToolbar);
final ToolBarManager tbm = new ToolBarManager(_galleryToolbar);
tbm.add(_actionToggleFolderGallery);
tbm.add(_actionNavigateBackward);
tbm.add(_actionNavigateForward);
tbm.update(true);
}
示例13: showViewMenu
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
protected void showViewMenu(MenuManager manager, ToolBar toolBar) {
// don't show if the debug button is disabled.
if (!isVisible()) {
return;
}
Menu menu = manager.createContextMenu(applicationActionButton);
applicationActionButton.setMenu(menu);
Rectangle bounds = toolBar.getBounds();
// Position the menu near the toolitem
Point topRight = new Point(bounds.x + bounds.x / 10, bounds.height);
topRight = applicationActionButton.toDisplay(topRight);
menu.setLocation(topRight.x, topRight.y);
menu.setVisible(true);
}
示例14: DataMappingComposite
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
public DataMappingComposite(Composite parent, int style)
{
super(parent, style);
GridLayout layout = new GridLayout(2, false);
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
layout.marginWidth = 0;
layout.marginHeight = 0;
this.setLayout(layout);
text = new StyledText(this, SWT.BORDER);
text.setBackground(getGrey());
text.setEnabled(false);
text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
text.setTopMargin(2);
ToolBar toolBar = new ToolBar(this, SWT.HORIZONTAL);
toolBar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1));
btnAttributeBrowser = new ToolItem(toolBar, SWT.NONE);
btnAttributeBrowser.setImage(IconFactory.get(parent.getDisplay()).getAttribute16());
}
示例15: fill
import org.eclipse.swt.widgets.ToolBar; //导入依赖的package包/类
@Override
public void fill(final ToolBar parent, int index)
{
toolItem = new ToolItem(parent, SWT.DROP_DOWN);
toolItem.setImage(actionProvider.getImage());
// toolItem.setDisabledImage(actionProvider.getDisabledImage());
// toolItem.setHotImage(actionProvider.getHotImage());
toolItem.setToolTipText(actionProvider.getToolTip());
toolItem.addSelectionListener(new SelectionAdapter()
{
@Override
public void widgetSelected(SelectionEvent selectionEvent)
{
actionProvider.run(parent);
}
});
}