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); } } }