-
Notifications
You must be signed in to change notification settings - Fork 228
Don't create dummy item when removing invalid element from tree #3525 #3527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@laeubi This fixes the issue with the project explorer. Though I'd still like to add a proper test case. |
|
@ptziegler good finding! I can guess its hard to come of with a simple testcase here given JDT is involved and we likely do not want to include it as a dependency. |
|
Considering M3 is this week, I would prefer to postpone this change to 4.39 (assuming it works() in general and not only for specific use case). This change (which affects org.eclipse.jface.viewers.AbstractTreeViewer.remove(Object...)` behavior must be tested for a longer time before release. |
|
I had a closer look at Bug 210747 and whatever was done with f1899ad doesn't work, regardless of my change.
As it is, eclipse.platform.ui/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java Lines 3125 to 3127 in 39d028e
What a mess... |
652520a to
657b1b7
Compare
|
I've adapted the check so that for the use-case described in Bug 210747, where an element was removed from the tree that hasn't been realized yet, the I'm still not sure what the reasoning behind the initial change was, but I'm fairly confident that what was described in the bug was never fixed and probably can't be reasonbly fixed. I've added a test case for this bug, which will obviously fail. Perhaps someone who is more familiar with the TreeViewer can have a look, otherwise I'll remove it again for the next M1.
That's fine by me. This problem has existed for almost two decades, so three more months won't make much of a difference. |
|
I'm a little bit concerned about this code block here, which is also responsible for the test failure and which was added with #810 eclipse.platform.ui/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java Lines 2065 to 2084 in 601b0d3
In short, if |
ad4c5c7 to
562ad67
Compare
|
This pull request changes some projects for the first time in this development cycle. An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patchFurther information are available in Common Build Issues - Missing version increments. |
…se-platform#3525 Due to the fix for Bug 210747, a dummy tree-item is added to the viewer if the same element is removed twice. The problem is that this fix doesn't distinguish between nodes that haven't been realized yet and nodes that are not part of the model. This check has been refined to only call updatePlus(...) if the removed object is associated with such a dummy node. To reproduce: - Create a new project "Project A" and "Project B" - Create a new text file "test" in "Project A" - Move "test" to "Project B" Closes eclipse-platform#3525
|
If there are no objections (and if the remaining checks succeed), I'll plan on merging this within the next few days. |
|
@ptziegler : not sure if the commit title & message, PR title & message are reflecting the actual fix? |
I can't reproduce on master, tried with Package and Project Explorers. Anything missing, like projects should be expanded / collapsed etc? Or is this only Windows specific (I'm on RHEL Linux/X11). |
|
This patch doesn't fix for me the problem with the steps above. |
Yes, the resource filter for files starting with a '.' needs to be enabled. Apologies for the inaccuracy.
On Linux, this block is entered, which then causes the creation of an additional tree item. But not on Windows. Commenting this block out makes the viewer behave as expected, but that shouldn't be the solution. eclipse.platform.ui/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java Lines 279 to 299 in 8b402ec
The call to eclipse.platform.ui/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java Lines 176 to 179 in 8b402ec
|
So it looks like the patch works on Windows only? Have you Mac access, any idea how it looks there? Could you please investigate that Windows/Linux inconsistency before merging the patch? |
That seems to be the cases, yes.
No, only Windows and Linux.
That's my current plan. If this really is an SWT issue, it should be possible to derive a small snippet with the same, inconsistent "expanded" state. |



Due to the fix for Bug 210747, a dummy tree-item is added to the viewer if the same element is removed twice. The problem is that this fix doesn't distinguish between nodes that haven't been realized yet and nodes that are not part of the model.
This check has been refined to only call updatePlus(...) if the removed object is associated with such a dummy node.
To reproduce:
Closes #3525