Codota Logo
Composite.getLocation
Code IndexAdd Codota to your IDE (free)

How to use
getLocation
method
in
org.eclipse.swt.widgets.Composite

Best Java code snippets using org.eclipse.swt.widgets.Composite.getLocation (Showing top 18 results out of 315)

  • Common ways to obtain Composite
private void myMethod () {
Composite c =
  • Codota IconControl control;control.getParent()
  • Codota IconStatusDialog zuper;(Composite) zuper.createDialogArea(parent)
  • Codota IconTitleAreaDialog zuper;(Composite) zuper.createDialogArea(parent)
  • Smart code suggestions by Codota
}
origin: pentaho/pentaho-kettle

public Point getRealPosition( Composite canvas, int x, int y ) {
 Point p = new Point( 0, 0 );
 Composite follow = canvas;
 while ( follow != null ) {
  Point xy = new Point( follow.getLocation().x, follow.getLocation().y );
  p.x += xy.x;
  p.y += xy.y;
  follow = follow.getParent();
 }
 p.x = x - p.x - 8;
 p.y = y - p.y - 48;
 return screen2real( p.x, p.y );
}
origin: pentaho/pentaho-kettle

public Point getRealPosition( Composite canvas, int x, int y ) {
 Point p = new Point( 0, 0 );
 Composite follow = canvas;
 while ( follow != null ) {
  org.eclipse.swt.graphics.Point loc = follow.getLocation();
  Point xy = new Point( loc.x, loc.y );
  p.x += xy.x;
  p.y += xy.y;
  follow = follow.getParent();
 }
 int offsetX = -16;
 int offsetY = -64;
 if ( Const.isOSX() ) {
  offsetX = -2;
  offsetY = -24;
 }
 p.x = x - p.x + offsetX;
 p.y = y - p.y + offsetY;
 return screen2real( p.x, p.y );
}
origin: pentaho/pentaho-kettle

 @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();
  }
 }
} );
origin: pentaho/pentaho-kettle

 @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();
  }
 }
} );
origin: pentaho/pentaho-kettle

 @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();
  }
 }
} );
origin: org.eclipse.recommenders.extdoc/rcp

public Point getLocation() {
  return container.getLocation();
}
origin: org.apache.uima/uimaj-ep-configurator

/**
 * Gets the absolute location.
 *
 * @param control the control
 * @param x the x
 * @param y the y
 * @return the absolute location
 */
private Point getAbsoluteLocation(Control control, int x, int y) {
 Point point = new Point(x, y);
 Composite composite = control.getParent();
 while (composite != null) {
  point.x += composite.getLocation().x;
  point.y += composite.getLocation().y;
  composite = composite.getParent();
 }
 return point;
}
origin: org.eclipse.e4.ui.workbench.renderers/swt

public void setLocation(Point location) {
  Rectangle trim = fShell.computeTrim(0, 0, 0, 0);
  Point textLocation = fComposite.getLocation();
  location.x += trim.x - textLocation.x;
  location.y += trim.y - textLocation.y;
  fShell.setLocation(location);
}
origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt

public void setLocation(Point location) {
  Rectangle trim = fShell.computeTrim(0, 0, 0, 0);
  Point textLocation = fComposite.getLocation();
  location.x += trim.x - textLocation.x;
  location.y += trim.y - textLocation.y;
  fShell.setLocation(location);
}
origin: org.eclipse.mylyn.commons/screenshots

  private void invokeMenu(Composite widget) {
    Rectangle b = widget.getBounds();
    Point p = widget.getLocation();
    p.x += b.width + 3;
    bMouse = false;
    redraw();
    clickMenu(p.x, p.y);
  }
});
origin: org.codehaus.openxma/xmartclient

protected Point getMinSize() {
  Point size = getButtonComposite().getSize();
  int bottomEnd = getButtonComposite().getLocation().y + size.y;
  int minWidth = size.x + 2*scaler.convertXToCurrent(HORIZONTAL_OFFSET) + 2*getShell().getBorderWidth();
  int minHeight = bottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT);
  return new Point(minWidth,minHeight);
}
origin: org.codehaus.openxma/xmartserver

