public void run() { if (!checkedId.equals(sorterDesc.getId())) { SortDropDownAction.this.setChecked(sorterDesc); BusyIndicator.showWhile(parent.getDisplay(), new Runnable() { public void run() { fViewer.setSorter(sorter); } }); } } };
/** * Marks this updator as dirty. Causes the updateControl method to * be invoked before the next time the control is repainted. */ protected final void makeDirty() { if (!dirty) { dirty = true; stopListening(); SWTUtil.runOnce(theMenu.getDisplay(), privateInterface); } }
@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 run() { if (!checkedId.equals(sorterDesc.getId())) { SortDropDownAction.this.setChecked(sorterDesc); BusyIndicator.showWhile(parent.getDisplay(), () -> fViewer.setSorter(sorter)); } } };
/** * 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; } }); }
@Override public void widgetSelected( SelectionEvent arg0) { new Clipboard(menu.getDisplay()).setContents(new Object[] {text}, new Transfer[] {TextTransfer.getInstance()}); } });
@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(); } } } });
@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); } } });
public void hidePopup(Event event, Menu menu, MPopupMenu menuModel) { // System.err.println("hidePopup: " + menuModel + "\n\t" + menu); final IEclipseContext popupContext = menuModel.getContext(); final IEclipseContext originalChild = (IEclipseContext) popupContext .get(TMP_ORIGINAL_CONTEXT); popupContext.remove(TMP_ORIGINAL_CONTEXT); if (!menu.isDisposed()) { menu.getDisplay().asyncExec(new Runnable() { public void run() { if (originalChild == null) { popupContext.deactivate(); } else { originalChild.activate(); } } }); } }
private void hidePopup(Menu menu, MPopupMenu menuModel, MenuManager menuManager) { final IEclipseContext popupContext = menuModel.getContext(); final IEclipseContext originalChild = (IEclipseContext) popupContext .get(MenuManagerRendererFilter.TMP_ORIGINAL_CONTEXT); popupContext.remove(MenuManagerRendererFilter.TMP_ORIGINAL_CONTEXT); if (!menu.isDisposed()) { menu.getDisplay().asyncExec(new Runnable() { public void run() { if (originalChild == null) { popupContext.deactivate(); } else { originalChild.activate(); } } }); } } }
@Override public void mouseDown(MouseEvent event) { try{ Point p = more_menu.getDisplay().map( l, null, event.x, event.y ); more_menu.setLocation( p ); more_menu.setVisible(true); }catch( Throwable e ){ Debug.out( e); } } });
@Override public void widgetSelected( SelectionEvent arg0) { new Clipboard(menu.getDisplay()).setContents(new Object[] { provider.getText()}, new Transfer[] {TextTransfer.getInstance()}); } });
private void hidePopup(Menu menu, MPopupMenu menuModel, MenuManager menuManager) { final IEclipseContext popupContext = menuModel.getContext(); final IEclipseContext originalChild = (IEclipseContext) popupContext .get(MenuManagerRendererFilter.TMP_ORIGINAL_CONTEXT); popupContext.remove(MenuManagerRendererFilter.TMP_ORIGINAL_CONTEXT); if (!menu.isDisposed()) { menu.getDisplay().asyncExec(() -> { if (originalChild == null) { popupContext.deactivate(); } else { originalChild.activate(); } }); } } }
public void hidePopup(Event event, Menu menu, MPopupMenu menuModel) { // System.err.println("hidePopup: " + menuModel + "\n\t" + menu); final IEclipseContext popupContext = menuModel.getContext(); final IEclipseContext originalChild = (IEclipseContext) popupContext .get(TMP_ORIGINAL_CONTEXT); popupContext.remove(TMP_ORIGINAL_CONTEXT); if (!menu.isDisposed()) { menu.getDisplay().asyncExec(() -> { if (originalChild == null) { popupContext.deactivate(); } else { originalChild.activate(); } }); } }
/** * 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; }); }
/** * 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; }); }
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(); } } } } });
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; }
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(); } }