'Stop NetBeans "fixing" imports

How do I stop Netbeans (8.2) automatically "fixing" imports, on every keystroke?

For example,

  1. deleting an import statement halfway through typing the statement [presumably because 'import x' isn't used when you are trying to type 'import x.y' ].

  2. Removing all the imports when I type a ", /*. {, or anything that makes the rest of the program syntactically invalid [presumably because it is "not using" the imports.

It is annoying to have to 'fix-imports' on almost every keystroke, but awful when fix-imports gets it wrong (eg. a program that using java.awt.* and java.util.List, but not java.awt.List)



Solution 1:[1]

To be honset I don't get your question exactly. What you describe seems not to be the default behaviour of NetBeans.

From your question it seems that you're writing your imports on your own. This is not necessary. When you want to use an non imported class just use the autocompletion (Ctrl+Space) or organize imports (Ctrl+Shift+i).

I've never had any of the issues that you describe. You might have installed some additional plugins.

Solution 2:[2]

The particular plugin that seemed to be causing the problem is

https://github.com/rsmz/AutoSaveModified

It saves every 1 second but that causes imports to be fixed every 1 second.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 javase
Solution 2 Dave Pullin