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 29240 - One sourcePath for project needed.
Summary: One sourcePath for project needed.
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: All All
: P1 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords: API
: 29281 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-12-03 15:36 UTC by Jan Jancura
Modified: 2007-09-26 09:14 UTC (History)
2 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Jancura 2002-12-03 15:36:20 UTC
I need some way how to find FileObject (or
ProjectMember or Line) for: Project & className.
The current support for this problem is not very
nice (I must go through all CompilationUnits). So,
is it possible to define one SourcePath for each
Project? It should contain all sources from all
compilation units & resources. 
This will be usefull for Editor module too (at least).
Comment 1 Svata Dedic 2002-12-04 08:16:52 UTC
:-)
What is missing is what contents should be in that classpath, actually.

- sources from the project
- classes from outside (jars, .class files) fed to the compiler
- reference sources (for the outside classes)
- project output classes
- a mixture of the above ?
Comment 2 Jan Jancura 2002-12-04 08:37:22 UTC
? Should I design it?
my initial idea is that it should contain "all sources" for project.
it means all .java files from sources & resources. 
Comment 3 Svata Dedic 2002-12-04 08:40:31 UTC
I wouldn't think that this content would be useful to Editor - they
update parser DB from both sources and classes inserted into the project.
Mato ?
Comment 4 Jan Jancura 2002-12-04 09:00:52 UTC
As I understand it, they can use sourcePath for finding a source, not
for updating databases.
Comment 5 Svata Dedic 2002-12-04 09:02:51 UTC
OK, that makes more sense.
Comment 6 Martin Roskanin 2002-12-04 09:10:21 UTC
It doesn't affect updater directly, but there are some cases that such
feature will be useful, i.e: FastOpen (or Go to class...) action. You
have FQN and you need the FileObject from that. Now I need traverse
through all projects, all their  CompilationUnits, all PathResources
and because pathResource.getContents() is always throwing
UnsupportedOExc. I need to find the FileObject recursively from
pathResource.getFile(). It would be really helpful to have the
possibility to obtain FO from FQN in specific javaproject directly.
Comment 7 Svata Dedic 2002-12-04 09:13:25 UTC
I do not understand that part with throwing an exception and recursive
something of FileObject. Could you please elaborate ?
Comment 8 Martin Roskanin 2002-12-04 09:21:34 UTC
I would like to use getContent to retrieve PathContent:

PathContent pathContent = pathResource.getContents();
FileObject fobj = pathContent.findResource(resourceName);

pathResource.getContents() throws UnsupportedOperationException (I
don't test it in the current builds, maybe it already works OK), thats
why I need to obtain FO in the way:

 FileObject pathFO = pathResource.getFile();
 DataObject dobj = DataObject.find(pathFO);
 DataFolder df = (DataFolder)dobj.getCookie(DataFolder.class);

and travese folders to find the FO from FQN.

I admit this is hack :-), perhaps some better way exists. Please,
advise ;-)
Comment 9 Svata Dedic 2002-12-04 10:38:29 UTC
Solvable using:

ProjectPath.find(whateverStartingPoint,
PATH_SOURCE).findResource("resourceName");

findResource on PathContent automatically calls getAllResources() on
itself and filters out invalid ones from the search.
Comment 10 Vitezslav Stejskal 2003-04-07 15:28:34 UTC
*** Issue 27121 has been marked as a duplicate of this issue. ***
Comment 11 Vitezslav Stejskal 2003-04-07 15:30:42 UTC
*** Issue 29281 has been marked as a duplicate of this issue. ***
Comment 12 Svata Dedic 2003-04-07 15:34:55 UTC
Well. At least #27121 is not a duplicate, since it talks about
allowing reference source items to be defined for Platform. This issue
is for project.
This issue talks about a merge path collecting sources from a project
and reference sources so that source for a symbol can be easily found.
Issue #29281 talks about implementation of such "reference source"
resources (which can be collected onto classpath requested in this issue).

Are they duplicate ?
Comment 13 Svata Dedic 2003-04-07 15:37:30 UTC
Oops there's yet another issue (#32360), specifically for the single
resource impl ;)
Comment 14 Tomas Zezula 2003-04-28 14:35:41 UTC
Probably the utility method creating an composite read only ClassPath
of given type is sufficient.
Am I right, Hanz?
Comment 15 Tomas Zezula 2003-04-29 09:23:12 UTC
Fixed.
Comment 16 Jan Becicka 2003-11-25 14:05:10 UTC
As described in
http://www.netbeans.org/servlets/ReadMsg?msgId=619519&listName=nbdiscuss the
current work on projects prototype has been stopped.

Marking issue as VERIFIED --->
Comment 17 Jan Becicka 2003-11-25 14:14:18 UTC
---> CLOSED