Skip to content

Conversation

@fedejeanne
Copy link
Contributor

@fedejeanne fedejeanne commented Jul 14, 2025

If some slow save action is performed after saving the very first file since the user started the Workbench (Eclipse) the dialog that informs the user that a save action is slow should appear. Currently, this dialog only appears after the first batch of slow actions is finished.

What it does

Offers the user to deactivate slow save actions even if this is the very first file being saved since the workspace was initiated.

How to test

  • Open/Restart Eclipse
  • Go to a project where you have activated some save actions (one that is very expensive and takes more than 2 seconds)
  • Change the file and save

A small hack to help testing

Add this delay into org.eclipse.jdt.core.manipulation.OrganizeImportsOperation.createTextEdit(IProgressMonitor) and use the Organize Imports action to test:

public TextEdit createTextEdit(IProgressMonitor m) throws CoreException, OperationCanceledException {
	SubMonitor subMonitor= SubMonitor.convert(m, Messages.format(JavaManipulationMessages.OrganizeImportsOperation_description, BasicElementLabels.getFileName(fCompilationUnit)), 9);
	fNumberOfImportsAdded= 0;
	fNumberOfImportsRemoved= 0;

	CompilationUnit astRoot= fASTRoot;
	if (astRoot == null) {
		astRoot= CoreASTProvider.getInstance().getAST(fCompilationUnit, CoreASTProvider.WAIT_YES, subMonitor.split(2));
	}

        // Add this delay
	int delayInSeconds =5;
	subMonitor.setWorkRemaining(7 + delayInSeconds);

	for (int i=delayInSeconds; i>0;i--) {
		System.out.println("Processing, " + i + " seconds left..."); //$NON-NLS-1$ //$NON-NLS-2$
		subMonitor.split(1);
		try {
			Thread.sleep(1_000);
		} catch (InterruptedException e) {
		}
	}
        // Leave the rest unchanged...
        // ...
}
      

Expected behavior
You should see the dialog that suggests to deactivate the slow save action:

image

Current behavior (before this PR)
This dialog will not show up the very first time you save a file in the workspace and a save action takes more 2 seconds.

Author checklist

If there are slow save actions that freeze the UI the very first time
the user saves a file then the dialog should also ask the user if he/she
wants to deactivate those actions.
@fedejeanne fedejeanne changed the title Show the dialog "Slow Save Actions" also in the first run Also show the dialog "Slow Save Actions" the very first time a file is saved since the Workbench was started Jul 18, 2025
@fedejeanne fedejeanne marked this pull request as ready for review July 18, 2025 06:21
@fedejeanne
Copy link
Contributor Author

Would it be possible to have this reviewed/merged for M1?

Let me know if you need help testing or something is not clear :-)

Thank you in advance.

@fedejeanne
Copy link
Contributor Author

Maybe @mpalat could look into this PR? :-)

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.

1 participant