public String getText(Object element) {
   if (element instanceof FeatureTypeStyleWrapper) {
     FeatureTypeStyleWrapper ftsW = (FeatureTypeStyleWrapper) element;
     String name = ftsW.getName();
     if (name == null || name.length() == 0) {
       name = Messages.GroupRulesTreeLabelProvider_0;
       name =
           checkSameNameFeatureTypeStyle(ftsW.getParent().getFeatureTypeStylesWrapperList(), name);
       ftsW.setName(name);
     }
     return name;
   } else if (element instanceof RuleWrapper) {
     RuleWrapper ruleWrapper = (RuleWrapper) element;
     String name = ruleWrapper.getName();
     if (name == null || name.length() == 0) {
       name = Messages.GroupRulesTreeLabelProvider_1;
       name = checkSameNameRule(ruleWrapper.getParent().getRulesWrapperList(), name);
       ruleWrapper.setName(name);
     }
     return name;
   }
   return null;
 }
  /**
   * Initialize the composite with pre-existing values.
   *
   * @param ruleWrapper the {@link RuleWrapper}.
   */
  public void init(RuleWrapper ruleWrapper) {
    PointSymbolizerWrapper pointSymbolizerWrapper =
        ruleWrapper.getGeometrySymbolizersWrapper().adapt(PointSymbolizerWrapper.class);

    mainComposite = new Composite(parent, SWT.RESIZE);
    mainComposite.setLayout(new GridLayout(2, false));
    mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label fontLabel = new Label(mainComposite, SWT.NONE);
    fontLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    fontLabel.setText("Font:"); // $NON-NLS-1$

    fontCombo = new Combo(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
    fontCombo.setItems(getScalableFonts());
    fontCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    String characterPath = pointSymbolizerWrapper.getMarkName();
    if (characterPath != null && characterPath.matches("ttf://.+#.+")) { // $NON-NLS-1$
      String[] fontElements = characterPath.substring(6).split("#"); // $NON-NLS-1$
      int index = fontCombo.indexOf(fontElements[0]);
      if (index != -1) {
        fontCombo.select(index);
        characterCode = fontElements[1].substring(2);
      } else {
        fontCombo.select(0);
        characterCode = Integer.toHexString(PLUS_SIGN);
      }
    } else {
      fontCombo.select(0);
      characterCode = Integer.toHexString(PLUS_SIGN);
    }

    fontCombo.addSelectionListener(this);
    fontName = fontCombo.getItem(fontCombo.getSelectionIndex());

    table = new Table(mainComposite, SWT.VIRTUAL | SWT.BORDER | SWT.V_SCROLL | SWT.SIMPLE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.horizontalSpan = 2;
    gridData.heightHint = 300;
    table.setLayoutData(gridData);
    table.setLinesVisible(true);
    table.setRedraw(false);
    Font font = new Font(Display.getCurrent(), fontName, FONT_SIZE, SWT.NORMAL);
    table.setFont(font);

    table.addListener(
        SWT.SetData,
        new Listener() {
          java.awt.Font awtFont = (new java.awt.Font(fontName, java.awt.Font.PLAIN, FONT_SIZE));

          @Override
          public void handleEvent(Event event) {

            final TableItem item = (TableItem) event.item;
            final int index = table.indexOf(item);
            final int ch = +FIRST_CHAR;

            // set a loading message
            item.setText(0, "..."); // $NON-NLS-1$

            Job load =
                new Job("Loading font icon") {

                  @Override
                  protected IStatus run(IProgressMonitor monitor) {

                    Display.getDefault()
                        .syncExec(
                            new Runnable() {

                              public void run() {

                                int character = ch + (index * COLUMNS);

                                for (int cel = 0; cel < COLUMNS; cel++) {

                                  if (character < CHARACTERS) {
                                    if (character > 0xFF && !awtFont.canDisplay(character)) {
                                      item.setText(cel, ""); // $NON-NLS-1$
                                    } else {
                                      item.setText(cel, characterString[character]);
                                    }
                                  }

                                  character++;
                                }
                              }
                            });

                    return Status.OK_STATUS;
                  }
                };

            load.schedule();
          }
        });

    for (int i = 0; i < COLUMNS; i++) {
      new TableColumn(table, SWT.NONE);
    }

    initializeCharacterStringArray();
    table.setItemCount(CHARACTERS / COLUMNS);

    table.getColumn(0).pack();
    int width = table.getColumn(0).getWidth();
    for (int i = 1; i < COLUMNS; i++) {
      table.getColumn(i).setWidth(width);
    }

    // Set redraw back to true so that the table
    // will paint appropriately
    table.setRedraw(true);
    //
    tableCursor = new TableCursor(table, SWT.NONE);
    tableCursor.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));

    int index = Integer.parseInt(characterCode, 16);
    int row = index / COLUMNS - 4;
    int col = index % COLUMNS;
    tableCursor.setSelection(row, col);
    tableCursor.setFont(font);
    tableCursor.addSelectionListener(this);

    characterLabel = new Label(mainComposite, SWT.NONE);
    characterLabel.setText(LABEL_PREFIX + characterCode + "      "); // $NON-NLS-1$
  }