Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Standalone Organize Imports
Standalone Organize Imports [message #1739172] Thu, 28 July 2016 01:47 Go to next message
Eclipse UserFriend
Hi

A variety of Java generating applications do not adequately organize
imports and so a manual clean up is needed after auto-generation.

e.g. EMF's genmodel, and OCL's code generator, ...

I invoke these from MWE2 scripts so I started writing an ImportOrganizer
step and pushed it back on my to-do stack as it started to get harder.
But surely something already exists.

Is there a standalone API/tool for JDT's fixes?

Regards

Ed Willink

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Re: Standalone Organize Imports [message #1739385 is a reply to message #1739172] Sun, 31 July 2016 07:15 Go to previous messageGo to next message
Eclipse UserFriend
I'm not aware of such a standalone tool.

You've probably seen org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation and org.eclipse.jdt.internal.corext.fix.ImportsFix

Have you had a look at how performing cleanups on save is implemented?
- original impl. in org.eclipse.jdt.internal.corext.fix.CleanUpPostSaveListener
- simpler version for tests in org.eclipse.jdt.ui.tests.quickfix.CleanUpTestCase.performRefactoring(ICompilationUnit[])

Well, all those are internal classes, so perhaps it's worth filing an RFE to create API for this. I'm not sure if such API should be specific to Organize Imports or more generic to apply to all kinds of clean-ups.
Re: Standalone Organize Imports [message #1739390 is a reply to message #1739385] Sun, 31 July 2016 09:15 Go to previous message
Eclipse UserFriend
Hi

Thanks. "CleanUpPostSaveListener" probably anticipates my next question.

Once I write an MWE2 tool, I'll contribute and may be it will inspire
someone to create an API that is also ANT friendly.

Regards

Ed Willink

On 31/07/2016 12:15, Stephan Herrmann wrote:
> I'm not aware of such a standalone tool.
>
> You've probably seen
> org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation and
> org.eclipse.jdt.internal.corext.fix.ImportsFix
> Have you had a look at how performing cleanups on save is implemented?
> - original impl. in
> org.eclipse.jdt.internal.corext.fix.CleanUpPostSaveListener
> - simpler version for tests in
> org.eclipse.jdt.ui.tests.quickfix.CleanUpTestCase.performRefactoring(ICompilationUnit[])
>
>
> Well, all those are internal classes, so perhaps it's worth filing an
> RFE to create API for this. I'm not sure if such API should be specific
> to Organize Imports or more generic to apply to all kinds of clean-ups.


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Previous Topic:Converting ASTNode to code
Next Topic:How do I install Neon on LinuxMint 18?
Goto Forum:
  


Current Time: Mon May 19 01:32:25 EDT 2025

Powered by FUDForum. Page generated in 0.06662 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top