Bug 3245 - sub folders with dot not visible in packages view (1GCOH17)
Summary: sub folders with dot not visible in packages view (1GCOH17)
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All Windows NT
: P2 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 3314 6491 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-10-10 22:51 EDT by Dani Megert CLA
Modified: 2002-01-11 09:22 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2001-10-10 22:51:55 EDT
1. JUnit setup
	2. Add folder that contains a dot (e.g. "com.ibm") to junit.test (in navigator or packages view)
	==> folder com.ibm not visible in packages view

	Add resource and/or java file to the folder
	==> folder and files not visible in packages view

	If the test case is done with a folder without a dot then the folder is visible


NOTES:
EG (4/29/2001 3:25:49 PM)
	some more facts:
	1) adding a package name a.b.c in the packages view with the New Package wizard works as expected
	2) in a project with source folders you can add com.ibm as an ordinary folder to the project using
		the basic New Folder wizard.
	3) in a project with source folders adding a new folder a.b.c to a package fragment root shows the
		behaviour that DM described above, i.e., the folder isn't visible, it exists and shows up in the
		packages view.

	It isn't a notification problem, the Java Model doesn't surface these folders.

	Notice once the Java Model surfaces these folders we have the problem how to distinguish 
	a folder "a.b.c" from a\b\c that shows up as a.b.c. We would have to use some escape
	mechanism, e.g., a\.b\.c

	However, before addressing this UI issue we first need to get such folders from the Java model.
	See also: 1GCP6M8: ITPJUI:WINNT - Adding a file without dot not visible in package
	Moving to JCORE
	
PM (4/30/2001 10:57:56 AM)
	Those were filtered out from package fragment creation code. Handling them will be tricky, given there is no way to distinguish them afterwards
	unless going back to the underlying resource.
	When not filtering them out, the package becomes visible, but then adding one class in it becomes tricky, given the model tries to recreate the proper
	folder structure (a/b/c from a.b.c)... 

	Then this is causing duplicate elements, because a/b/c and a.b.c are producing elements named 'a.b.c'.
	What's the point ? How do we want to handle these ?

	Enabling the creation of packages with dot names: org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(IContainer, String, Vector)

/**
 * Starting at this folder, create package fragments and add the fragments to the collection
 * of children.
 * 
 * @exception JavaModelException  The resource associated with this package fragment does not exist
 */
protected void computeFolderChildren(IContainer folder, String prefix, Vector vChildren) throws JavaModelException {
	IPackageFragment pkg = getPackageFragment(prefix);
	vChildren.addElement(pkg);
	try {
		IPath outputLocationPath = getJavaProject().getOutputLocation();
		IResource[] members = folder.members();
		for (int i = 0, max = members.length; i < max; i++) {
			IResource member = members[i];
			if (member.getType() == IResource.FOLDER) {
				String newPrefix;
				if (prefix.length() == 0) {
					newPrefix = member.getName();
				} else {
					newPrefix = prefix + "." + member.getName();
				}
				// eliminate binary output only if nested inside direct subfolders
				if (!member.getFullPath().equals(outputLocationPath)) {
					computeFolderChildren((IFolder) member, newPrefix, vChildren);
				}
			}
		}
	} catch(IllegalArgumentException e){
		throw new JavaModelException(e, IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST); // could be thrown by ElementTree when path is not found
	} catch (CoreException e) {
		throw new JavaModelException(e);
	}
}
Comment 1 DJ Houghton CLA 2001-10-23 23:52:44 EDT
PRODUCT VERSION:
	SDK 0.046


Comment 2 Philipe Mulet CLA 2001-11-14 10:28:02 EST
Is this one resolved with latest delta processing algorithm ?
Comment 3 Jerome Lanneluc CLA 2001-11-14 10:57:39 EST
The current behavior is that the addition of dot-named folder is reported as 
the non-java resource addition. Files added to this folder are considered non-
java resources (even if their suffix is .java).

This behavior is correct since a dot-named folder is not a valid name for a 
package.

Closing.
Comment 4 Dani Megert CLA 2001-12-04 03:26:50 EST
This PR is not fixed. If JCore does not consider it a bug then it is a UI bug: I 
can handle the fact that folder names with '.' are not valid package names but 
then the folders have to show up immediately as resource folders in the Packages 
view.
Comment 5 Jerome Lanneluc CLA 2001-12-04 03:41:35 EST
Sorry, you're right, this bug is not entirely fixed. The delta processor now 
correctly reports a resource delta for addition of a dot-named folder, BUT the 
non-java resources of packages or package fragment roots don't include the dot-
named folder. This must be fixed by JDT Core.
Comment 6 Jerome Lanneluc CLA 2001-12-11 13:28:49 EST
Now correctly add dot-named folders to the non-java resources of 
IPackageFragments and IPackageFragmentRoots.
Comment 7 Jerome Lanneluc CLA 2001-12-11 13:29:59 EST
*** Bug 6491 has been marked as a duplicate of this bug. ***
Comment 8 Jerome Lanneluc CLA 2001-12-17 11:53:28 EST
*** Bug 3314 has been marked as a duplicate of this bug. ***