当前位置: 首页>>代码示例>>Java>>正文


Java ToolItem类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.ToolItem的典型用法代码示例。如果您正苦于以下问题:Java ToolItem类的具体用法?Java ToolItem怎么用?Java ToolItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ToolItem类属于org.eclipse.swt.widgets包,在下文中一共展示了ToolItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createContent

import org.eclipse.swt.widgets.ToolItem; //导入依赖的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);
}
 
开发者ID:technology16,项目名称:pgsqlblocks,代码行数:26,代码来源:DBProcessInfoView.java

示例2: createToolbarButton

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
private void createToolbarButton ()
{
    if ( this.button == null )
    {
        final int index = this.toolBarNavigator.calculateToolbarIndex ( this.descriptor );

        if ( index < 0 )
        {
            return;
        }

        this.button = new ToolItem ( this.toolbar, SWT.RADIO, index );
        this.button.setText ( this.descriptor.getName () );
        this.button.addSelectionListener ( new SelectionAdapter () {
            @Override
            public void widgetSelected ( final org.eclipse.swt.events.SelectionEvent e )
            {
                showView ( ToolBarNavigatorItem.this.descriptor.getId () );
            };
        } );
        // set current state
        this.button.setImage ( this.currentButtonImage );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:25,代码来源:ToolBarNavigatorItem.java

示例3: toolBarSetEnable

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
public void toolBarSetEnable(String toolItemId, boolean enable) {
	try {
		final int i = toolItemsIds.get(toolItemId).intValue();
		final boolean enabled = enable;
		getDisplay().asyncExec(new Runnable() {
			public void run() {
				if (toolBar.isDisposed())
					return;
				ToolItem[] toolItems = toolBar.getItems();
				ToolItem toolItem = toolItems[i];
				if (toolItem != null)
					toolItem.setEnabled(enabled);
			}
		});
	} catch (Exception e) {
	}
	;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:19,代码来源:ConnectorEditorPart.java

示例4: toolBarSetSelection

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
public void toolBarSetSelection(String toolItemId, boolean select) {
	try {
		final int i = toolItemsIds.get(toolItemId).intValue();
		final boolean selected = select;
		getDisplay().syncExec(new Runnable() {
			public void run() {
				if (toolBar.isDisposed())
					return;
				ToolItem[] toolItems = toolBar.getItems();
				ToolItem toolItem = toolItems[i];
				if (toolItem != null)
					toolItem.setSelection(selected);
			}
		});
	} catch (Exception e) {
	}
	;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:19,代码来源:ConnectorEditorPart.java

示例5: deleteToolItem

import org.eclipse.swt.widgets.ToolItem; //导入依赖的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();
		}
	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:InputFieldsComposite.java

示例6: runWithEvent

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
@Override
public void runWithEvent(final Event event) {
    if (showMenuForDefaultAction) {
        final ToolItem item = (ToolItem) event.widget;
        final Rectangle itemRectangle = item.getBounds();
        final Point point = item.getParent().toDisplay(new Point(itemRectangle.x, itemRectangle.y));

        final Menu menu = getSubActionMenu(item.getParent());
        menu.setLocation(point.x, point.y + itemRectangle.height);
        menu.setVisible(true);
    } else {
        final IAction defaultSubAction = getDefaultSubAction();
        if (defaultSubAction != null && defaultSubAction.isEnabled()) {
            defaultSubAction.runWithEvent(event);
        }
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:18,代码来源:ToolbarPulldownAction.java

示例7: createSection

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
public void createSection(final TGToolBar toolBar) {
	this.undo = new ToolItem(toolBar.getControl(), SWT.PUSH);
	this.undo.addSelectionListener(toolBar.createActionProcessor(TGUndoAction.NAME));
	
	this.redo = new ToolItem(toolBar.getControl(), SWT.PUSH);
	this.redo.addSelectionListener(toolBar.createActionProcessor(TGRedoAction.NAME));
	
	this.menuItem = new ToolItem(toolBar.getControl(), SWT.PUSH);
	this.menuItem.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent event) {
			createMenu(toolBar, (ToolItem) event.widget);
		}
	});
	
	this.loadIcons(toolBar);
	this.loadProperties(toolBar);
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:18,代码来源:TGToolBarSectionEdit.java

示例8: addSelectionListener

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
public static void addSelectionListener(Widget w, SelectionListener l) {
	if (w instanceof MenuItem)
		addSelectionListener((MenuItem) w, l);
	else if (w instanceof ToolItem)
		addSelectionListener((ToolItem) w, l);
	else if (w instanceof Button)
		addSelectionListener((Button) w, l);
	else if (w instanceof DropDownToolItem) {
		addSelectionListener((DropDownToolItem) w, l);
	} 
	else if (w instanceof CTabFolder) {
		addSelectionListener((CTabFolder) w, l);
	}
	else if (w instanceof Combo){
		addSelectionListener((Combo) w, l);
	}
	else
		throw new RuntimeException("Widget type not supported for selection events: " + w);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:20,代码来源:SWTUtil.java

示例9: createDivisionTypeMenu

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
private void createDivisionTypeMenu(TGToolBar toolBar, ToolItem item) {
	TGDuration duration = TablatureEditor.getInstance(toolBar.getContext()).getTablature().getCaret().getDuration();
	Menu menu = new Menu(item.getParent().getShell());
	
	for( int i = 0 ; i < TGDivisionType.ALTERED_DIVISION_TYPES.length ; i ++ ){
		TGDivisionType divisionType = TGDivisionType.ALTERED_DIVISION_TYPES[i];
		
		MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
		menuItem.setText(toolBar.toCheckString(Integer.toString(TGDivisionType.ALTERED_DIVISION_TYPES[i].getEnters()), (divisionType.isEqual(duration.getDivision()))));
		menuItem.addSelectionListener(this.createDivisionTypeAction(toolBar, divisionType));
	}
	
	Rectangle rect = item.getBounds();
	Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y));
	
	menu.setLocation(pt.x, pt.y + rect.height);
	menu.setVisible(true);
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:19,代码来源:TGToolBarSectionDuration.java

示例10: main

import org.eclipse.swt.widgets.ToolItem; //导入依赖的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();
  }
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:20,代码来源:ToolBarVertical.java

示例11: createContents

import org.eclipse.swt.widgets.ToolItem; //导入依赖的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;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:25,代码来源:SWTCoolBarTestDemo.java

示例12: setEnabled

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
@Override public void setEnabled(boolean value) {
	super.setEnabled(value);
	
	regionsPagingToolBar.setToolbarEnabled(value);
	for (ToolItem ti : additionalToolItems)
		ti.setEnabled(value);
	
	text.setEnabled(value);
	
	if (!value) {
		text.setLineBullet(0, text.getLineCount(), null);
		text.setStyleRange(null);
		text.setBackground(Colors.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
	} else
		text.setBackground(Colors.getSystemColor(SWT.COLOR_WHITE));
	
	undoRedo.setEnabled(value);
	
	if (value && showWordGraphEditorItem!=null)
		setWordGraphEditorVisibility(showWordGraphEditorItem.getSelection());
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:22,代码来源:ATranscriptionWidget.java

示例13: runWithEvent

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
@Override
public void runWithEvent(final Event event) {
	if (event.widget instanceof ToolItem) {
		final ToolItem toolItem = (ToolItem) event.widget;
		final Control control = toolItem.getParent();
		@SuppressWarnings("hiding")
		final Menu menu = getMenu(control);
		final Rectangle bounds = toolItem.getBounds();
		final Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
		menu.setLocation(control.toDisplay(topLeft));
		menu.setVisible(true);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:DropDownAction.java

示例14: runWithEvent

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
@Override
public void runWithEvent(Event event) {
	if (event.widget instanceof ToolItem) {
		final ToolItem toolItem = (ToolItem) event.widget;
		final Control control = toolItem.getParent();
		final Menu menu = getMenuCreator().getMenu(control);

		final Rectangle bounds = toolItem.getBounds();
		final Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
		menu.setLocation(control.toDisplay(topLeft));
		menu.setVisible(true);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:ShowHistoryAction.java

示例15: addItemToToolBar

import org.eclipse.swt.widgets.ToolItem; //导入依赖的package包/类
private ToolItem addItemToToolBar(ToolBar bar, String text, String toolTip,
		int type) {
	ToolItem cit = new ToolItem(bar, type);
	if (text != null)
		cit.setText(text);
	if (toolTip != null)
		cit.setToolTipText(toolTip);

	return cit;
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:11,代码来源:BarManager.java


注:本文中的org.eclipse.swt.widgets.ToolItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。