Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java files won't be generated with "Organize Imports" preferences. #4

Open
thake opened this issue Jan 15, 2021 · 1 comment
Open

Comments

@thake
Copy link

thake commented Jan 15, 2021

First of all thanks for your great work! Faktor-IPS is a nice tool to model with.

I recently noticed that the generated Java files are not generated according to the "Organize Imports" preferences. Especially the import order gets mangled as soon as wildcard imports are used. This is an issue for us, because every time we change the implementation of a custom method, the source file gets formatted taking into account the "Organize Imports" preferences. This leads to a rather large diff on check-in which is harder to review.

Do you think it is possible to integrate the eclipse build in OrganizeImportsOperation (https://github.com/eclipse/eclipse.jdt.ui/blob/master/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/core/manipulation/OrganizeImportsOperation.java) organize the imports?
You can find an example of how to use it with a String in the sources of EMF: https://github.com/eclipse/emf/blob/master/plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/generator/AbstractGeneratorAdapter.java (Method organizeImports of EclipseHelper).

@hd42
Copy link
Member

hd42 commented Jan 18, 2021

Thank you for the suggestion. The OrganizeImportsOperation is unfortunately part of the UI code and therefor cannot be used by our code generator, but the EMF code looks promising and we'll look into incorporating it in our generator code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants