@Override public String getContentType(int offset) { TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
/** * Fires <code>formatterStops</code> to all formatter strategies which were * involved in the formatting process which is about to terminate. * * @param regions the partitioning of the document which has been formatted */ private void stop(TypedPosition[] regions) { for (TypedPosition region : regions) { IFormattingStrategy s= getFormattingStrategy(region.getType()); if (s != null) s.formatterStops(); } }
/** * Fires <code>formatterStops</code> to all formatter strategies which were * involved in the formatting process which is about to terminate. * * @param regions the partitioning of the document which has been formatted */ private void stop(TypedPosition[] regions) { for (int i= 0; i < regions.length; i++) { IFormattingStrategy s= getFormattingStrategy(regions[i].getType()); if (s != null) s.formatterStops(); } }
@Override public String getContentType(int offset) { TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
/** * Formats one partition after the other using the formatter strategy registered for * the partition's content type. * * @param ranges the partitioning of the document region to be formatted * @since 3.0 */ private void format(TypedPosition[] ranges) { for (TypedPosition range : ranges) { IFormattingStrategy s= getFormattingStrategy(range.getType()); if (s != null) { format(s, range); } } }
/** * Formats one partition after the other using the formatter strategy registered for * the partition's content type. * * @param ranges the partitioning of the document region to be formatted * @since 3.0 */ private void format(TypedPosition[] ranges) { for (int i= 0; i < ranges.length; i++) { IFormattingStrategy s= getFormattingStrategy(ranges[i].getType()); if (s != null) { format(s, ranges[i]); } } }
/** * Fires <code>formatterStarts</code> to all formatter strategies * which will be involved in the forthcoming formatting process. * * @param regions the partitioning of the document to be formatted * @param indentation the initial indentation */ private void start(TypedPosition[] regions, String indentation) { for (TypedPosition region : regions) { IFormattingStrategy s= getFormattingStrategy(region.getType()); if (s != null) s.formatterStarts(indentation); } }
/** * Fires <code>formatterStarts</code> to all formatter strategies * which will be involved in the forthcoming formatting process. * * @param regions the partitioning of the document to be formatted * @param indentation the initial indentation */ private void start(TypedPosition[] regions, String indentation) { for (int i= 0; i < regions.length; i++) { IFormattingStrategy s= getFormattingStrategy(regions[i].getType()); if (s != null) s.formatterStarts(indentation); } }
@Override public String getContentType(int offset) { checkInitialization(); TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
@Override public String getContentType(int offset) { checkInitialization(); TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
/** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ public String getContentType(int offset) { checkInitialization(); TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
/** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ public String getContentType(int offset) { checkInitialization(); TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
/** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ @Override public String getContentType(int offset) { checkInitialization(); TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
/** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ @Override public String getContentType(int offset) { checkInitialization(); TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
/** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> * * @since 2.2 */ public String getContentType(int offset) { checkInitialization(); TypedPosition p = findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.DEFAULT_CONTENT_TYPE; }
private void removeRangeMarkers(List<TypedPosition> positions, IDocument document, TemplateVariable[] variables) throws MalformedTreeException, BadLocationException, BadPositionCategoryException { // revert previous changes for (Iterator<TypedPosition> it= positions.iterator(); it.hasNext();) { TypedPosition position= it.next(); // remove and re-add in order to not confuse ExclusivePositionUpdater document.removePosition(CATEGORY, position); final String original= position.getType(); if (original != null) { document.replace(position.getOffset(), position.getLength(), original); position.setLength(original.length()); } document.addPosition(position); } Iterator<TypedPosition> it= positions.iterator(); for (int i= 0; i != variables.length; i++) { TemplateVariable variable= variables[i]; int[] offsets= new int[variable.getOffsets().length]; for (int j= 0; j != offsets.length; j++) offsets[j]= it.next().getOffset(); variable.setOffsets(offsets); } } }
private void removeRangeMarkers(List<TypedPosition> positions, IDocument document, TemplateVariable[] variables) throws MalformedTreeException, BadLocationException, BadPositionCategoryException { // revert previous changes for (Iterator<TypedPosition> it= positions.iterator(); it.hasNext();) { TypedPosition position= it.next(); // remove and re-add in order to not confuse ExclusivePositionUpdater document.removePosition(CATEGORY, position); final String original= position.getType(); if (original != null) { document.replace(position.getOffset(), position.getLength(), original); position.setLength(original.length()); } document.addPosition(position); } Iterator<TypedPosition> it= positions.iterator(); for (int i= 0; i != variables.length; i++) { TemplateVariable variable= variables[i]; int[] offsets= new int[variable.getOffsets().length]; for (int j= 0; j != offsets.length; j++) offsets[j]= it.next().getOffset(); variable.setOffsets(offsets); } } }
private void removeRangeMarkers(List positions, IDocument document, TemplateVariable[] variables) throws MalformedTreeException, BadLocationException, BadPositionCategoryException { // revert previous changes for (Iterator it= positions.iterator(); it.hasNext();) { TypedPosition position= (TypedPosition) it.next(); // remove and re-add in order to not confuse ExclusivePositionUpdater document.removePosition(CATEGORY, position); final String original= position.getType(); if (original != null) { document.replace(position.getOffset(), position.getLength(), original); position.setLength(original.length()); } document.addPosition(position); } Iterator it= positions.iterator(); for (int i= 0; i != variables.length; i++) { TemplateVariable variable= variables[i]; int[] offsets= new int[variable.getOffsets().length]; for (int j= 0; j != offsets.length; j++) offsets[j]= ((Position) it.next()).getOffset(); variable.setOffsets(offsets); } } }