This document lists changes made to the Editor Utilities
API. Please ask on the dev@openide.netbeans.org
mailing list
if you have any questions about the details of a
change, or are wondering how to convert existing code to be compatible.
Fuller descriptions of all changes can be found below (follow links).
Not all deprecations are listed here, assuming that the deprecated APIs continue to essentially work. For a full deprecation list, please consult the Javadoc.
DocumentListenerPriority.LEXER
added
These API specification versions may be used to indicate that a module requires a certain API feature in order to function. For example, if you see here a feature you need which is labelled 1.20, your manifest should contain in its main attributes the line:
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.editor.util > 1.20
DocumentListenerPriority.LEXER
added
org.netbeans.lib.editor.util.GapList
Added support for adding weak property change listeners to documents
by providing
DocumentUtilities.addWeakPropertyChangeListener(doc, listenerImplementation)
.
The supplied listenerImplementation
is not held via
a strong reference, but a weak reference and so can be GCed
independendly of the referencing document.
GapList
; made by: mmetelka; issues:
#257888
Added StringEscapeUtils.escapeHtml
and StringEscapeUtil.unescapeHtml
to escape text to html.
Added BlockCompare.invalidX()
and BlockCompare.invalidY()
to check for invalid bounds of compared blocks.
Adding DocumentUtilities.addPropertyChangeListener(Document, PropertyChangeListener)
and DocumentUtilities.removePropertyChangeListener(Document, PropertyChangeListener)
in order
to support listening on document property changes.
Adding DocumentUtilities.getDocumentTimestamp(Document) to provide access to documents' timestamp property.
Adding DocumentUtilities.getDocumentVersion(Document) to provide access to documents' version property.
Adding DocumentUtilities.debugOffset(Document, int) to dump both the integer offset and line and column as seen in editor's status bar. PositionRegion.toString(doc) debugs its bounds using debugOffset(). Added PositionRegion.getText() and PositionRegion.getString() to obtain text of the region.
Adding DocumentUtilities.getMimeType(Document)
and
DocumentUtilities.getMimeType(JTextComponent)
in order
to standardize access to documents' mimetype.
Adding CharacterConversions
as a replacement for
org.netbeans.editor.LineSeparatorConversion
, which was
deprecated.
DocumentListenerPriority.FIRST
is called prior any other
priority levels.
DocumentUtilities.getDocumentListenerCount() returns total count of document listeners attached to a document covering the case when the document priority listening is used.
ArrayUtilities.binarySearch(int [] array, int key) and its variants can be used for searching in sorted integer array (eg. containing document offsets, etc.).
DocumentUtilities.isReadLocked() and isWriteLocked() allow to check whether AbstractDocument based documents are currently read/write-locked.
FlyOffsetGapList.elementOrEndOffset()
added for use by lexer module
to get either an element's offset or end offset of the last element.
DocumentListenerPriority.LEXER
added
DocumentListenerPriority.LEXER
added for use by lexer module to update
token list for a document.
ArrayUtilities.unmodifiableList() return simple unmodifiable list for the given object array.
ListenerList.getListeners now returns List<T> instead of T[]. The listeners are returned in exactly the same order as they were added to the ListenerList.
CompactMap.MapEntry was made an abstract class (instead of original interface) to prevent misuse of CompactMap.MapEntry.setNextMapEntry(). CompactMap.AbstractMapEntry was removed.
Added ListenerList and added DocumentListenerPriority.VIEW.
Added two new classes PositionComparator and PositionRegion and a new level AFTER_CARET_UPDATE to DocumentListenerPriority class.
Added document listeners ordering support through
DocumentUtilities.addDocumentListener(doc, listener, priority)
.
The present classes were repackaged from org.netbeans.modules.editor.util into org.netbeans.lib.editor.util package to fulfil the editor module split proposal #51486 according to which the editor classes independent of the NB IDE should be placed under org.netbeans.lib package.