Bug 263640 - [organize import] Organize Import causes comment line above imports to be deleted forever.
Summary: [organize import] Organize Import causes comment line above imports to be del...
Status: VERIFIED DUPLICATE of bug 24804
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.8 M2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-04 09:20 EST by Bouchet Stéphane CLA
Modified: 2011-09-13 05:27 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bouchet Stéphane CLA 2009-02-04 09:20:13 EST
+++ This bug was initially created as a clone of Bug #124284 +++

This bug is known from eclipse 3.2, but we use more an more MDA tools and especially code generators ( MTL, ...) to develop java applications (anong other langages). 

There is a major problem with imports. 

The problem is to keep a comment block inside the import block. 

Example : 
import java.util.ArrayList;
// Start of user code for imports
import java.util.List;
// End of user code

When trying to do CTRL+SHIFT+O or CTRL+SHIFT+M, it will remove the first comment. But these comments are used by the generator tool to keep user code ( that is not generated ) and it will end up with a bad generated file... 

it is possible to keep all these comments and the imports between them ?
Comment 1 Markus Keller CLA 2009-02-04 13:07:52 EST
Organize imports by definition reorders, adds, replaces, and removes imports. I guess it would not help you if it just retained the comments but moved them to an arbitrary location, e.g:

import java.util.ArrayList;
import java.util.List;
// Start of user code for imports
// End of user code

I guess what you really want is a way to mark a section in the import container which should be touched by Organize Imports. That would be an enhancement request.

Moving to JDT/Core.
Comment 2 Dani Megert CLA 2009-02-05 02:41:27 EST

*** This bug has been marked as a duplicate of bug 24804 ***
Comment 3 Satyam Kandula CLA 2011-09-13 05:27:01 EDT
Verified for 3.8M2 using build I20110912-0800