/**
   * test overlap before create a JavaEditor#simpleSection
   *
   * @param beginOffset
   * @param endOffset
   * @throws CollabException
   * @return
   */
  public boolean testOverlap(int beginOffset, int endOffset) throws CollabException {
    try {
      StyledDocument doc = getEditorCookie().getDocument();
      Position begin = doc.createPosition(beginOffset);
      Position end = doc.createPosition(endOffset);

      GuardedSectionManager man = GuardedSectionManager.getInstance(doc);
      if (man == null) return true;

      for (GuardedSection sect : man.getGuardedSections()) {
        if (sect.contains(begin, true) || sect.contains(end, true)) return false;
        if (sect.getStartPosition().getOffset() > beginOffset
            && sect.getStartPosition().getOffset() < endOffset) return false;
      }
      return true;
    } catch (BadLocationException e) {
      throw new CollabException(e);
    }
  }
  /** findInitialGuardedSections */
  protected void findInitialGuardedSections() throws CollabException {
    Debug.log(this, "CollabJavaHandler, findInitialGuardedSections"); // NoI18n

    StyledDocument docu = getDocument();
    synchronized (docu) {
      GuardedSectionManager man = GuardedSectionManager.getInstance(docu);
      if (man == null) return; // no guarded sections

      Iterator it = man.getGuardedSections().iterator();

      while (it.hasNext()) {
        GuardedSection sect = (GuardedSection) it.next();
        String name = sect.getName();
        this.otherGuardedSections.put(name, sect);

        if (sect instanceof SimpleSection) {
          Debug.log(this, "CollabJavaHandler, simple_sect: " + name); // NoI18n
        } else {
          Debug.log(this, "CollabJavaHandler, inter_sect: " + name); // NoI18n
        }
      }
    }
  }