-->

Quick fix many problems at once

2019-01-14 14:52发布

问题:

Is it possible to quick fix all errors in a class opened in Eclipse?

I have 71 errors that are pretty much the same, I would rather not do it one-by-one.

(Note: I am quick fixing a Java file)

回答1:

Often, you can fix errors en masse. There are several ways. I recommend going to your Problems view, selecting one of the errors, and hitting Ctrl-1 (quick fix). It should offer you the chance to fix all the errors of the selected type, in all files.

You can also mouse over the error in the text editor and wait for a popup; it should say "fix 70 other errors of this type". Doing it this way applies only to the specific file.



回答2:

It depends on type of errors.If error are there because of missing imports then you can solve it by pressing CTRL + SHIFT + O. For other errors you have to solve one by one [AFAIK].



回答3:

As far as I know, there's no way to do this. Sorry!



回答4:

You would get better answers if you would specify the error type. And if errors are too similar -hopefully identical-, you can always use find&replace tool.



回答5:

There are certain errors/warnings which you can fix in one go in a file e.g. missing NON-NLS tags. When you hover on an error, the quick fix list will show something like 'Fix n problems of same kind'.

In other cases you could use a cleanup, e.g. for missing @Override annotation.



回答6:

All imports fix as CTRL + SHIFT + M