本文整理匯總了Java中org.eclipse.swt.widgets.ToolItem.addSelectionListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ToolItem.addSelectionListener方法的具體用法?Java ToolItem.addSelectionListener怎麽用?Java ToolItem.addSelectionListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.ToolItem
的用法示例。
在下文中一共展示了ToolItem.addSelectionListener方法的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: addItemToToolBar
import org.eclipse.swt.widgets.ToolItem; //導入方法依賴的package包/類
private ToolItem addItemToToolBar(ToolBar bar, String text, String toolTip,
int type, SelectionAdapter listener, Image icon) {
ToolItem item = addItemToToolBar(bar, text, toolTip, type);
if (listener != null)
item.addSelectionListener(listener);
if (icon != null)
item.setImage(icon);
return item;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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();
}
});
}
示例7: 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;
}
示例8: 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);
}
示例9: 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());
}
示例10: BindBoolBeanValueToToolItemSelectionListener
import org.eclipse.swt.widgets.ToolItem; //導入方法依賴的package包/類
public BindBoolBeanValueToToolItemSelectionListener(String property, IPropertyChangeSupport bean, ToolItem ti) {
this.ti = ti;
this.property = property;
this.bean = bean;
// String sp = BeanUtils.getSimpleProperty(bean, property);
// System.out.println("VALUE OF PROPERTY: "+sp);
updateSelectionIfChanged();
bean.addPropertyChangeListener(this);
ti.addSelectionListener(this);
}
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:14,代碼來源:BindBoolBeanValueToToolItemSelectionListener.java
示例11: addSelectionListener
import org.eclipse.swt.widgets.ToolItem; //導入方法依賴的package包/類
public static boolean addSelectionListener(ToolItem ti, SelectionListener l) {
if (isDisposed(ti))
return false;
ti.addSelectionListener(l);
return true;
}
示例12: 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;
}
示例13: AttachManager
import org.eclipse.swt.widgets.ToolItem; //導入方法依賴的package包/類
AttachManager( final ItemModel model, final StyledText swtText, final ToolBar toolbar) {
// this.swtText = swtText;
this.toolBar = toolbar;
Open open = new Open(model, swtText);
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);
// i_open.addSelectionListener(new SelectionAdapter() {
// public void widgetSelected( SelectionEvent e){
// }
// });
// // Menu(bar)
// menu = new Menu(toolBar.getShell(), SWT.POP_UP);
//
// MenuItem m_addBody = new MenuItem(menu, SWT.PUSH);
// m_addBody.setText("Add File");
// m_addBody.addSelectionListener(open);
// m_attachPart = new MenuItem(menu, SWT.PUSH);
// m_attachPart.setText("Attach File");
// m_attachPart.addSelectionListener(open);
//
// addBody = new ToolItem(toolBar, SWT.DROP_DOWN);
// addBody.setImage(ResourceUtils.getImage(CoreImages.ATTACH));
// addBody.setToolTipText("Add Body");
// addBody.addListener(SWT.Selection, new Listener() {
// public void handleEvent( Event event){
// if (event.detail == SWT.ARROW) {
// Rectangle rect = addBody.getBounds();
// menu.setLocation(toolBar.toDisplay(rect.x, rect.y + rect.height));
// menu.setVisible(true);
// } else {
// FileDialog fd = new FileDialog(toolBar.getShell(), SWT.OPEN);
// fd.setText("Open");
// // fd.setFilterPath("C:/");
// fd.setFilterExtensions(CoreConstants.FILE_FILTER_EXT);
// String file = fd.open();
// if (file != null) {
// fileReadAction(file);
// }
// }
// }
// });
}
示例14: initTaggingToolbar
import org.eclipse.swt.widgets.ToolItem; //導入方法依賴的package包/類
private void initTaggingToolbar() {
boldTagItem = new ToolItem(regionsToolbar, SWT.PUSH);
boldTagItem.setImage(Images.getOrLoad("/icons/text_bold.png"));
boldTagItem.setToolTipText("Tag text as bold");
boldTagItem.setData(TextStyleTag.getBoldTag());
boldTagItem.addSelectionListener(new TagItemListener());
additionalToolItems.add(boldTagItem);
italicTagItem = new ToolItem(regionsToolbar, SWT.PUSH);
italicTagItem.setImage(Images.getOrLoad("/icons/text_italic.png"));
italicTagItem.setToolTipText("Tag as italic");
italicTagItem.setData(TextStyleTag.getItalicTag());
italicTagItem.addSelectionListener(new TagItemListener());
additionalToolItems.add(italicTagItem);
subscriptTagItem = new ToolItem(regionsToolbar, SWT.PUSH);
subscriptTagItem.setImage(Images.getOrLoad("/icons/text_subscript.png"));
subscriptTagItem.setToolTipText("Tag as subscript");
subscriptTagItem.setData(TextStyleTag.getSubscriptTag());
subscriptTagItem.addSelectionListener(new TagItemListener());
additionalToolItems.add(subscriptTagItem);
superscriptTagItem = new ToolItem(regionsToolbar, SWT.PUSH);
superscriptTagItem.setImage(Images.getOrLoad("/icons/text_superscript.png"));
superscriptTagItem.setToolTipText("Tag as superscript");
superscriptTagItem.setData(TextStyleTag.getSuperscriptTag());
superscriptTagItem.addSelectionListener(new TagItemListener());
additionalToolItems.add(superscriptTagItem);
underlinedTagItem = new ToolItem(regionsToolbar, SWT.PUSH);
underlinedTagItem.setImage(Images.getOrLoad("/icons/text_underline.png"));
underlinedTagItem.setToolTipText("Tag as underlined");
underlinedTagItem.setData(TextStyleTag.getUnderlinedTag());
underlinedTagItem.addSelectionListener(new TagItemListener());
additionalToolItems.add(underlinedTagItem);
strikethroughTagItem = new ToolItem(regionsToolbar, SWT.PUSH);
strikethroughTagItem.setImage(Images.getOrLoad("/icons/text_strikethrough.png"));
strikethroughTagItem.setToolTipText("Tag as strikethrough");
strikethroughTagItem.setData(TextStyleTag.getStrikethroughTag());
strikethroughTagItem.addSelectionListener(new TagItemListener());
additionalToolItems.add(strikethroughTagItem);
}
示例15: addSelectionListener
import org.eclipse.swt.widgets.ToolItem; //導入方法依賴的package包/類
private void addSelectionListener(ToolItem el) {
if (el!=null && !el.isDisposed()) el.addSelectionListener(this);
}