简体   繁体   中英

Eclipse: Is there a way to force an import in Organize Import to solve an ambiguity?

I'm using Eclipse on an android project. I updated to Lion and problems began to appear... Trying stuff for hours, no results.

Here is the problem:

I have dozens of files com.stuff.morestuff in my project. I would like to crtl+shift+O my project so every import are resolved. But, on each file, eclipse ask me to resolve ambiguities.

Therefore, I would like to impose to eclipse to choose the first choice.

Some clues

1 - I tried to make rules in the build path, but it's to powerful. Ex: If i exclude android.R from the build path, then it doesn't appear in the choices but I cannot use it explicitly in my code...

2 - Do it manually —> to long

3 - I tried to configure the Organize Import tool, but didn't succeed.

Thank for your answers!

You can use 'Preferences > Java > Appearance > Type Filters'. Create filters for types that you don't want to use. Eg If you are not interested in types from java.awt package, you can create a filter for the entire package, or you can filter out individual types.

The filtered types are then hidden from the UI, ie they are not used in Organize imports or shown in Open Type dialog etc. Note that the types are still visible to the compiler, this is different from fiddling with the build path which will hide the types from the compiler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM