private void openStyle() {
    try {
      JFileChooser fileChooser = new JFileChooser();
      int result = fileChooser.showOpenDialog(this);
      if (result == JFileChooser.APPROVE_OPTION) {
        File f = fileChooser.getSelectedFile();
        if (!f.exists()) throw new Exception("File doesn't exists!");

        String path = f.getAbsolutePath();
        // String path = Constants.ROOT_MAPSFORGE_DIR + "\\styles\\default.xml";

        if (_openedDocument != null) closeStyle();

        refreshUI();

        _openedDocument = StyleDocument.loadStyle(path);
        _editorPane.setText(_openedDocument.getContent());

        refreshUI();
        _editorPane.addCaretListener(_caretListener);
      }

    } catch (Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(
          this, e.toString(), "Error while opening style", JOptionPane.ERROR_MESSAGE);
    }
  }
  private void createStyle() {
    try {
      if (_openedDocument != null) closeStyle();

      refreshUI();

      _openedDocument = new StyleDocument();
      String baseFileText = openBaseFileText();
      _openedDocument.putContents(baseFileText);
      _editorPane.setText(_openedDocument.getContent());

      refreshUI();
      _editorPane.addCaretListener(_caretListener);

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