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

x33g5p2x  于2022-01-29 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(171)

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

Table.setMenu介绍

暂无

代码示例

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

if (e.button == 3) {
  if (selectedItem == null)
    table.setMenu(menu_null);
  else {
    NodeType type = (NodeType) selectedItem
      table.setMenu(menu_null);
    else if (type == NodeType.SERVER) {
      updateMenuServer(true, menuTableServer);
      table.setMenu(menuTableServer);
    } else if (type == NodeType.CONTAINER) {
      TableItem[] items = table.getSelection();
        updateMenuDBContainer(type,
            menuTableDBContainer);
        table.setMenu(menuTableDBContainer);
      } else {
        table.setMenu(menu_Multi);
      table.setMenu(menuTableDBContainer);
    } else {
      TableItem[] items = table.getSelection();
      if (items.length == 1)
        table.setMenu(menu_key);
      else
        table.setMenu(menu_Multi);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@Override
public void setMenu (Menu menu) {
  super.setMenu(menu);
  table.setMenu(menu);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@Override
public void setMenu (Menu menu) {
  super.setMenu(menu);
  table.setMenu(menu);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@Override
public void setMenu (Menu menu) {
  super.setMenu(menu);
  table.setMenu(menu);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@Override
public void setMenu (Menu menu) {
  super.setMenu(menu);
  table.setMenu(menu);
}

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

miEditRedo.addSelectionListener( lsEditRedo );
table.setMenu( mRow );

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

public void setMenu (Menu menu) {
  super.setMenu(menu);
  table.setMenu(menu);
}

代码示例来源:origin: cbeust/testng-eclipse

private void initMenu() {
 MenuManager menuMgr = new MenuManager();
 menuMgr.setRemoveAllWhenShown(true);
 menuMgr.addMenuListener(this);
 Menu menu = menuMgr.createContextMenu(fTable);
 fTable.setMenu(menu);
}

代码示例来源:origin: stackoverflow.com

private void setMenu(final Table table) {
  Listener popUpListener = new Listener() {

    @Override
    public void handleEvent(Event event) {
      MenuItem item = (MenuItem)event.widget;
      Menu pare = item.getParent();
      Decorations fdf = pare.getParent();

      // Now you can access the table from within the Listener
      System.out.println(table);
    }
  };
  Menu menu = new Menu(table); // where table1 is your table
  MenuItem item1 = new MenuItem(menu, SWT.PUSH);
  item1.setText("Copy cell");
  item1.addListener(SWT.Selection, popUpListener);
  MenuItem item2 = new MenuItem(menu, SWT.PUSH);
  item2.setText("Copy row");
  item2.addListener(SWT.Selection, popUpListener);
  MenuItem item3 = new MenuItem(menu, SWT.PUSH);
  item3.setText("Copy column");
  item3.addListener(SWT.Selection, popUpListener);
  MenuItem item4 = new MenuItem(menu, SWT.PUSH);
  item4.setText("Copy all");
  item4.addListener(SWT.Selection, popUpListener);
  table.setMenu(menu);
}

代码示例来源:origin: openaudible/openaudible

protected void createSortMenu(String menuNames[]) {
  if (table == null)
    return;
  sortMenu = new Menu(table.getShell(), SWT.POP_UP);
  for (int x = 0; x < menuNames.length; x++) {
    MenuItem item = new MenuItem(sortMenu, SWT.PUSH);
    Integer ID = x;
    item.setData(ID);
    item.setText(menuNames[x]);
    item.addSelectionListener(this);
  }
  table.setMenu(sortMenu);
}

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

private void addPopupMenu() {
  Menu menu= new Menu(fTable.getShell(), SWT.POP_UP);
  fTable.setMenu(menu);
  final MenuItem remove= new MenuItem(menu, SWT.NONE);
  remove.setText(JavaUIMessages.TypeInfoViewer_remove_from_history);
  menu.addMenuListener(new MenuAdapter() {
    public void menuShown(MenuEvent e) {
      TableItem[] selection= fTable.getSelection();
      remove.setEnabled(canEnable(selection));
    }
  });
  remove.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
      deleteHistoryEntry();
    }
  });
}

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

private void addPopupMenu() {
  Menu menu= new Menu(fTable.getShell(), SWT.POP_UP);
  fTable.setMenu(menu);
  final MenuItem remove= new MenuItem(menu, SWT.NONE);
  remove.setText(JavaUIMessages.TypeInfoViewer_remove_from_history);
  menu.addMenuListener(new MenuAdapter() {
    public void menuShown(MenuEvent e) {
      TableItem[] selection= fTable.getSelection();
      remove.setEnabled(canEnable(selection));
    }
  });
  remove.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
      deleteHistoryEntry();
    }
  });
}

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

