public void dragOver( DropTargetEvent e ) { styledText.setFocus(); Point location = xParent.getDisplay().map( null, styledText, e.x, e.y ); location.x = Math.max( 0, location.x ); location.y = Math.max( 0, location.y ); try { int offset = styledText.getOffsetAtLocation( new Point( location.x, location.y ) ); styledText.setCaretOffset( offset ); } catch ( IllegalArgumentException ex ) { int maxOffset = styledText.getCharCount(); Point maxLocation = styledText.getLocationAtOffset( maxOffset ); if ( location.y >= maxLocation.y ) { if ( location.x >= maxLocation.x ) { styledText.setCaretOffset( maxOffset ); } else { int offset = styledText.getOffsetAtLocation( new Point( location.x, maxLocation.y ) ); styledText.setCaretOffset( offset ); } } else { styledText.setCaretOffset( maxOffset ); } } }
@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(); } } } );
@Override public void menuDetected( MenuDetectEvent event ) { org.eclipse.swt.graphics.Point real = new org.eclipse.swt.graphics.Point( event.x, event.y ); org.eclipse.swt.graphics.Point point = display.map( null, cTabFolder, real ); final CTabItem item = cTabFolder.getItem( point ); if ( item != null ) {
@Override public void getOffsetAtPoint(AccessibleTextEvent e) { StyledText st = StyledText.this; Point point = new Point (e.x, e.y); Display display = st.getDisplay(); point = display.map(null, st, point); e.offset = st.getOffsetAtPoint(point.x, point.y, null, true); } @Override
@Override public void getOffsetAtPoint(AccessibleTextEvent e) { StyledText st = StyledText.this; Point point = new Point (e.x, e.y); Display display = st.getDisplay(); point = display.map(null, st, point); e.offset = st.getOffsetAtPoint(point.x, point.y, null, true); } @Override
@Override public void getLocation (AccessibleControlEvent e) { Rectangle rect = display.map (getParent (), null, getBounds ()); e.x = rect.x; e.y = rect.y; e.width = rect.width; e.height = rect.height; }
@Override public void getLocation (AccessibleControlEvent e) { Rectangle rect = display.map (getParent (), null, getBounds ()); e.x = rect.x; e.y = rect.y; e.width = rect.width; e.height = rect.height; }
@Override public void getLocation (AccessibleControlEvent e) { Rectangle rect = display.map (getParent (), null, getBounds ()); e.x = rect.x; e.y = rect.y; e.width = rect.width; e.height = rect.height; }
@Override public void getLocation(AccessibleControlEvent e) { Rectangle rect = getDisplay().map(getParent(), null, getBounds()); e.x = rect.x; e.y = rect.y; e.width = rect.width; e.height = rect.height; }
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) {
public void update(DragDetectEvent e) { reset(); if (!(e.widget instanceof Control)) return; curCtrl = (Control) e.widget; cursorPos = new Point(e.x, e.y); cursorPos = curCtrl.getDisplay().map(curCtrl, null, cursorPos); curElement = getModelElement(curCtrl); setItemInfo(); } }
public void update(DragDetectEvent e) { reset(); if (!(e.widget instanceof Control)) { return; } curCtrl = (Control) e.widget; cursorPos = new Point(e.x, e.y); cursorPos = curCtrl.getDisplay().map(curCtrl, null, cursorPos); curElement = getModelElement(curCtrl); setItemInfo(); } }
@Override public void getLocation(AccessibleControlEvent e) { Rectangle rect = getDisplay().map(getParent(), null, getBounds()); e.x = rect.x; e.y = rect.y; e.width = rect.width; e.height = rect.height; }
@Override public void getLocation(AccessibleControlEvent e) { Rectangle rect = getDisplay().map(getParent(), null, getBounds()); e.x = rect.x; e.y = rect.y; e.width = rect.width; e.height = rect.height; }
public void getLocation(AccessibleControlEvent e) { Rectangle rect = getDisplay().map(getParent(), null, getBounds()); e.x = rect.x; e.y = rect.y; e.width = rect.width; e.height = rect.height; }
private boolean isAfter(Control trimCtrl, DnDInfo info) { Rectangle bounds = trimCtrl.getBounds(); bounds = trimCtrl.getDisplay().map(trimCtrl.getParent(), null, bounds); Point center = new Point(bounds.x + (bounds.width / 2), bounds.y + (bounds.height / 2)); boolean horizontal = trimBar.getSide() == SideValue.TOP || trimBar.getSide() == SideValue.BOTTOM; boolean after = horizontal ? info.cursorPos.x > center.x : info.cursorPos.y > center.y; return after; }
public void run() { Rectangle itemRect = item.getDisplay().map( hit.getParent(), item, hit.getBounds()); Point origin = item.getOrigin(); origin.y = itemRect.y; item.setOrigin(origin); } });
/** Returns this corner's position on the given control in display coordinates. */ public Point getPosition(Control control) { if (control instanceof Shell) { return getPosition(control.getBounds()); } else { return control.getDisplay().map(control.getParent(), null, getPosition(control.getBounds())); } }