Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 253635

Summary: [ds tooling] Service Component wizard improvements
Product: [Eclipse Project] PDE Reporter: Simon Archer <sja.eclipse>
Component: UIAssignee: Chris Aniszczyk <caniszczyk>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: caniszczyk
Version: 3.5   
Target Milestone: 3.5 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
DSFileWizardPage and DSNewWizard updates
caniszczyk: iplog+
Wizard patch updates caniszczyk: iplog+

Description Simon Archer CLA 2008-11-04 00:06:46 EST
Using Eclipse 3.5M3

While bug 248816 addresses the automatic population of the wizard's "Name" field, there are some other issues with the wizard that need addressing:

1.  The dialog has no title.

2.  While I realize that this dialog follows the convention of many other
    PDE dialogs, the organization of this dialog looks too busy. I'd rather
    see the part where you pick a parent folder on a page on its own.
    Putting all these UI elements on one page feels cramped and confusing.

3.  While I hate to re-implement behavior that is available else where, I
    feel that there needs to be a way to create a folder.  This behavior
    should also reside on the first page of the wizard, since it's part of
    picking a parent. I'd really like to find a way to encourage people to
    put their XML documents in a common place, such as OSGI-INF, otherwise
    they're all going to end up in the root of the project, which I'm never
    a fan of.  But, even if we give the user the opportunity to create a
    folder, that does not mean that they'll pick OSGI-INF, so we need to
    come up with something clever to make that the default choice.

4.  I'd like to see the "File name:" field and the "Component Definition
    Information" moved on to a separate page. Today, the "File name:" field
    looks strange since it's stuck between the "pick a parent" composite and
    the group control. Separating these concerns will possibly improve
    usability.

5.  The "File name:" field needs to be automatically populated, and I
    suggest that we use "component.xml".  In most cases there will only
    be a single XML document, so this name works perfectly. The value of
    this field should be persisted (using either dialog settings or plug-in 
    preferences) so that the user does not have to enter their preferred
    name every time.

6.  Today you can enter a name in the "Class:" field, or using the
    "Browse..." button you can pick an existing class, but I typically find
    that neither of these are helpful. What I typically want to do is
    generate a class, so that means that I want to pick a parent package and
    enter the name of the class and have it generated for me by the wizard. 
    Again, I hate to ask for behavior that is already implemented elsewhere,
    such as in JDT, so maybe there's a way to launch the "New Java Class"
    wizard here.

7.  Clicking the "Browse..." button allows you to pick any class in the
    workspace, when really you should only be picking a class visible to the
    defining bundle, namely: Any class that is defined by the bundle, or any
    class visible to the bundle per its Import-Package and Require-Bundle
    manifest headers.

8.  The error message "Names cannot be empty." is not particularly helpful,
    plus, once you've entered something in the "Field name:" and "Name:"
    field there is no error message telling you to populate the "Class:"
    field, and the "Finish" button remains disabled. We also need some
    improvements to the field validation, since entering nonsense values,
    such as spaces seems to satisfy the field validation.

9.  The wizard updates the bundle's Service-Component header, but it does
    not do any validation: For example, it should check to see if the value
    that it is appending to the header already exists, since today if you 
    create a component XML document, delete it, and then recreate it, you
    end up with the XML document appearing twice. Also see bug 249391.

10. The "Name:" field, the "Class:" field and the "Browse..." button do not
    have ALT accelerators.
Comment 1 Rafael Oliveira Nóbrega CLA 2008-11-05 14:58:30 EST
Created attachment 117134 [details]
DSFileWizardPage and DSNewWizard updates

Dialog has a title now.
He have a hyperlink to create new java implementation class.
Comment 2 Chris Aniszczyk CLA 2008-11-05 16:09:28 EST
Rafael, can you reapply a new patch?

This one doesn't apply cleanly against HEAD.
Comment 3 Rafael Oliveira Nóbrega CLA 2008-11-10 19:57:17 EST
Created attachment 117506 [details]
Wizard patch updates
Comment 4 Chris Aniszczyk CLA 2008-11-10 21:07:09 EST
Thanks Rafael!
Comment 5 Simon Archer CLA 2008-11-11 11:57:26 EST
Having tried out the patch, this looks like a step in the right direction. Issues 1, 5 (suggest component filename) and 6 seem to have been addressed.


Problems with the patch:

- To be consistent with other wizards, change the dialog title from
  "Service Component" to "New Service Component.

- When using the Bundle-SymbolicName as the component name, it is
  important to strip off any header parameters, such as ";singleton:=true".


Issues yet to be addressed:
 - 2, 3, 4, 5 (persist component filename), 7, 8, 9, 10. Maybe extracting
   issues to separate bug report might be the answer.


New Suggestions:
 - It might be helpful to have the following checkbox below the Class field:

     [x] Generate lifecycle methods.

   If this checkbox is checked, and it should be checked by default, the 
   component class will have the following methods added, if they do not
   already exist:

     protected void activate(ComponentContext context) {
     }

     protected void deactivate(ComponentContext context) {
     }

   The state of the checkbox should probably also be persisted. The context
   parameter is of type org.osgi.service.component.ComponentContext.
Comment 6 Chris Aniszczyk CLA 2008-11-11 16:14:12 EST
I made the fixes Simon suggested for the wizard title and stripping attributes.

I will leave it up to SImon to open bugs for the other issues as this bug is getting too large for everythig IMHO.

Thanks guys!
Comment 7 Simon Archer CLA 2008-11-11 23:09:50 EST
Thanks Chris.  Here's the new bug reports for the remaining open issues:

Issue 2: Ignore for now.

Issue 3: See bug 254969.
[ds tooling] Service Component wizard: Support Folder Creation

Issue 4: Ignore for now.

Issue 5: See bug 254970.
[ds tooling] Service Component wizard: Persist "File name" field

Issue 7: See bug 254971.
[ds tooling] Service Component wizard: "Browse..." button should only allow visible types to be chosen

Issue 8: See bug 254972.
[ds tooling] Service Component wizard: Improve field validation

Issue 9: See bug 254973.
[ds tooling] Service Component wizard: Improve the handling of the Service-Component header

Issue 10: See bug 254975.
[ds tooling] Service Component wizard: Add missing ALT accelerators

And the suggestion to add a "Generate lifecycle methods" checkbox has been moved to bug 254976.
[ds tooling] Service Component wizard: Add checkbox for generating lifecycle methods