/** * return true if can create region * * @param beginOffset * @param endOffset * @throws CollabException * @return */ public boolean testCreateRegion(int beginOffset, int endOffset) throws CollabException { Debug.log(this, "CollabJavaFileHandler, testCreateRegion"); // NoI18n // check for initial guarded sections if (!testOverlap(beginOffset, endOffset) || !testOverlap(beginOffset + 1, endOffset)) { Debug.log(this, "CollabJavaFileHandler, found initial guarded section"); // NoI18n return false; } int length = endOffset - beginOffset; CollabRegion region = getContainingRegion(beginOffset, length, true); if (region != null) { if (!region.isGuarded()) { Debug.log(this, "CollabJavaFileHandler, region instanceof CollabJavaRegion"); // NoI18n return false; } else { Debug.log( this, "CollabJavaFileHandler, region instanceof JavaEditor.SimpleSection"); // NoI18n return testOverlap(beginOffset, endOffset); } } return true; }
/** * get the file document content of a region * * @param regionName the regionName * @return document Content content * @throws CollabException */ public String getContent(String regionName) throws CollabException { StyledDocument fileDocument = getDocument(); CollabRegion region = getRegion(regionName); return region.getContent(); }