private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) { link = new Link( shell, SWT.SINGLE | SWT.WRAP ); link.setText( helpLink ); if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) { FontData[] fD = link.getFont().getFontData(); fD[0].setHeight( 13 ); link.setFont( new Font( display, fD[0] ) ); } FormData fdlink = new FormData(); fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon fdlink.top = new FormAttachment( description, margin ); fdlink.width = maxTextWidth; link.setLayoutData( fdlink ); props.setLook( link ); link.addListener( SWT.Selection, new Listener() { public void handleEvent( Event event ) { if ( Desktop.isDesktopSupported() ) { try { Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) ); } catch ( Exception e ) { log.logError( "Error opening external browser", e ); } } } } ); }
@Override void createWidget (int index) { super.createWidget (index); layout.setFont (getFont ()); text = ""; initAccessible (); }
@Override void createWidget (int index) { super.createWidget (index); layout.setFont (getFont ()); text = ""; initAccessible (); }
@Override void createWidget (int index) { super.createWidget (index); layout.setFont (getFont ()); text = ""; initAccessible (); }
@Override public Point computeSize( int wHint, int hHint, boolean changed ) { checkWidget(); int width = 0; int height = 0; if( ( displayText.length() > 0 ) ) { // Replace '&' with '&&' to ensure proper size calculation with one '&', // because the other will be escaped in // TextSizeUtil#createMeasureString() String string = escapeAmpersand( displayText ); Point extent = TextSizeUtil.textExtent( getFont(), string, wHint ); width = extent.x; height = extent.y; } if( wHint != SWT.DEFAULT ) { width = wHint; } if( hHint != SWT.DEFAULT ) { height = hHint; } BoxDimensions border = getBorder(); BoxDimensions padding = getPadding(); width += border.left + border.right + padding.left + padding.right; height += border.top + border.bottom + padding.top + padding.bottom; return new Point( width, height ); }
FontData[] fontData = link.getFont().getFontData(); for (FontData fd : fontData) { fd.setHeight(10);
widget.setAutoresizingMask (OS.NSViewWidthSizable | OS.NSViewHeightSizable); widget.textContainer().setLineFragmentPadding(2); widget.setFont(getFont().handle); widget.setAlignment (OS.NSLeftTextAlignment);