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 44513 - TemplateWizard should return the value returned by InstantiatingIterator.instantiate ()
Summary: TemplateWizard should return the value returned by InstantiatingIterator.inst...
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jiri Rechtacek
Depends on:
Reported: 2004-06-08 12:25 UTC by Tomas Zezula
Modified: 2008-12-22 17:36 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

proposed API change (6.52 KB, patch)
2004-06-25 08:21 UTC, Jiri Rechtacek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2004-06-08 12:25:46 UTC
TemplateWizard should return the value returned by
InstantiatingIterator.instantiate ().
Comment 1 Jiri Rechtacek 2004-06-11 19:54:02 UTC
I think a method with this flavor should be added ASAP to avoid to
publish unfinished API in promoD.
Comment 2 Jiri Rechtacek 2004-06-25 08:19:24 UTC
The attached patch changes WizardDescriptor, added the new method
Set/*<FileObject>*/ getInstantiatedObjects. This method returns set of
newly instantiated objects if the wizard has been correctly finished.
The empty set as default, if the wizard uses the InstantiatingIterator
then returns a set of FileObject as same as
The method throws the exception IllegalStateException if this method
is called on the unfinished wizard.
The patch also contains the tests which covered new funcionality.

Reviews, please could you review the attached patch before merge
to maintrunk? Thanks
Comment 3 Jiri Rechtacek 2004-06-25 08:21:31 UTC
Created attachment 15994 [details]
proposed API change
Comment 4 Jaroslav Tulach 2004-06-25 08:36:31 UTC
Request from me: WizardDescriptor cannot return Set<FileObject> as it
does not depend on filesystem API. 

My suggestions. Imho you have to choice something else:
1. return just Object to represent "a value"
2. return Lookup
3. say that when one uses InstantiatingIterator and it finishes
successfully the value of already existing WizardDescriptor.getValue()
will be the one returned from the iterator.
4. talk about the Set as a set of Objects

I like #3, but I am unsure of the implications. #1 means yet another
method that returns object, which is a bit ugly. #2 is partially nice
as it allows multiple returned value types, but such usage of lookup
is a bit pioneering. #4 is probably how Jesse wanted it when he helped
to introduce InstantiatingIterator.

My summary and suggested solution: On the other hand - the
InstantiatingIterator is SPI so it is fine to return the Set. The
WizardDescriptor's getter is however plain API - for that Lookup was
found right. So the only change which would make the system
independent on the actual returned type and provide a bit of type
safety is:

public Lookup WizardDescriptor.getInstantiatedObjects () {
  return Lookups.fixed (newObjects.toArray ());

Take most of this issue as suggestions, the requests that blocks the
integration is only the reference to FileObject.
Comment 5 Jiri Rechtacek 2004-06-25 14:15:09 UTC
Jardo, thank you for your comments. I tend to use your suggestion #4,
i.e. return set of indeterminate objects (in place of FileObject).
Let's wait for opinions of others before do the finally decision. Thanks
Comment 6 Jesse Glick 2004-06-25 15:14:17 UTC
Re. "#4 is probably how Jesse wanted it when he helped to introduce
InstantiatingIterator." - for the record, I never suggested or
encouraged *any* use of InstantiatingIterator in WizardDescriptor. All
we ever needed from it was for the interface to be defined in
openide.jar. There was never any use case in the project system for
the interface to be referenced from anywhere else inside openide.jar.
In fact the only reason to put it in openide.jar at all was because it
seemed undesirable to copy the same interface into the SPIs of several
different modules that could use it.

However since TemplateWizard was changed to use WD.II (which was not
strictly necessary, but apparently convenient?) then we are forced to
have TW at least (in openide-loaders.jar) be changed to refer to it in
its API. I hope that one day openide-loaders.jar will die and
TemplateWizard will be replaced by something simpler and more testable.

Re. Lookup WizardDescriptor.getInstantiatedObjects() - ugly and
unnecessary, IMHO. Why can't we just return Set<Object>??
Comment 7 Jiri Rechtacek 2004-07-02 10:12:56 UTC
Thanks for comments, I'm going to integrate it, I'll followed your
Comment 8 Jiri Rechtacek 2004-07-02 10:36:17 UTC
Checking in;
/cvs/openide/,v  <--
new revision: 1.151; previous revision: 1.150
Processing log script arguments...
Mailing the commit message to (from
Checking in api/doc/changes/apichanges.xml;
/cvs/openide/api/doc/changes/apichanges.xml,v  <--  apichanges.xml
new revision: 1.210; previous revision: 1.209
Processing log script arguments...
Mailing the commit message to (from
Checking in src/org/openide/;
/cvs/openide/src/org/openide/,v  <--
new revision: 1.105; previous revision: 1.104
Processing log script arguments...
Mailing the commit message to (from
Checking in test/unit/src/org/openide/;
new revision: 1.6; previous revision: 1.5
Checking in test/unit/src/org/openide/;
/cvs/openide/test/unit/src/org/openide/,v  <--
new revision: 1.5; previous revision: 1.4
Comment 9 Tomas Danek 2005-07-08 11:36:03 UTC
Can you verify it Tomas??
Comment 10 Tomas Zezula 2005-07-08 11:38:27 UTC
Comment 11 Tomas Danek 2005-07-08 11:40:11 UTC
Comment 12 Tomas Zezula 2005-07-08 12:50:33 UTC