Java 类com.intellij.openapi.editor.event.DocumentListener 实例源码

项目:DarkyenusTimeTracker    文件:TimeTrackerWidget.java   
private void setupAutoStartDocumentListener(boolean enabled) {
    final EditorEventMulticaster editorEventMulticaster = EditorFactory.getInstance().getEventMulticaster();
    if (autoStartDocumentListener != null) {
        editorEventMulticaster.removeDocumentListener(autoStartDocumentListener);
        autoStartDocumentListener = null;
    }
    if (enabled) {
        editorEventMulticaster.addDocumentListener(autoStartDocumentListener = new DocumentListener() {
            @Override
            public void documentChanged(DocumentEvent e) {
                if (running) return;
                //getSelectedTextEditor() must be run from event dispatch thread
                EventQueue.invokeLater(() -> {
                    final Editor selectedTextEditor = FileEditorManager.getInstance(project).getSelectedTextEditor();
                    if (selectedTextEditor == null) return;
                    if(e.getDocument().equals(selectedTextEditor.getDocument())) {
                        setRunning(true);
                    }
                });
            }
        });
    }
}
项目:intellij-ce-playground    文件:StringTableCellEditor.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  final EditorTextField editorTextField = new EditorTextField((String) value, myProject, StdFileTypes.JAVA) {
          @Override
          protected boolean shouldHaveBorder() {
            return false;
          }
        };
  myDocument = editorTextField.getDocument();
  if (myDocument != null) {
    for (DocumentListener listener : myListeners) {
      editorTextField.addDocumentListener(listener);
    }
  }
  return editorTextField;
}
项目:intellij-ce-playground    文件:CodeFragmentTableCellEditorBase.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  myCodeFragment = (PsiCodeFragment)value;

  myDocument = PsiDocumentManager.getInstance(myProject).getDocument(myCodeFragment);
  myEditorTextField = createEditorField(myDocument);
  if (myEditorTextField != null) {
    for (DocumentListener listener : myListeners) {
      myEditorTextField.addDocumentListener(listener);
    }
    myEditorTextField.setDocument(myDocument);
    myEditorTextField.setBorder(new LineBorder(table.getSelectionBackground()));
  }

  return myEditorTextField;
}
项目:intellij-ce-playground    文件:PyParameterTableModel.java   
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  myCodeFragment = (PsiCodeFragment)((Pair)value).getFirst();

  myDocument = PsiDocumentManager.getInstance(myProject).getDocument(myCodeFragment);
  JPanel panel = new JPanel();
  myEditorTextField = createEditorField(myDocument);
  if (myEditorTextField != null) {
    for (DocumentListener listener : myListeners) {
      myEditorTextField.addDocumentListener(listener);
    }
    myEditorTextField.setDocument(myDocument);
    myEditorTextField.setBorder(new LineBorder(table.getSelectionBackground()));
  }

  panel.add(myEditorTextField);
  panel.add(new JCheckBox());
  return panel;
}
项目:jetbrains-plugin-st4    文件:STGroupPluginController.java   
@Override
public void editorReleased(@NotNull EditorFactoryEvent event) {
    Editor editor = event.getEditor();
    final Document doc = editor.getDocument();
    if (editor.getProject() != null && editor.getProject() != project) {
        return;
    }
    STGroupFileEditorListener listener = editor.getUserData(EDITOR_DOCUMENT_LISTENER_KEY);
    if (listener != null) {
        doc.removeDocumentListener(listener);
        doc.putUserData(EDITOR_DOCUMENT_LISTENER_KEY, null);
    }
    DocumentListener listener2 = editor.getUserData(EDITOR_STRUCTVIEW_LISTENER_KEY);
    if (listener2 != null) {
        doc.removeDocumentListener(listener2);
        doc.putUserData(EDITOR_STRUCTVIEW_LISTENER_KEY, null);
    }
}
项目:eddy    文件:LightDocument.java   
private void changedUpdate(@NotNull DocumentEvent event, long newModificationStamp) {
  try {
    getLineSet().changedUpdate(event);
    setModificationStamp(newModificationStamp);

    if (!ShutDownTracker.isShutdownHookRunning()) {
      DocumentListener[] listeners = getCachedListeners();
      for (DocumentListener listener : listeners) {
        try {
          listener.documentChanged(event);
        }
        catch (Throwable e) {
          log(e);
        }
      }
    }
  }
  finally {
    myEventsHandling = false;
  }
}
项目:tools-idea    文件:DocumentImpl.java   
private void changedUpdate(DocumentEvent event, long newModificationStamp) {
  try {
    if (LOG.isDebugEnabled()) LOG.debug(event.toString());

    myLineSet.changedUpdate(event);
    setModificationStamp(newModificationStamp);

    if (!ShutDownTracker.isShutdownHookRunning()) {
      DocumentListener[] listeners = getCachedListeners();
      for (DocumentListener listener : listeners) {
        try {
          listener.documentChanged(event);
        }
        catch (Throwable e) {
          LOG.error(e);
        }
      }
    }
  }
  finally {
    myEventsHandling = false;
  }
}
项目:tools-idea    文件:StringTableCellEditor.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  final EditorTextField editorTextField = new EditorTextField((String) value, myProject, StdFileTypes.JAVA) {
          @Override
          protected boolean shouldHaveBorder() {
            return false;
          }
        };
  myDocument = editorTextField.getDocument();
  if (myDocument != null) {
    for (DocumentListener listener : myListeners) {
      editorTextField.addDocumentListener(listener);
    }
  }
  return editorTextField;
}
项目:tools-idea    文件:CodeFragmentTableCellEditorBase.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  myCodeFragment = (PsiCodeFragment)value;

  myDocument = PsiDocumentManager.getInstance(myProject).getDocument(myCodeFragment);
  myEditorTextField = createEditorField(myDocument);
  if (myEditorTextField != null) {
    for (DocumentListener listener : myListeners) {
      myEditorTextField.addDocumentListener(listener);
    }
    myEditorTextField.setDocument(myDocument);
    myEditorTextField.setBorder(new LineBorder(table.getSelectionBackground()));
  }

  return myEditorTextField;
}
项目:consulo    文件:StringTableCellEditor.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  final EditorTextField editorTextField = new EditorTextField((String) value, myProject, InternalStdFileTypes.JAVA) {
          @Override
          protected boolean shouldHaveBorder() {
            return false;
          }
        };
  myDocument = editorTextField.getDocument();
  if (myDocument != null) {
    for (DocumentListener listener : myListeners) {
      editorTextField.addDocumentListener(listener);
    }
  }
  return editorTextField;
}
项目:consulo    文件:CodeFragmentTableCellEditorBase.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  myCodeFragment = (PsiCodeFragment)value;

  myDocument = PsiDocumentManager.getInstance(myProject).getDocument(myCodeFragment);
  myEditorTextField = createEditorField(myDocument);
  if (myEditorTextField != null) {
    for (DocumentListener listener : myListeners) {
      myEditorTextField.addDocumentListener(listener);
    }
    myEditorTextField.setDocument(myDocument);
    myEditorTextField.setBorder(new LineBorder(table.getSelectionBackground()));
  }

  return myEditorTextField;
}
项目:tmc-intellij    文件:ActivateSpywareAction.java   
@Override
public void execute(@NotNull final Editor editor, char cha, @NotNull DataContext dataContext) {
    if (!listenedDocuments.contains(editor.getDocument()) && isThisCorrectProject()) {
        DocumentListener docl = new TextInputListener();
        editor.getDocument().addDocumentListener(docl);
        listenedDocuments.add(editor.getDocument());
        logger.info("Added document listener to ", editor.getDocument().toString());
        UsagesCollector.doPersistProjectUsages(new ObjectFinder().findCurrentProject());
    }
    handler.execute(editor, cha, dataContext);
}
项目:intellij-ce-playground    文件:DocumentImpl.java   
private void fireMoveText(int start, int end, int newBase) {
  for (DocumentListener listener : getCachedListeners()) {
    if (listener instanceof PrioritizedInternalDocumentListener) {
      ((PrioritizedInternalDocumentListener)listener).moveTextHappened(start, end, newBase);
    }
  }
}
项目:intellij-ce-playground    文件:DocumentImpl.java   
private void doBeforeChangedUpdate(DocumentEvent event) {
  Application app = ApplicationManager.getApplication();
  if (app != null) {
    FileDocumentManager manager = FileDocumentManager.getInstance();
    VirtualFile file = manager.getFile(this);
    if (file != null && !file.isValid()) {
      LOG.error("File of this document has been deleted.");
    }
  }
  assertInsideCommand();

  getLineSet(); // initialize line set to track changed lines

  if (!ShutDownTracker.isShutdownHookRunning()) {
    DocumentListener[] listeners = getCachedListeners();
    for (int i = listeners.length - 1; i >= 0; i--) {
      try {
        listeners[i].beforeDocumentChange(event);
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }

  myEventsHandling = true;
}
项目:intellij-ce-playground    文件:DocumentImpl.java   
private void changedUpdate(@NotNull DocumentEvent event, long newModificationStamp, ImmutableText prevText) {
  try {
    if (LOG.isDebugEnabled()) LOG.debug(event.toString());

    myLineSet = getLineSet().update(prevText, event.getOffset(), event.getOffset() + event.getOldLength(), event.getNewFragment(), event.isWholeTextReplaced());
    myFrozen = null;
    if (myTabTrackingRequestors > 0) {
      updateMightContainTabs(event.getNewFragment());
    }
    setModificationStamp(newModificationStamp);

    if (!ShutDownTracker.isShutdownHookRunning()) {
      DocumentListener[] listeners = getCachedListeners();
      for (DocumentListener listener : listeners) {
        try {
          listener.documentChanged(event);
        }
        catch (Throwable e) {
          LOG.error(e);
        }
      }
    }
  }
  finally {
    myEventsHandling = false;
  }
}
项目:intellij-ce-playground    文件:DocumentImpl.java   
@Override
public void addDocumentListener(@NotNull DocumentListener listener) {
  myCachedDocumentListeners.set(null);

  if (myDocumentListeners.contains(listener)) {
    LOG.error("Already registered: " + listener);
  }
  boolean added = myDocumentListeners.add(listener);
  LOG.assertTrue(added, listener);
}
项目:intellij-ce-playground    文件:DocumentImpl.java   
private DocumentListenerDisposable(@NotNull DocumentListener listener,
                                   @NotNull Ref<DocumentListener[]> cachedDocumentListenersRef,
                                   @NotNull List<DocumentListener> documentListeners) {
  myListener = listener;
  myCachedDocumentListenersRef = cachedDocumentListenersRef;
  myDocumentListeners = documentListeners;
}
项目:intellij-ce-playground    文件:DocumentImpl.java   
private static void doRemoveDocumentListener(@NotNull DocumentListener listener,
                                             @NotNull Ref<DocumentListener[]> cachedDocumentListenersRef,
                                             @NotNull List<DocumentListener> documentListeners) {
  cachedDocumentListenersRef.set(null);
  boolean success = documentListeners.remove(listener);
  if (!success) {
    LOG.error("Can't remove document listener (" + listener + "). Registered listeners: " + documentListeners);
  }
}
项目:intellij-ce-playground    文件:DocumentImpl.java   
@NotNull
private DocumentListener[] getCachedListeners() {
  DocumentListener[] cachedListeners = myCachedDocumentListeners.get();
  if (cachedListeners == null) {
    DocumentListener[] listeners = ArrayUtil.stripTrailingNulls(myDocumentListeners.toArray(new DocumentListener[myDocumentListeners.size()]));
    Arrays.sort(listeners, PrioritizedDocumentListener.COMPARATOR);
    cachedListeners = listeners;
    myCachedDocumentListeners.set(cachedListeners);
  }

  return cachedListeners;
}
项目:intellij-ce-playground    文件:SrcFileAnnotator.java   
public void hideCoverageData() {
  if (myEditor == null) return;
  final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
  final List<RangeHighlighter> highlighters = myEditor.getUserData(COVERAGE_HIGHLIGHTERS);
  if (highlighters != null) {
    for (final RangeHighlighter highlighter : highlighters) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          highlighter.dispose();
        }
      });
    }
    myEditor.putUserData(COVERAGE_HIGHLIGHTERS, null);
  }

  final Map<FileEditor, EditorNotificationPanel> map = myFile.getCopyableUserData(NOTIFICATION_PANELS);
  if (map != null) {
    final VirtualFile vFile = myFile.getVirtualFile();
    LOG.assertTrue(vFile != null);
    boolean freeAll = !fileEditorManager.isFileOpen(vFile);
    myFile.putCopyableUserData(NOTIFICATION_PANELS, null);
    for (FileEditor fileEditor : map.keySet()) {
      if (!freeAll && !isCurrentEditor(fileEditor)) {
        continue;
      }
      fileEditorManager.removeTopComponent(fileEditor, map.get(fileEditor));
    }
  }

  final DocumentListener documentListener = myEditor.getUserData(COVERAGE_DOCUMENT_LISTENER);
  if (documentListener != null) {
    myDocument.removeDocumentListener(documentListener);
    myEditor.putUserData(COVERAGE_DOCUMENT_LISTENER, null);
  }
}
项目:jetbrains-plugin-st4    文件:STGroupPluginController.java   
/** Invalidate tree upon doc change */
public void registerStructureViewModel(final Editor editor, final STGroupStructureViewModel model) {
    final Document doc = editor.getDocument();
    final DocumentListener listener = new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent e) { model.invalidate(); }
    };
    DocumentListener oldListener = doc.getUserData(EDITOR_STRUCTVIEW_LISTENER_KEY);
    if ( oldListener!=null ) {
        doc.removeDocumentListener(oldListener);
    }
    doc.putUserData(EDITOR_STRUCTVIEW_LISTENER_KEY, listener);
    doc.addDocumentListener(listener);
}
项目:eddy    文件:LightDocument.java   
private void fireMoveText(int start, int end, int newBase) {
  for (DocumentListener listener : getCachedListeners()) {
    if (listener instanceof PrioritizedInternalDocumentListener) {
      ((PrioritizedInternalDocumentListener)listener).moveTextHappened(start, end, newBase);
    }
  }
}
项目:eddy    文件:LightDocument.java   
@NotNull
private DocumentEvent doBeforeChangedUpdate(int offset, CharSequence oldString, CharSequence newString, boolean wholeTextReplaced) {
  Application app = ApplicationManager.getApplication();
  if (app != null) {
    FileDocumentManager manager = FileDocumentManager.getInstance();
    if (manager != null) {
      VirtualFile file = manager.getFile(this);
      if (file != null && !file.isValid())
        log("File of this document has been deleted.");
    }
  }

  getLineSet(); // initialize line set to track changed lines

  DocumentEvent event = new DocumentEventImpl(this, offset, oldString, newString, myModificationStamp, wholeTextReplaced);

  if (!ShutDownTracker.isShutdownHookRunning()) {
    DocumentListener[] listeners = getCachedListeners();
    for (int i = listeners.length - 1; i >= 0; i--) {
      try {
        listeners[i].beforeDocumentChange(event);
      }
      catch (Throwable e) {
        log(e);
      }
    }
  }

  myEventsHandling = true;
  return event;
}
项目:eddy    文件:LightDocument.java   
@Override
public void addDocumentListener(@NotNull DocumentListener listener) {
  myCachedDocumentListeners.set(null);

  if (myDocumentListeners.contains(listener)) {
    log("Already registered: " + listener);
  }
  boolean added = myDocumentListeners.add(listener);
  assert added : listener;
}
项目:eddy    文件:LightDocument.java   
public DocumentListenerDisposable(@NotNull DocumentListener listener,
                                  @NotNull Ref<DocumentListener[]> cachedDocumentListenersRef,
                                  @NotNull List<DocumentListener> documentListeners) {
  myListener = listener;
  myCachedDocumentListenersRef = cachedDocumentListenersRef;
  myDocumentListeners = documentListeners;
}
项目:eddy    文件:LightDocument.java   
private static void doRemoveDocumentListener(@NotNull DocumentListener listener,
                                             @NotNull Ref<DocumentListener[]> cachedDocumentListenersRef,
                                             @NotNull List<DocumentListener> documentListeners) {
  cachedDocumentListenersRef.set(null);
  boolean success = documentListeners.remove(listener);
  if (!success) {
    log("Can't remove document listener (" + listener + "). Registered listeners: " + documentListeners);
  }
}
项目:eddy    文件:LightDocument.java   
@NotNull
private DocumentListener[] getCachedListeners() {
  DocumentListener[] cachedListeners = myCachedDocumentListeners.get();
  if (cachedListeners == null) {
    DocumentListener[] listeners = myDocumentListeners.toArray(new DocumentListener[myDocumentListeners.size()]);
    Arrays.sort(listeners, PrioritizedDocumentListener.COMPARATOR);
    cachedListeners = listeners;
    myCachedDocumentListeners.set(cachedListeners);
  }

  return cachedListeners;
}
项目:tools-idea    文件:SoftWrapModelImpl.java   
@Override
public void beforeDocumentChange(DocumentEvent event) {
  if (myBulkUpdateInProgress) {
    return;
  }
  myUpdateInProgress = true;
  if (!isSoftWrappingEnabled()) {
    myDirty = true;
    return;
  }
  for (DocumentListener listener : myDocumentListeners) {
    listener.beforeDocumentChange(event);
  }
}
项目:tools-idea    文件:SoftWrapModelImpl.java   
@Override
public void documentChanged(DocumentEvent event) {
  if (myBulkUpdateInProgress) {
    return;
  }
  myUpdateInProgress = false;
  if (!isSoftWrappingEnabled()) {
    return;
  }
  for (DocumentListener listener : myDocumentListeners) {
    listener.documentChanged(event);
  }
}
项目:tools-idea    文件:DocumentImpl.java   
private void fireMoveText(int start, int end, int newBase) {
  for (DocumentListener listener : getCachedListeners()) {
    if (listener instanceof PrioritizedInternalDocumentListener) {
      ((PrioritizedInternalDocumentListener)listener).moveTextHappened(start, end, newBase);
    }
  }
}
项目:tools-idea    文件:DocumentImpl.java   
@NotNull
private DocumentEvent doBeforeChangedUpdate(int offset, CharSequence oldString, CharSequence newString, boolean wholeTextReplaced) {
  FileDocumentManager manager = FileDocumentManager.getInstance();
  if (manager != null) {
    VirtualFile file = manager.getFile(this);
    if (file != null && !file.isValid()) {
      LOG.error("File of this document has been deleted.");
    }
  }

  DocumentEvent event = new DocumentEventImpl(this, offset, oldString, newString, myModificationStamp, wholeTextReplaced);

  if (!ShutDownTracker.isShutdownHookRunning()) {
    DocumentListener[] listeners = getCachedListeners();
    for (int i = listeners.length - 1; i >= 0; i--) {
      try {
        listeners[i].beforeDocumentChange(event);
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }

  myEventsHandling = true;
  return event;
}
项目:tools-idea    文件:DocumentImpl.java   
@Override
public void addDocumentListener(@NotNull DocumentListener listener) {
  if (myCachedDocumentListeners != null) {
    myCachedDocumentListeners.set(null);
  }

  LOG.assertTrue(!myDocumentListeners.contains(listener), "Already registered: " + listener);
  boolean added = myDocumentListeners.add(listener);
  LOG.assertTrue(added, listener);
}
项目:tools-idea    文件:DocumentImpl.java   
private static void doRemoveDocumentListener(DocumentListener listener,
                                             Ref<DocumentListener[]> cachedDocumentListenersRef,
                                             List<DocumentListener> documentListeners) {
  if (cachedDocumentListenersRef != null) {
    cachedDocumentListenersRef.set(null);
  }
  boolean success = documentListeners.remove(listener);
  if (!success) {
    LOG.error("Can't remove document listener (" + listener + "). Registered cachedDocumentListenersRef: " + documentListeners);
  }
}
项目:tools-idea    文件:DocumentImpl.java   
@NotNull
private DocumentListener[] getCachedListeners() {
  DocumentListener[] cachedListeners = myCachedDocumentListeners.get();
  if (cachedListeners == null) {
    DocumentListener[] listeners = myDocumentListeners.toArray(new DocumentListener[myDocumentListeners.size()]);
    Arrays.sort(listeners, PrioritizedDocumentListener.COMPARATOR);
    cachedListeners = listeners;
    myCachedDocumentListeners.set(cachedListeners);
  }

  return cachedListeners;
}
项目:consulo    文件:SrcFileAnnotator.java   
public void hideCoverageData() {
  if (myEditor == null) return;
  final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
  final List<RangeHighlighter> highlighters = myEditor.getUserData(COVERAGE_HIGHLIGHTERS);
  if (highlighters != null) {
    for (final RangeHighlighter highlighter : highlighters) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          highlighter.dispose();
        }
      });
    }
    myEditor.putUserData(COVERAGE_HIGHLIGHTERS, null);
  }

  final Map<FileEditor, EditorNotificationPanel> map = myFile.getCopyableUserData(NOTIFICATION_PANELS);
  if (map != null) {
    final VirtualFile vFile = myFile.getVirtualFile();
    LOG.assertTrue(vFile != null);
    boolean freeAll = !fileEditorManager.isFileOpen(vFile);
    myFile.putCopyableUserData(NOTIFICATION_PANELS, null);
    for (FileEditor fileEditor : map.keySet()) {
      if (!freeAll && !isCurrentEditor(fileEditor)) {
        continue;
      }
      fileEditorManager.removeTopComponent(fileEditor, map.get(fileEditor));
    }
  }

  final DocumentListener documentListener = myEditor.getUserData(COVERAGE_DOCUMENT_LISTENER);
  if (documentListener != null) {
    myDocument.removeDocumentListener(documentListener);
    myEditor.putUserData(COVERAGE_DOCUMENT_LISTENER, null);
  }
}
项目:consulo    文件:EditorComponentImpl.java   
@Override
public void addDocumentListener(javax.swing.event.DocumentListener documentListener) {
  if (myListeners == null) {
    myListeners = new ArrayList<>(2);
  }
  myListeners.add(documentListener);
}
项目:consulo    文件:DocumentImpl.java   
private void fireMoveText(int start, int end, int newBase) {
  for (DocumentListener listener : getListeners()) {
    if (listener instanceof PrioritizedInternalDocumentListener) {
      ((PrioritizedInternalDocumentListener)listener).moveTextHappened(start, end, newBase);
    }
  }
}
项目:consulo    文件:DocumentImpl.java   
private void beforeChangedUpdate(DocumentEvent event) {
  Application app = ApplicationManager.getApplication();
  if (app != null) {
    FileDocumentManager manager = FileDocumentManager.getInstance();
    VirtualFile file = manager.getFile(this);
    if (file != null && !file.isValid()) {
      LOG.error("File of this document has been deleted: "+file);
    }
  }
  assertInsideCommand();

  getLineSet(); // initialize line set to track changed lines

  if (!ShutDownTracker.isShutdownHookRunning()) {
    DocumentListener[] listeners = getListeners();
    for (int i = listeners.length - 1; i >= 0; i--) {
      try {
        listeners[i].beforeDocumentChange(event);
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }

  myEventsHandling = true;
}
项目:consulo    文件:DocumentImpl.java   
@Override
public void addDocumentListener(@Nonnull DocumentListener listener) {
  if (ArrayUtil.contains(listener, getListeners())) {
    LOG.error("Already registered: " + listener);
  }
  myDocumentListeners.add(listener);
}
项目:consulo    文件:DocumentImpl.java   
@Override
public void removeDocumentListener(@Nonnull DocumentListener listener) {
  boolean success = myDocumentListeners.remove(listener);
  if (!success) {
    LOG.error("Can't remove document listener (" + listener + "). Registered listeners: " + Arrays.toString(getListeners()));
  }
}