I still have a problem with the refreshreference:
I added the call of an AuthorOperation after the git-commit to rfresh the reference. But the setModified(false) doesn't work there - and I get no warning in the log.
Here is my minimized code for this issue:
Code: Select all
@WebappCompatible
@WebappRestSafe
public class CommitRefreshTest extends AuthorOperationWithResult implements AuthorOperationWithCustomUndoBehavior {
public String doOperation(AuthorDocumentModel model, ArgumentsMap args) throws AuthorOperationException {
try {
final AuthorAccess authorAccess = model.getAuthorAccess();
final AuthorNode node = authorAccess.getDocumentController().getNodeAtOffset(0);
System.out.println("CommitRefreshTest: " + node.getDisplayName());
authorAccess.getDocumentController().refreshNodeReferences(node);
authorAccess.getEditorAccess().setModified(false);
} catch (BadLocationException e) {
final AuthorOperationException ex = new AuthorOperationException(e.getMessage(), e);
ex.setOperationRejectedOnPurpose(true);
}
return null;
}
}
Code: Select all
goog.events.listenOnce(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
var editor = e.editor;
goog.events.listenOnce(e.editor, sync.api.Editor.EventTypes.ACTIONS_LOADED, function(e) {
var commitAction = editor.getActionsManager().getActionById('Git/Commit');
var oldActionPerformed = commitAction.actionPerformed;
commitAction.actionPerformed = function(callback) {
oldActionPerformed.call(commitAction, function(callback) {
if (!editor.isDirty()) {
console.log('Git/Commit - Done and doc not dirty so it was successful.');
editor.getActionsManager().invokeOperation(
'com.gdvdl.TgicServiceCatalog.operations.CommitRefreshTest',
{}, // no parameters
null, // no callback
null,
true // This is a background operation - it does not update the document
);
} else {
console.log('Git/Commit - Done but doc is still dirty so it was not successful.');
}
})
};
});
});
I was also looking into the documentation for setModified and found this:
For Web Author, can be used to mark the document as clean and to make sure that the clean state is properly identified after a series of undo/redo operations. This method has some limitations:
- It does not automatically update the client-side editor dirty status.
- [...]
- it does nothing if invoked with false
.
This also confuses me. How should I use this method to mark a document as clean other than by invoking it with false?
And in all other cases it was working fine!?
Still the most important question for me remains: How can I refresh the references after a commit without making the document dirty.
Thanks and regards,
Patrik