Skip to content

Conversation

fedejeanne
Copy link
Contributor

@fedejeanne fedejeanne commented Aug 6, 2025

What it does

Fixes #2414

Show a progress dialog (after a delay) if the precalculation of the AST during a save takes too long.

Requires

This is to avoid the "flickering" of the progress dialog showing up and immediately disappearing when the calculation of the AST takes just a few milliseconds.

How to test

  • Activate a save action that requires an AST, e.g. "Organize imports"
  • Open a big class and make a modification
  • Save

Expected outcome
If the AST takes a while to calculate then you should see a (non-cancelable) progress dialog.

image

Note

Since the methods that end up creating the AST do not really report progress with the monitor they receive, the progress dialog doesn't really show any progress (the bar does not move). I couldn't find any way around it but I'm open to suggestions.


A small hack to help testing
Add a delay to org.eclipse.jdt.core.dom.ASTParser.createAST(IProgressMonitor)

for (int i=0; i<5;i++) {
	try {
		Thread.sleep(1000);
	} catch (InterruptedException e) {
		e.printStackTrace();
	}
}

Author checklist

@fedejeanne
Copy link
Contributor Author

Test failures are unrelated. I ran them all and they pass locally.

@carstenartur
Copy link
Contributor

Test failures are unrelated. I ran them all and they pass locally.

In general you cannot conclude that there is no issue when tests run through locally. It might be right in this case but is not in general.
See
#2213 (comment)

@fedejeanne fedejeanne force-pushed the show_progress_post_save_actions_ast branch from 596a4ae to 086a0a4 Compare August 20, 2025 07:04
@fedejeanne
Copy link
Contributor Author

@carstenartur the test failures are unrelated and they are documented in #2423.

Since that issue has been fixed last week (see https://ci.eclipse.org/jdt/job/eclipse.jdt.ui-github/job/master/474/testReport/), I rebased on master. That should get rid of the errors.

@fedejeanne fedejeanne marked this pull request as draft August 20, 2025 07:06
@fedejeanne
Copy link
Contributor Author

I'm drafting this PR since I have no intention of merging it before M1

@fedejeanne fedejeanne marked this pull request as ready for review September 8, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Performance] Precalculating AST during save freezes UI
2 participants