/**
   * constructs region Node
   *
   * @param regionName
   * @param regionInfo RegionInfo
   * @param pregion Protocol region
   */
  public void constructRegion(RegionInfo regionInfo, Object pregion) throws CollabException {
    String regionName = regionInfo.getID();
    String mode = regionInfo.getMode();
    int beginOffset = 0;
    int endOffset = 0;
    StyledDocument fileDocument = getDocument();

    if (mode.equals(RegionInfo.LINE_RANGE)) {
      javax.swing.text.Element beginElement =
          fileDocument.getDefaultRootElement().getElement(regionInfo.getbegin());
      beginOffset = beginElement.getStartOffset();

      javax.swing.text.Element endElement =
          fileDocument.getDefaultRootElement().getElement(regionInfo.getend());
      endOffset = endElement.getEndOffset();
    } else {
      beginOffset = regionInfo.getbegin();
      endOffset = regionInfo.getend();
      int endCorrection = regionInfo.getCorrection();
      endOffset += endCorrection;
      if (endOffset < 0) endOffset = 0;
    }

    if (pregion instanceof JavaRegion) {
      JavaRegion javaRegion = (JavaRegion) pregion;
      int length = endOffset - beginOffset;
      javaRegion.setRegionName(regionName);
      javaRegion.setBeginOffset(new java.math.BigInteger(String.valueOf(beginOffset)));
      javaRegion.setLength(new java.math.BigInteger(String.valueOf(length)));
    } else {
      super.constructRegion(regionInfo, pregion);
    }
  }
  /** updateDocument */
  protected void updateDocument(String content) throws CollabException {
    Debug.log(this, "CollabJavaFileHandler, updateDocument"); // NoI18n

    if ((getInitialGuardedSections() == null) || (getInitialGuardedSections().size() == 0)) {
      Debug.log(this, "CollabJavaFileHandler, no initial guarded sections"); // NoI18n	
      super.updateDocument(content);
    } else {
      Debug.log(this, "CollabJavaFileHandler, initial guarded sections exist"); // NoI18n	
      updateFileObject(content);
      getFileObject().refresh(false);
    }
  }
 /**
  * removes all region from the repository
  *
  * @throws CollabException
  */
 public synchronized void removeAllRegion() throws CollabException {
   super.removeAllRegion();
 }