Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 18703

Summary: enable 'organize imports' on source folders and projects [code manipulation]
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: UIAssignee: Martin Aeschlimann <martinae>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: martinae, mccull1, mlq.eclipse, shortcutter
Version: 2.0   
Target Milestone: 2.1 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 18697    
Bug Blocks:    

Description Adam Kiezun CLA 2002-06-03 09:26:12 EDT
now that the action works on packages it should be easy to make it work on 
source folders and projects too
Comment 1 Erich Gamma CLA 2002-06-05 02:45:40 EDT
defer
Comment 2 Andrew McCullough CLA 2002-07-25 15:17:58 EDT
I originally posted the same request as bug 6665 ...

I don't know that it really makes much difference, but I have a plugin that 
does this if anyone is interested.  I defined an abstract object action which 
searches for compilation units under the selected element(s) 
(project/package/file/).  I then defined actions for Format, Organize Imports, 
and Insert File Comment.  Seems the same approach could be taken.  The abstract 
Action handles the progress bar and creating the workbench runnable, and then 
asks the subclasses to process a single compilation unit at a time via an 
abstract method that returns an IStatus.  After each is processed the progress 
bar is updated and it moves to the next compilation unit.

Another little feature I am trying to add is popping up the editor of a class 
where there is an ambiguous reference, and asking the user to choose (like 
regular organize does).  Unfortunately, this tends to cause the progress bar to 
disappear so I might have to abandon it.

I am currently working on integrating Jalopy (since I don't trust the Eclipse 
formatter to format my whole project, but there are enough bugs on that one), 
and on figureing out how to hook into VCM to check out files (I use ClearCase 
at work).  Whenever I finish it I will be making it public... but if you care, 
the code is available via anonymous CVS.

-Andrew
Comment 3 Martin Aeschlimann CLA 2002-09-30 10:57:49 EDT
organize imports now also works on Project & source folders.

We should add this also for the formatter. Andrew, it would be nice to take 
your code. Can you attach it to this bug report or mail it to me?

closing this one.