Skip to content

Commit

Permalink
[REFACTOR][I] Rename document modification handlers
Browse files Browse the repository at this point in the history
Renames the document modification handler implementations to better
match their purposes.

Also adjusts the documentation of the
LocalDocumentModificationAnnotationUpdater to match its new purpose.
  • Loading branch information
tobous committed Mar 9, 2021
1 parent 68a93d7 commit 60af0aa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
Expand Up @@ -10,8 +10,8 @@
import saros.intellij.editor.annotations.AnnotationManager;
import saros.intellij.eventhandler.colorscheme.AnnotationReloader;
import saros.intellij.eventhandler.editor.caret.LocalCaretPositionChangeHandler;
import saros.intellij.eventhandler.editor.document.LocalClosedEditorModificationHandler;
import saros.intellij.eventhandler.editor.document.LocalDocumentModificationHandler;
import saros.intellij.eventhandler.editor.document.LocalDocumentModificationActivityDispatcher;
import saros.intellij.eventhandler.editor.document.LocalDocumentModificationAnnotationUpdater;
import saros.intellij.eventhandler.editor.editorstate.AnnotationUpdater;
import saros.intellij.eventhandler.editor.editorstate.EditorStatusChangeActivityDispatcher;
import saros.intellij.eventhandler.editor.editorstate.PreexistingSelectionDispatcher;
Expand Down Expand Up @@ -72,11 +72,11 @@ public ProjectEventHandlers createProjectEventHandlers(@NotNull Project project)
* document modification handlers
*/
projectEventHandlers.add(
new LocalClosedEditorModificationHandler(
new LocalDocumentModificationAnnotationUpdater(
project, editorManager, sarosSession, annotationManager));

projectEventHandlers.add(
new LocalDocumentModificationHandler(project, editorManager, sarosSession));
new LocalDocumentModificationActivityDispatcher(project, editorManager, sarosSession));

/*
* editor state change handlers
Expand Down
Expand Up @@ -15,7 +15,8 @@
*
* @see DocumentListener#beforeDocumentChange(DocumentEvent)
*/
public class LocalDocumentModificationHandler extends AbstractLocalDocumentModificationHandler {
public class LocalDocumentModificationActivityDispatcher
extends AbstractLocalDocumentModificationHandler {

private final DocumentListener documentListener =
new DocumentListener() {
Expand All @@ -25,7 +26,7 @@ public void documentChanged(@NotNull DocumentEvent event) {
}
};

public LocalDocumentModificationHandler(
public LocalDocumentModificationActivityDispatcher(
Project project, EditorManager editorManager, ISarosSession sarosSession) {

super(project, editorManager, sarosSession);
Expand Down
Expand Up @@ -12,12 +12,12 @@
import saros.session.ISarosSession;

/**
* Tracks modifications of Documents and adjusts the local annotations accordingly if the document
* is not currently open in an editor.
* Tracks modifications of Documents and adjusts the local annotations accordingly.
*
* @see com.intellij.openapi.editor.event.DocumentListener
*/
public class LocalClosedEditorModificationHandler extends AbstractLocalDocumentModificationHandler {
public class LocalDocumentModificationAnnotationUpdater
extends AbstractLocalDocumentModificationHandler {
private final AnnotationManager annotationManager;

private final DocumentListener documentListener =
Expand All @@ -28,7 +28,7 @@ public void documentChanged(@NotNull DocumentEvent event) {
}
};

public LocalClosedEditorModificationHandler(
public LocalDocumentModificationAnnotationUpdater(
Project project,
EditorManager editorManager,
ISarosSession sarosSession,
Expand All @@ -40,9 +40,13 @@ public LocalClosedEditorModificationHandler(
}

/**
* Adjusts the annotations for the resource represented by the changed document if it is not
* currently open in an editor. If it is currently open in an editor, this will be done
* automatically by Intellij.
* Adjusts the annotations for the resource represented by the changed document as necessary.
*
* <p>Calculates the new annotation positions if the document is currently not open in an editor.
*
* <p>Only prunes the annotations that were invalidated by text removals if the document is open
* in an editor. The positions of the remaining annotations will be adjusted automatically by
* Intellij.
*
* @param event the event to react to
* @see DocumentListener#beforeDocumentChange(DocumentEvent)
Expand Down
Expand Up @@ -44,7 +44,7 @@
import saros.intellij.editor.ProjectAPI;
import saros.intellij.editor.annotations.AnnotationManager;
import saros.intellij.eventhandler.IApplicationEventHandler;
import saros.intellij.eventhandler.editor.document.LocalDocumentModificationHandler;
import saros.intellij.eventhandler.editor.document.LocalDocumentModificationActivityDispatcher;
import saros.intellij.filesystem.VirtualFileConverter;
import saros.intellij.runtime.EDTExecutor;
import saros.intellij.ui.Messages;
Expand Down Expand Up @@ -103,7 +103,7 @@ public void beforePropertyChange(@NotNull VirtualFilePropertyEvent event) {
* configuration files.
*
* <p>File changes done though an Intellij editor are processed in the {@link
* LocalDocumentModificationHandler} instead.
* LocalDocumentModificationActivityDispatcher} instead.
*
* @param event
*/
Expand Down Expand Up @@ -200,7 +200,7 @@ public LocalFilesystemModificationHandler(
* Notifies the other session participants of the local save of the given file.
*
* @param virtualFileEvent the event to react to
* @see LocalDocumentModificationHandler
* @see LocalDocumentModificationActivityDispatcher
* @see VirtualFileListener#beforeContentsChange(VirtualFileEvent)
*/
private void generateEditorSavedActivity(@NotNull VirtualFileEvent virtualFileEvent) {
Expand Down

0 comments on commit 60af0aa

Please sign in to comment.