private void saveStyle() {
    if (_openedDocument == null) return;

    _openedDocument.putContents(_editorPane.getText());

    try {
      if (!_openedDocument.isSaved()) {
        JFileChooser fileChooser = new JFileChooser();
        int result = fileChooser.showSaveDialog(this);
        if (result == JFileChooser.APPROVE_OPTION) {
          File f = fileChooser.getSelectedFile();
          String path = f.getAbsolutePath();

          _openedDocument.saveStyle(path);
          refreshUI();
        }
      } else {
        _openedDocument.saveStyle();
        refreshUI();
      }

    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          this, e.toString(), "Error while saving style", JOptionPane.ERROR_MESSAGE);
    }
  }