private void addElement(ElementManager.Type type) {
        StyledDocument doc = jTextPane_Source.getStyledDocument();
        int pos = jTextPane_Source.getCaretPosition();
        if (jTextPane_Source.getSelectedText() == null) {
            try {
                doc.insertString(pos, "<" + type.name() + "> </" + type.name() + ">", null);
            } catch (BadLocationException ex) {
                Logger.getLogger(FrameMain.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else if (!jTextPane_Source.getSelectedText().isEmpty()) {
            String temp = element.addSingleElements(jTextPane_Source.getSelectedText(), type);
            try {
                jTextPane_Source.replaceSelection("");
                pos = jTextPane_Source.getCaretPosition();
                doc.insertString(pos, temp, null);
            } catch (BadLocationException ex) {
                Logger.getLogger(FrameMain.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }