Commit b39c458
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 b39c458
File tree
13 files changed
+244
-309
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
+244
-309
lines changedLines changed: 41 additions & 47 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 | | |
| |||
457 | 455 | | |
458 | 456 | | |
459 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
460 | 462 | | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
497 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
498 | 494 | | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
509 | 503 | | |
510 | 504 | | |
511 | 505 | | |
| |||
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: 42 additions & 58 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 | | |
| |||
177 | 173 | | |
178 | 174 | | |
179 | 175 | | |
| 176 | + | |
| 177 | + | |
180 | 178 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
202 | 196 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
210 | 202 | | |
211 | | - | |
| 203 | + | |
212 | 204 | | |
213 | 205 | | |
214 | 206 | | |
| |||
244 | 236 | | |
245 | 237 | | |
246 | 238 | | |
247 | | - | |
248 | 239 | | |
249 | 240 | | |
250 | 241 | | |
| |||
510 | 501 | | |
511 | 502 | | |
512 | 503 | | |
513 | | - | |
514 | | - | |
515 | 504 | | |
516 | 505 | | |
517 | 506 | | |
518 | 507 | | |
519 | 508 | | |
520 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
521 | 515 | | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
543 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
544 | 529 | | |
545 | | - | |
| 530 | + | |
546 | 531 | | |
547 | 532 | | |
548 | 533 | | |
| |||
616 | 601 | | |
617 | 602 | | |
618 | 603 | | |
619 | | - | |
620 | 604 | | |
621 | 605 | | |
622 | 606 | | |
| |||
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: 27 additions & 33 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 | | |
| |||
612 | 610 | | |
613 | 611 | | |
614 | 612 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
624 | 616 | | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
625 | 634 | | |
626 | | - | |
627 | | - | |
628 | | - | |
| 635 | + | |
| 636 | + | |
629 | 637 | | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
634 | 642 | | |
635 | 643 | | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
| 644 | + | |
649 | 645 | | |
650 | | - | |
651 | | - | |
652 | 646 | | |
653 | 647 | | |
654 | 648 | | |
| |||
0 commit comments