當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。