コード例 #1
0
    @Override
    public String getSelectedText() {
      Document doc = getDocument();
      int start = getSelectionStart();
      int end = getSelectionEnd();

      try {
        Position p0 = doc.createPosition(start);
        Position p1 = doc.createPosition(end);
        StringWriter sw = new StringWriter(p1.getOffset() - p0.getOffset());
        getEditorKit().write(sw, doc, p0.getOffset(), p1.getOffset() - p0.getOffset());

        return StringUtil.removeHtmlTags(sw.toString());
      } catch (BadLocationException e) {
        LOG.warn(e);
      } catch (IOException e) {
        LOG.warn(e);
      }
      return super.getSelectedText();
    }
コード例 #2
0
 private void checkMultiline() {
   myMultiline =
       StringUtil.removeHtmlTags(getText()).contains(SystemProperties.getLineSeparator());
 }