protected Point getMinSize() {
  Point size = getButtonComposite().getSize();
  int bottomEnd = getButtonComposite().getLocation().y + size.y;
  int minWidth = size.x + 2*scaler.convertXToCurrent(HORIZONTAL_OFFSET) + 2*getShell().getBorderWidth();
  int minHeight = bottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT);
  return new Point(minWidth,minHeight);
}
origin: com.diffplug.durian/durian-swt

/** Opens the shell on this parent shell. */
public Shell openOn(Shell parent) {
  Preconditions.checkNotNull(parent);
  Shell shell = new Shell(parent, style);
  if (location == null) {
    Point parentPos = shell.getParent().getLocation();
    int SHELL_MARGIN = SwtMisc.systemFontHeight();
    parentPos.x += SHELL_MARGIN;
    parentPos.y += SHELL_MARGIN;
    location = Maps.immutableEntry(Corner.TOP_LEFT, parentPos);
  }
  setupShell(shell);
  return shell;
}
origin: stackoverflow.com

Point loc = btnCntrl.getLocation();
Rectangle rect = btnCntrl.getBounds();
Point loc = btnCntrl2.getLocation();
Rectangle rect = btnCntrl2.getBounds();
origin: org.codehaus.openxma/xmartserver

protected Point getMinSize() {
  int minWidth = scaler.convertXToCurrent(23) + detailButton.getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET);
  minWidth += copyButton.getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET);
  minWidth += getButtonComposite().getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET);
  int okBottomEnd = getButtonComposite().getLocation().y + getButtonComposite().getSize().y;
  int minHeight = okBottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT);
  if(detailOpen) {
    minHeight += scaler.convertYToCurrent(100);
  }
  return new Point(minWidth,minHeight);
}
origin: org.codehaus.openxma/xmartclient

protected Point getMinSize() {
  int minWidth = scaler.convertXToCurrent(23) + detailButton.getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET);
  minWidth += copyButton.getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET);
  minWidth += getButtonComposite().getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET);
  int okBottomEnd = getButtonComposite().getLocation().y + getButtonComposite().getSize().y;
  int minHeight = okBottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT);
  if(detailOpen) {
    minHeight += scaler.convertYToCurrent(100);
  }
  return new Point(minWidth,minHeight);
}
origin: org.eclipse.platform/org.eclipse.ui.workbench

private void adjustHeight(StyledText text) {
  int lineCount = text.getLineCount();
  int lineHeight = text.getLineHeight();
  int startPos = text.getLocation().y;
  Composite c = text.getParent();
  while (c != null) {
    startPos += c.getLocation().y;
    c = c.getParent();
  }
  // the text is not positioned yet, we assume that it will appear
  // on the bottom of the dialog
  startPos += text.getShell().getBounds().height;
  int screenHeight = text.getShell().getMonitor().getBounds().height;
  int availableScreenForText = screenHeight - startPos;
  if (availableScreenForText <= MINIMUM_HEIGHT) {
    // should not happen. But in that case nothing can improve user
    // experience.
    return;
  }
  int desiredHeight = lineCount * lineHeight;
  if (desiredHeight > availableScreenForText * 0.75) {
    ((GridData) text.getLayoutData()).heightHint = (int) (availableScreenForText * 0.75);
  }
}
origin: org.eclipse.platform/org.eclipse.ui.workbench

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();
  }
}
org.eclipse.swt.widgetsCompositegetLocation

Popular methods of Composite

  • setLayout
    Sets the layout which is associated with the receiver to be the argument which may be null.
  • <init>
    Constructs a new instance of this class given its parent and a style value describing its behavior a
  • setLayoutData
  • layout
    Forces a lay out (that is, sets the size and location) of all widgets that are in the parent hierarc
  • getDisplay
  • getChildren
    Returns a (possibly empty) array containing the receiver's children. Children are returned in the or
  • getShell
  • getFont
  • getLayout
    Returns layout which is associated with the receiver, or null if one has not been set.
  • setFont
  • getParent
  • computeSize
  • getParent,
  • computeSize,
  • dispose,
  • setBackground,
  • getClientArea,
  • isDisposed,
  • getBackground,
  • setVisible,
  • setSize,
  • setData

Popular in Java

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • setContentView (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now