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 141553 - Different source package label
Summary: Different source package label
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Eclipse project importer (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-24 14:53 UTC by Maksim Khramov
Modified: 2009-11-02 11:04 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Khramov 2008-07-24 14:53:33 UTC
Netbeans dayly build 20080724 on Ubuntu Linux

Once Eclipse project created and imported to NB on Linux, the default source package label is 'src' instead of 'Source
Packages' as on Windows machine. Same for test roots 'test' instead of 'Test Packages'
Comment 1 Jesse Glick 2008-07-30 22:36:21 UTC
ProjectFactorySupport.updateSourceRootLabels doesn't make any sense to me. First of all, we probably do not need to
update labels at all - J2SEProjectGenerator.createProject already names the first root src.dir (test.src.dir for tests)
automatically, and this will be displayed as "Source Packages" ("Test Packages" resp.).

Even assuming this method should exist, its implementation is wrong. It first checks to see if a URL is a folder URL -
which should only involve it ending with '/' (cannot possibly end with '\\'). Then it checks whether URL.file - i.e. the
path component of the URL, beginning with the first '/' - happens to be the same as a disk file path. This can never be
true on Windows, and will be true on Unix only if the path does not contain any URL metacharacters (e.g. SPACE). If so,
the method sets the label to something similar to what SourceRoots.getRootDisplayName would have produced anyway (if not
called on the first root of a given type).

I would recommend the method (and its four call points) just be deleted.
Comment 2 David Konecny 2008-07-30 23:28:14 UTC
The code in method is silly. It's been there since the riginal importer. I would amend it by replacing "String path =
rootURLs[i].getFile();" with "String path = new File(rootURLs[i].toURI()).getPath();".

The method is useful when NB project created during the import is stored outside of Eclipse folder. In such a case you
end up with labels of source roots being fully qualified paths. Apart from first one which is called "Source Packages".
Try it on that musicpinboard example which has three source roots. What method does is it use the same labels as Eclipse
project. To me this is P4.
Comment 3 Quality Engineering 2008-08-04 15:40:03 UTC
Integrated into 'main-golden', available in build *200808041401* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/c609b46664f1
User: David Konecny <dkonecny@netbeans.org>
Log: #141553 - fixing URL path conversion
Comment 4 Jesse Glick 2008-08-05 15:22:57 UTC
So it is fixed now?
Comment 5 David Konecny 2008-08-05 23:18:09 UTC
Only code you questioned was fixed.

I'm still not sure if it is desirable to implement this or not. For newly created NB project it make sense to show
"Source Packages" because we create "src" folder and we want to present it to user as "Source Packages". In case of
project imported from Eclipse it can be beneficial (to Eclipse user) to see source roots named as in Eclipse. In any
case IMO this is low priority issue.
Comment 6 David Konecny 2008-11-18 21:32:11 UTC
.
Comment 7 Quality Engineering 2009-11-02 11:04:05 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX