@Override public synchronized void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException { super.addPosition(category, position); } /* (non-Javadoc)
private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException { Document doc= new Document(string); try { if (positions != null) { final String POS_CATEGORY= "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { if (fOffset < fPosition.offset && (fPosition.offset + fPosition.length < fOffset + fLength)) { fPosition.offset= fOffset + fLength; // deleted positions: set to end of remove return false; } return true; } }); for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; }
private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException { Document doc= new Document(string); try { if (positions != null) { final String POS_CATEGORY= "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { int start= this.fOffset; int end= start + this.fLength; if (start < this.fPosition.offset && (this.fPosition.offset + this.fPosition.length < end)) { this.fPosition.offset= end; // deleted positions: set to end of remove return false; } return true; } }); for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length(), e); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; }
public synchronized void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException { super.addPosition(category, position); } /* (non-Javadoc)
private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException { Document doc= new Document(string); try { if (positions != null) { final String POS_CATEGORY= "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { int start= this.fOffset; int end= start + this.fLength; if (start < this.fPosition.offset && (this.fPosition.offset + this.fPosition.length < end)) { this.fPosition.offset= end; // deleted positions: set to end of remove return false; } return true; } }); for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; }
@Override public void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException { positionsWriteLock.lock(); try { super.addPosition(category, position); } finally { positionsWriteLock.unlock(); } }
for (int i = 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]);
public void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException { Object lockObject= getLockObject(); if (lockObject == null) { super.addPosition(category, position); return; } synchronized (lockObject) { super.addPosition(category, position); } }
for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length(), e); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
@Override public void addPosition(Position position) throws BadLocationException { positionsWriteLock.lock(); try { super.addPosition(position); } finally { positionsWriteLock.unlock(); } }
private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException { Document doc= new Document(string); try { if (positions != null) { final String POS_CATEGORY= "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { int start= this.fOffset; int end= start + this.fLength; if (start < this.fPosition.offset && (this.fPosition.offset + this.fPosition.length < end)) { this.fPosition.offset= end; // deleted positions: set to end of remove return false; } return true; } }); for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; }
@Override public void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException { Object lockObject= getLockObject(); if (lockObject == null) { super.addPosition(category, position); return; } synchronized (lockObject) { super.addPosition(category, position); } }
private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException { Document doc= new Document(string); try { if (positions != null) { final String POS_CATEGORY= "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { int start= this.fOffset; int end= start + this.fLength; if (start < this.fPosition.offset && (this.fPosition.offset + this.fPosition.length < end)) { this.fPosition.offset= end; // deleted positions: set to end of remove return false; } return true; } }); for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; }
for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + content.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException { Document doc= new Document(string); try { if (positions != null) { final String POS_CATEGORY= "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { int start= this.fOffset; int end= start + this.fLength; if (start < this.fPosition.offset && (this.fPosition.offset + this.fPosition.length < end)) { this.fPosition.offset= end; // deleted positions: set to end of remove return false; } return true; } }); for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; }
for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + content.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
for (int i= 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + content.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$