コード例 #1
0
 /**
  * @param parent the SWT parent for the tree area controls.
  * @return the new <code>Control</code>.
  * @since 3.0
  */
 protected Control createTreeAreaContents(Composite parent) {
   // Build the tree an put it into the composite.
   treeViewer = createTreeViewer(parent);
   treeViewer.setInput(getPreferenceManager());
   updateTreeFont(JFaceResources.getDialogFont());
   layoutTreeAreaControl(treeViewer.getControl());
   return treeViewer.getControl();
 }
コード例 #2
0
  /**
   * 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;
  }