diff --git a/intellij/src/saros/intellij/eventhandler/ProjectEventHandlersFactory.java b/intellij/src/saros/intellij/eventhandler/ProjectEventHandlersFactory.java index fe9f73028b..604b321f80 100644 --- a/intellij/src/saros/intellij/eventhandler/ProjectEventHandlersFactory.java +++ b/intellij/src/saros/intellij/eventhandler/ProjectEventHandlersFactory.java @@ -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; @@ -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 diff --git a/intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationHandler.java b/intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationActivityDispatcher.java similarity index 91% rename from intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationHandler.java rename to intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationActivityDispatcher.java index 3f356b8a97..092796018f 100644 --- a/intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationHandler.java +++ b/intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationActivityDispatcher.java @@ -15,7 +15,8 @@ * * @see DocumentListener#beforeDocumentChange(DocumentEvent) */ -public class LocalDocumentModificationHandler extends AbstractLocalDocumentModificationHandler { +public class LocalDocumentModificationActivityDispatcher + extends AbstractLocalDocumentModificationHandler { private final DocumentListener documentListener = new DocumentListener() { @@ -25,7 +26,7 @@ public void documentChanged(@NotNull DocumentEvent event) { } }; - public LocalDocumentModificationHandler( + public LocalDocumentModificationActivityDispatcher( Project project, EditorManager editorManager, ISarosSession sarosSession) { super(project, editorManager, sarosSession); diff --git a/intellij/src/saros/intellij/eventhandler/editor/document/LocalClosedEditorModificationHandler.java b/intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationAnnotationUpdater.java similarity index 82% rename from intellij/src/saros/intellij/eventhandler/editor/document/LocalClosedEditorModificationHandler.java rename to intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationAnnotationUpdater.java index bb42c221a7..87f0dbffd2 100644 --- a/intellij/src/saros/intellij/eventhandler/editor/document/LocalClosedEditorModificationHandler.java +++ b/intellij/src/saros/intellij/eventhandler/editor/document/LocalDocumentModificationAnnotationUpdater.java @@ -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 = @@ -28,7 +28,7 @@ public void documentChanged(@NotNull DocumentEvent event) { } }; - public LocalClosedEditorModificationHandler( + public LocalDocumentModificationAnnotationUpdater( Project project, EditorManager editorManager, ISarosSession sarosSession, @@ -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. + * + *

Calculates the new annotation positions if the document is currently not open in an editor. + * + *

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) diff --git a/intellij/src/saros/intellij/eventhandler/filesystem/LocalFilesystemModificationHandler.java b/intellij/src/saros/intellij/eventhandler/filesystem/LocalFilesystemModificationHandler.java index 673d3cf848..7dd8c7bf41 100644 --- a/intellij/src/saros/intellij/eventhandler/filesystem/LocalFilesystemModificationHandler.java +++ b/intellij/src/saros/intellij/eventhandler/filesystem/LocalFilesystemModificationHandler.java @@ -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; @@ -103,7 +103,7 @@ public void beforePropertyChange(@NotNull VirtualFilePropertyEvent event) { * configuration files. * *

File changes done though an Intellij editor are processed in the {@link - * LocalDocumentModificationHandler} instead. + * LocalDocumentModificationActivityDispatcher} instead. * * @param event */ @@ -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) {