@Override public ITypedRegion[] computePartitioning(int offset, int length) { return computePartitioning(offset, length, false); }
@Override public boolean documentChanged(DocumentEvent e) { IRegion region= documentChanged2(e); return (region != null); }
@Override public String getContentType(int offset, boolean preferOpenPartitions) { return getPartition(offset, preferOpenPartitions).getType(); }
p= category[i]; if (p.isDeleted) { rememberDeletedOffset(e.getOffset()); break; String contentType= getTokenContentType(token); if (!isSupportedContentType(contentType)) { token= fScanner.nextToken(); continue; !contentType.equals(p.getType())))) { rememberRegion(p.offset, p.length); d.removePosition(fPositionCategory, p); ++ first; return createRegion(); rememberRegion(start, length); } catch (BadPositionCategoryException x) { } catch (BadLocationException x) { p= (TypedPosition) category[first++]; d.removePosition(fPositionCategory, p); rememberRegion(p.offset, p.length); return createRegion();
/** * Performs the initial partitioning of the partitioner's document. */ protected void initialize() { fScanner.setRange(fDocument, 0, fDocument.getLength()); try { IToken token= fScanner.nextToken(); while (!token.isEOF()) { String contentType= getTokenContentType(token); if (isSupportedContentType(contentType)) { TypedPosition p= new TypedPosition(fScanner.getTokenOffset(), fScanner.getTokenLength(), contentType); fDocument.addPosition(fPositionCategory, p); } token= fScanner.nextToken(); } } catch (BadLocationException x) { // cannot happen as offsets come from scanner } catch (BadPositionCategoryException x) { // cannot happen if document has been connected before } }
@Override public void connect(IDocument document) { Assert.isNotNull(document); Assert.isTrue(!document.containsPositionCategory(fPositionCategory)); fDocument= document; fDocument.addPositionCategory(fPositionCategory); initialize(); }
@Override public String getContentType(int offset) { TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
p= element; if (p.isDeleted) { rememberDeletedOffset(e.getOffset()); break; String contentType= getTokenContentType(token); if (!isSupportedContentType(contentType)) { token= fScanner.nextToken(); continue; !contentType.equals(p.getType())))) { rememberRegion(p.offset, p.length); d.removePosition(fPositionCategory, p); ++ first; return createRegion(); rememberRegion(start, length); } catch (BadPositionCategoryException x) { } catch (BadLocationException x) { p= (TypedPosition) category[first++]; d.removePosition(fPositionCategory, p); rememberRegion(p.offset, p.length); return createRegion();
/** * Performs the initial partitioning of the partitioner's document. */ protected void initialize() { fScanner.setRange(fDocument, 0, fDocument.getLength()); try { IToken token= fScanner.nextToken(); while (!token.isEOF()) { String contentType= getTokenContentType(token); if (isSupportedContentType(contentType)) { TypedPosition p= new TypedPosition(fScanner.getTokenOffset(), fScanner.getTokenLength(), contentType); fDocument.addPosition(fPositionCategory, p); } token= fScanner.nextToken(); } } catch (BadLocationException x) { // cannot happen as offsets come from scanner } catch (BadPositionCategoryException x) { // cannot happen if document has been connected before } }
@Override public void connect(IDocument document) { Assert.isNotNull(document); Assert.isTrue(!document.containsPositionCategory(fPositionCategory)); fDocument= document; fDocument.addPositionCategory(fPositionCategory); initialize(); }
@Override public String getContentType(int offset) { TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
@Override public String getContentType(int offset, boolean preferOpenPartitions) { return getPartition(offset, preferOpenPartitions).getType(); }
@Override public boolean documentChanged(DocumentEvent e) { IRegion region= documentChanged2(e); return (region != null); }
@Override public ITypedRegion[] computePartitioning(int offset, int length) { return computePartitioning(offset, length, false); }
@Override public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) { ITypedRegion region= getPartition(offset); if (preferOpenPartitions) { if (region.getOffset() == offset && !region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) { if (offset > 0) { region= getPartition(offset - 1); if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) return region; } return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE); } } return region; }
@Override public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) { ITypedRegion region= getPartition(offset); if (preferOpenPartitions) { if (region.getOffset() == offset && !region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) { if (offset > 0) { region= getPartition(offset - 1); if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) return region; } return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE); } } return region; }