Commit 0da857c
committed
Fix incorrect SubMonitor usage patterns
This commit addresses several SubMonitor anti-patterns identified
throughout the codebase, based on best practices from the Eclipse
article on Progress Monitors.
Changes made:
1. Remove unnecessary null checks before SubMonitor.convert()
- SubMonitor.convert() can handle null monitors
- Fixed in team Policy.java files (core and ui)
2. Remove unnecessary SubMonitor.done() calls
- SubMonitor.done() is a no-op and should not be called
- Removed 27 instances across resources and team bundles:
* org.eclipse.core.filesystem: LocalFile.java (2 calls)
* org.eclipse.core.resources: File.java (6), Folder.java (1),
Project.java (3), SaveManager.java (4), Workspace.java (7)
* org.eclipse.compare.core: RangeComparatorLCS.java (1)
* org.eclipse.compare: AddFromHistoryAction.java (1)
* org.eclipse.team.core: BundleImporterDelegate.java (1),
Subscriber.java (1)
3. Remove redundant cancellation checks before split()
- SubMonitor.split() already checks for cancellation
- Fixed in AutoBuildJob.java
Reference: https://www.eclipse.org/articles/Article-Progress-Monitors/article.html1 parent 3e8e40e commit 0da857c
File tree
13 files changed
+2
-51
lines changed- resources/bundles
- org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local
- org.eclipse.core.resources/src/org/eclipse/core/internal
- events
- resources
- team/bundles
- org.eclipse.compare.core/src/org/eclipse/compare/rangedifferencer
- org.eclipse.compare/compare/org/eclipse/compare/internal
- org.eclipse.team.core/src/org/eclipse/team
- core
- importing/provisional
- subscribers
- internal/core
- org.eclipse.team.ui/src/org/eclipse/team/internal/ui
13 files changed
+2
-51
lines changedLines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | | - | |
184 | 182 | | |
185 | 183 | | |
186 | 184 | | |
| |||
503 | 501 | | |
504 | 502 | | |
505 | 503 | | |
506 | | - | |
507 | | - | |
508 | 504 | | |
509 | 505 | | |
510 | 506 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| |||
Lines changed: 0 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | 94 | | |
97 | 95 | | |
98 | 96 | | |
| |||
163 | 161 | | |
164 | 162 | | |
165 | 163 | | |
166 | | - | |
167 | | - | |
168 | 164 | | |
169 | 165 | | |
170 | 166 | | |
| |||
207 | 203 | | |
208 | 204 | | |
209 | 205 | | |
210 | | - | |
211 | | - | |
212 | 206 | | |
213 | 207 | | |
214 | 208 | | |
| |||
244 | 238 | | |
245 | 239 | | |
246 | 240 | | |
247 | | - | |
248 | 241 | | |
249 | 242 | | |
250 | 243 | | |
| |||
510 | 503 | | |
511 | 504 | | |
512 | 505 | | |
513 | | - | |
514 | | - | |
515 | 506 | | |
516 | 507 | | |
517 | 508 | | |
| |||
541 | 532 | | |
542 | 533 | | |
543 | 534 | | |
544 | | - | |
545 | | - | |
546 | 535 | | |
547 | 536 | | |
548 | 537 | | |
| |||
616 | 605 | | |
617 | 606 | | |
618 | 607 | | |
619 | | - | |
620 | 608 | | |
621 | 609 | | |
622 | 610 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | 121 | | |
123 | 122 | | |
124 | 123 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
256 | 255 | | |
257 | 256 | | |
258 | 257 | | |
| |||
360 | 359 | | |
361 | 360 | | |
362 | 361 | | |
363 | | - | |
364 | 362 | | |
365 | 363 | | |
366 | 364 | | |
| |||
647 | 645 | | |
648 | 646 | | |
649 | 647 | | |
650 | | - | |
651 | | - | |
652 | 648 | | |
653 | 649 | | |
654 | 650 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
279 | 277 | | |
280 | 278 | | |
281 | 279 | | |
| |||
1603 | 1601 | | |
1604 | 1602 | | |
1605 | 1603 | | |
1606 | | - | |
1607 | | - | |
1608 | 1604 | | |
1609 | 1605 | | |
1610 | 1606 | | |
| |||
2181 | 2177 | | |
2182 | 2178 | | |
2183 | 2179 | | |
2184 | | - | |
2185 | 2180 | | |
2186 | 2181 | | |
2187 | 2182 | | |
| |||
2257 | 2252 | | |
2258 | 2253 | | |
2259 | 2254 | | |
2260 | | - | |
2261 | 2255 | | |
2262 | 2256 | | |
2263 | 2257 | | |
| |||
Lines changed: 0 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
636 | 635 | | |
637 | 636 | | |
638 | 637 | | |
| |||
1135 | 1134 | | |
1136 | 1135 | | |
1137 | 1136 | | |
1138 | | - | |
1139 | 1137 | | |
1140 | 1138 | | |
1141 | 1139 | | |
| |||
1529 | 1527 | | |
1530 | 1528 | | |
1531 | 1529 | | |
1532 | | - | |
1533 | 1530 | | |
1534 | 1531 | | |
1535 | 1532 | | |
| |||
2206 | 2203 | | |
2207 | 2204 | | |
2208 | 2205 | | |
2209 | | - | |
2210 | 2206 | | |
2211 | 2207 | | |
2212 | 2208 | | |
| |||
2512 | 2508 | | |
2513 | 2509 | | |
2514 | 2510 | | |
2515 | | - | |
2516 | 2511 | | |
2517 | 2512 | | |
2518 | 2513 | | |
| |||
2641 | 2636 | | |
2642 | 2637 | | |
2643 | 2638 | | |
2644 | | - | |
2645 | 2639 | | |
2646 | 2640 | | |
2647 | 2641 | | |
| |||
2941 | 2935 | | |
2942 | 2936 | | |
2943 | 2937 | | |
2944 | | - | |
2945 | | - | |
2946 | 2938 | | |
2947 | 2939 | | |
2948 | 2940 | | |
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
140 | 138 | | |
141 | 139 | | |
142 | 140 | | |
| |||
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 133 | + | |
138 | 134 | | |
139 | 135 | | |
140 | 136 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | 106 | | |
108 | 107 | | |
109 | 108 | | |
| |||
0 commit comments