/** * Creates the wizard's title area. * * @param parent the SWT parent for the title area composite. * @return the created title area composite. */ protected Composite createTitleArea(Composite parent) { // Create the title area which will contain // a title, message, and image. int margins = 2; titleArea = new Composite(parent, SWT.NONE); FormLayout layout = new FormLayout(); layout.marginHeight = 0; layout.marginWidth = margins; titleArea.setLayout(layout); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.verticalAlignment = SWT.TOP; titleArea.setLayoutData(layoutData); // Message label messageArea = new DialogMessageArea(); messageArea.createContents(titleArea); titleArea.addControlListener( new ControlAdapter() { @Override public void controlResized(ControlEvent e) { updateMessage(); } }); final IPropertyChangeListener fontListener = event -> { if (JFaceResources.BANNER_FONT.equals(event.getProperty())) { updateMessage(); } if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) { updateMessage(); Font dialogFont = JFaceResources.getDialogFont(); updateTreeFont(dialogFont); Control[] children = ((Composite) buttonBar).getChildren(); for (int i = 0; i < children.length; i++) { children[i].setFont(dialogFont); } } }; titleArea.addDisposeListener( event -> JFaceResources.getFontRegistry().removeListener(fontListener)); JFaceResources.getFontRegistry().addListener(fontListener); messageArea.setTitleLayoutData(createMessageAreaData()); messageArea.setMessageLayoutData(createMessageAreaData()); return titleArea; }
/** Updates this dialog's controls to reflect the current page. */ protected void update() { // Update the title bar updateTitle(); // Update the message line updateMessage(); // Update the buttons updateButtons(); // Saved the selected node in the preferences setSelectedNode(); firePageChanged(new PageChangedEvent(this, getCurrentPage())); }