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

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

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

[英]Returns the receiver's parent item, which must be a MenuItem or null when the receiver is a root.
[中]返回接收者的父项,当接收者是根时,父项必须是MenuItem或null。

代码示例

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

private void safeHandleEvent(Event event) {
  if (!(event.widget instanceof Menu)) {
    return;
  }
  final Menu menu = (Menu) event.widget;
  if (event.type == SWT.Dispose) {
    trace("handleMenu.Dispose", menu, null); //$NON-NLS-1$
    cleanUp(menu);
  }
  Object obj = menu.getData(AbstractPartRenderer.OWNING_ME);
  if (obj == null && menu.getParentItem() != null) {
    obj = menu.getParentItem().getData(AbstractPartRenderer.OWNING_ME);
  }
  if (obj instanceof MPopupMenu) {
    handleContextMenu(event, menu, (MPopupMenu) obj);
  } else if (obj instanceof MMenu) {
    handleMenu(event, menu, (MMenu) obj);
  }
}

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

private void safeHandleEvent(Event event) {
  if (!(event.widget instanceof Menu)) {
    return;
  }
  final Menu menu = (Menu) event.widget;
  if (event.type == SWT.Dispose) {
    trace("handleMenu.Dispose", menu, null); //$NON-NLS-1$
    cleanUp(menu);
  }
  Object obj = menu.getData(AbstractPartRenderer.OWNING_ME);
  if (obj == null && menu.getParentItem() != null) {
    obj = menu.getParentItem().getData(AbstractPartRenderer.OWNING_ME);
  }
  if (obj instanceof MPopupMenu) {
    handleContextMenu(event, menu, (MPopupMenu) obj);
  } else if (obj instanceof MMenu) {
    handleMenu(event, menu, (MMenu) obj);
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

if (menu != null && !menu.isDisposed() && menu.getParentItem() != null) {
  if (IAction.TEXT.equals(property)) {
    String text = getOverrides().getText(this);
      menu.getParentItem().setText(text);
    menu.getParentItem().setImage(localManager.createImage(image));
    disposeOldImages();
    imageManager = localManager;

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

public void run() {
    if (!proxy.isDisposed()) {
      MenuItem parentItem = proxy.getParentItem();
      proxy.dispose();
      parentItem.setMenu(holdMenu);
    }
    if (holdMenu != null && !holdMenu.isDisposed()) {
      holdMenu.notifyListeners(SWT.Hide, null);
    }
    holdMenu = null;
  }
});

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

if (menu != null && !menu.isDisposed() && menu.getParentItem() != null) {
  if (IAction.TEXT.equals(property)) {
    String text = getOverrides().getText(this);
      menu.getParentItem().setText(text);
    menu.getParentItem().setImage(localManager.createImage(image));
    disposeOldImages();
    imageManager = localManager;

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

if (menu != null && !menu.isDisposed() && menu.getParentItem() != null) {
  if (IAction.TEXT.equals(property)) {
    String text = getOverrides().getText(this);
      menu.getParentItem().setText(text);
    menu.getParentItem().setImage(localManager.createImage(image));
    disposeOldImages();
    imageManager = localManager;

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

/**
 * The proxy menu is being hidden, so we need to make it go away.
 *
 * @param proxy
 *            the proxy menu
 * @since 3.4
 */
private void handleHideProxy(final Menu proxy) {
  proxy.removeListener(SWT.Hide, getMenuCreatorListener());
  proxy.getDisplay().asyncExec(() -> {
    if (!proxy.isDisposed()) {
      MenuItem parentItem = proxy.getParentItem();
      proxy.dispose();
      parentItem.setMenu(holdMenu);
    }
    if (holdMenu != null && !holdMenu.isDisposed()) {
      holdMenu.notifyListeners(SWT.Hide, null);
    }
    holdMenu = null;
  });
}

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

/**
 * The proxy menu is being hidden, so we need to make it go away.
 *
 * @param proxy
 *            the proxy menu
 * @since 3.4
 */
private void handleHideProxy(final Menu proxy) {
  proxy.removeListener(SWT.Hide, getMenuCreatorListener());
  proxy.getDisplay().asyncExec(() -> {
    if (!proxy.isDisposed()) {
      MenuItem parentItem = proxy.getParentItem();
      proxy.dispose();
      parentItem.setMenu(holdMenu);
    }
    if (holdMenu != null && !holdMenu.isDisposed()) {
      holdMenu.notifyListeners(SWT.Hide, null);
    }
    holdMenu = null;
  });
}

相关文章