本文整理了Java中org.eclipse.swt.widgets.MenuItem.<init>()
方法的一些代码示例,展示了MenuItem.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.<init>()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.MenuItem
类名称:MenuItem
方法名:<init>
[英]Constructs a new instance of this class given its parent (which must be a Menu
) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent.
The style value is either one of the style constants defined in class SWT
which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int
"|" operator) two or more of those SWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
[中]给定该类的父类(必须是Menu
)和描述其行为和外观的样式值,构造该类的新实例。该项将添加到其父项维护的项的末尾。
样式值可以是类SWT
中定义的样式常量之一,该类适用于该类的实例,或者必须通过位或组合(即使用int
“|”运算符)两个或多个SWT
样式常量来构建。类描述列出了适用于该类的样式常量。样式位也继承自超类。
代码示例来源:origin: caoxinyu/RedisClient
private Menu initMenuTreeServer() {
Menu menu_server = initMenuTableServer();
new MenuItem(menu_server, SWT.SEPARATOR);
MenuItem mntmRefresh_3 = new MenuItem(menu_server, SWT.NONE);
mntmRefresh_3.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TreeItem[] items = tree.getSelection();
serverTreeItemSelected(items[0], true);
}
});
mntmRefresh_3.setText(i18nFile.getText(I18nFile.REFRESH));
return menu_server;
}
代码示例来源:origin: caoxinyu/RedisClient
private Menu initMenuTreeDB() {
Menu menu = initMenuTableDB();
new MenuItem(menu, SWT.SEPARATOR);
MenuItem mntmRefresh_2 = new MenuItem(menu, SWT.NONE);
mntmRefresh_2.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TreeItem[] items = tree.getSelection();
refreshOrder();
dbContainerTreeItemSelected(items[0], true);
}
});
mntmRefresh_2.setText(i18nFile.getText(I18nFile.REFRESH));
return menu;
}
代码示例来源:origin: caoxinyu/RedisClient
private void addFavoriteMenuItem() {
List<Favorite> favorites = service3.listAll();
if (favorites.size() > 0) {
new MenuItem(menuFavorite, SWT.SEPARATOR);
for (Favorite favorite : favorites) {
final MenuItem menuItem = new MenuItem(menuFavorite, SWT.NONE);
menuItem.setText(favorite.getName());
menuItem.setData(FAVORITE, favorite);
代码示例来源:origin: caoxinyu/RedisClient
private void initMenuMulti() {
menu_Multi = new Menu(shell);
MenuItem mntmDelete_5 = new MenuItem(menu_Multi, SWT.NONE);
mntmDelete_5.addSelectionListener(new SelectionAdapter() {
@Override
mntmDelete_5.setText(i18nFile.getText(I18nFile.DELETE));
new MenuItem(menu_Multi, SWT.SEPARATOR);
MenuItem mntmCut_2 = new MenuItem(menu_Multi, SWT.NONE);
mntmCut_2.addSelectionListener(new SelectionAdapter() {
@Override
mntmCut_2.setText(i18nFile.getText(I18nFile.CUT));
MenuItem mntmCopy_3 = new MenuItem(menu_Multi, SWT.NONE);
mntmCopy_3.addSelectionListener(new SelectionAdapter() {
@Override
mntmCopy_3.setText(i18nFile.getText(I18nFile.COPY));
new MenuItem(menu_Multi, SWT.SEPARATOR);
MenuItem mntmExport_2 = new MenuItem(menu_Multi, SWT.NONE);
mntmExport_2.addSelectionListener(new SelectionAdapter() {
@Override
代码示例来源:origin: pentaho/pentaho-kettle
private Menu createRootPopupMenu( Tree tree ) {
if ( rootMenu == null ) {
rootMenu = new Menu( tree );
MenuItem menuItem = new MenuItem( rootMenu, SWT.NONE );
menuItem.setText( BaseMessages.getString( PKG, "RunConfigurationPopupMenuExtension.MenuItem.New" ) );
menuItem.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent selectionEvent ) {
runConfigurationDelegate.create();
}
} );
}
return rootMenu;
}
代码示例来源:origin: pentaho/pentaho-kettle
private void buildingFolderMenu() {
MenuItem addNewItem = new MenuItem( cMenu, SWT.PUSH );
addNewItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.AddNewTab" ) );
addNewItem.addListener( SWT.Selection, new Listener() {
MenuItem copyItem = new MenuItem( cMenu, SWT.PUSH );
copyItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.AddCopy" ) );
copyItem.addListener( SWT.Selection, new Listener() {
new MenuItem( cMenu, SWT.SEPARATOR );
MenuItem setActiveScriptItem = new MenuItem( cMenu, SWT.PUSH );
setActiveScriptItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.SetTransformClass" ) );
setActiveScriptItem.addListener( SWT.Selection, new Listener() {
new MenuItem( cMenu, SWT.SEPARATOR );
MenuItem setRemoveScriptItem = new MenuItem( cMenu, SWT.PUSH );
setRemoveScriptItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.RemoveClassType" ) );
setRemoveScriptItem.addListener( SWT.Selection, new Listener() {
代码示例来源:origin: pentaho/pentaho-kettle
private Menu createItemPopupMenu( Tree tree ) {
if ( itemMenu == null ) {
itemMenu = new Menu( tree );
MenuItem editMenuItem = new MenuItem( itemMenu, SWT.NONE );
editMenuItem.setText( BaseMessages.getString( PKG, "RunConfigurationPopupMenuExtension.MenuItem.Edit" ) );
editMenuItem.addSelectionListener( new SelectionAdapter() {
@Override public void widgetSelected( SelectionEvent selectionEvent ) {
runConfigurationDelegate.edit( runConfigurationManager.load( runConfiguration ) );
}
} );
MenuItem deleteMenuItem = new MenuItem( itemMenu, SWT.NONE );
deleteMenuItem.setText( BaseMessages.getString( PKG, "RunConfigurationPopupMenuExtension.MenuItem.Delete" ) );
deleteMenuItem.addSelectionListener( new SelectionAdapter() {
@Override public void widgetSelected( SelectionEvent selectionEvent ) {
runConfigurationDelegate.delete( runConfigurationManager.load( runConfiguration ) );
}
} );
}
return itemMenu;
}
}
代码示例来源:origin: caoxinyu/RedisClient
MenuItem mntmNewConnection = new MenuItem(menu_null, SWT.NONE);
mntmNewConnection.addSelectionListener(new SelectionAdapter() {
@Override
mntmNewConnection.setText(i18nFile.getText(I18nFile.ADDSERVER));
new MenuItem(menu_null, SWT.SEPARATOR);
MenuItem mntmFind = new MenuItem(menu_null, SWT.NONE);
mntmFind.addSelectionListener(new SelectionAdapter() {
@Override
mntmFind.setText(i18nFile.getText(I18nFile.FIND));
MenuItem mntmFindNext = new MenuItem(menu_null, SWT.NONE);
mntmFindNext.addSelectionListener(new SelectionAdapter() {
@Override
MenuItem mntmFindBackward_2 = new MenuItem(menu_null, SWT.NONE);
mntmFindBackward_2.addSelectionListener(new SelectionAdapter() {
@Override
new MenuItem(menu_null, SWT.SEPARATOR);
MenuItem mntmRefresh = new MenuItem(menu_null, SWT.NONE);
mntmRefresh.addSelectionListener(new SelectionAdapter() {
@Override
代码示例来源:origin: pentaho/pentaho-kettle
private void buildingTreeMenu() {
MenuItem addDeleteItem = new MenuItem( tMenu, SWT.PUSH );
addDeleteItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Delete.Label" ) );
addDeleteItem.addListener( SWT.Selection, new Listener() {
MenuItem renItem = new MenuItem( tMenu, SWT.PUSH );
renItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Rename.Label" ) );
renItem.addListener( SWT.Selection, new Listener() {
new MenuItem( tMenu, SWT.SEPARATOR );
MenuItem helpItem = new MenuItem( tMenu, SWT.PUSH );
helpItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Sample.Label" ) );
helpItem.addListener( SWT.Selection, new Listener() {
代码示例来源:origin: pentaho/pentaho-kettle
private void buildingTreeMenu() {
MenuItem addDeleteItem = new MenuItem( tMenu, SWT.PUSH );
addDeleteItem.setText( BaseMessages.getString( PKG, "ScriptDialog.Delete.Label" ) );
addDeleteItem.addListener( SWT.Selection, new Listener() {
MenuItem renItem = new MenuItem( tMenu, SWT.PUSH );
renItem.setText( BaseMessages.getString( PKG, "ScriptDialog.Rename.Label" ) );
renItem.addListener( SWT.Selection, new Listener() {
new MenuItem( tMenu, SWT.SEPARATOR );
MenuItem helpItem = new MenuItem( tMenu, SWT.PUSH );
helpItem.setText( BaseMessages.getString( PKG, "ScriptDialog.Sample.Label" ) );
helpItem.addListener( SWT.Selection, new Listener() {
代码示例来源:origin: pentaho/pentaho-kettle
private void buildingTreeMenu() {
MenuItem addDeleteItem = new MenuItem( tMenu, SWT.PUSH );
addDeleteItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.Delete.Label" ) );
addDeleteItem.setImage( imageDeleteScript );
MenuItem renItem = new MenuItem( tMenu, SWT.PUSH );
renItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.Rename.Label" ) );
renItem.addListener( SWT.Selection, new Listener() {
new MenuItem( tMenu, SWT.SEPARATOR );
MenuItem helpItem = new MenuItem( tMenu, SWT.PUSH );
helpItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.Sample.Label" ) );
helpItem.addListener( SWT.Selection, new Listener() {
代码示例来源:origin: caoxinyu/RedisClient
MenuItem mntmCut = new MenuItem(menu, SWT.NONE);
mntmCut.addSelectionListener(new SelectionAdapter() {
@Override
mntmCut.setText(RedisClient.i18nFile.getText(I18nFile.CUT));
MenuItem mntmCopy = new MenuItem(menu, SWT.NONE);
mntmCopy.addSelectionListener(new SelectionAdapter() {
@Override
mntmCopy.setText(RedisClient.i18nFile.getText(I18nFile.COPY));
MenuItem mntmPaste = new MenuItem(menu, SWT.NONE);
mntmPaste.addSelectionListener(new SelectionAdapter() {
@Override
mntmPaste.setText(RedisClient.i18nFile.getText(I18nFile.PASTE));
MenuItem mntmSelectAll = new MenuItem(menu, SWT.NONE);
mntmSelectAll.addSelectionListener(new SelectionAdapter() {
@Override
mntmSelectAll.setText(RedisClient.i18nFile.getText(I18nFile.SELECTALL));
MenuItem mntmClear = new MenuItem(menu, SWT.NONE);
mntmClear.addSelectionListener(new SelectionAdapter() {
@Override
代码示例来源:origin: pentaho/pentaho-kettle
if ( item != null ) {
Menu menu = new Menu( cTabFolder );
MenuItem closeItem = new MenuItem( menu, SWT.NONE );
closeItem.setText( BaseMessages.getString( PKG, "Spoon.Tab.Close" ) );
closeItem.addSelectionListener( new SelectionAdapter() {
MenuItem closeAllItems = new MenuItem( menu, SWT.NONE );
closeAllItems.setText( BaseMessages.getString( PKG, "Spoon.Tab.CloseAll" ) );
closeAllItems.addSelectionListener( new SelectionAdapter() {
MenuItem closeOtherItems = new MenuItem( menu, SWT.NONE );
closeOtherItems.setText( BaseMessages.getString( PKG, "Spoon.Tab.CloseOthers" ) );
closeOtherItems.addSelectionListener( new SelectionAdapter() {
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void widgetSelected( SelectionEvent e ) {
if ( e.detail == SWT.DROP_DOWN ) {
Menu menu = new Menu( shell, SWT.POP_UP );
MenuItem item1 = new MenuItem( menu, SWT.PUSH );
item1.setText( BaseMessages.getString( PKG, "Spoon.Menu.StopTranformation" ) );
item1.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e1 ) {
stopTransformation();
}
} );
MenuItem item2 = new MenuItem( menu, SWT.PUSH );
item2.setText( BaseMessages.getString( PKG, "Spoon.Menu.SafeStopTranformation" ) );
item2.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e2 ) {
safeStop();
}
} );
menu.setLocation( shell.getDisplay().map( mainComposite.getParent(), null, mainComposite.getLocation() ) );
menu.setVisible( true );
} else {
stopTransformation();
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
if ( repositoriesMeta != null ) {
for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) {
MenuItem item = new MenuItem( connectionMenu, SWT.CHECK );
String truncatedName = truncateName( repositoriesMeta.getRepository( i ).getName() );
item.setText( truncatedName );
new MenuItem( connectionMenu, SWT.SEPARATOR );
MenuItem managerItem = new MenuItem( connectionMenu, SWT.NONE );
managerItem.setText( BaseMessages.getString( PKG, "RepositoryConnectMenu.RepositoryManager" ) );
managerItem.addSelectionListener( new SelectionAdapter() {
new MenuItem( connectionMenu, SWT.SEPARATOR );
MenuItem disconnectItem = new MenuItem( connectionMenu, SWT.NONE );
disconnectItem.setEnabled( spoon.rep != null );
disconnectItem.setText( BaseMessages.getString( PKG, "RepositoryConnectMenu.Disconnect" ) );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void widgetSelected( SelectionEvent e ) {
if ( e.detail == SWT.DROP_DOWN ) {
Menu menu = new Menu( shell, SWT.POP_UP );
MenuItem item1 = new MenuItem( menu, SWT.PUSH );
item1.setText( BaseMessages.getString( PKG, "Spoon.Run.Run" ) );
item1.setAccelerator( SWT.F9 );
item1.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e1 ) {
runJob();
}
} );
MenuItem item2 = new MenuItem( menu, SWT.PUSH );
item2.setText( BaseMessages.getString( PKG, "Spoon.Run.RunOptions" ) );
item2.setAccelerator( SWT.F8 );
item2.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e2 ) {
runOptionsJob();
}
} );
menu.setLocation( shell.getDisplay().map( mainComposite.getParent(), null, mainComposite.getLocation() ) );
menu.setVisible( true );
} else {
runJob();
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void widgetSelected( SelectionEvent e ) {
if ( e.detail == SWT.DROP_DOWN ) {
Menu menu = new Menu( shell, SWT.POP_UP );
MenuItem item1 = new MenuItem( menu, SWT.PUSH );
item1.setText( BaseMessages.getString( PKG, "Spoon.Run.Run" ) );
item1.setAccelerator( SWT.F9 );
item1.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e1 ) {
runTransformation();
}
} );
MenuItem item2 = new MenuItem( menu, SWT.PUSH );
item2.setText( BaseMessages.getString( PKG, "Spoon.Run.RunOptions" ) );
item2.setAccelerator( SWT.F8 );
item2.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e2 ) {
runOptionsTransformation();
}
} );
menu.setLocation( shell.getDisplay().map( mainComposite.getParent(), null, mainComposite.getLocation() ) );
menu.setVisible( true );
} else {
runTransformation();
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override public void widgetSelected( SelectionEvent e ) {
Menu menu = new Menu( shell );
for ( final PerspectiveData perspectiveData : perspectiveList ) {
MenuItem item = new MenuItem( menu, SWT.CHECK );
if ( perspectiveData.isHidden() ) {
item.setEnabled( false );
}
if ( activePerspective.getId().equals( perspectiveData.getId() ) ) {
item.setSelection( true );
}
item.setText( perspectiveData.getName() );
item.addSelectionListener( new SelectionAdapter() {
@Override public void widgetSelected( SelectionEvent selectionEvent ) {
Spoon.getInstance().loadPerspective( perspectiveData.getId() );
swtToolbar.forceFocus();
}
} );
}
ToolItem item = (ToolItem) e.widget;
Rectangle rect = item.getBounds();
Point pt = item.getParent().toDisplay( new Point( rect.x, rect.y + rect.height ) );
menu.setLocation( pt.x, pt.y );
menu.setVisible( true );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
MenuItem item = new MenuItem( menu, SWT.NONE );
item.setText( Const.NVL( stream.getDescription(), "" ) );
item.setImage( getImageFor( stream ) );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void menuDetected( MenuDetectEvent event ) {
if ( tree.getSelectionCount() < 1 ) {
return;
}
TreeItem treeItem = tree.getSelection()[0];
if ( treeItem != null ) {
String[] labels = ConstUI.getTreeStrings( treeItem );
int depth = ConstUI.getTreeLevel( treeItem );
if ( depth == 3 ) {
final String metaStoreName = labels[0];
final String namespace = labels[1];
final String elementTypeName = labels[2];
final String elementName = labels[3];
Menu menu = new Menu( tree );
MenuItem removeItem = new MenuItem( menu, SWT.POP_UP );
removeItem.setText( "Remove element" );
removeItem.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent arg0 ) {
removeElement( metaStoreName, namespace, elementTypeName, elementName );
}
} );
tree.setMenu( menu );
menu.setVisible( true );
}
}
}
} );
内容来源于网络,如有侵权,请联系作者删除!