Bug 303426 - Class Creation Wizard lists projects in the package selection menu
Summary: Class Creation Wizard lists projects in the package selection menu
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IDE4EDU (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-21 02:31 EST by Brenda Sadoway CLA
Modified: 2014-01-09 15:38 EST (History)
0 users

See Also:


Attachments
Shows the dropdown menu (45.11 KB, image/png)
2010-02-21 02:31 EST, Brenda Sadoway CLA
no flags Details
List packages in the package dropdown menu (28.03 KB, text/plain)
2010-02-26 20:54 EST, Brenda Sadoway CLA
no flags Details
List packages in the package dropdown menu (28.77 KB, text/plain)
2010-03-05 17:32 EST, Brenda Sadoway CLA
no flags Details
List packages in the package dropdown menu (28.67 KB, text/plain)
2010-03-10 01:42 EST, Brenda Sadoway CLA
no flags Details
List packages in the package dropdown menu (28.46 KB, patch)
2010-03-10 23:39 EST, Brenda Sadoway CLA
no flags Details | Diff
List packages in the package dropdown menu (31.70 KB, patch)
2010-03-31 23:18 EDT, Brenda Sadoway CLA
no flags Details | Diff
List packages in the package dropdown menu (30.44 KB, patch)
2010-04-02 16:04 EDT, Brenda Sadoway CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brenda Sadoway CLA 2010-02-21 02:31:56 EST
Created attachment 159685 [details]
Shows the dropdown menu

In the class creation wizard, the user can specify a project and package to put the class in.  However, the dropdown menu for the package location lists the projects, not packages.
Comment 1 Brenda Sadoway CLA 2010-02-26 20:54:06 EST
Created attachment 160389 [details]
List packages in the package dropdown menu

The packages combobox was being updated according to the list of projects rather than packages.  This patch fills the combobox based on the packages in the current project.

However, if you use the projects dropdown menu to choose a different project from the one that was originally selected, the list of packages does not update to the new project's packages.

I will work on fixing this as well.  I just wanted to post the first half for feedback and suggestions if necessary.
Comment 2 Brenda Sadoway CLA 2010-03-05 17:32:48 EST
Created attachment 161202 [details]
List packages in the package dropdown menu

This patch replaces the previous.  It updates the package dropdown menu to list the packages in the currently chosen project; that is, it updates accordingly if a different project is selected.  It also lists the default package as "(default package)" rather than a blank line.
Comment 3 Brenda Sadoway CLA 2010-03-10 01:42:37 EST
Created attachment 161568 [details]
List packages in the package dropdown menu

This patch is actually in response to Bug 303581 (NewJavaClassConstructor does not include package name when checking if name already used).  The fix for that bug overlaps with the patch I had submitted for this as both bugs are really related to the same problem.

Both bugs are fixed in this patch.
Comment 4 Wayne Beaton CLA 2010-03-10 10:01:34 EST
I'm getting an infinite recursion error with this patch. I believe that the act of setting the text in the modify listener is causing a modify event. You may notice that when I manipulate the text of the CCombo, I first remove the modify listener.
Comment 5 Brenda Sadoway CLA 2010-03-10 23:39:36 EST
Created attachment 161702 [details]
List packages in the package dropdown menu

Oh my...  Yes I see that.  I believe this fixes the problem.
Comment 6 Wayne Beaton CLA 2010-03-17 15:11:21 EDT
Okay. That fixes the bug. It all seems to work.

I'm not comfortable with the solution, however. The behaviour that decides which packages are presented should be in the constructor. The idea is that the constructor is effectively the model for the user interface. It is the responsibility of the model to tell the UI what to display. It is the responsibility of the UI to display information to the user and accept their input.

I am hopeful that we will eventually start using these constructors in other ways. By putting the behaviour in the constructor, we will avoid duplicating behaviour in later work.

How can we move this behaviour out of the UI and into the constructor?
Comment 7 Brenda Sadoway CLA 2010-03-31 23:18:14 EDT
Created attachment 163600 [details]
List packages in the package dropdown menu

This patch moves the functionality for getting the packages in the selected project.  It's moved from the UI to the class constructor.  What do you think?
Comment 8 Brenda Sadoway CLA 2010-04-02 16:04:09 EDT
Created attachment 163745 [details]
List packages in the package dropdown menu

I just realized I forgot to remove one of the methods from the wizard that got moved over to the constructor.  For the sake of preventing confusion and inconsistency, this patch deletes the now unused method.  Sorry about that.