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
Status: RESOLVED FIXED
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
URL:
Keywords:
: 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:


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

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
Reasonable.
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 OpenProjects.open(...) 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
paths.
Comment 11 Milos Kleint 2006-10-27 14:41:31 UTC
done

Checking in projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java;
/cvs/projects/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java,v
 <--  OpenProjectList.java
new revision: 1.62; previous revision: 1.61
done
Checking in
projectui/src/org/netbeans/modules/project/ui/OpenProjectsTrampolineImpl.java;
/cvs/projects/projectui/src/org/netbeans/modules/project/ui/OpenProjectsTrampolineImpl.java,v
 <--  OpenProjectsTrampolineImpl.java
new revision: 1.9; previous revision: 1.8
done
Checking in projectui/src/org/netbeans/modules/project/ui/ProjectUtilities.java;
/cvs/projects/projectui/src/org/netbeans/modules/project/ui/ProjectUtilities.java,v
 <--  ProjectUtilities.java
new revision: 1.34; previous revision: 1.33
done
Checking in projectui/src/org/netbeans/modules/project/ui/actions/CloseProject.java;
/cvs/projects/projectui/src/org/netbeans/modules/project/ui/actions/CloseProject.java,v
 <--  CloseProject.java
new revision: 1.11; previous revision: 1.10
done
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 ProjectUtilitiesTest.java;
/shared/data/ccvs/repository/projects/projectui/test/unit/src/org/netbeans/modules/project/ui/ProjectUtilitiesTest.java,v
 <--  ProjectUtilitiesTest.java
new revision: 1.14; previous revision: 1.13
done
Checking in OpenProjectListTest.java;
/shared/data/ccvs/repository/projects/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java,v
 <--  OpenProjectListTest.java
new revision: 1.10; previous revision: 1.9
done
Checking in OpenProjectsTrampolineImplTest.java;
/shared/data/ccvs/repository/projects/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectsTrampolineImplTest.java,v
 <--  OpenProjectsTrampolineImplTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in actions/SetMainProjectTest.java;
/shared/data/ccvs/repository/projects/projectui/test/unit/src/org/netbeans/modules/project/ui/actions/SetMainProjectTest.java,v
 <--  SetMainProjectTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in api/RecentProjectsTest.java;
/shared/data/ccvs/repository/projects/projectui/test/unit/src/org/netbeans/modules/project/ui/api/RecentProjectsTest.java,v
 <--  RecentProjectsTest.java
new revision: 1.4; previous revision: 1.3
done
Comment 13 Milos Kleint 2006-11-06 09:12:42 UTC
fixed the OpenProjectListTest

Checking in
projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java;
/cvs/projects/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java,v
 <--  OpenProjectListTest.java
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.