Bug 207146 - Files created in folders that are on a java project as classes folder is not updated in Package Explorer
Summary: Files created in folders that are on a java project as classes folder is not ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.4 M3   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-23 07:31 EDT by Max Rydahl Andersen CLA
Modified: 2007-10-31 06:55 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Max Rydahl Andersen CLA 2007-10-23 07:31:51 EDT
Build ID: I20070601-1539

Steps To Reproduce:
1. Create Java project A
2. Create a folder named "resources" in project A
3. Create Java Project B
4. Add the "resources" folder from A as Classes folder to Project B
5. Now every file you put in resources will not show up in the package explorer in Project A.

One have to either close/open Project B to get changes (refresh does not work) or close/open the package explorer.

This is hurting us alot since we put e.g. the WebContent folder of a web project on to a test project to make sure it can pick up web-inf in it's classpath.

This is something we only starting having issues with in 3.3.1


More information:
Comment 1 Max Rydahl Andersen CLA 2007-10-23 07:35:03 EDT
I forgot a point 6.

6) But all changes will be shown inside the "Referenced libraries" node on Project B.

Originally found in our work with JBoss Tools/RHDS (http://jira.jboss.com/jira/browse/JBIDE-1057) but this is reproducable on a bare eclipse 3.3.1 installation just using the normal file creation wizards.

Comment 2 Max Rydahl Andersen CLA 2007-10-23 07:37:00 EDT
Putting a blocker since this is a big usability and regression bug.
Comment 3 Max Rydahl Andersen CLA 2007-10-23 07:40:59 EDT
Correction: It is also reproducible on Eclipse 3.3.0 (on some machines :(
Comment 4 Olivier Thomann CLA 2007-10-23 22:48:09 EDT
Moving to JDT/UI
Comment 5 Martin Aeschlimann CLA 2007-10-24 08:18:10 EDT
The delta the package explorer gets is:

Java Model[*]: {CHILDREN}
	B[*]: {CHILDREN}
		/A/resources[*]: {CONTENT}
			ResourceDelta(/A/resources/ff)[+]

I think also A should get a delta.
Comment 6 Jerome Lanneluc CLA 2007-10-24 10:59:33 EDT
I verified that this bug didn't exist in 3.0.2, but it existed in 3.1.2, 3.2.2, 3.3.1. So this is really not new.
Comment 7 Max Rydahl Andersen CLA 2007-10-24 12:03:58 EDT
The weird thing is that the issue is not *always* present.

Any known workarounds for avoiding this would be *much* appreciated.
We need to have a folder from another project on the classpath; is there any way we can get that without the changes getting lost in the view ?

It sometime also works fine in the other views (e.g. navigator and project explorer) but not package explorer.
Comment 8 Jerome Lanneluc CLA 2007-10-25 04:40:49 EDT
(In reply to comment #7)
A workaround would be to put "resources" on the buildpath of A as well (e.g. as a class folder).
Comment 9 Max Rydahl Andersen CLA 2007-10-25 05:12:16 EDT
Not possible since the usecase is to put the WebContent in a WTP project onto the classpath of a test java project (so tests can lookup resources found in WEB-INF/, e.g. faces-config.xml, web.xml, componets.xml etc.)

If I add WebContent I get a "Cannot nest <prj>/WebContent/WEB-INF/classes" inside library '<prj>/WeBcontent' because of the Web App libraries classpath container.

If I remove Web App libraries then it also results in webcontent to be inside referenced libraries and thus not visible unless I expand the referenced libraries node and the package explorer becomes untangible.

I also tried to write a custom library container but that resulted in the same issues ;(

Any other ideas ? 
Comment 10 Max Rydahl Andersen CLA 2007-10-25 05:16:12 EDT
The biggest issue is also that Refresh does not even force a refresh.

Anyone that can tell which operations we could perform programmatically to force a refresh without having to close/open the Package Explorer ?
Comment 11 Max Rydahl Andersen CLA 2007-10-25 05:50:37 EDT
Another "workaround" is to not enable "Show 'Reference Libraries' Node" in package explorer. As soon as that is of things work as expected.
Comment 12 Max Rydahl Andersen CLA 2007-10-25 07:21:12 EDT
But again not a real usefull workaround since it makes tree unmanagable when using many libraries.

Comment 13 Max Rydahl Andersen CLA 2007-10-25 08:48:00 EDT
Ok - so this only a bug that is triggered when Show Referenced Libraries Node is enabled. When not enabled everything works fine.

I'm now looking at PackageExplorerContentProvider to see if there is any resource modification/touch I can do to trigger a proper update. If I find that I can install a resource change listener and trigger the modification to make the package explorer update.

Any ideas would be appreciated ;)
Comment 14 Jerome Lanneluc CLA 2007-10-25 09:41:09 EDT
After fixing the Java delta problem (see bug 207441), the Package Explorer updates on the first file addition, but if you add a second file to /A/resources, it doesn't update.
Moving back to JDT/UI for further investigation.
Comment 15 Max Rydahl Andersen CLA 2007-10-25 09:44:34 EDT
(accidently posted this in the partly fix bug - putting it here where it belongs)

btw. the best workaround i've found until now is to touch all META-INF and
MANIFEST.MF files in the related project when a resource is changed - then the
tree is actually updated in 3.3.1 (but of course less inefficient)

project.accept(new IResourceProxyVisitor() {
                public boolean visit(IResourceProxy proxy) throws CoreException 

                                if(proxy.getName().equals("MANIFEST-MF") ||
proxy.getName().equals("META-INF")) {
                                proxy.requestResource().touch(monitor);
                                }
                                return true;
                        }
        }, IResource.DEPTH_INFINITE);

This triggers the isManifestChange method in PackageExplorerContentProvider.
Comment 16 Martin Aeschlimann CLA 2007-10-25 13:00:12 EDT
fixed > 20071025
Comment 17 Martin Aeschlimann CLA 2007-10-25 13:03:25 EDT
From the JDT.UI standpoint we could provide the fix also for 3.3.2. But it only makes sense if bug 207441 is ported to 3.3.2 as well.
Comment 18 Jerome Lanneluc CLA 2007-10-26 04:57:15 EDT
Fix for bug 207441 has now been backported to R3_3_maintenance.
Comment 19 Max Rydahl Andersen CLA 2007-10-31 05:55:04 EDT
Just to be sure - this fix have also been applied to Eclipse 3.2.x correct ?
The releated bug have been applied to 3.2.x, but this bug just says 3.3
Comment 20 Max Rydahl Andersen CLA 2007-10-31 05:57:32 EDT
forget it - I read the numbers wrong ;(
Comment 21 Markus Keller CLA 2007-10-31 06:55:14 EDT
Verified in I20071031-0010. Filed bug 208208 for backporting this to 3.3.2