private void addPopupMenu() {
  Menu menu= new Menu(fTable.getShell(), SWT.POP_UP);
  fTable.setMenu(menu);
  final MenuItem remove= new MenuItem(menu, SWT.NONE);
  remove.setText(JavaUIMessages.TypeInfoViewer_remove_from_history);
  menu.addMenuListener(new MenuAdapter() {
    @Override
    public void menuShown(MenuEvent e) {
      TableItem[] selection= fTable.getSelection();
      remove.setEnabled(canEnable(selection));
    }
  });
  remove.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      deleteHistoryEntry();
    }
  });
}

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

/**
 * Attaches a contextmenu listener to the table
 * @param menuListener the menu listener
 * @param popupId the popup id
 * @param viewSite the view site
 */
public void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) {
  MenuManager menuMgr= new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(menuListener);
  Menu menu= menuMgr.createContextMenu(getTable());
  getTable().setMenu(menu);
  viewSite.registerContextMenu(popupId, menuMgr, this);
}

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

private void addPopupMenu() {
  Menu menu= new Menu(fTable.getShell(), SWT.POP_UP);
  fTable.setMenu(menu);
  final MenuItem remove= new MenuItem(menu, SWT.NONE);
  remove.setText(JavaUIMessages.TypeInfoViewer_remove_from_history);
  menu.addMenuListener(new MenuAdapter() {
    @Override
    public void menuShown(MenuEvent e) {
      TableItem[] selection= fTable.getSelection();
      remove.setEnabled(canEnable(selection));
    }
  });
  remove.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      deleteHistoryEntry();
    }
  });
}

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

/**
 * Attaches a contextmenu listener to the table
 * @param menuListener the menu listener
 * @param popupId the popup id
 * @param viewSite the view site
 */
public void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) {
  MenuManager menuMgr= new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(menuListener);
  Menu menu= menuMgr.createContextMenu(getTable());
  getTable().setMenu(menu);
  viewSite.registerContextMenu(popupId, menuMgr, this);
}

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

/**
 * Attaches a contextmenu listener to the table
 * @param menuListener the menu listener
 * @param popupId the popup id
 * @param viewSite the view site
 */
public void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) {
  MenuManager menuMgr= new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(menuListener);
  Menu menu= menuMgr.createContextMenu(getTable());
  getTable().setMenu(menu);
  viewSite.registerContextMenu(popupId, menuMgr, this);
}

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

private void createPopupMenu() {
  removeHistoryItemAction = new RemoveHistoryItemAction();
  removeHistoryActionContributionItem = new ActionContributionItem(removeHistoryItemAction);
  contextMenuManager = new MenuManager();
  contextMenuManager.setRemoveAllWhenShown(true);
  contextMenuManager.addMenuListener(manager -> fillContextMenu(manager));
  final Table table = list.getTable();
  Menu menu= contextMenuManager.createContextMenu(table);
  table.setMenu(menu);
}

代码示例来源:origin: openaudible/openaudible

public void init(int attributes) {
  if (table != null)
    throw new InvalidParameterException("init already called on table!");
  attributes |= SWT.VIRTUAL;
  isVirtual = (attributes & SWT.VIRTUAL) != 0;
  table = new Table(parent, attributes);
  table.setHeaderVisible(true);
  if (oddEvenColors)
    enableBasicOddEvenColors();
  
  changeTableLayout(numColumns);
  
  table.setData(this);
  if (sortMenu != null)
    table.setMenu(sortMenu);
  table.setFont(FontShop.instance.tableFont());
  
  initCallbacks();
  addKeyBoardListener();
  addSelectionListener(this);
}

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

table.setMenu(createPopUpMenu());
table.addSelectionListener(widgetDefaultSelectedAdapter(e -> {
  TableItem[] items = table.getSelection();

相关文章

Table类方法