org.eclipse.swt.widgets.MenuItem.addListener()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(147)

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

暂无

代码示例

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

item.addListener( SWT.Selection, new Listener() {
item.addListener( SWT.Selection, new Listener() {

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

addNewItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  addCtab( "", "", TabAddActions.ADD_BLANK );
copyItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
setActiveScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
MenuItem setRemoveScriptItem = new MenuItem( cMenu, SWT.PUSH );
setRemoveScriptItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.RemoveClassType" ) );
setRemoveScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();

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

addNewItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  addCtab( "", "", ADD_BLANK );
copyItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
setActiveScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
setStartScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
setEndScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
MenuItem setRemoveScriptItem = new MenuItem( cMenu, SWT.PUSH );
setRemoveScriptItem.setText( BaseMessages.getString( PKG, "ScriptDialog.RemoveScriptType" ) );
setRemoveScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();

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

addDeleteItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  if ( wTree.getSelectionCount() <= 0 ) {
renItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  renameFunction( wTree.getSelection()[0] );
MenuItem helpItem = new MenuItem( tMenu, SWT.PUSH );
helpItem.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Sample.Label" ) );
helpItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  String snippitFullName = wTree.getSelection()[0].getText();

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

addDeleteItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  if ( wTree.getSelectionCount() <= 0 ) {
renItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  renameFunction( wTree.getSelection()[0] );
MenuItem helpItem = new MenuItem( tMenu, SWT.PUSH );
helpItem.setText( BaseMessages.getString( PKG, "ScriptDialog.Sample.Label" ) );
helpItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  String strFunctionName = wTree.getSelection()[0].getText();

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

addDeleteItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.Delete.Label" ) );
addDeleteItem.setImage( imageDeleteScript );
addDeleteItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  if ( wTree.getSelectionCount() <= 0 ) {
renItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  renameFunction( wTree.getSelection()[0] );
MenuItem helpItem = new MenuItem( tMenu, SWT.PUSH );
helpItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.Sample.Label" ) );
helpItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  String strFunctionName = wTree.getSelection()[0].getText();

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

addNewItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.AddNewTab" ) );
addNewItem.setImage( imageAddScript );
addNewItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  addCtab( "", "", ADD_BLANK );
copyItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.AddCopy" ) );
copyItem.setImage( imageDuplicateScript );
copyItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
setActiveScriptItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.SetTransformScript" ) );
setActiveScriptItem.setImage( imageActiveScript );
setActiveScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
setStartScriptItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.SetStartScript" ) );
setStartScriptItem.setImage( imageActiveStartScript );
setStartScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();
setEndScriptItem.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.SetEndScript" ) );
setEndScriptItem.setImage( imageActiveEndScript );
setEndScriptItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  CTabItem item = folder.getSelection();

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

undoItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  undo();
redoItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  redo();
MenuItem cutItem = new MenuItem( styledTextPopupmenu, SWT.PUSH );
cutItem.setText( OsHelper.customizeMenuitemText( BaseMessages.getString( PKG, "WidgetDialog.Styled.Cut" ) ) );
cutItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  styledText.cut();
copyItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  styledText.copy();
pasteItem
 .setText( OsHelper.customizeMenuitemText( BaseMessages.getString( PKG, "WidgetDialog.Styled.Paste" ) ) );
pasteItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  styledText.paste();
selectAllItem.setText( OsHelper.customizeMenuitemText( BaseMessages.getString(
 PKG, "WidgetDialog.Styled.SelectAll" ) ) );
selectAllItem.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  styledText.selectAll();

代码示例来源:origin: BiglySoftware/BiglyBT

public static MenuItem addRestartMenuItem(Menu menuParent) {
  MenuItem file_restart = new MenuItem(menuParent, SWT.NULL);
  Messages.setLanguageText(file_restart, MENU_ID_RESTART); //$NON-NLS-1$
  file_restart.addListener(SWT.Selection, new Listener() {
    @Override
    public void handleEvent(Event event) {
      UIFunctionsManagerSWT.getUIFunctionsSWT().dispose(true, false);
    }
  });
  return file_restart;
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt

/**
 * Creates a restore menu item that removes the minimized tag from the {@link #minimizedElement}
 */
private void createEmtpyEditorAreaMenu() {
  MenuItem restoreItem = new MenuItem(trimStackMenu, SWT.NONE);
  restoreItem.setText(Messages.TrimStack_RestoreText);
  restoreItem.addListener(SWT.Selection, new Listener() {
    public void handleEvent(Event event) {
      minimizedElement.getTags().remove(IPresentationEngine.MINIMIZED);
    }
  });
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt

/**
 * Creates a restore menu item that removes the minimized tag from the {@link #minimizedElement}
 */
private void createEmtpyEditorAreaMenu() {
  MenuItem restoreItem = new MenuItem(trimStackMenu, SWT.NONE);
  restoreItem.setText(Messages.TrimStack_RestoreText);
  restoreItem.addListener(SWT.Selection,
      event -> minimizedElement.getTags().remove(IPresentationEngine.MINIMIZED));
}

代码示例来源:origin: com.eclipsesource.tabris/tabris

private void createMenuItem( String proposal ) {
 MenuItem item = new MenuItem( proposalsMenu, SWT.PUSH );
 item.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
 item.setText( proposal );
 item.addListener( SWT.Selection, new MenuItemSelectionListener() );
}

代码示例来源:origin: BiglySoftware/BiglyBT

protected void addMenuItemListener(Menu menu, Listener l) {
  for (MenuItem item : menu.getItems()) {
    if (item.getStyle() == SWT.CASCADE) {
      addMenuItemListener(item.getMenu(), l);
    } else {
      item.addListener(SWT.Selection, l);
    }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@Override
public void fill(Menu menu, int index) {
  MenuItem item = new MenuItem(menu, SWT.CHECK);
  item.setText(MarkerMessages.sortDirectionAscending_text);
  final ExtendedMarkersView view = getView();
  item.addListener(SWT.Selection, event -> {
    if (view != null)
      view.toggleSortDirection();
  });
  if (view != null)
    item.setSelection(view.getSortAscending());
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@Override
public void fill(Menu menu, int index) {
  MenuItem item = new MenuItem(menu, SWT.CHECK);
  item.setText(MarkerMessages.MarkerFilter_showAllCommand_title);
  item.setSelection(noFiltersSelected());
  item.addListener(SWT.Selection, event -> {
    ExtendedMarkersView view = getView();
    if (view != null) {
      view.disableAllFilters();
    }
  });
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

public void createDefaultMenuItem(Menu menu, final IFileRevision revision, boolean markAsSelected) {
  final MenuItem menuItem = new MenuItem(menu, SWT.RADIO);
  menuItem.setSelection(markAsSelected);
  menuItem.setText(TeamUIMessages.LocalHistoryPage_OpenWithMenu_DefaultEditorDescription);
  Listener listener = event -> {
    if (event.type == SWT.Selection && menuItem.getSelection()) {
      openEditor(Utils.getDefaultEditor(revision), false);
    }
  };
  menuItem.addListener(SWT.Selection, listener);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@Override
public void fill(Menu menu, int index) {
  MenuItem item = new MenuItem(menu, SWT.CHECK);
  item.setText(group.getName());
  item.addListener(SWT.Selection, getMenuItemListener(group,
      view));
  if (view != null && view.isEnabled(group)) {
    item.setSelection(true);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

/** Adds the gradient menu item. */
private void addGradientItems(Menu menu, MenuItemListener menuListener) {
  if (menu.getItemCount() != 0) {
    new MenuItem(menu, SWT.SEPARATOR);
  }
  menuListener.customGradientMI = new MenuItem(menu, SWT.NONE);
  menuListener.customGradientMI.setText(GraphicsExample.getResourceString("Gradient")); //$NON-NLS-1$
  menuListener.customGradientMI.addListener(SWT.Selection, menuListener);
  GraphicsBackground gb = new GraphicsBackground();
  menuListener.customGradientMI.setData(gb);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@Override
public void fill(Menu menu, int index) {
  MenuItem item = new MenuItem(menu, SWT.RADIO);
  String title = field.getName();
  item.setText(title);
  ExtendedMarkersView view = getView();
  item.addListener(SWT.Selection,
      getMenuItemListener(field, view));
  if (view != null)
    item.setSelection(view.isPrimarySortField(field));
}

代码示例来源:origin: com.eclipsesource.tabris/tabris

private void addMenuItem( PageDescriptor pageDescriptor ) {
 MenuItem item = new MenuItem( pageSwitcherMenu, SWT.PUSH );
 item.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
 String title = pageDescriptor.getTitle();
 item.setText( title == null ? "" : title );
 item.setImage( getImage( uiParent.getDisplay(), pageDescriptor.getImage() ) );
 item.setData( pageDescriptor );
 item.addListener( SWT.Selection, new MenuItemSelectionListener() );
}

相关文章