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 ); } }
@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 ); } } );
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 ) );
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); }
@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 ); } }
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); }
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); }
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); }
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); }
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); } });
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); }
@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); } });
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); }
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); }
private void showMenu(ToolBar toolBar) { Menu menu= getMenuManager().createContextMenu(toolBar); menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y)); fIsMenuUp= true; menu.setVisible(true); }
private void showMenu(ToolBar toolBar) { Menu menu= getMenuManager().createContextMenu(toolBar); menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y)); fIsMenuUp= true; menu.setVisible(true); }
protected void showMenu(ToolBar toolBar) { Menu menu = getMenuManager().createContextMenu(toolBar); menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y)); iSMenuUp = true; menu.setVisible(true); }
private void showMenu(ToolBar toolBar) { Menu menu= getMenuManager().createContextMenu(toolBar); menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y)); fIsMenuUp= true; menu.setVisible(true); }
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) {
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(); } } } } });