Community
Participate
Working Groups
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 Build Identifier: 3.4.2 In our product we have extended the TitleAreaDialog. We use the extended dialog to create new files in our project. If an invalid name is entered for the file we dynamically update the dialog to display an error message. These error messages end up getting translated and often the translated messages get truncated as the control which displays the message does not resize when the message is updated. The height of the Text control is fixed. It is calculated when the control is initializing and is not later recomputed when the label is updated * Creates the dialog's title area. * * @param parent * the SWT parent for the title area widgets * @return Control with the highest x axis value. */ private Control createTitleArea(Composite parent) { // add a dispose listener parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (titleAreaColor != null) { titleAreaColor.dispose(); } } }); // Determine the background color of the title bar Display display = parent.getDisplay(); Color background; Color foreground; if (titleAreaRGB != null) { titleAreaColor = new Color(display, titleAreaRGB); background = titleAreaColor; foreground = null; } else { background = JFaceColors.getBannerBackground(display); foreground = JFaceColors.getBannerForeground(display); } parent.setBackground(background); int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); // Dialog image @ right titleImageLabel = new Label(parent, SWT.CENTER); titleImageLabel.setBackground(background); if (titleAreaImage == null) titleImageLabel.setImage(JFaceResources .getImage(DLG_IMG_TITLE_BANNER)); else titleImageLabel.setImage(titleAreaImage); FormData imageData = new FormData(); imageData.top = new FormAttachment(0, 0); // Note: do not use horizontalSpacing on the right as that would be a // regression from // the R2.x style where there was no margin on the right and images are // flush to the right // hand side. see reopened comments in 41172 imageData.right = new FormAttachment(100, 0); // horizontalSpacing titleImageLabel.setLayoutData(imageData); // Title label @ top, left titleLabel = new Label(parent, SWT.LEFT); JFaceColors.setColors(titleLabel, foreground, background); titleLabel.setFont(JFaceResources.getBannerFont()); titleLabel.setText(" ");//$NON-NLS-1$ FormData titleData = new FormData(); titleData.top = new FormAttachment(0, verticalSpacing); titleData.right = new FormAttachment(titleImageLabel); titleData.left = new FormAttachment(0, horizontalSpacing); titleLabel.setLayoutData(titleData); // Message image @ bottom, left messageImageLabel = new Label(parent, SWT.CENTER | SWT.BORDER); messageImageLabel.setBackground(background); // Message label @ bottom, center messageLabel = new Text(parent, SWT.WRAP | SWT.READ_ONLY); JFaceColors.setColors(messageLabel, foreground, background); messageLabel.setText(" \n "); // two lines//$NON-NLS-1$ messageLabel.setFont(JFaceResources.getDialogFont()); messageLabelHeight = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; // Filler labels leftFillerLabel = new Label(parent, SWT.CENTER); leftFillerLabel.setBackground(background); bottomFillerLabel = new Label(parent, SWT.CENTER); bottomFillerLabel.setBackground(background); setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); determineTitleImageLargest(); if (titleImageLargest) return titleImageLabel; return messageLabel; } Reproducible: Always
Oops, please close this - just found defect# 16552 https://bugs.eclipse.org/bugs/show_bug.cgi?id=290988
*** This bug has been marked as a duplicate of bug 16552 ***