If you make changes without saving, then try to close the program, it gives a warning
"(yourfile) has been modified. Would you like to save it?"
The selections are Yes, No, and Cancel.
I would expect choosing Cancel would stop the program from exiting, but instead it just closes DrJava without saving! So the same behavior as choosing No. Seems like it should be an easy fix.
DrJava Version : drjava-20140826-r5761
DrJava Build Time: 20140826-0459
JDK Version: 1.7.0_67
OS: Windows 7 64-bit
This is a duplicate of bug [#941].
Indeed it sounds easy to fix, but inspecting the source (MainFrame.java) the logic made sense--I'm surprised it doesn't work.
I'm just another user, but If I can figure out how to compile Dr. Java, I might be able to track down the cause and submit a fix for this.
Related
Bugs: #941
Hi Kevin and Christopher,
I will look at the problem but I may report the same results that
Christopher did. The DrJava code base has evolved over the past decade
with most of the code written by students (loosely under my supervision).
It is amazing that the code base works as well as it does.
Best,
Robert "Corky" Cartwright
On Sat, Mar 21, 2015 at 12:39 AM, Christopher Chavez chrstphrchvz@users.sf.net wrote:
Related
Bugs: #941
Bugs: #951
To be more specific, this issue only occurs for files not part of an open project; cancelling for files in a project stops the program from quitting.
So far I've tried looking closer at MainFrame.quit() for the case that there is no project open (e.g. just the untitled file open), so the user isn't prompted to close any files until _updateSavedConfiguration() is called. Clicking cancel, it returns early as expected, but it's possible that MainFrame.quit() might not be taking the proper action for this case, which is aborting the quit. It proceeds to call _model.quit(), making nested calls to _model.closeAllFilesOnQuit(), AbstractGlobalModel.ConcreteOpenDefDoc.canAbandonFile(), and GlobalEventNotifier.canAbandonFile(), returning in reverse order true and true, indicating to _model.closeAllFilesOnQuit() that "user did not want to cancel", even though docs list (returned from getOpenDefinitionsDocuments()) still has our unsaved file. So this might also be the source of the issue.
I don't think I'm familiar enough with the architecture of DrJava at this point to know what it's supposed to do, so I might not see the easy fix here.
Last edit: Christopher Chavez 2015-03-23
The best fix I can suggest at the moment is making
MainFrame._updateSavedConfiguration()
boolean and returning false if the when the user cancels, and then handling this inMainFrame.quit()
by returning early if the user cancels. I will push this fix to a fork shortly.This is fixed in drjava-beta-20160913-225446.