private void applyStyle() {
    StyleLayer layer = getSelectedLayer();

    Style newStyle = propertiesEditor.getStyle();
    List<FeatureTypeStyle> featureTypeStyles = newStyle.featureTypeStyles();
    int ftsNum = featureTypeStyles.size();
    if (ftsNum < 1) {
      MessageDialog.openWarning(
          getShell(), Messages.SimplePointEditorPage_1, Messages.SimplePointEditorPage_2);
      style = oldStyle;
      setStyle(oldStyle);
      layer.revertAll();
      layer.apply();

      StyleEditorDialog dialog = (StyleEditorDialog) getContainer();
      dialog.getCurrentPage().refresh();
      return;
    }

    newStyle.setName(layer.getName());

    setStyle(newStyle);

    StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
    styleBlackboard.put(SLDContent.ID, newStyle);
  }
  @Override
  public void createPageContent(Composite parent) {

    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    stackLayout = new StackLayout();
    mainComposite.setLayout(stackLayout);

    noFeatureLabel = new Label(mainComposite, SWT.NONE);
    noFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    noFeatureLabel.setText(Messages.SimplePointEditorPage_0);

    StyleLayer layer = getSelectedLayer();
    IGeoResource resource = layer.getGeoResource();
    if (resource.canResolve(FeatureSource.class)) {
      StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
      oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
      if (oldStyle == null) {
        oldStyle = Utilities.createDefaultPointStyle();
      }

      DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();
      dsv.visit(oldStyle);
      style = (Style) dsv.getCopy();

      if (isPointStyle(style)) {
        propertiesEditor = new PointPropertiesEditor(layer);
        propertiesEditor.open(mainComposite, style);
        stackLayout.topControl = propertiesEditor.getControl();
      } else {
        stackLayout.topControl = noFeatureLabel;
      }
    } else {
      stackLayout.topControl = noFeatureLabel;
    }
  }
  public void refresh() {
    Layer layer = getSelectedLayer();
    IGeoResource resource = layer.getGeoResource();
    if (!resource.canResolve(FeatureSource.class)) {
      return;
    }

    StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
    oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
    if (oldStyle == null) {
      oldStyle = Utilities.createDefaultPointStyle();
    }
    DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();
    dsv.visit(oldStyle);
    style = (Style) dsv.getCopy();

    if (!isPointStyle(style)) {
      stackLayout.topControl = noFeatureLabel;
    } else {
      stackLayout.topControl = propertiesEditor.getControl();
      propertiesEditor.updateStyle(style);
    }
    mainComposite.layout();
  }
 public boolean performOk() {
   applyStyle();
   propertiesEditor.close();
   return true;
 }