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 ); } }
helperMenu.setLocation( l.x + p.x, l.y + p.y + h ); helperMenu.setDefaultItem( first ); helperMenu.setVisible( true ); helperMenu.setLocation( l.x + p.x, l.y + p.y + h ); helperMenu.setDefaultItem( first ); helperMenu.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 ); } } );
menu.setLocation( canvas.toDisplay( mouseX, mouseY ) ); menu.setVisible( true );
@Override public void widgetSelected( SelectionEvent e ) { if ( e.detail == SWT.DROP_DOWN ) { Menu menu = new Menu( shell, SWT.POP_UP ); MenuItem item1 = new MenuItem( menu, SWT.PUSH ); item1.setText( BaseMessages.getString( PKG, "Spoon.Menu.StopTranformation" ) ); item1.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent e1 ) { stopTransformation(); } } ); MenuItem item2 = new MenuItem( menu, SWT.PUSH ); item2.setText( BaseMessages.getString( PKG, "Spoon.Menu.SafeStopTranformation" ) ); item2.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent e2 ) { safeStop(); } } ); menu.setLocation( shell.getDisplay().map( mainComposite.getParent(), null, mainComposite.getLocation() ) ); menu.setVisible( true ); } else { stopTransformation(); } } } );
@Override public void widgetSelected( SelectionEvent e ) { if ( e.detail == SWT.DROP_DOWN ) { Menu menu = new Menu( shell, SWT.POP_UP ); MenuItem item1 = new MenuItem( menu, SWT.PUSH ); item1.setText( BaseMessages.getString( PKG, "Spoon.Run.Run" ) ); item1.setAccelerator( SWT.F9 ); item1.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent e1 ) { runJob(); } } ); MenuItem item2 = new MenuItem( menu, SWT.PUSH ); item2.setText( BaseMessages.getString( PKG, "Spoon.Run.RunOptions" ) ); item2.setAccelerator( SWT.F8 ); item2.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent e2 ) { runOptionsJob(); } } ); menu.setLocation( shell.getDisplay().map( mainComposite.getParent(), null, mainComposite.getLocation() ) ); menu.setVisible( true ); } else { runJob(); } } } );
@Override public void widgetSelected( SelectionEvent e ) { if ( e.detail == SWT.DROP_DOWN ) { Menu menu = new Menu( shell, SWT.POP_UP ); MenuItem item1 = new MenuItem( menu, SWT.PUSH ); item1.setText( BaseMessages.getString( PKG, "Spoon.Run.Run" ) ); item1.setAccelerator( SWT.F9 ); item1.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent e1 ) { runTransformation(); } } ); MenuItem item2 = new MenuItem( menu, SWT.PUSH ); item2.setText( BaseMessages.getString( PKG, "Spoon.Run.RunOptions" ) ); item2.setAccelerator( SWT.F8 ); item2.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent e2 ) { runOptionsTransformation(); } } ); menu.setLocation( shell.getDisplay().map( mainComposite.getParent(), null, mainComposite.getLocation() ) ); menu.setVisible( true ); } else { runTransformation(); } } } );
menu.setLocation( real ); menu.setVisible( true );
item.getParent().toDisplay( new org.eclipse.swt.graphics.Point( rect.x, rect.y + rect.height ) ); connectionMenu.setLocation( pt.x, pt.y ); connectionMenu.setVisible( true );
@Override public void mouseDown(MouseEvent e) { fMouseUpDelta= System.currentTimeMillis(); fDoubleClicked= false; if (fRulerContextMenu != null && !fRulerContextMenu.isDisposed()) { Display display= fRulerContextMenu.getDisplay(); Point location= display.getCursorLocation(); fRulerContextMenu.setLocation(location.x, location.y); } } };
@Override public void mouseDown(MouseEvent e) { fMouseUpDelta= System.currentTimeMillis(); fDoubleClicked= false; if (fRulerContextMenu != null && !fRulerContextMenu.isDisposed()) { Display display= fRulerContextMenu.getDisplay(); Point location= display.getCursorLocation(); fRulerContextMenu.setLocation(location.x, location.y); } } };
@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 ); } }
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); } });
@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); } });
@Override public void runWithEvent(Event event) { if (event.widget instanceof ToolItem) { ToolItem toolItem= (ToolItem) event.widget; Control control= toolItem.getParent(); Menu menu= getMenu(control); Rectangle bounds= toolItem.getBounds(); Point topLeft= new Point(bounds.x, bounds.y + bounds.height); menu.setLocation(control.toDisplay(topLeft)); menu.setVisible(true); } }
private void showProposalsMenu() { Control control = getControl(); Rectangle bounds = control.getBounds(); bounds.y += bounds.height + 5; Point point = control.toDisplay( bounds.x, bounds.y ); proposalsMenu.setLocation( point ); proposalsMenu.setVisible( true ); }
@Override public void mouseDown(MouseEvent event) { try{ Point p = status_menu.getDisplay().map( menu_drop, null, event.x, event.y ); status_menu.setLocation( p ); status_menu.setVisible(true); }catch( Throwable e ){ Debug.out( e); } } });
protected void showMenu(ToolBar toolBar) { Menu menu = getMenuManager().createContextMenu(toolBar); menu.setLocation(toolBar.toDisplay(0, toolBar.getSize().y)); iSMenuUp = true; menu.setVisible(true); }
@Override public void pressed(SWTSkinButtonUtility buttonUtility, SWTSkinObject skinObject, int stateMask) { Control c = buttonUtility.getSkinObject().getControl(); menuDropDown.setLocation(c.getDisplay().getCursorLocation()); menuDropDown.setVisible(!menuDropDown.getVisible()); } });