Re: project conversion questions
Peter Wisnovsky <[email protected]> Wed, 30 Jul 2003 15:28:37 -0700
| Newsgroups | gmane.comp.java.netbeans.modules.projects.devel |
|---|---|
| Message-ID | <[email protected]> |
Svata Dedic writes: > Peter Wisnovsky wrote: > > > Instead of DataObject.find() just use > > > theProjectInstance.getProjectMember(theFile) to get a ProjectMember > > > (file's representant within the project). > > > > Hmm...so I tried this conversion and did it in a wizard, where I don't > > have a project. (I notice there is no getTargetProject in the > > TemplateWizard class...should there be?). When I try: > > > I think it should not - at least in the TemplateWizard interface; but > possibly project action-initiated Wizards could have a reference to the > destination project in some of Wizard's properties, whose name would be > declared in Project APIs and would be used by project-aware wizards. No > idea about "global" or "context-free" actions. > > > java.lang.RuntimeException: Could not find newly created object > > at com.sun.s1s.jpe.module.resources.MetaClassWizardIterator.createClassElement(MetaClassWizardIterator.java:78) > > at com.sun.s1s.jpe.module.resources.ServiceWizardIterator.instantiate(ServiceWizardIterator.java:164) > AAARGH! I am very sorry -- I made a mistake (maybe I am still used to > old and long obsolete semantics :-() > > Please use Project.findAll() to find all projects, which the file in > question belongs to (if there are any), then choose some and use > thatProject.getProjectMember(thatFile). Refer to Project.find() javadoc > for exact description of how the call works. OK, I'll try that. I looked in the Java module template stuff and saw there is a reference to a bug about projects and template wizardss. Is this the same bug or a new issue? Part of my problem is that I'm finding I need to have a Project around to call various APIs (for example ClassElement.forName) but SourceElement -- my module is really built around the src API -- does not provide an accessor for the project this source element is in (I guess it could be more than one, I'm not sure I have a way of dealing with this yet.) Would be be possible to have a method SourceElement.getProjects()? The old techniques for finding stuff don't seem to work any more, like searching the repositories and doing a DataObject.find on the file object. Thanks, Peter