-
Notifications
You must be signed in to change notification settings - Fork 0
Restore scope functions for Block-scoped progress monitor grouping #568
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4c841b0
Implement SubProgressMonitor enhancements: standalone conversion, fla…
Copilot 59472e0
Fix standalone SubProgressMonitor detection and transformation
Copilot 0800453
Address code review feedback: document limitations and add test coverage
Copilot 1a9c9cb
Add done() call removal feature (partial implementation)
Copilot bc55472
Fix done() removal - iterate through all holders to find matches
Copilot 32c35b4
Temporarily disable done() removal to fix test failures
Copilot c192348
Fix standalone SubProgressMonitor conversion and done() removal in JF…
Copilot 48a9d9a
[WIP] Fix SubProgressMonitor to SubMonitor transformation regression …
Copilot cbab8ea
Plan: Fix JFace cleanup transformation not being applied
Copilot 557598c
Fix JFace cleanup: remove scope functions from SubProgressMonitor and…
Copilot aacb76e
[WIP] Fix variable declaration in JFacePlugin to resolve CI test fail…
Copilot 0c7f66b
Restore scope functions to enable Block-level grouping of progress mo…
Copilot 5e49d57
Fix holder access in JFace cleanup and document pattern detection iss…
Copilot 587934d
Remove standalone SubProgressMonitor and done() removal from JFace cl…
Copilot af851fd
[WIP] Update expected output for JFace cleanup tests (#598)
Copilot 62d98a6
Fix JFace cleanup idempotence tests - align given/expected for alread…
Copilot 4a0384f
fix formatting
carstenartur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
530 changes: 530 additions & 0 deletions
530
...x_common_test/src/org/sandbox/jdt/ui/tests/quickfix/ClassInstanceCreationVisitorTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
sandbox_common_test/src/org/sandbox/jdt/ui/tests/quickfix/mock/MockProgressMonitor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2026 Carsten Hammer. | ||
| * | ||
| * This program and the accompanying materials | ||
| * are made available under the terms of the Eclipse Public License 2.0 | ||
| * which accompanies this distribution, and is available at | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Carsten Hammer | ||
| *******************************************************************************/ | ||
| package org.sandbox.jdt.ui.tests.quickfix.mock; | ||
|
|
||
| /** | ||
| * Mock interface for testing ClassInstanceCreation visitor patterns. | ||
| * Mimics the IProgressMonitor pattern without JFace dependencies. | ||
| */ | ||
| public interface MockProgressMonitor { | ||
| /** | ||
| * Begins a task with the specified name and total work units. | ||
| * | ||
| * @param name the task name | ||
| * @param totalWork the total work units | ||
| */ | ||
| void beginTask(String name, int totalWork); | ||
|
|
||
| /** | ||
| * Marks the task as complete. | ||
| */ | ||
| void done(); | ||
|
|
||
| /** | ||
| * Reports work progress. | ||
| * | ||
| * @param work the amount of work done | ||
| */ | ||
| void worked(int work); | ||
| } |
69 changes: 69 additions & 0 deletions
69
sandbox_common_test/src/org/sandbox/jdt/ui/tests/quickfix/mock/MockSubMonitor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2026 Carsten Hammer. | ||
| * | ||
| * This program and the accompanying materials | ||
| * are made available under the terms of the Eclipse Public License 2.0 | ||
| * which accompanies this distribution, and is available at | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Carsten Hammer | ||
| *******************************************************************************/ | ||
| package org.sandbox.jdt.ui.tests.quickfix.mock; | ||
|
|
||
| /** | ||
| * Mock class for testing ClassInstanceCreation visitor patterns. | ||
| * Mimics the SubMonitor pattern (replacement for SubProgressMonitor) without JFace dependencies. | ||
| */ | ||
| public class MockSubMonitor implements MockProgressMonitor { | ||
|
|
||
| /** | ||
| * Converts a monitor to a SubMonitor. | ||
| * | ||
| * @param monitor the monitor to convert | ||
| * @param work the total work units | ||
| * @return a new MockSubMonitor instance | ||
| */ | ||
| public static MockSubMonitor convert(MockProgressMonitor monitor, int work) { | ||
| return new MockSubMonitor(); | ||
| } | ||
|
|
||
| /** | ||
| * Converts a monitor to a SubMonitor with a task name. | ||
| * | ||
| * @param monitor the monitor to convert | ||
| * @param taskName the task name | ||
| * @param work the total work units | ||
| * @return a new MockSubMonitor instance | ||
| */ | ||
| public static MockSubMonitor convert(MockProgressMonitor monitor, String taskName, int work) { | ||
| return new MockSubMonitor(); | ||
| } | ||
|
|
||
| /** | ||
| * Splits off a portion of work. | ||
| * | ||
| * @param work the amount of work to split | ||
| * @return a new MockSubMonitor for the split work | ||
| */ | ||
| public MockSubMonitor split(int work) { | ||
| return new MockSubMonitor(); | ||
| } | ||
|
|
||
| @Override | ||
| public void beginTask(String name, int totalWork) { | ||
| // Mock implementation | ||
| } | ||
|
|
||
| @Override | ||
| public void done() { | ||
| // Mock implementation | ||
| } | ||
|
|
||
| @Override | ||
| public void worked(int work) { | ||
| // Mock implementation | ||
| } | ||
| } |
63 changes: 63 additions & 0 deletions
63
sandbox_common_test/src/org/sandbox/jdt/ui/tests/quickfix/mock/MockSubProgressMonitor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2026 Carsten Hammer. | ||
| * | ||
| * This program and the accompanying materials | ||
| * are made available under the terms of the Eclipse Public License 2.0 | ||
| * which accompanies this distribution, and is available at | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Carsten Hammer | ||
| *******************************************************************************/ | ||
| package org.sandbox.jdt.ui.tests.quickfix.mock; | ||
|
|
||
| /** | ||
| * Mock class for testing ClassInstanceCreation visitor patterns. | ||
| * Mimics the deprecated SubProgressMonitor pattern without JFace dependencies. | ||
| */ | ||
| public class MockSubProgressMonitor implements MockProgressMonitor { | ||
|
|
||
| private final MockProgressMonitor monitor; | ||
| private final int ticks; | ||
| private final int style; | ||
|
|
||
| /** | ||
| * Creates a new MockSubProgressMonitor with 2 arguments. | ||
| * | ||
| * @param monitor the parent monitor | ||
| * @param ticks the number of ticks | ||
| */ | ||
| public MockSubProgressMonitor(MockProgressMonitor monitor, int ticks) { | ||
| this(monitor, ticks, 0); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a new MockSubProgressMonitor with 3 arguments. | ||
| * | ||
| * @param monitor the parent monitor | ||
| * @param ticks the number of ticks | ||
| * @param style the style flags | ||
| */ | ||
| public MockSubProgressMonitor(MockProgressMonitor monitor, int ticks, int style) { | ||
| this.monitor = monitor; | ||
| this.ticks = ticks; | ||
| this.style = style; | ||
| } | ||
|
|
||
| @Override | ||
| public void beginTask(String name, int totalWork) { | ||
| // Mock implementation | ||
| } | ||
|
|
||
| @Override | ||
| public void done() { | ||
| // Mock implementation | ||
| } | ||
|
|
||
| @Override | ||
| public void worked(int work) { | ||
| // Mock implementation | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation does not clarify the behavior for standalone SubProgressMonitor with flags. The examples on lines 85-99 only show flag behavior "in beginTask context" but don't mention what happens when a standalone SubProgressMonitor is created with flags. Since the implementation silently drops flags for standalone cases, this should be documented in the Limitations section to set user expectations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in commit b121e22. Updated README.md Limitations section to explicitly document that standalone SubProgressMonitor instances with flags will have those flags silently ignored.