/** * Inserts given soft wrap to {@link #myWraps} collection at the given index. * * @param softWrap soft wrap to store * @param notifyListeners flag that indicates if registered listeners should be notified about soft wrap registration * @return previous soft wrap object stored for the same offset if any; <code>null</code> otherwise */ @SuppressWarnings({"ForLoopReplaceableByForEach"}) @Nullable public SoftWrap storeOrReplace(SoftWrapImpl softWrap, boolean notifyListeners) { int i = getSoftWrapIndex(softWrap.getStart()); if (i >= 0) { return myWraps.set(i, softWrap); } i = -i - 1; myWraps.add(i, softWrap); if (notifyListeners) { // Use explicit loop as profiling shows that iterator-based processing is quite slow. for (int j = 0; j < myListeners.size(); j++) { SoftWrapChangeListener listener = myListeners.get(j); listener.softWrapAdded(softWrap); } } return null; }
public void notifyListenersAboutChange() { for (SoftWrapChangeListener listener : myListeners) { listener.softWrapsChanged(); } }
@Override public boolean addSoftWrapChangeListener(@NotNull SoftWrapChangeListener listener) { return false; }
private void notifyListenersAboutRemoval() { for (SoftWrapChangeListener listener : myListeners) { listener.softWrapsRemoved(); } }
@Override public boolean addSoftWrapChangeListener(@Nonnull SoftWrapChangeListener listener) { return false; }
/** * Registers given listener within the current model * * @param listener listener to register * @return <code>true</code> if given listener was not registered before; <code>false</code> otherwise */ public boolean addSoftWrapChangeListener(@NotNull SoftWrapChangeListener listener) { return myListeners.add(listener); }
/** * Registers given listener within the current model * * @param listener listener to register * @return <code>true</code> if given listener was not registered before; <code>false</code> otherwise */ public boolean addSoftWrapChangeListener(@Nonnull SoftWrapChangeListener listener) { return myListeners.add(listener); }