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

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

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

ToolBar.toDisplay介绍

暂无

代码示例

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

public void newFileDropDown() {
 // Drop down a list below the "New" icon (new.png)
 // First problem: where is that icon?
 XulToolbarbutton button = (XulToolbarbutton) this.mainToolbar.getElementById( "file-new" );
 Object object = button.getManagedObject();
 if ( object instanceof ToolItem ) {
  // OK, let's determine the location of this widget...
  //
  ToolItem item = (ToolItem) object;
  Rectangle bounds = item.getBounds();
  org.eclipse.swt.graphics.Point p =
   item.getParent().toDisplay( new org.eclipse.swt.graphics.Point( bounds.x, bounds.y ) );
  fileMenus.setLocation( p.x, p.y + bounds.height );
  fileMenus.setVisible( true );
 }
}

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

@Override public void widgetSelected( SelectionEvent e ) {
  Menu menu = new Menu( shell );
  for ( final PerspectiveData perspectiveData : perspectiveList ) {
   MenuItem item = new MenuItem( menu, SWT.CHECK );
   if ( perspectiveData.isHidden() ) {
    item.setEnabled( false );
   }
   if ( activePerspective.getId().equals( perspectiveData.getId() ) ) {
    item.setSelection( true );
   }
   item.setText( perspectiveData.getName() );
   item.addSelectionListener( new SelectionAdapter() {
    @Override public void widgetSelected( SelectionEvent selectionEvent ) {
     Spoon.getInstance().loadPerspective( perspectiveData.getId() );
     swtToolbar.forceFocus();
    }
   } );
  }
  ToolItem item = (ToolItem) e.widget;
  Rectangle rect = item.getBounds();
  Point pt = item.getParent().toDisplay( new Point( rect.x, rect.y + rect.height ) );
  menu.setLocation( pt.x, pt.y );
  menu.setVisible( true );
 }
} );

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

Rectangle rect = item.getBounds();
org.eclipse.swt.graphics.Point pt =
  item.getParent().toDisplay( new org.eclipse.swt.graphics.Point( rect.x, rect.y + rect.height ) );

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

private void showStartupOptions(final Menu menu) {
  Rectangle rect = fStartupItem.getBounds();
  Point pt = new Point(rect.x, rect.y + rect.height);
  pt = ftoolBar.toDisplay(pt);
  menu.setLocation(pt.x, pt.y);
  menu.setVisible(true);
}

代码示例来源:origin: com.eclipsesource.tabris/tabris

@Override
 public void handleEvent( Event event ) {
  ToolItem item = ( ToolItem )event.widget;
  Rectangle bounds = item.getBounds();
  bounds.y += bounds.height;
  Point point = pageSwitcher.toDisplay( bounds.x + 10, bounds.y );
  pageSwitcherMenu.setLocation( point );
  pageSwitcherMenu.setVisible( true );
 }
}

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

public void widgetSelected(SelectionEvent e) {
  Rectangle b = dropDownItem.getBounds();
  Point p = dropDownItem.getParent().toDisplay(
      new Point(b.x, b.y + b.height));
  menu.setLocation(p.x, p.y);
  menu.setVisible(true);
}

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

public void widgetSelected(SelectionEvent e) {
  Rectangle b = dropDownItem.getBounds();
  Point p = dropDownItem.getParent().toDisplay(
      new Point(b.x, b.y + b.height));
  menu.setLocation(p.x, p.y);
  menu.setVisible(true);
}

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

private void showViewMenu() {
  Menu menu = fMenuManager.createContextMenu(getShell());
  Rectangle bounds = fToolItem.getBounds();
  Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
  topLeft = fToolBar.toDisplay(topLeft);
  menu.setLocation(topLeft.x, topLeft.y);
  menu.setVisible(true);
}

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

private void showViewMenu() {
  Menu menu = fMenuManager.createContextMenu(getShell());
  Rectangle bounds = fToolItem.getBounds();
  Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
  topLeft = fToolBar.toDisplay(topLeft);
  menu.setLocation(topLeft.x, topLeft.y);
  menu.setVisible(true);
}

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

public void widgetSelected(SelectionEvent e)
 {
  Menu menu = browseMenu.createContextMenu(getShell());
  Rectangle bounds = browseItem.getBounds();
  Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
  topLeft = browseToolBar.toDisplay(topLeft);
  menu.setLocation(topLeft.x, topLeft.y);
  menu.setVisible(true);
 }
});

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

private void showViewMenu() {
  Menu menu = menuManager.createContextMenu(getShell());
  Rectangle bounds = toolItem.getBounds();
  Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
  topLeft = toolBar.toDisplay(topLeft);
  menu.setLocation(topLeft.x, topLeft.y);
  menu.setVisible(true);
}

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

@Override
  public void widgetSelected(SelectionEvent e) {
    fControl.setFocus();
    Rectangle rect= dropDown.getBounds();
    Point pt= dropDown.getParent().toDisplay(new Point(rect.x, rect.y));
    menu.setLocation(pt.x, pt.y + rect.height);
    menu.setVisible(true);
  }
});

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

private void showViewMenu() {
  Menu menu = fMenuManager.createContextMenu(getShell());
  Rectangle bounds = fToolItem.getBounds();
  Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
  topLeft = fToolBar.toDisplay(topLeft);
  menu.setLocation(topLeft.x, topLeft.y);
  menu.setVisible(true);
}

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

private void showViewMenu() {
  Menu menu = fMenuManager.createContextMenu(getShell());
  Rectangle bounds = fToolItem.getBounds();
  Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
  topLeft = fToolBar.toDisplay(topLeft);
  menu.setLocation(topLeft.x, topLeft.y);
  menu.setVisible(true);
}

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

private void showMenu(ToolBar toolBar) {
  Menu menu= getMenuManager().createContextMenu(toolBar);
  menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y));
  fIsMenuUp= true;
  menu.setVisible(true);
}

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

private void showMenu(ToolBar toolBar) {
  Menu menu= getMenuManager().createContextMenu(toolBar);
  menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y));
  fIsMenuUp= true;
  menu.setVisible(true);
}

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

protected void showMenu(ToolBar toolBar) {
  Menu menu = getMenuManager().createContextMenu(toolBar);
  menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y));
  iSMenuUp = true;
  menu.setVisible(true);
}

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

private void showMenu(ToolBar toolBar) {
  Menu menu= getMenuManager().createContextMenu(toolBar);
  menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y));
  fIsMenuUp= true;
  menu.setVisible(true);
}

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

public void runWithEvent(Event event) {
  ToolItem toolItem= (ToolItem) event.widget;
  ToolBar toolBar= toolItem.getParent();
  Menu menu= getMenu(toolBar);
  Rectangle toolItemBounds= toolItem.getBounds();
  Point location= toolBar.toDisplay(toolItemBounds.x, toolItemBounds.y + toolItemBounds.height);
  menu.setLocation(location);
  menu.setVisible(true);
}
public void executed(Action action) {

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

相关文章

ToolBar类方法