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

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

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

[英]Returns the receiver's parent, which must be a Menu.
[中]返回接收者的父项,该父项必须是Menu

代码示例

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

private static boolean isTopLevelMenuBarItem( final MenuItem menuItem ) {
 return ( menuItem.getParent().getStyle() & SWT.BAR ) != 0;
}

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

/**
 * Returns the receiver's parent item, which must be a
 * <code>Menu</code> or null when the receiver is a
 * root.
 *
 * @return the receiver's parent item
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public Menu getParentMenu () {
  checkWidget();
  if (cascade == null) return null;
  return cascade.getParent ();
}

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

/**
 * Returns the receiver's parent item, which must be a
 * <code>Menu</code> or null when the receiver is a
 * root.
 *
 * @return the receiver's parent item
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public Menu getParentMenu () {
  checkWidget();
  if (cascade == null) return null;
  return cascade.getParent ();
}

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

/**
 * Returns the receiver's parent item, which must be a
 * <code>Menu</code> or null when the receiver is a
 * root.
 *
 * @return the receiver's parent item
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public Menu getParentMenu () {
  checkWidget();
  if (cascade == null) return null;
  return cascade.getParent ();
}

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

/**
 * Returns the receiver's parent item, which must be a
 * <code>Menu</code> or null when the receiver is a
 * root.
 *
 * @return the receiver's parent item
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public Menu getParentMenu() {
 checkWidget();
 if( cascade != null ) {
  return cascade.getParent();
 }
 return null;
}

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

static void newItem( final MenuItem menuItem,
           final String jsClass,
           final String type )
 throws IOException
{
 JSWriter writer = JSWriter.getWriterFor( menuItem );
 writer.newWidget( jsClass, new String[]{ type } );
 int index = menuItem.getParent().indexOf( menuItem );
 writer.call( menuItem.getParent(),
        "addMenuItemAt",
        new Object[]{ menuItem, new Integer( index ) } );
}

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

private boolean isTopLevelMenu() {
  if (menu != null && !menu.isDisposed() && menuItem != null
      && !menuItem.isDisposed()) {
    Menu parentMenu = menuItem.getParent();
    return parentMenu != null
        && ((parentMenu.getStyle() & SWT.BAR) == SWT.BAR);
  }
  return false;
}

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

/**
 * Constructs a new instance of this class given its parent
 * (which must be a <code>MenuItem</code>) and sets the style
 * for the instance so that the instance will be a drop-down
 * menu on the given parent's parent menu.
 *
 * @param parent a menu item which will be the parent of the new instance (cannot be null)
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
 *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
 * </ul>
 *
 * @see SWT#DROP_DOWN
 * @see Widget#checkSubclass
 * @see Widget#getStyle
 */
public Menu( MenuItem parent ) {
 this( checkNull( parent ).getParent().getParent(), SWT.DROP_DOWN );
}

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

private boolean isTopLevelMenu() {
  if (menu != null && !menu.isDisposed() && menuItem != null
      && !menuItem.isDisposed()) {
    Menu parentMenu = menuItem.getParent();
    return parentMenu != null
        && ((parentMenu.getStyle() & SWT.BAR) == SWT.BAR);
  }
  return false;
}

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

private boolean isTopLevelMenu() {
  if (menu != null && !menu.isDisposed() && menuItem != null
      && !menuItem.isDisposed()) {
    Menu parentMenu = menuItem.getParent();
    return parentMenu != null
        && ((parentMenu.getStyle() & SWT.BAR) == SWT.BAR);
  }
  return false;
}

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

private static boolean isAccessible( MenuItem menuItem ) {
 return menuItem.getEnabled() && isShellAccessible( menuItem.getParent().getShell() );
}

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

static void processArmEvent( final MenuItem menuItem ) {
  Menu menu = menuItem.getParent();
  String eventId = JSConst.EVENT_MENU_SHOWN;
  if( WidgetLCAUtil.wasEventSent( menu, eventId ) ) {
   if( ArmEvent.hasListener( menuItem ) ) {
    ArmEvent event = new ArmEvent( menuItem );
    event.processEvent();
   }
  }
 }
}

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

void renderInitialization( MenuItem menuItem ) throws IOException {
 MenuItemLCAUtil.newItem( menuItem, "org.eclipse.rwt.widgets.MenuItem", ITEM_TYPE_RADIO );
 if( ( menuItem.getParent().getStyle() & SWT.NO_RADIO_GROUP ) != 0 ) {
  JSWriter writer = JSWriter.getWriterFor( menuItem );
  writer.set( "noRadioGroup", true );
 }
}

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

|| (itemToolTip != null && toolTip.equals(itemToolTip.getMessage()))) return;
itemToolTip = new MenuItemToolTip (this.getParent().getShell());
itemToolTip.setMessage (toolTip);
itemToolTip.setVisible (false);

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

MenuItem item = this.fileMenuItems[i];
if (item != null && !item.isDisposed()) {
  int index = item.getParent().indexOf(item);
MenuItem item = this.containerMenuItems[i];
if (item != null && !item.isDisposed()) {
  int index = item.getParent().indexOf(item);
  int /*long*/ id = getMenuItemID(hMenu, index);
  ids.add(new LONG(id));
MenuItem item = this.windowMenuItems[i];
if (item != null && !item.isDisposed()) {
  int index = item.getParent().indexOf(item);
  int /*long*/ id = getMenuItemID(hMenu, index);
  ids.add(new LONG(id));

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

@Override
public void renderInitialization( MenuItem item ) throws IOException {
 RemoteObject remoteObject = RemoteObjectFactory.createRemoteObject( item, TYPE );
 remoteObject.setHandler( new MenuItemOperationHandler( item ) );
 Menu parent = item.getParent();
 remoteObject.set( "parent", getId( parent ) );
 remoteObject.set( "style", createJsonArray( getStyles( item, ALLOWED_STYLES ) ) );
 remoteObject.set( "index", parent.indexOf( item ) );
}

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

MenuItem item = this.fileMenuItems[i];
if (item != null) {
  int index = item.getParent().indexOf(item);
MenuItem item = this.containerMenuItems[i];
if (item != null) {
  int index = item.getParent().indexOf(item);
MenuItem item = this.windowMenuItems[i];
if (item != null) {
  int index = item.getParent().indexOf(item);

代码示例来源:origin: org.xworker/xworker_swt

item.getParent().setVisible(false);

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.runtime

shell = ((Menu) event.widget).getShell();
} else if (event.widget instanceof MenuItem) {
  shell = ((MenuItem) event.widget).getParent().getShell();

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

SWT.error( SWT.ERROR_MENU_NOT_DROP_DOWN );
if( menu.getParent() != getParent().getParent() ) {
 SWT.error( SWT.ERROR_INVALID_PARENT );

相关文章