Does someone know a plugin for Eclipse that replaces fully qualified Java class names with the simple one and the corresponding import where possible? It would be even better if it could be performed as a Save Action.
Simplifying fully qualified names in Eclipse
Asked Answered
According to bugs.eclipse.org/bugs/show_bug.cgi?id=112999, this is a pending enhancement request. Please vote for it. :) But still would be good to have it as a plugin... –
Credulous
Here's a plugin offering this functionality called Clean Qualified Types Plugin (CQTP): http://blog.mi-ernst.de/projekte/
How can you set it to preserve comments too? –
Yevetteyew
Need to use
rewrite
instead of toString
after the clean. :) –
Yevetteyew No. But you can use Add Import command (Ctrl+Shift+M) on each fully qualified identifier to convert it to an import + a short name.
+1 - I didn't either. But that's a one by one method. I would like to do it for whole source file(s) and at save if possible. –
Credulous
I asked last year about doing this with static imports and received no positive answers: #824511 –
Sulph
FYI...at least on a Mac you need to put the cursor on the Type (not the path) –
Mar
I recently did some work in IntelliJ where doing this action resulted in all occurrences being replaced. –
Sulph
That's better than nothing. Thanks! However, I wish it also worked in block selects. :( It appears you really do have to do this one at a time. –
Disinterested
If you use maven it is trivially simple to work with your project in all the major Java ide's –
Sulph
Here's a plugin offering this functionality called Clean Qualified Types Plugin (CQTP): http://blog.mi-ernst.de/projekte/
How can you set it to preserve comments too? –
Yevetteyew
Need to use
rewrite
instead of toString
after the clean. :) –
Yevetteyew © 2022 - 2024 — McMap. All rights reserved.