/** * Determines the location for the help popup shell given the widget which * orginated the request for help. * * @param display * the display where the help will appear */ private static Point computePopUpLocation(Display display) { Point point = display.getCursorLocation(); return new Point(point.x + 15, point.y); }
/** * Determines the location for the help popup shell given the widget which * orginated the request for help. * * @param display * the display where the help will appear */ private static Point computePopUpLocation(Display display) { Point point = display.getCursorLocation(); return new Point(point.x + 15, point.y); }
@Override protected Point getInitialLocation(Point initialSize) { // show popup relative to cursor Display display = getShell().getDisplay(); Point location = display.getCursorLocation(); location.x += CURSOR_SIZE; location.y += CURSOR_SIZE; return location; }
/** {@inheritDoc} */ @Override protected Point getInitialLocation(final Point initialSize) { final Point p = getDisplay().getCursorLocation(); p.x += DISTANCE_TO_CURSOR; p.y = Math.max(p.y - initialSize.y / 2, 0); return p; }
@Override protected Point getInitialLocation(Point initialSize) { // show popup relative to cursor Display display = getShell().getDisplay(); Point location = display.getCursorLocation(); location.x += CURSOR_SIZE; location.y += CURSOR_SIZE; return location; }
@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 TableRowCore getTableRowWithCursor() { // TODO: Make work outside SWT? Point pt = cTable.getDisplay().getCursorLocation(); pt = cTable.toControl(pt); return getTableRow(pt.x, pt.y, true); }
void doMouseLinkCursor() { Display display = getDisplay(); Point point = display.getCursorLocation(); point = display.map(null, this, point); doMouseLinkCursor(point.x, point.y); } void doMouseLinkCursor(int x, int y) {
/** * Sometimes, Display.getCursorControl doesn't go deep enough.. */ public static Control getCursorControl() { Display d = Utils.getDisplay(); Point cursorLocation = d.getCursorLocation(); Control cursorControl = d.getCursorControl(); if (cursorControl instanceof Composite) { return getCursorControl((Composite) cursorControl, cursorLocation); } return cursorControl; }
@Override public TableCellCore getTableCellWithCursor() { // TODO: Make work outside SWT? Point pt = cTable.getDisplay().getCursorLocation(); pt = cTable.toControl(pt); return getTableCell(pt.x, clientArea.y + pt.y); }
void doMouseLinkCursor() { Display display = getDisplay(); Point point = display.getCursorLocation(); point = display.map(null, this, point); doMouseLinkCursor(point.x, point.y); } void doMouseLinkCursor(int x, int y) {
void doMouseLinkCursor() { Display display = getDisplay(); Point point = display.getCursorLocation(); point = display.map(null, this, point); doMouseLinkCursor(point.x, point.y); } void doMouseLinkCursor(int x, int y) {
void doMouseLinkCursor() { Display display = getDisplay(); Point point = display.getCursorLocation(); point = display.map(null, this, point); doMouseLinkCursor(point.x, point.y); } void doMouseLinkCursor(int x, int y) {
@Override protected Point computeInformationControlLocation(Rectangle subjectArea, Point controlSize) { Point result= super.computeInformationControlLocation(subjectArea, controlSize); Point cursorLocation= fTextViewer.getTextWidget().getDisplay().getCursorLocation(); if (isTakingFocusWhenVisible() || cursorLocation.x <= result.x + controlSize.x) return result; result.x= cursorLocation.x + 20 - controlSize.x; return result; }
/** Opens the shell as a root shell. */ public Shell openOnDisplay() { Display display = SwtMisc.assertUI(); if (location == null) { location = Maps.immutableEntry(Corner.CENTER, display.getCursorLocation()); } Shell shell = new Shell(display, style); setupShell(shell); return shell; }
@Override protected Point computeInformationControlLocation(Rectangle subjectArea, Point controlSize) { Point result= super.computeInformationControlLocation(subjectArea, controlSize); Point cursorLocation= fTextViewer.getTextWidget().getDisplay().getCursorLocation(); if (isTakingFocusWhenVisible() || cursorLocation.x <= result.x + controlSize.x) return result; result.x= cursorLocation.x + 20 - controlSize.x; return result; }
@Override public void pressed(SWTSkinButtonUtility buttonUtility, SWTSkinObject skinObject, int stateMask) { Control c = buttonUtility.getSkinObject().getControl(); menuDropDown.setLocation(c.getDisplay().getCursorLocation()); menuDropDown.setVisible(!menuDropDown.getVisible()); } });
@Override public void run() { if (fControlPos == null || fScrollable.isDisposed() || this.fDisplay.isDisposed()) { return; } // Note: we re-click based on the current position. Point cursorLocation = fDisplay.getCursorLocation(); Point point = fScrollable.toControl(cursorLocation); Rectangle currClientArea = fScrollable.getClientArea(); fTargetScrollHandler.scrollOnMouseDown(fScrollable, point, currClientArea); // After the first, the interval is only 50 millis fDisplay.timerExec(50, this); }
protected void showSettings() { final MenuManager manager = new MenuManager(); fillMenu(manager); final Menu menu = manager.createContextMenu(getControl()); final Point location = getControl().getDisplay().getCursorLocation(); menu.setLocation(location); menu.setVisible(true); }