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

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

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

暂无

代码示例

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

private void removeMenuDisposeListener() {
 if( menu != null ) {
  menu.removeListener( SWT.Dispose, menuDisposeListener );
 }
}

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

/**
 * Removes the listener from the collection of listeners who will
 * be notified when the menu events are generated for the control.
 *
 * @param listener the listener which should no longer be notified
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 * </ul>
 * @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>
 *
 * @see MenuListener
 * @see #addMenuListener
 */
public void removeMenuListener( MenuListener listener ) {
 checkWidget();
 if( listener == null ) {
  error( SWT.ERROR_NULL_ARGUMENT );
 }
 removeListener( SWT.Show, listener );
 removeListener( SWT.Hide, listener );
}

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

/**
 * The proxy menu is being hidden, so we need to make it go away.
 * 
 * @param proxy
 *            the proxy menu
 * @since 1.1
 */
private void handleHideProxy(final Menu proxy) {
  proxy.removeListener(SWT.Hide, getMenuCreatorListener());
  proxy.getDisplay().asyncExec(new Runnable() {
    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.rap/org.eclipse.rap.rwt

/**
 * Removes the listener from the collection of listeners who will
 * be notified when the help events are generated for the control.
 *
 * @param listener the listener which should no longer be notified
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 * </ul>
 * @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>
 *
 * @see HelpListener
 * @see #addHelpListener
 * @since 1.3
 */
public void removeHelpListener( HelpListener listener ) {
 checkWidget();
 if( listener == null ) {
  error( SWT.ERROR_NULL_ARGUMENT );
 }
 removeListener( SWT.Help, listener );
}

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

public void handleEvent(Event innerEvent) {
    ToolBar innerToolBar = toolBarManager.getControl();
    if (innerToolBar != null) {
      innerToolBar.setMenu(null);
      Menu innerParentMenu = innerToolBar.getParent()
          .getMenu();
      if (innerParentMenu != null) {
        innerParentMenu.removeListener(SWT.Hide, this);
      }
    }
  }
});

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

@Override
  public void handleEvent(Event innerEvent) {
    ToolBar innerToolBar = toolBarManager.getControl();
    if (innerToolBar != null) {
      innerToolBar.setMenu(null);
      Menu innerParentMenu = innerToolBar.getParent()
          .getMenu();
      if (innerParentMenu != null) {
        innerParentMenu.removeListener(SWT.Hide, this);
      }
    }
  }
});

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

@Override
  public void handleEvent(Event innerEvent) {
    ToolBar innerToolBar = toolBarManager.getControl();
    if (innerToolBar != null) {
      innerToolBar.setMenu(null);
      Menu innerParentMenu = innerToolBar.getParent()
          .getMenu();
      if (innerParentMenu != null) {
        innerParentMenu.removeListener(SWT.Hide, this);
      }
    }
  }
});

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

@Override
  public void handleEvent(Event event) {
    if (item.isDisposed()) {
      menu.removeListener(SWT.Show, this);
    } else {
      item.setSelection(!MiniBarManager.getManager().getShellManager().isEmpty());
    }
  }
});

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

/**
 * The proxy menu is being shown, we better get the real menu.
 *
 * @param proxy
 *            the proxy menu
 * @since 3.4
 */
private void handleShowProxy(Menu proxy) {
  proxy.removeListener(SWT.Show, getMenuCreatorListener());
  IMenuCreator mc = action.getMenuCreator();
  menuCreatorCalled  = true;
  if (mc == null) {
    return;
  }
  holdMenu = mc.getMenu(proxy.getParentMenu());
  if (holdMenu == null) {
    return;
  }
  copyMenu(holdMenu, proxy);
}

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

/**
 * The proxy menu is being shown, we better get the real menu.
 *
 * @param proxy
 *            the proxy menu
 * @since 3.4
 */
private void handleShowProxy(Menu proxy) {
  proxy.removeListener(SWT.Show, getMenuCreatorListener());
  IMenuCreator mc = action.getMenuCreator();
  menuCreatorCalled  = true;
  if (mc == null) {
    return;
  }
  holdMenu = mc.getMenu(proxy.getParentMenu());
  if (holdMenu == null) {
    return;
  }
  copyMenu(holdMenu, proxy);
}

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

/**
 * The proxy menu is being shown, we better get the real menu.
 * 
 * @param proxy
 *            the proxy menu
 * @since 1.1
 */
private void handleShowProxy(Menu proxy) {
  proxy.removeListener(SWT.Show, getMenuCreatorListener());
  IMenuCreator mc = action.getMenuCreator();
  menuCreatorCalled  = true;
  if (mc == null) {
    return;
  }
  holdMenu = mc.getMenu(proxy.getParentMenu());
  if (holdMenu == null) {
    return;
  }
  copyMenu(holdMenu, proxy);
}

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

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

相关文章