You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/08/02 02:55:35 UTC

[GitHub] arusinha commented on a change in pull request #639: [NETBEANS-691]: Corrected undo conversion of constructor to factory w…

arusinha commented on a change in pull request #639: [NETBEANS-691]: Corrected undo conversion of constructor to factory w…
URL: https://github.com/apache/incubator-netbeans/pull/639#discussion_r207088910
 
 

 ##########
 File path: openide.text/src/org/openide/text/UndoRedoManager.java
 ##########
 @@ -251,7 +251,7 @@ void beforeUndoAtSavepoint(WrapUndoEdit edit) {
     }
         
     private void undoSaveActions() {
-        if (onSaveTasksEdit != null) {
+        if (onSaveTasksEdit != null && onSaveTasksEdit.canUndo()){
 
 Review comment:
   redoSaveActions is called from delegateUndoFailedAtSavepoint/delegateRedoAtFailedAtSavepoint in finally block of undo/redo function of WrapUndoEdit class . It will call redoSaveActions only if delegate.undo() had thrown CannotUndoException in  WrapUndoEdit class.
   As already it had thrown undoException, checking for onSaveTasksEdit.canUndo() inside undoSaveActions method will not make any difference. So should I check for canRedo() inside redoSaveActions?
   
   "As I went through the relevant code In UndoRedoManager, there's one strange thing at line ~282 (in afterUndoCheck): when the edits are undone to the savepoint, the onSaveTasksEdit are '''redone''' (not undone)"
   I had checked after changing onSaveTasksEdit.undo() to  onSaveTasksEdit.redo() at line 282; with refactor constructor call to factory method.
   After refactoring  I did undo , redo and undo. 
   Last undo actionthrows CannotUndoException at line 282 as onSaveTasksEdit.hasBeenDone flag is already true at that point.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists