本文整理汇总了Java中org.eclipse.swt.widgets.ToolItem.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java ToolItem.setImage方法的具体用法?Java ToolItem.setImage怎么用?Java ToolItem.setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.ToolItem
的用法示例。
在下文中一共展示了ToolItem.setImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
});
}
示例2: createToolItem
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的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;
}
示例3: 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();
}
示例4: addItemToToolBar
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
private ToolItem addItemToToolBar(ToolBar bar, String text, String toolTip,
int type, Listener listener, Image icon) {
ToolItem item = addItemToToolBar(bar, text, toolTip, type);
if (listener != null)
item.addListener(SWT.Selection, listener);
if (icon != null)
item.setImage(icon);
return item;
}
示例5: setToolItemIcon
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
private void setToolItemIcon(ToolItem toolItem, String iconPath, String text, String tooltip) {
try {
toolItem.setImage(ConvertigoPlugin.getDefault().getStudioIcon(iconPath));
} catch (IOException e1) {
toolItem.setText(text);
}
toolItem.setToolTipText(tooltip);
}
示例6: dialogBuild
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
private void dialogBuild(ToolItem buildModeItem, MenuItem menuItem) {
MobileBuilderBuildMode newBuildMode = (MobileBuilderBuildMode) menuItem.getData();
if (dialogBuild(newBuildMode)) {
buildModeItem.setImage(menuItem.getImage());
buildModeItem.setToolTipText("Rebuild in: " + buildMode.label() + "\n" + buildMode.description());
try {
JSONObject device = new JSONObject(FileUtils.readFileToString(devicePref, "UTF-8"));
device.put("buildMode", buildMode.name());
FileUtils.write(devicePref, device.toString(4), "UTF-8");
} catch (Exception ex) {
Engine.logStudio.debug("Cannot save build mode", ex);
}
}
}
示例7: createCopyToolItem
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
/**
* Create the copy tool item (button).
*/
protected ToolItem createCopyToolItem() {
ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
toolItem.setImage(imageManager.get(ImageManager.ICON_COPY));
toolItem.setText(textBundle.get("FileViewerWindow.CopyButton")); //$NON-NLS-1$
toolItem.setToolTipText(textBundle.get("FileViewerWindow.CopyTooltip")); //$NON-NLS-1$
toolItem.setEnabled(true);
toolItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getContentTypeAdapter().copy();
}
});
return toolItem;
}
示例8: createPrintToolItem
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
/**
* Create the print tool item (button).
*/
protected ToolItem createPrintToolItem() {
ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
toolItem.setImage(imageManager.get(ImageManager.ICON_PRINT_FILE));
toolItem.setText(textBundle.get("PrintButton")); //$NON-NLS-1$
toolItem.setToolTipText(textBundle.get("FileViewerWindow.PrintTooltip")); //$NON-NLS-1$
toolItem.setEnabled(true);
toolItem.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
getContentTypeAdapter().print();
}
});
return toolItem;
}
示例9: addToolItem
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
private void addToolItem(ToolBar toolBar) {
ToolItem tltmNewItem = new ToolItem(toolBar, SWT.NONE);
tltmNewItem.setImage(ImagePathConstant.ADD_BUTTON.getImageFromRegistry());
tltmNewItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
inputFields.add("Field");
dialog.refreshErrorLogs();
}
});
}
示例10: addIconButton
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
public ToolItem addIconButton(ToolBar toolBar, Command cmd) {
final ToolItem item = new ToolItem(toolBar, SWT.PUSH);
String icon = "icons/" + cmd.name().toLowerCase() + ".png";
item.setImage(PaintShop.getImage(icon));
item.setText("");
item.setToolTipText(cmd.getToolTip());
item.setData(cmd);
item.addSelectionListener(this);
return item;
}
示例11: doToolbar
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
private ViewForm doToolbar( String title, final ItemModel model, final Composite parent){
final ViewForm vForm = ViewUtils.buildViewForm(title, model, parent);
final ToolBar bar = new ToolBar(vForm, SWT.FLAT);
ToolItem i_raw = new ToolItem(bar, SWT.RADIO);
i_raw.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.RAW));
i_raw.setToolTipText("Raw View");
ToolItem i_pretty = new ToolItem(bar, SWT.RADIO);
i_pretty.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.PRETTY));
i_pretty.setToolTipText("Pretty View");
ToolItem i_json = new ToolItem(bar, SWT.RADIO);
i_json.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.JSON));
i_json.setToolTipText("JSON View");
ToolItem i_hex = new ToolItem(bar, SWT.RADIO);
i_hex.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.HEX));
i_hex.setToolTipText("Hex View");
ToolItem i_br = new ToolItem(bar, SWT.RADIO);
i_br.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.BROWSER));
i_br.setToolTipText("View in Browser");
vForm.setTopCenter(bar);
return vForm;
}
示例12: ParamsAttachManager
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
ParamsAttachManager( final ItemModel model, final StyledText styledText, final ToolBar toolbar) {
// this.swtText = swtText;
this.toolBar = toolbar;
ParamsOpen open = new ParamsOpen(this, model, styledText);
i_open = new ToolItem(toolBar, SWT.PUSH);
i_open.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.FILE_OPEN));
i_open.setDisabledImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.FILE_OPEN_DIS));
i_open.setToolTipText("Add File");
i_open.addSelectionListener(open);
}
示例13: initToolBar2
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
/**
* add all toolbar buttons that come *after* the canvas toolbar
*/
private void initToolBar2() {
new ToolItem(toolBar, SWT.SEPARATOR);
bugReportItem = new ToolItem(toolBar, SWT.PUSH);
bugReportItem.setToolTipText("Send a bug report or feature request");
bugReportItem.setImage(Images.BUG);
//new ToolItem(toolBar, SWT.SEPARATOR);
toolBar.pack();
updateToolBarSize();
}
示例14: WordTranscriptionWidget
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
public WordTranscriptionWidget(final Composite parent, int style, TrpSettings settings, TrpMainWidgetView view) {
super(parent, style, settings, view);
deleteWordTextItem.setEnabled(true);
applyTextFromWords = new ToolItem(regionsPagingToolBar.getToolBar(), SWT.CHECK);
applyTextFromWords.setImage(Images.getOrLoad("/icons/arrow_merge.png"));
applyTextFromWords.setText("Sync with lines");
applyTextFromWords.setToolTipText("Enable to sync the text in the words with the text in the corresponding lines - warning: overwrites the text content in the lines!");
applyTextFromWords.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (currentRegionObject != null) {
logger.debug("applying text from words to lines and region!");
if (applyTextFromWords.getSelection()) {
if (DialogUtil.showYesNoDialog(parent.getShell(),
"Synchronize word text to lines", "Do you really want to overwrite the text in the lines with text from the words?") == SWT.YES) {
applyTextFromWords();
}
else {
applyTextFromWords.setSelection(false);
}
}
}
}
});
// applyTextFromWords.setEnabled(!isLinesInSyncWithWordsText());
}
示例15: createLinkToolBar
import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
private ToolBar createLinkToolBar(final CoolBar parent) {
final ToolBar toolBar = new ToolBar(parent, toolbarStyle);
linkButtonItem = new ToolItem(toolBar, SWT.PUSH);
linkButtonItem.setToolTipText(Messages.getString("HTMLEditor.ConvertToHyperlinkToolTip")); //$NON-NLS-1$
linkButtonItem.setImage(imageHelper.getImage("/images/htmleditor/link.gif")); //$NON-NLS-1$
linkButtonItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
/*
* IE and Mozilla do not give us the existing link on the
* selecte item (if there is one) through any
* queryCommandValue() invocation. To retrieve the current link,
* call a special method on the HTMLEditor.
*/
final Object existingLinkObject = evaluate("return editor.getLinkUnderSelection() || '';"); //$NON-NLS-1$
final String initialValue =
((existingLinkObject instanceof String) && existingLinkObject.toString().length() > 0)
? (String) existingLinkObject : "http://"; //$NON-NLS-1$
final StringInputDialog dialog =
new StringInputDialog(
getShell(),
Messages.getString("HTMLEditor.HyperlinkInputDialogPrompt"), //$NON-NLS-1$
initialValue,
Messages.getString("HTMLEditor.HyperlinkInputDialogTitle"), //$NON-NLS-1$
"HTMLEditor.toolBar.linkButtonItem"); //$NON-NLS-1$
/*
* Allow an empty string, to unset the link.
*/
dialog.setRequired(false);
if (dialog.open() == IDialogConstants.OK_ID) {
if (dialog.getInput() != null && dialog.getInput().length() > 0) {
/*
* Disallow Javascript links. These would be removed
* during the round-trip through save anyway (see
* HtmlFilter).
*/
if (dialog.getInput().startsWith("javascript:") == false) //$NON-NLS-1$
{
doEditorCommand("CreateLink", false, dialog.getInput()); //$NON-NLS-1$
}
} else {
doEditorCommand("Unlink", false, null); //$NON-NLS-1$
}
}
}
});
return toolBar;
}