Commit b907b50
committed
Skip dummy item creation when removing invalid element from tree #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 intend of the original fix is
to remove the "expand" icon from a tree item, when its still collapsed
children are removed from the viewer (but not the model).
The problem with this approach is that it doesn't take the situation
into consideration, where the children of the item have already been
removed.
Given a tree item with at least one child in the data model but where
all child-widgets have been removed in the viewer. When removing the
children again, this internally calls `updatePlus(Item,Object)`.
But because the number of child-widgets doesn't match the number of
children, this method now creates a dummy item, to correct this
inconsistency. This problem doesn't occur when calling
`internalRemove(Object,Object[])`, because here the call to
`updatePlus(Item,Object)` is guarded by a check to make sure the tree
item has at least one child-widget.
To reproduce:
1) Make sure the ".* resources" filter is enabled
2) Create a new project "Project A" and "Project B"
3) Create a new text file "test" in "Project A"
4) Move "test" to "Project B"
Closes #35251 parent 02fc196 commit b907b50
File tree
2 files changed
+45
-8
lines changed- bundles/org.eclipse.jface/src/org/eclipse/jface/viewers
- tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers
2 files changed
+45
-8
lines changedLines changed: 2 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
2095 | 2095 | | |
2096 | 2096 | | |
2097 | 2097 | | |
2098 | | - | |
2099 | | - | |
2100 | | - | |
2101 | | - | |
2102 | | - | |
2103 | | - | |
| 2098 | + | |
2104 | 2099 | | |
2105 | 2100 | | |
2106 | 2101 | | |
| |||
Lines changed: 43 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
117 | 159 | | |
0 commit comments