Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Standalone Organize Imports
Standalone Organize Imports [message #1739172] Thu, 28 July 2016 05:47 Go to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
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 11:15 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
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 13:15 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
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: Thu Oct 10 01:26:12 GMT 2024

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

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

Back to the top