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

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

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

[英]Returns true if the receiver is visible and all of the receiver's ancestors are visible and false otherwise.
[中]如果接收器可见且所有接收器的祖先都可见,则返回true,否则返回false

代码示例

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

@Override
public void run() {
  if (theMenu != null && !theMenu.isDisposed() && theMenu.isVisible()) {
    updateIfNecessary();
  }
}

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

void redraw () {
  if (!isVisible ()) return;
  if ((style & SWT.BAR) != 0) {
    display.addBar (this);
  } else {
    update ();
  }
}

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

private static void writeShow( final Menu menu ) throws IOException {
  if( menu.isVisible() ) {
   JSWriter writer = JSWriter.getWriterFor( menu );
   IMenuAdapter adapter
    = ( IMenuAdapter )menu.getAdapter( IMenuAdapter.class );
   Point location = adapter.getLocation();
   Object[] args = new Object[] {
    menu,
    new Integer( location.x ),
    new Integer( location.y )
   };
   writer.call( "showMenu", args );
   menu.setVisible( false );
  }
 }
}

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

@Override
  public void menuDetected(MenuDetectEvent event) {
    menu.setLocation(event.x + 10, event.y + 10);
    menu.setVisible(true);
    while (!menu.isDisposed() && menu.isVisible()) {
      if (!menu.getDisplay().readAndDispatch()) {
        menu.getDisplay().sleep();
      }
    }
  }
});

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

while (!menu.isDisposed() && menu.isVisible()) {
  if (!shell.getDisplay().readAndDispatch())
    shell.getDisplay().sleep();

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

private static void renderShow( Menu menu ) {
 if( isPopupMenu( menu ) &&  menu.isVisible() ) {
  IMenuAdapter adapter = menu.getAdapter( IMenuAdapter.class );
  Point location = adapter.getLocation();
  JsonObject parameters = new JsonObject().add( "x", location.x ).add( "y", location.y );
  getRemoteObject( menu ).call( METHOD_SHOW_MENU, parameters );
  menu.setVisible( false );
 }
}

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

public void widgetSelected(SelectionEvent e) {
    if (e.detail == SWT.ARROW) {
      Menu menu = getMenu(mmenu, ti);
      Rectangle itemBounds = ti.getBounds();
      Point displayAt = ti.getParent().toDisplay(
          itemBounds.x,
          itemBounds.y + itemBounds.height);
      menu.setLocation(displayAt);
      menu.setVisible(true);
      Display display = menu.getDisplay();
      while (menu.isVisible()) {
        if (!display.readAndDispatch()) {
          display.sleep();
        }
      }
    }
  }
});

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

