+ " is not available locally: " + textEdit);
// TODO A consistency check can be started here
return;
}
User user = textEdit.getSource();
/*
* Disable documentListener temporarily to avoid being notified of the
* change
*/
documentListener.enabled = false;
replaceText(path, textEdit.getOffset(), textEdit.getReplacedText(),
textEdit.getText(), user);
documentListener.enabled = true;
/*
* If the text edit ends in the visible region of a local editor, set
* the cursor annotation.
*
* TODO Performance optimization in case of batch operation might make
* sense. Problem: How to recognize batch operations?
*/
for (IEditorPart editorPart : editorPool.getEditors(path)) {
ITextViewer viewer = EditorAPI.getViewer(editorPart);
if (viewer == null) {
// No text viewer for the editorPart found.
continue;
}
int cursorOffset = textEdit.getOffset()
+ textEdit.getText().length();
if (viewer.getTopIndexStartOffset() <= cursorOffset
&& cursorOffset <= viewer.getBottomIndexEndOffset()) {
editorAPI.setSelection(editorPart, new TextSelection(
cursorOffset, 0), user, user.equals(getFollowedUser()));
}
}
// inform all registered ISharedEditorListeners about this text edit
editorListenerDispatch.textEditRecieved(user, path, textEdit.getText(),