@Override public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event, boolean documentPartitioningChanged) { if (!documentPartitioningChanged) { try { IRegion info = fDocument.getLineInformationOfOffset(event.getOffset()); int start = Math.max(partition.getOffset(), info.getOffset()); int end = event.getOffset() + (event.getText() == null ? event.getLength() : event.getText().length()); if (info.getOffset() <= end && end <= info.getOffset() + info.getLength()) { // optimize the case of the same line end = info.getOffset() + info.getLength(); } else{ end = endOfLineOf(end); } end = Math.min(partition.getOffset() + partition.getLength(), end); return new Region(start, end - start); } catch (BadLocationException x) { } } return partition; }
private ITypedRegion getPartition(final String partitionContentType) { final IDocumentExtension3 extension = (IDocumentExtension3) this.document; ITypedRegion[] computePartitioning = null; try { computePartitioning = extension.computePartitioning(IDocumentExtension3.DEFAULT_PARTITIONING, 0, this.document.getLength(), false); } catch (BadLocationException | BadPartitioningException e) { e.printStackTrace(); } for (final ITypedRegion iTypedRegion : computePartitioning) { if (iTypedRegion.getType().equals(partitionContentType)) { return iTypedRegion; } } return null; }
@Override public void reconcile(final IRegion partition) { if (this.document == null) { return; } try { final ITypedRegion[] partitionRegions = this.document.computePartitioning(partition.getOffset(), partition.getLength()); for (int i = 0; i < partitionRegions.length; i++) { if (partitionRegions[i].getType().equals(MetaModelPartitionScanner.META_MODEL_REASON)) { this.reconcile(null, partitionRegions[i]); } } } catch (final BadLocationException e) { e.printStackTrace(); } }
@Override protected void computeCommentFolding(IXtextDocument xtextDocument, IFoldingRegionAcceptor<ITextRegion> foldingRegionAcceptor, ITypedRegion typedRegion, boolean initiallyFolded) { String text; try { text = xtextDocument.get(typedRegion.getOffset(), typedRegion.getLength()); int lines = Strings.countLines(text); if (shouldCreateCommentFolding(lines)) { boolean collapse = shouldCollapse(typedRegion, lines); super.computeCommentFolding(xtextDocument, foldingRegionAcceptor, typedRegion, collapse); } } catch (BadLocationException e) { log.error(e, e); } }
public String getHoverInfo( ITextViewer textViewer, IRegion hoverRegion){ int offset = hoverRegion.getOffset(); if (hoverRegion != null) { try { if (hoverRegion.getLength() > -1) { IDocument doc = textViewer.getDocument(); // String key = textViewer.getDocument().get(offset, hoverRegion.getLength()); // ITypedRegion region = doc.getPartition(offset); ITypedRegion partitionType = textViewer.getDocument().getPartition(offset); IRegion reg2 = doc.getLineInformationOfOffset(offset); String lineText = doc.get(reg2.getOffset(), reg2.getLength()); // if(BaseUtils.isEmpty(key)){ // key = BaseUtils.getKeyFromLine(lineText); // return HAssistInfoMap.getInfo(key); // } String key = DocumentUtils.getKeyFromLine(lineText); return LazyObjects.getInfoMap("Headers").getInfo(key); } } catch (BadLocationException x) { } } return "JavaEditorMessages.getString(MyTextHover.emptySelection)"; }
public void printPartitions( IDocument document){ StringBuilder buffer = new StringBuilder(); ITypedRegion[] partitions = computePartitioning(0, document.getLength()); for (int i = 0; i < partitions.length; i++) { try { buffer.append("Partition type: " + partitions[i].getType() + ", offset: " + partitions[i].getOffset() + ", length: " + partitions[i].getLength()); buffer.append("\n"); buffer.append("Text:\n"); buffer.append(document.get(partitions[i].getOffset(), partitions[i].getLength())); buffer.append("\n---------------------------\n\n\n"); } catch (BadLocationException e) { e.printStackTrace(); } } System.out.print(buffer); }
/** * Add start of coverage * @param start */ public void addTagStart(ITypedRegion start) { // Assert.isTrue(inTag() && !inTag() == !hasUserPartitions(), // "Found user partitions which have not been removed. This is a bug."); ITypedRegion userRegion = getUserRegion(); if (userRegion != null) { stack.push(userRegion); } TLCRegion startRegion = new TLCRegion(start.getOffset(), start.getLength(), start.getType()); startRegion.setMessageCode(getMessageCode(start, START)); startRegion.setSeverity(getSeverity(start)); // add start to stack stack.push(startRegion); }
/** * Returns array of elements from top of the stack with start as the last element (call pop until the start is found) * @param code * @return */ private ITypedRegion[] getFindStart(int code) { Assert.isTrue(!stack.isEmpty(), "Bug. Empty stack, start tag expected"); Vector<ITypedRegion> elements = new Vector<ITypedRegion>(); while (!stack.isEmpty()) { ITypedRegion region = (ITypedRegion) stack.pop(); elements.add(region); if (TagBasedTLCOutputTokenScanner.TAG_OPEN.equals(region.getType())) { TLCRegion startRegion = (TLCRegion) region; Assert.isTrue(startRegion.getMessageCode() == code, "Found a non-matching start. This is a bug."); // found a match break; } else { // not a start tag // but something else, e.G. user partition } } return (ITypedRegion[]) elements.toArray(new ITypedRegion[elements.size()]); }
public void onOutput(ITypedRegion region, String text) { // a) just store the region this.regions.add(region); // b) convert to TLCState if TLCRegion if (region instanceof TLCRegion) { TLCRegion tlcRegion = (TLCRegion) region; int severity = tlcRegion.getSeverity(); switch (severity) { case MP.STATE: TLCState state = TLCState.parseState(text, "bogusModelName"); this.states.add(state); return; } } // c) unexpected content this.garbage = true; }
public void uncommentSelection(ITypedRegion region, IDocument doc){ int offset = region.getOffset(); int endOffset = region.getOffset() + (region.getLength() - commentBegin.length() - commentEnd.length()); if(!region.getType().equals("__xml_comment")) return; // we should ignore if the region is not a comment try { doc.replace(offset, commentBegin.length(), ""); // remove start comment if(doc.get(endOffset, commentEnd.length()).equals(commentEnd)) doc.replace(endOffset, commentEnd.length(), ""); // remove end comment } catch (BadLocationException e) { e.printStackTrace(); } }
private Integer getCharStart(int lineNumber, int columnNumber) { try { int lineStartChar = document.getLineOffset(lineNumber - 1); Integer charEnd = getCharEnd(lineNumber, columnNumber); if (charEnd != null) { ITypedRegion typedRegion = document.getPartition(charEnd .intValue() - 2); int partitionStartChar = typedRegion.getOffset(); return new Integer(partitionStartChar); } else return new Integer(lineStartChar); } catch (BadLocationException e) { e.printStackTrace(); return null; } }
public void printPartitions(IDocument document) { StringBuffer buffer = new StringBuffer(); ITypedRegion[] partitions = computePartitioning(0, document.getLength()); for (int i = 0; i < partitions.length; i++) { try { buffer.append("Partition type: " + partitions[i].getType() + ", offset: " + partitions[i].getOffset() + ", length: " + partitions[i].getLength()); buffer.append("\n"); buffer.append("Text:\n"); buffer.append(document.get(partitions[i].getOffset(), partitions[i].getLength())); buffer.append("\n---------------------------\n\n\n"); } catch (BadLocationException e) { e.printStackTrace(); } } System.out.print(buffer); }
public String getCurrentTagname(int documentOffset) { try { ITypedRegion region = getPartition(documentOffset); int partitionOffset = region.getOffset(); int readLength = region.getLength(); ColorManager colorManager = new ColorManager(); scanner = new XMLTagScanner(colorManager); String text = get(partitionOffset, readLength); int p = 0; char ch; String tagname = ""; ch = text.charAt(0); while (true) { if (p + 1 >= text.length() || !Character.isJavaIdentifierPart(text.charAt(p + 1))) break; ch = text.charAt(++p); tagname += ch; } return tagname; } catch (BadLocationException e) { e.printStackTrace(); } return ""; }
public ITypedRegion getNextEndTagPartition(String tagname, int offset) { ITypedRegion partition; try { partition = getPartition(offset); while (partition != null) { if (partition.getType().equals(XMLPartitionScanner.XML_END_TAG)) { if (getCurrentEndTagName(partition.getOffset()).equals( tagname)) return partition; } partition = getNextPartition(partition); } } catch (Exception e) { return null; } return null; }
public boolean removeElement(String id, int offset) { try { int elementOffset = getElementOffset(id); ITypedRegion region = getNextTagPartition(elementOffset); String tag = get(region.getOffset(), region.getLength()); if (tag.endsWith("/>")) replace(region.getOffset(), region.getLength(), ""); else { String tagname = getCurrentTagname(offset); ITypedRegion endTagRegion = getNextEndTagPartition(tagname, offset); int begin = region.getOffset(); int end = endTagRegion.getOffset() + endTagRegion.getLength() - begin; replace(begin, end, ""); } return true; } catch (BadLocationException e) { return true; // or false? } }
public boolean removeElement(int offset) { try { ITypedRegion region = getNextTagPartition(offset); String tag = get(region.getOffset(), region.getLength()); if (tag.endsWith("/>")) replace(region.getOffset(), region.getLength(), ""); else { String tagname = getCurrentTagname(offset); ITypedRegion endTagRegion = getNextEndTagPartition(tagname, offset); int begin = region.getOffset(); int end = endTagRegion.getOffset() + endTagRegion.getLength() - begin; replace(begin, end, ""); } return true; } catch (BadLocationException e) { return true; } }
public boolean addChild(String child, String attribute, String value, int elementOffset) { try { ITypedRegion region = getPartition(elementOffset); String indent = getIndentLine(elementOffset) + "\t"; String tagStructue = computeTagStructure(child, indent, ""); replace(region.getOffset() + region.getLength(), 0, "\n" + indent + tagStructue); region = getNextTagPartition(region); String tag = get(region.getOffset(), region.getLength()); setAttribute(attribute, value, region.getOffset()); return true; } catch (BadLocationException e) { e.printStackTrace(); return false; } }
/** * This method return the position of the first element that has the * attribute attr with value = value starting from offset * * @param attr * @param value * @param offset * @return */ public int getElementOffset(String attr, String value, int offset) { try { ITypedRegion region = getNextTagPartition(offset); if (region == null) throw new BadLocationException(); String startTag = get(region.getOffset(), region.getLength()); String currentAttr = getAttributeValueFromCurrentTagName( region.getOffset(), attr); if (currentAttr != null) { if (currentAttr.equals(value)) { return region.getOffset(); } } return getElementOffset(attr, value, region.getOffset() + region.getLength() + 1); } catch (BadLocationException e) { return -1; } }
public int getOffsetByValue(String attribute, String value) { try { if (attribute == null || value == null) return -1; ITypedRegion region = getPartition(0); String t; do { t = get(region.getOffset(), region.getLength()); String tagId; if (region.getType().equals(XMLPartitionScanner.XML_START_TAG)) { tagId = getAttributeValueFromCurrentTagName( region.getOffset(), attribute); if (tagId != null && !tagId.equals("")) if (tagId.equals(value)) return region.getOffset(); } region = getNextPartition(region); } while (!t.equals("</ncl>")); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } return -1; }
/** * Return all the offsets of the tags containing the attribute * * @param attribute * @return */ public Vector<Integer> getAllTagsWithAttribute(String attribute) { Vector<Integer> aliasOffset = new Vector<Integer>(); try { ITypedRegion region = getPartition(0); String t; do { t = get(region.getOffset(), region.getLength()); String att; if (region.getType().equals(XMLPartitionScanner.XML_START_TAG)) { att = getAttributeValueFromCurrentTagName( region.getOffset(), attribute); if (att != null && !att.equals("")) aliasOffset.add(region.getOffset()); } region = getNextPartition(region); } while (!t.equals("</ncl>") && region != null); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); return aliasOffset; } return aliasOffset; }
/** * @param offset * @return */ private String getTagname(int offset) { ITypedRegion region; try { region = getPartition(offset); if (region.getType().equals(XMLPartitionScanner.XML_START_TAG)) return getCurrentTagname(region.getOffset()); if (region.getType().equals(XMLPartitionScanner.XML_END_TAG)) return "/" + getCurrentEndTagName(region.getOffset()); return ""; } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); return ""; } }
private boolean samePartition(int beg, int len) throws BadLocationException { if (len == 0) return TextUtilities.getContentType(doc, Partitions.MK_PARTITIONING, cpos, false) .equals(IDocument.DEFAULT_CONTENT_TYPE); boolean begDef = TextUtilities.getContentType(doc, Partitions.MK_PARTITIONING, beg, false) .equals(IDocument.DEFAULT_CONTENT_TYPE); boolean endDef = TextUtilities.getContentType(doc, Partitions.MK_PARTITIONING, beg + len - 1, false) .equals(IDocument.DEFAULT_CONTENT_TYPE); if (begDef && endDef) { ITypedRegion begRegion = TextUtilities.getPartition(doc, Partitions.MK_PARTITIONING, beg, false); ITypedRegion endRegion = TextUtilities.getPartition(doc, Partitions.MK_PARTITIONING, beg + len - 1, false); if (begRegion.getOffset() == endRegion.getOffset()) return true; } return false; }
private int checkPartition(IDocument doc, int beg, int len) { try { boolean begCmt = TextUtilities.getContentType(doc, Partitions.MK_PARTITIONING, beg, false) .equals(Partitions.COMMENT); boolean endCmt = TextUtilities.getContentType(doc, Partitions.MK_PARTITIONING, beg + len - 1, false) .equals(Partitions.COMMENT); if (begCmt && endCmt) { ITypedRegion begPar = TextUtilities.getPartition(doc, Partitions.MK_PARTITIONING, beg, false); ITypedRegion endPar = TextUtilities.getPartition(doc, Partitions.MK_PARTITIONING, beg + len - 1, false); if (begPar.getOffset() == endPar.getOffset()) return SAME; return DIFF; } if ((begCmt && !endCmt) || (!begCmt && endCmt)) return LAPD; return NONE; } catch (BadLocationException e) { Log.error("Bad comment partitioning " + e.getMessage()); return UNKN; } }
private void removeComment(IDocument doc, int offset) { try { IDocumentUndoManager undoMgr = DocumentUndoManagerRegistry.getDocumentUndoManager(doc); undoMgr.beginCompoundChange(); ITypedRegion par = TextUtilities.getPartition(doc, Partitions.MK_PARTITIONING, offset, false); int beg = par.getOffset(); int len = par.getLength(); String comment = doc.get(beg, len); int eLen = markerLen(comment); int bLen = eLen + 1; MultiTextEdit edit = new MultiTextEdit(); edit.addChild(new DeleteEdit(beg, bLen)); edit.addChild(new DeleteEdit(beg + len - eLen, eLen)); edit.apply(doc); undoMgr.endCompoundChange(); } catch (MalformedTreeException | BadLocationException e) { Log.error("Failure removing comment " + e.getMessage()); } }
/** * Returns a valid insert location (except for whitespace) in <code>partition</code> or -1 if * there is no valid insert location. An valid insert location is right after any java string or * character partition, or at the end of a java default partition, but never behind * <code>maxOffset</code>. Comment partitions or empty java partitions do never yield valid * insert positions. * * @param doc the document being modified * @param partition the current partition * @param maxOffset the maximum offset to consider * @return a valid insert location in <code>partition</code>, or -1 if there is no valid insert * location */ private static int getValidPositionForPartition(IDocument doc, ITypedRegion partition, int maxOffset) { final int INVALID = -1; if (Partitions.FRONT_MATTER.equals(partition.getType())) return INVALID; if (Partitions.COMMENT.equals(partition.getType())) return INVALID; if (Partitions.CODEBLOCK.equals(partition.getType())) return INVALID; int endOffset = Math.min(maxOffset, partition.getOffset() + partition.getLength()); if (IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())) { try { if (doc.get(partition.getOffset(), endOffset - partition.getOffset()).trim().length() == 0) { return INVALID; } else { return endOffset; } } catch (BadLocationException e) { return INVALID; } } // default: we don't know anything about the partition - assume valid return endOffset; }
@Override public void reconcile(IRegion region) { if (getAnnotationModel() == null) { return; } try { currentRegion = region; if (region instanceof ITypedRegion && !contentTypes.contains(((ITypedRegion) region).getType())) { ISpellingProblemCollector collector = createSpellingProblemCollector(); collector.beginCollecting(); collector.endCollecting(); } else { super.reconcile(region); } } finally { currentRegion = null; } }
/** * searches backwards for the given string within the same partition type * @return the region of the match or <code>null</code> if no match were found * @since 2.4 */ public IRegion searchBackwardsInSamePartition(String toFind, String documentText, IDocument document, int endOffset) throws BadLocationException { if (endOffset < 0) { return null; } int length = toFind.length(); String text = preProcessSearchString(documentText); ITypedRegion partition = document.getPartition(endOffset); int indexOf = text.lastIndexOf(toFind, endOffset - length); while (indexOf >= 0) { ITypedRegion partition2 = document.getPartition(indexOf); if (partition2.getType().equals(partition.getType())) { return new Region(indexOf, length); } indexOf = text.lastIndexOf(toFind, partition2.getOffset() - length); } String trimmed = toFind.trim(); if (trimmed.length() > 0 && trimmed.length() != length) { return searchBackwardsInSamePartition(trimmed, documentText, document, endOffset); } return null; }
/** * searches for the given string within the same partition type * * @return the region of the match or <code>null</code> if no match were found * @since 2.4 */ public IRegion searchInSamePartition(String toFind, String documentText, IDocument document, int startOffset) throws BadLocationException { if (startOffset >= document.getLength()) { return null; } String text = preProcessSearchString(documentText); ITypedRegion partition = document.getPartition(startOffset); int indexOf = text.indexOf(toFind, getOffset(toFind, startOffset)); while (indexOf >= 0 && indexOf < document.getLength()) { ITypedRegion partition2 = document.getPartition(indexOf); if (partition2.getType().equals(partition.getType())) { return new Region(indexOf, toFind.length()); } indexOf = text.indexOf(toFind, partition2.getOffset() + partition2.getLength()); } String trimmed = toFind.trim(); if (trimmed.length() > 0 && trimmed.length() != toFind.length()) { return searchInSamePartition(trimmed, documentText, document, startOffset); } return null; }
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event, boolean documentPartitioningChanged) { if (!documentPartitioningChanged) { try { IRegion info= document.getLineInformationOfOffset(event.getOffset()); int start= Math.max(partition.getOffset(), info.getOffset()); int end= event.getOffset() + (event.getText() == null ? event.getLength() : event.getText().length()); if (info.getOffset() <= end && end <= info.getOffset() + info.getLength()) { // optimize the case of the same line end= info.getOffset() + info.getLength(); } else end= endOfLineOf(end); end= Math.min(partition.getOffset() + partition.getLength(), end); return new Region(start, end - start); } catch (BadLocationException x) { logger.logInfo("unable to find location in document to repair a given region",x); //$NON-NLS-1$ } } return partition; }
/** * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion) */ public void createPresentation(TextPresentation presentation, ITypedRegion region) { wipeExistingScopes(region); synchronized (getLockObject(fDocument)) { try { fDocument.addPositionCategory(ICommonConstants.SCOPE_CATEGORY); fDocument.addPosition( ICommonConstants.SCOPE_CATEGORY, new TypedPosition(region.getOffset(), region.getLength(), (String) fDefaultTextAttribute .getData())); } catch (Exception e) { IdeLog.logError(CommonEditorPlugin.getDefault(), e); } } addRange(presentation, region.getOffset(), region.getLength(), getTextAttribute(region)); }
/** * Returns a valid insert location (except for whitespace) in <code>partition</code> or -1 if * there is no valid insert location. An valid insert location is right after any java string or * character partition, or at the end of a java default partition, but never behind <code> * maxOffset</code>. Comment partitions or empty java partitions do never yield valid insert * positions. * * @param doc the document being modified * @param partition the current partition * @param maxOffset the maximum offset to consider * @return a valid insert location in <code>partition</code>, or -1 if there is no valid insert * location */ private static int getValidPositionForPartition( IDocument doc, ITypedRegion partition, int maxOffset) { final int INVALID = -1; if (IJavaPartitions.JAVA_DOC.equals(partition.getType())) return INVALID; if (IJavaPartitions.JAVA_MULTI_LINE_COMMENT.equals(partition.getType())) return INVALID; if (IJavaPartitions.JAVA_SINGLE_LINE_COMMENT.equals(partition.getType())) return INVALID; int endOffset = Math.min(maxOffset, partition.getOffset() + partition.getLength()); if (IJavaPartitions.JAVA_CHARACTER.equals(partition.getType())) return endOffset; if (IJavaPartitions.JAVA_STRING.equals(partition.getType())) return endOffset; if (IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())) { try { if (doc.get(partition.getOffset(), endOffset - partition.getOffset()).trim().length() == 0) return INVALID; else return endOffset; } catch (BadLocationException e) { return INVALID; } } // default: we don't know anything about the partition - assume valid return endOffset; }
/** * Finds the partition containing the given offset. * * @param document the document to search * @param offset the offset used to find a matching partition * @return the partition, or null */ public static ITypedRegion getPartition(IStructuredDocument document, int offset) { ITypedRegion[] partitions; try { partitions = TextUtilities.computePartitioning(document, IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, 0, document.getLength(), true); } catch (BadLocationException e) { CorePluginLog.logError(e, "Unexpected bad location exception."); return null; } for (ITypedRegion partition : partitions) { if (partition.getOffset() <= offset && offset < partition.getOffset() + partition.getLength()) { return partition; } } return null; }
@Override protected boolean isInterestingProblem(SpellingProblem problem) { IStructuredDocument doc = (IStructuredDocument) getDocument(); try { ITypedRegion[] partitions = doc.computePartitioning( problem.getOffset(), problem.getLength()); for (ITypedRegion partition : partitions) { if (partition.getType().equals(ICSSPartitions.STYLE)) { return false; } } } catch (BadLocationException e) { // Ignore } return super.isInterestingProblem(problem); }
public static ITypedRegion getEnclosingJsniRegion(ITextSelection selection, IDocument document) { try { ITypedRegion region = TextUtilities.getPartition(document, GWTPartitions.GWT_PARTITIONING, selection.getOffset(), false); if (region.getType().equals(GWTPartitions.JSNI_METHOD)) { int regionEnd = region.getOffset() + region.getLength(); int selectionEnd = selection.getOffset() + selection.getLength(); // JSNI region should entirely contain the selection if (region.getOffset() <= selection.getOffset() && regionEnd >= selectionEnd) { return region; } } } catch (BadLocationException e) { GWTPluginLog.logError(e); } return null; }
public static String[] getJsniMethods(IDocument document) { try { List<String> jsniMethods = new LinkedList<String>(); ITypedRegion[] regions = TextUtilities.computePartitioning(document, GWTPartitions.GWT_PARTITIONING, 0, document.getLength(), false); // Format all JSNI blocks in the document for (ITypedRegion region : regions) { if (region.getType().equals(GWTPartitions.JSNI_METHOD)) { String jsni = document.get(region.getOffset(), region.getLength()); jsniMethods.add(jsni); } } return jsniMethods.toArray(new String[0]); } catch (BadLocationException e) { GWTPluginLog.logError(e); return null; } }
/** * DOCUMENT ME! * * @param offset * DOCUMENT ME! * @param partitions * DOCUMENT ME! * @param include_start * DOCUMENT ME! * @param doc * DOCUMENT ME! * * @return DOCUMENT ME! */ public static boolean isInsidePartition(int offset, String[] partitions, boolean include_start, IDocument doc) { try { ITypedRegion partition = doc.getPartition(offset); if (include_start || (offset != partition.getOffset())) { String type = partition.getType(); for (int i = 0; i < partitions.length; i++) { if (type.equals(partitions[i])) { return true; } } } } catch (BadLocationException e) { } return false; }
protected List<ElementRegion> parseTag(IDocument document, ITypedRegion tagRegion, String[] attrs) { IDocumentPartitioner partitioner = null; try { // create attribute partitioner partitioner = createAttrPartitioner(document, attrs); ITypedRegion[] regions = partitioner.computePartitioning( tagRegion.getOffset(), tagRegion.getLength()); return fetchAttrsRegions(document, regions); } finally { if (partitioner != null) { partitioner.disconnect(); } } }