private boolean dropdownEvent(Event event) {
  if (event.detail == SWT.ARROW && model instanceof MToolItem) {
    ToolItem ti = (ToolItem) event.widget;
    MMenu mmenu = ((MToolItem) model).getMenu();
    if (mmenu == null) {
      return false;
    }
    Menu menu = getMenu(mmenu, ti);
    if (menu == null) {
      return true;
    }
    Rectangle itemBounds = ti.getBounds();
    Point displayAt = ti.getParent().toDisplay(itemBounds.x,
        itemBounds.y + itemBounds.height);
    menu.setLocation(displayAt);
    menu.setVisible(true);
    Display display = menu.getDisplay();
    while (menu.isVisible()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return true;
  }
  return false;
}

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

private void showStandaloneViewMenu(ExecutionEvent event, MPart model, MMenu menuModel,
    Composite partContainer) {
  Shell shell = partContainer.getShell();
  Menu menu = (Menu) menuModel.getWidget();
  if (menu == null) {
    IPresentationEngine engine = (IPresentationEngine) HandlerUtil.getVariable(event,
        IPresentationEngine.class.getName());
    menu = (Menu) engine.createGui(menuModel, shell, model.getContext());
    if (menu != null) {
      final Menu tmpMenu = menu;
      partContainer.addDisposeListener(e -> tmpMenu.dispose());
    }
  }
  Display display = menu.getDisplay();
  Point location = display.map(partContainer, null, partContainer.getLocation());
  Point size = partContainer.getSize();
  menu.setLocation(location.x + size.x, location.y);
  menu.setVisible(true);
  while (!menu.isDisposed() && menu.isVisible()) {
    if (!display.readAndDispatch())
      display.sleep();
  }
  if (!(menu.getData() instanceof MenuManager)) {
    menu.dispose();
  }
}

代码示例来源:origin: org.apache.uima/ruta-ep-caseditor

@Override
public void mouseDown(final MouseEvent mouseEvent) {
 if (mouseEvent.button == 3) {
  Display display = Display.getCurrent();
  Menu menu = new Menu(display.getActiveShell(), SWT.POP_UP);
  MenuItem item = new MenuItem(menu, SWT.PUSH);
  item.setText("Set Annotation Mode");
  item.setImage(rutaImage);
  item.addListener(SWT.Selection, new Listener() {
   public void handleEvent(Event e) {
    TreeItem item = treeView.getTree().getItem(new Point(mouseEvent.x, mouseEvent.y));
    if (item != null && item.getData() instanceof AbstractTreeNode) {
     Type type = ((AbstractTreeNode) item.getData()).getType();
     if(type != null) {
      getTreeViewer().setGrayed(new TypeTreeNode(null, type), false);
      editor.setAnnotationMode(type);
     }
    }
   }
  });
  menu.setVisible(true);
  while (!menu.isDisposed() && menu.isVisible()) {
   if (!display.readAndDispatch())
    display.sleep();
  }
  menu.dispose();
 }
}

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

/**
 * @param event
 * @return whether the event was a drop down on a toolitem
 */
protected boolean dropdownEvent(Event event) {
  if (event.detail == SWT.ARROW && modelItem instanceof MToolItem) {
    ToolItem ti = (ToolItem) event.widget;
    MMenu mmenu = ((MToolItem) modelItem).getMenu();
    if (mmenu == null) {
      return false;
    }
    Menu menu = getMenu(mmenu, ti);
    if (menu == null || menu.isDisposed()) {
      return true;
    }
    Rectangle itemBounds = ti.getBounds();
    Point displayAt = ti.getParent().toDisplay(itemBounds.x, itemBounds.y + itemBounds.height);
    menu.setLocation(displayAt);
    menu.setVisible(true);
    Display display = menu.getDisplay();
    while (!menu.isDisposed() && menu.isVisible()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return true;
  }
  return false;
}

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

/**
 * @param event
 * @return
 */
private boolean dropdownEvent(Event event) {
  if (event.detail == SWT.ARROW && model instanceof MToolItem) {
    ToolItem ti = (ToolItem) event.widget;
    MMenu mmenu = ((MToolItem) model).getMenu();
    if (mmenu == null) {
      return false;
    }
    Menu menu = getMenu(mmenu, ti);
    if (menu == null || menu.isDisposed()) {
      return true;
    }
    Rectangle itemBounds = ti.getBounds();
    Point displayAt = ti.getParent().toDisplay(itemBounds.x,
        itemBounds.y + itemBounds.height);
    menu.setLocation(displayAt);
    menu.setVisible(true);
    Display display = menu.getDisplay();
    while (!menu.isDisposed() && menu.isVisible()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return true;
  }
  return false;
}

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

/**
 * {@inheritDoc}
 */
public void run() {
  Display display= Display.getCurrent();
  if (display == null)
    return;
  Control focus= display.getFocusControl();
  if (focus == null || focus.isDisposed())
    return;
  
  MenuManager menu= new MenuManager();
  fillMenu(menu);
  final Menu widget= menu.createContextMenu(focus.getShell());
  Point location= computeMenuLocation(focus, widget);
  if (location == null)
    return;
  widget.setLocation(location);
  widget.setVisible(true);
  while (!widget.isDisposed() && widget.isVisible()) {
    if (!display.readAndDispatch())
      display.sleep();
  }
  if (!widget.isDisposed()) {
    widget.dispose();
  }
}

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

menu.setLocation (pt.x, pt.y);
menu.setVisible (true);
while (menu != null && !menu.isDisposed() && menu.isVisible ()) {
  if (!display.readAndDispatch ()) display.sleep ();

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

while (!menu.isDisposed() && menu.isVisible()) {
  if (!display.readAndDispatch())
    display.sleep();

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

menu.setVisible (true);
while (menu != null && !menu.isDisposed () && menu.isVisible ()) {
  if (!display.readAndDispatch ()) {
    display.sleep ();

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

@Override
  public void menuDetected(MenuDetectEvent event) {
    ISelectionProvider selectionProvider;
    if (fBreadcrumbViewer.isDropDownOpen()) {
      selectionProvider= fBreadcrumbViewer.getDropDownSelectionProvider();
    } else {
      selectionProvider= fBreadcrumbViewer;
    }
    ActionGroup actionGroup= createContextMenuActionGroup(selectionProvider);
    if (actionGroup == null)
      return;
    try {
      MenuManager manager= new MenuManager();
      actionGroup.setContext(new ActionContext(selectionProvider.getSelection()));
      actionGroup.fillContextMenu(manager);
      getTextEditor().getEditorSite().registerContextMenu(manager, selectionProvider, false);
      if (manager.isEmpty())
        return;
      Menu menu= manager.createContextMenu(fBreadcrumbViewer.getControl());
      menu.setLocation(event.x + 10, event.y + 10);
      menu.setVisible(true);
      while (!menu.isDisposed() && menu.isVisible()) {
        if (!menu.getDisplay().readAndDispatch())
          menu.getDisplay().sleep();
      }
    } finally {
      actionGroup.dispose();
    }
  }
});

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

@Override
  public void menuDetected(MenuDetectEvent event) {
    ISelectionProvider selectionProvider;
    if (fBreadcrumbViewer.isDropDownOpen()) {
      selectionProvider= fBreadcrumbViewer.getDropDownSelectionProvider();
    } else {
      selectionProvider= fBreadcrumbViewer;
    }
    ActionGroup actionGroup= createContextMenuActionGroup(selectionProvider);
    if (actionGroup == null)
      return;
    try {
      MenuManager manager= new MenuManager();
      actionGroup.setContext(new ActionContext(selectionProvider.getSelection()));
      actionGroup.fillContextMenu(manager);
      getTextEditor().getEditorSite().registerContextMenu(manager, selectionProvider, false);
      if (manager.isEmpty())
        return;
      Menu menu= manager.createContextMenu(fBreadcrumbViewer.getControl());
      menu.setLocation(event.x + 10, event.y + 10);
      menu.setVisible(true);
      while (!menu.isDisposed() && menu.isVisible()) {
        if (!menu.getDisplay().readAndDispatch())
          menu.getDisplay().sleep();
      }
    } finally {
      actionGroup.dispose();
    }
  }
});

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

while (!menu.isDisposed() && menu.isVisible()) {
  if (!display.readAndDispatch())
    display.sleep();

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

while (!swtMenu.isDisposed() && swtMenu.isVisible()) {
  if (!display.readAndDispatch())
    display.sleep();

相关文章