Bug 183409 - wrong delta if Java nature is added to a project
Summary: wrong delta if Java nature is added to a project
Status: CLOSED DUPLICATE of bug 184296
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P5 normal (vote)
Target Milestone: 3.3 RC1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-20 12:10 EDT by Markus Keller CLA
Modified: 2019-11-12 08:54 EST (History)
2 users (show)

See Also:


Attachments
possible fix (1.28 KB, patch)
2007-04-20 13:46 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-04-20 12:10:24 EDT
HEAD, was OK in I20070418-1012; FUP to bug 183149

Package Explorer does not properly update when Java nature is added (which transforms an IProject into an IJavaProject).

To reproduce, add
		<nature>org.eclipse.jdt.core.javanature</nature>
to the .project file of a simple project.
Comment 1 Markus Keller CLA 2007-04-20 12:30:18 EDT
Moving to core. We get a wrong delta when the Java nature is added.

Was:
FIRING POST_CHANGE Delta [Thread[main,6,main]]:
Java Model[*]: {CHILDREN | CONTENT}
	P[+]: {}
	ResourceDelta(/P)[*]

Expected: IProject should be removed, not changed:
FIRING POST_CHANGE Delta [Thread[main,6,main]]:
Java Model[*]: {CHILDREN | CONTENT}
	P[+]: {}
	ResourceDelta(/P)[-]
Comment 2 Markus Keller CLA 2007-04-20 12:40:26 EDT
Same problem when nature is removed:
Delta says ResourceDelta(/P)[*],
should be  ResourceDelta(/P)[+].

BTW: the "was OK in I20070418-1012" probably only applies to the visible effects of the fix for bug 182520. I have not checked if this has ever been correct.
Comment 3 Jerome Lanneluc CLA 2007-04-20 13:01:24 EDT
Unfortunately we cannot change the platform delta (i.e. there is no API to create a REMOVED IResourceDelta).

This would require a new API on our side (e.g. IJavaElementDelta#F_JAVA_NATURE_ADDED). This would have to be done post 3.3.
Comment 4 Markus Keller CLA 2007-04-20 13:46:56 EDT
Created attachment 64478 [details]
possible fix

AFAICS, the Package Explorer used to be refreshed completely in this scenario before bug 182520 comment 13 has been released.

In JDT/UI, we could either fix this in FilterUpdater with the attached patch, or move the updating code to PackageExplorerContentProvider.processDelta(..) and JavaBrowsingContentProvider.processDelta(..), where we could detect these special kinds of changes and remove the IProject / add the IJavaProject without refreshing the entire tree.

Martin?
Comment 5 Markus Keller CLA 2007-05-08 11:14:57 EDT
The effects of this bug have been fixed in PackageExplorerContentProvider.processDelta(..), see bug 184296.

JavaBrowsingContentProvider does not seem to need any changes, because it only shows IJavaProjects and no IProjects.
Comment 6 Eclipse Genie CLA 2019-11-11 20:14:18 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 7 Stephan Herrmann CLA 2019-11-12 08:54:37 EST
Closing according to comment 5.

*** This bug has been marked as a duplicate of bug 184296 ***