Hi Pierre-Arnaud, you are totally right. Hardcoding the width and height in that way is not a good idea, my fault. On Linux/GTK the height of the widget is good. But on other platforms it may be too high.
Instead the width and heigt of widgets should be calculated depending on the platform dependent font metrics. Here is a code snippet: ------------------------------------------------ GC gc = new GC( control ); gc.setFont( JFaceResources.getDialogFont() ); FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ); int height = Dialog.convertVerticalDLUsToPixels( fontMetrics, IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2 ); ------------------------------------------------ I don't think we need to pass a GridData to the createContent() method when we use that calculation. WDYT? Regards, Stefan Seelmann Pierre-Arnaud Marcelot schrieb: > Hi Dev, > > I'm using the ConnectionWidget class > (org.apache.directory.studio.connection.ui.widgets.ConnectionWidget) in > the Schema Editor plugin to let the user select the connection he wants > to associate with a Schema Project. The widget performs well but is > unfortunately defined with a height value of 250 which causes the window > to be a little too high. > > I was wondering if was possible to modify the interface of the methods: > > * public void createWidget( Composite parent ) > * protected Control createContent( Composite parent ) > > to be able to give them a GridData for specifying the size of the widget > instead of using a default size of width = 450 & height = 250. > > WDYT ? > > Regards, > P-A > >
