private void refreshUI() {
    if (_openedDocument != null) {
      // _editorPane.setText(_openedDocument.getContent());

      String path = _openedDocument.getPath();
      Layers layers = _mapView.getLayerManager().getLayers();

      layers.clear();
      TileCache tc = createTileCache(0);

      System.out.println("RefreshUI()");

      String filePath = Constants.MAP_FILE;
      String rendererPath = _openedDocument.getPath();
      String fileLocation = "";
      if (rendererPath != null)
        fileLocation = new File(rendererPath).getParentFile().getAbsolutePath();

      TileRendererLayer layer =
          createTileRendererLayerWithString(
              tc,
              _mapView.getModel().mapViewPosition,
              false,
              true,
              filePath,
              _editorPane.getText(),
              fileLocation);
      layers.add(layer);

      _openedDocument.putContents(_editorPane.getText());

      // TODO
      final RenderThemeFuture rtf =
          new RenderThemeFuture(
              GRAPHIC_FACTORY,
              new MapsForgeStringXmlRenderTheme(_editorPane.getText(), fileLocation),
              new DisplayModel());
      Thread t =
          new Thread(
              new Runnable() {

                @Override
                public void run() {

                  rtf.run();
                  try {
                    rtf.get();

                    SwingUtilities.invokeLater(
                        new Runnable() {

                          @Override
                          public void run() {
                            System.out.println("Dismiss the error!");
                            // _mapView.setVisible(true);
                            // lblError.setVisible(false);
                            lblError.setText("");
                          }
                        });

                  } catch (final Exception e) {
                    SwingUtilities.invokeLater(
                        new Runnable() {

                          @Override
                          public void run() {
                            System.out.println("Showing an error!");
                            // _mapView.setVisible(false);
                            // lblError.setVisible(true);
                            lblError.setText("<html>" + e.toString() + "</html>");
                          }
                        });
                  }
                }
              });
      t.start();

    } else {
      Layers layers = _mapView.getLayerManager().getLayers();
      layers.clear();
    }
  }