org.eclipse.swt.widgets.Menu.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.eclipse.swt.widgets.Menu.<init>()方法的一些代码示例,展示了Menu.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.<init>()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Menu
类名称:Menu
方法名:<init>

[英]Constructs a new instance of this class given its parent, and sets the style for the instance so that the instance will be a popup menu on the given parent's shell.

After constructing a menu, it can be set into its parent using parent.setMenu(menu). In this case, the parent may be any control in the same widget tree as the parent.
[中]在给定父类的情况下构造该类的新实例,并设置该实例的样式,使该实例成为给定父类外壳上的弹出菜单。
构建菜单后,可以使用parent.setMenu(menu)将其设置为其父菜单。在这种情况下,父控件可以是与父控件相同的小部件树中的任何控件。

代码示例

代码示例来源: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

helperMenu = new Menu( shell, SWT.POP_UP );
} else {
 for ( MenuItem item : helperMenu.getItems() ) {

代码示例来源: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: pentaho/pentaho-kettle

final Menu menu = new Menu( text );
MenuItem item = new MenuItem( menu, SWT.NONE );
item.setText( BaseMessages.getString( PKG, "LogBrowser.CopySelectionToClipboard.MenuItem" ) );

代码示例来源: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

Menu menu = new Menu( canvas );
for ( final StreamInterface stream : streams ) {
 MenuItem item = new MenuItem( menu, SWT.NONE );

代码示例来源: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 );
   }
  }
 }
} );

代码示例来源: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

@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

final CTabItem item = cTabFolder.getItem( point );
if ( item != null ) {
 Menu menu = new Menu( cTabFolder );
 MenuItem closeItem = new MenuItem( menu, SWT.NONE );
 closeItem.setText( BaseMessages.getString( PKG, "Spoon.Tab.Close" ) );

代码示例来源:origin: pentaho/pentaho-kettle

redoStack = new LinkedList<UndoRedoStack>();
styledText = new StyledText( this, args );
styledTextPopupmenu = new Menu( parent.getShell(), SWT.POP_UP );
xParent = parent;
this.strTabName = strTabName;

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
 if ( e.detail == SWT.DROP_DOWN ) {
  Menu menu = new Menu( shell, SWT.POP_UP );
public void widgetSelected( SelectionEvent e ) {
 if ( e.detail == SWT.DROP_DOWN ) {
  Menu menu = new Menu( shell, SWT.POP_UP );

代码示例来源:origin: caoxinyu/RedisClient

private void initMenuMulti() {
  menu_Multi = new Menu(shell);

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void widgetSelected( SelectionEvent event ) {
 final Menu connectionMenu = new Menu( toolBar.getShell() );
 if ( repositoriesMeta != null ) {
  for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) {

代码示例来源:origin: caoxinyu/RedisClient

private void initMenu() {
  menu = new Menu(tabFolder.getShell());

代码示例来源:origin: caoxinyu/RedisClient

private void initMenuNull() {
  menu_null = new Menu(shell);

代码示例来源:origin: pentaho/pentaho-kettle

mTree = new Menu( wTree );

代码示例来源:origin: caoxinyu/RedisClient

private void initMenuData() {
  menu_key = new Menu(shell);

代码示例来源:origin: caoxinyu/RedisClient

private Menu initMenuTableServer() {
  Menu menu_server_1 = new Menu(shell);

相关文章