public static Point getScreenLocation(Composite cmpTarget) { Point ptScreen = new Point(0, 0); try { Composite cTmp = cmpTarget; while (!(cTmp instanceof Shell)) { ptScreen.x += cTmp.getLocation().x; ptScreen.y += cTmp.getLocation().y; cTmp = cTmp.getParent(); } } catch (Exception e ) { e.printStackTrace(); } return cmpTarget.getShell().toDisplay(ptScreen); }
public static Point getScreenLocation( Composite cmpTarget ) { Point ptScreen = new Point( 0, 0 ); try { Composite cTmp = cmpTarget; while ( !( cTmp instanceof Shell ) ) { ptScreen.x += cTmp.getLocation( ).x; ptScreen.y += cTmp.getLocation( ).y; cTmp = cTmp.getParent( ); } } catch ( Exception e ) { logger.log( e ); } return cmpTarget.getShell( ).toDisplay( ptScreen ); }
    public static Point getScreenLocation(Composite cmpTarget)    {        Point ptScreen = new Point(0, 0);        try        {            Composite cTmp = cmpTarget;            while (!(cTmp instanceof Shell))            {                ptScreen.x += cTmp.getLocation().x;                ptScreen.y += cTmp.getLocation().y;                cTmp = cTmp.getParent();            }        }        catch (Exception e )        {            e.printStackTrace();        }        return cmpTarget.getShell().toDisplay(ptScreen);    }