本文整理了Java中org.eclipse.swt.widgets.MenuItem.getText()
方法的一些代码示例,展示了MenuItem.getText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.getText()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.MenuItem
类名称:MenuItem
方法名:getText
暂无
代码示例来源:origin: com.eclipsesource.tabris/tabris
@Override
public void handleEvent( Event event ) {
MenuItem item = ( MenuItem )event.widget;
doSearch( item.getText() );
}
代码示例来源:origin: stefanhaustein/flowgrid
public String getTitle() {
return swtItem.getText();
}
代码示例来源:origin: BiglySoftware/BiglyBT
/**
* Helper method to set a keyboard accelerator for a MenuItem. If kbInfo is SWT.NONE, no accelerator will be set.
* @param menu SWT MenuItem
* @param kbInfo KeyBindingInfo object, which contains the SWT accelerator value and its display name
*/
private static void setAccelerator(final MenuItem menu, final KeyBindingInfo kbInfo)
{
if ( menu.isDisposed()){
return;
}
if(kbInfo.accelerator != SWT.NONE)
{
menu.setAccelerator(kbInfo.accelerator);
// SWT on OS X now uses native drawing
if(!Constants.isOSX && !menu.getText().endsWith(kbInfo.name))
menu.setText(menu.getText() + kbInfo.name);
}
}
代码示例来源:origin: openaudible/openaudible
String name = item.getText();
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
static void writeImageAndText( final MenuItem menuItem ) throws IOException {
String text = menuItem.getText();
if( WidgetLCAUtil.hasChanged( menuItem, Props.TEXT, text ) ) {
JSWriter writer = JSWriter.getWriterFor( menuItem );
// Strip accelerator text
int index = text.indexOf( "\t" );
if( index != -1 ) {
text = text.substring( 0, index );
}
text = WidgetLCAUtil.escapeText( text, true );
writer.set( "text", text.equals( "" ) ? null : text );
}
writeImage( menuItem );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
private static int getMenuItemWidth( final MenuItem menuItem ) {
Font systemFont = menuItem.getDisplay().getSystemFont();
int result
= ITEM_LEFT_PADDING
+ ITEM_IMAGE
+ ITEM_SPACING
+ Graphics.stringExtent( systemFont, menuItem.getText() ).x
+ ITEM_SPACING
+ ITEM_IMAGE
+ ITEM_RIGHT_PADDING;
return result;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
private static void writeText( final MenuItem menuItem ) throws IOException {
String text = menuItem.getText();
if( WidgetLCAUtil.hasChanged( menuItem, Props.TEXT, text ) ) {
JSWriter writer = JSWriter.getWriterFor( menuItem );
text = WidgetLCAUtil.escapeText( text, true );
writer.set( "text", text );
}
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private void prepareDrowpdown(ToolItem dropDown, String dropDownLabel, MenuItem mostPopularItem) {
dropDown.setToolTipText(dropDownLabel + mostPopularItem.getText());
dropDown.setImage(mostPopularItem.getImage());
dropDown.setEnabled(true);
}
};
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private static void renderText( MenuItem item ) {
String newValue = item.getText();
if( WidgetLCAUtil.hasChanged( item, PROP_TEXT, newValue, "" ) ) {
String text = MnemonicUtil.removeAmpersandControlCharacters( newValue );
getRemoteObject( item ).set( PROP_TEXT, text );
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
protected boolean valueMatches(StringMatcher matcher) {
String value= getPreferences().get(getKey());
int wrappingStyle= DefaultCodeFormatterConstants.getWrappingStyle(value);
MenuItem wrapStyleItem= updateMenuItem(fWrapStyleItems, wrappingStyle);
if (matcher.match(wrapStyleItem.getText()))
return true;
if (wrappingStyle == DefaultCodeFormatterConstants.WRAP_NO_SPLIT)
return false;
boolean forceWrapping= DefaultCodeFormatterConstants.getForceWrapping(value);
if (forceWrapping && matcher.match(fForceSplitItem.getToolTipText()))
return true;
MenuItem indentStyleItem= updateMenuItem(fIndentationItems, DefaultCodeFormatterConstants.getIndentStyle(value));
if (matcher.match(indentStyleItem.getText()))
return true;
if (fWrapBeforeKey != null) {
int wrapBeforeAfterValue= WRAP_BEFORE_PREF_VALUES.indexOf(getPreferences().get(fWrapBeforeKey));
MenuItem wrapBeforeAfterItem= updateMenuItem(fWrapBeforeAfterItems, wrapBeforeAfterValue);
if (matcher.match(wrapBeforeAfterItem.getText()))
return true;
}
return false;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private static void renderMnemonicIndex( MenuItem item ) {
if( ( item.getStyle() & SWT.SEPARATOR ) == 0 ) {
String text = item.getText();
if( WidgetLCAUtil.hasChanged( item, PROP_TEXT, text, "" ) ) {
int mnemonicIndex = MnemonicUtil.findMnemonicCharacterIndex( text );
if( mnemonicIndex != -1 ) {
getRemoteObject( item ).set( PROP_MNEMONIC_INDEX, mnemonicIndex );
}
}
}
}
代码示例来源:origin: com.eclipsesource.tabris/tabris
@Override
public void handleEvent( Event event ) {
MenuItem item = ( MenuItem )event.widget;
PageDescriptor pageDescriptor = ( PageDescriptor )item.getData();
ToolItem dropDown = pageSwitcher.getItem( 0 );
dropDown.setText( item.getText() );
dropDown.setData( pageDescriptor );
dropDown.setImage( item.getImage() );
if( !DATA_ACTIVATED.equals( event.data ) ) {
ui.getPageOperator().openPage( pageDescriptor.getId() );
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
if (imagesButton.getSelection()) item.setImage(instance.images[ControlExample.ciClosedFolder]);
item.setEnabled(enabledButton.getSelection());
if (tooltipButton.getSelection()) item.setToolTipText(ControlExample.getResourceString("Tooltip", item.getText() ));
hookListeners(item);
if (tooltipButton.getSelection()) item.setToolTipText(ControlExample.getResourceString("Tooltip", item.getText() ));
if (imagesButton.getSelection()) item.setImage(instance.images[ControlExample.ciOpenFolder]);
item.setEnabled(enabledButton.getSelection());
if (tooltipButton.getSelection()) item.setToolTipText(ControlExample.getResourceString("Tooltip", item.getText() ));
hookListeners(item);
item.setSelection(true);
item.setEnabled(enabledButton.getSelection());
if (tooltipButton.getSelection()) item.setToolTipText(ControlExample.getResourceString("Tooltip", item.getText() ));
hookListeners(item);
if (imagesButton.getSelection()) item.setImage(instance.images[ControlExample.ciTarget]);
item.setEnabled(enabledButton.getSelection());
if (tooltipButton.getSelection()) item.setToolTipText(ControlExample.getResourceString("Tooltip", item.getText()));
hookListeners(item);
item.setEnabled(enabledButton.getSelection());
hookListeners(subMenu);
if (tooltipButton.getSelection()) item.setToolTipText(ControlExample.getResourceString("Tooltip", item.getText() ));
createMenuItems(subMenu, createSubSubMenu, false);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
item.setText(getMenuItemText("Cascade"));
if (imagesButton.getSelection()) item.setImage(instance.images[ControlExample.ciOpenFolder]);
if (tooltipButton.getSelection()) item.setToolTipText(ControlExample.getResourceString("Tooltip", item.getText() ));
hookListeners(item);
Menu dropDownMenu = new Menu(shell, SWT.DROP_DOWN | radioBehavior);
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void handleEvent(Event e) {
if (e.widget instanceof MenuItem) {
String text = ((MenuItem) e.widget).getText();
TOTorrent torrent = manager.getTorrent();
TorrentUtils.announceGroupsSetFirst(torrent, text);
try {
TorrentUtils.writeToFile(torrent);
} catch (TOTorrentException f) {
Debug.printStackTrace(f);
}
TRTrackerAnnouncer tc = manager.getTrackerClient();
if (tc != null) {
tc.resetTrackerUrl(false);
}
}
}
};
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
protected void updateWidget() {
String value= getPreferences().get(getKey());
int wrappingStyle= DefaultCodeFormatterConstants.getWrappingStyle(value);
boolean wrapEnabled= wrappingStyle != DefaultCodeFormatterConstants.WRAP_NO_SPLIT;
MenuItem wrapStyleItem= updateMenuItem(fWrapStyleItems, wrappingStyle);
fWrapStyleDropDown.setToolTipText(FormatterMessages.FormatterModifyDialog_lineWrap_wrapping_policy_label + wrapStyleItem.getText());
fWrapStyleDropDown.setImage(wrapStyleItem.getImage());
boolean forceWrapping= DefaultCodeFormatterConstants.getForceWrapping(value);
fForceSplitItem.setSelection(forceWrapping);
fForceSplitItem.setEnabled(wrapEnabled);
MenuItem indentStyleItem= updateMenuItem(fIndentationItems, DefaultCodeFormatterConstants.getIndentStyle(value));
fIndentationDropDown.setToolTipText(FormatterMessages.FormatterModifyDialog_lineWrap_indentation_policy_label + indentStyleItem.getText());
fIndentationDropDown.setImage(indentStyleItem.getImage());
fIndentationDropDown.setDisabledImage((Image) indentStyleItem.getData(DATA_IMAGE_DISABLED));
fIndentationDropDown.setEnabled(wrapEnabled);
if (fWrapBeforeKey != null) {
int wrapBeforeAfterValue= WRAP_BEFORE_PREF_VALUES.indexOf(getPreferences().get(fWrapBeforeKey));
MenuItem wrapBeforeAfterItem= updateMenuItem(fWrapBeforeAfterItems, wrapBeforeAfterValue);
fWrapBeforeAfterDropDown.setToolTipText(wrapBeforeAfterItem.getText());
fWrapBeforeAfterDropDown.setImage(wrapBeforeAfterItem.getImage());
fWrapBeforeAfterDropDown.setDisabledImage((Image) wrapBeforeAfterItem.getData(DATA_IMAGE_DISABLED));
fWrapBeforeAfterDropDown.setEnabled(wrapEnabled);
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
@Override
public void preserveValues( MenuItem item ) {
preserveProperty( item, PROP_TEXT, item.getText() );
preserveProperty( item, PROP_IMAGE, item.getImage() );
preserveProperty( item, PROP_MENU, item.getMenu() );
preserveProperty( item, PROP_ENABLED, item.getEnabled() );
preserveProperty( item, PROP_SELECTION, item.getSelection() );
}
代码示例来源:origin: BiglySoftware/BiglyBT
chat_pub.setText( chat_pub.getText() + " (" + MessageText.getString( "PeersView.state.pending" ) + ")" );
chat_priv.setText( chat_priv.getText() + " (" + MessageText.getString( "PeersView.state.pending" ) + ")" );
chat_priv.setText( chat_priv.getText() + " (" + MessageText.getString( "PeersView.state.pending" ) + ")" );
代码示例来源:origin: BiglySoftware/BiglyBT
final MenuItem share_item = new MenuItem(menu, SWT.CASCADE);
Messages.setLanguageText(share_item, "azbuddy.ui.menu.cat.share");
share_item.setText( share_item.getText() + " " ); // nasty hack to fix nastyness on windows
share_item.setMenu(share_menu);
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
proxyItem.setImage(realItem.getImage());
proxyItem.setSelection(realItem.getSelection());
proxyItem.setText(realItem.getText());
内容来源于网络,如有侵权,请联系作者删除!