This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 59041 - OpenProjects.close(...) and "File->Close Project" have different semantic
Summary: OpenProjects.close(...) and "File->Close Project" have different semantic
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: Milos Kleint
: 87552 (view as bug list)
Depends on:
Blocks: 44319 50683
  Show dependency tree
Reported: 2005-05-18 21:20 UTC by Thomas Preisler
Modified: 2007-01-21 04:13 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

551 patch (15.63 KB, application/octet-stream)
2007-01-17 08:29 UTC, Milos Kleint
unified diff of the same (24.96 KB, application/octet-stream)
2007-01-17 08:48 UTC, Milos Kleint

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Preisler 2005-05-18 21:20:53 UTC
OpenProjects.close(project[]) and the user menu actions File->Close Project both
close the specified projects but the menu action does more. It also stores
information about open files in the project before it closes them so they will
be opened next time the project is opened. See closeAlldocuments() in
org.netbeans.modules.project.ui.ProjectUtilities for details of what it does.

The semantic of the two should be identical.

org.netbeans.modules.project.ui.ProjectUtilities is not public so it is not
possible to copy this behavior.
Comment 1 Jesse Glick 2005-05-19 00:12:22 UTC
Comment 2 Jesse Glick 2005-05-24 19:27:11 UTC
Not really an API change; change in impl behavior.
Comment 3 Jiri Rechtacek 2005-05-27 15:52:17 UTC
Note: ProjectUtilities.closeAllDocuments(Project[]) can return false if a user
doesn't want to close all open&modified documents. It's possible if the close
action is invoked from UI. What should a user do if its invoked from code and
some project's documents are modified? Should be ignored?
Will be determined in NB4.2.
Comment 4 Thomas Preisler 2005-05-29 18:47:43 UTC
Please also check for similar problem.
Comment 5 Jiri Rechtacek 2005-11-21 15:37:46 UTC
Reassign to new owner.
Comment 6 Jan Lahoda 2006-01-09 09:44:43 UTC
Maybe it would be reasonable to save the project's documents unconditionaly when
closing via OpenProjects.close, should be discussed.

Time estimate: 1-2 weeks.
Comment 7 Antonin Nebuzelsky 2006-10-03 13:37:37 UTC
Reassigning to Milos.
Comment 8 Milos Kleint 2006-10-18 15:04:38 UTC
i would rather close non-modified file and keep the modified ones opened. Write
both groups as being part of the project, so once the project gets reopened, all
get shown again.. somewhat clumsy, but better than forcing a save on modified files.

Comment 9 Jesse Glick 2006-10-19 21:56:35 UTC
*** Issue 87552 has been marked as a duplicate of this issue. ***
Comment 10 Jesse Glick 2006-10-19 21:58:18 UTC
I need this for project groups. Should be pretty simple to do, I think -
reassign to me if you want.

Agreed with Miloš' last suggestion - don't touch modified files but store their
Comment 11 Milos Kleint 2006-10-27 14:41:31 UTC

Checking in projectui/src/org/netbeans/modules/project/ui/;
new revision: 1.62; previous revision: 1.61
Checking in
new revision: 1.9; previous revision: 1.8
Checking in projectui/src/org/netbeans/modules/project/ui/;
new revision: 1.34; previous revision: 1.33
Checking in projectui/src/org/netbeans/modules/project/ui/actions/;
new revision: 1.11; previous revision: 1.10
Command Finished.
Comment 12 Jesse Glick 2006-11-02 15:49:08 UTC
Your commit broke compilation of unit tests in this module. I have fixed them to
compile, by adding 'false' as an extra parameter to all calls to close projects,
but OpenProjectListTest still fails and I do not know why. ProjectUtilitiesTest
passes only after using 'true' in testSavingModifiedNotOpenedFiles67526; using
'true' does not work in OPLT. Please review and correct the unit tests, and next
time please run them before committing changes.

Checking in;
new revision: 1.14; previous revision: 1.13
Checking in;
new revision: 1.10; previous revision: 1.9
Checking in;
new revision: 1.5; previous revision: 1.4
Checking in actions/;
new revision: 1.5; previous revision: 1.4
Checking in api/;
new revision: 1.4; previous revision: 1.3
Comment 13 Milos Kleint 2006-11-06 09:12:42 UTC
fixed the OpenProjectListTest

Checking in
new revision: 1.11; previous revision: 1.10

testSavingModifiedNotOpenedFiles67526 is correct. "false" means no modified
files are saved. That's the case when no UI is to be shown on closing project

Comment 14 Milos Kleint 2007-01-17 08:29:42 UTC
Created attachment 37430 [details]
551 patch
Comment 15 Milos Kleint 2007-01-17 08:48:17 UTC
Created attachment 37432 [details]
unified diff of the same
Comment 16 _ rkubacki 2007-01-17 12:26:32 UTC
looks OK to me
Comment 17 Milos Kleint 2007-01-19 07:20:35 UTC
merged into release551 branch
Comment 18 Jesse Glick 2007-01-21 04:13:52 UTC
Should set TM then.