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

Bug 120528

Summary: [clean up] inside editor behaves unexpected
Product: [Eclipse Project] JDT Reporter: Philip Mayer <eclipsetalk2>
Component: UIAssignee: Benno Baumgartner <benno.baumgartner>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, eclipse, Konstantin.Scheglov, markus.kell.r, martinae
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philip Mayer CLA 2005-12-13 05:03:38 EST
Build id: I20051213-0010

Invoking Context Menu > Source > Clean Up... inside a java editor currently does nothing (no dialog, no error message). We should either assume the enclosing cu as a selection or disable the action.
Comment 1 Philip Mayer CLA 2005-12-13 10:29:22 EST
I just realised the clean up action actually performs on the cu inside which the cursor is placed ;) 

However for me the behaviour was/is unexpected. As the action name has three dots behind it ("Clean Up...") I expect a dialog; and in some cus it really does nothing if there is indeed nothing to do without any message. 

Comment 2 Tom Hofmann CLA 2005-12-13 10:42:16 EST
I think we should show a lightweight indication of the result when no dialog is shown. E.g. the status line could say "Nothing to clean up" or so...
Comment 3 Martin Aeschlimann CLA 2005-12-13 16:33:46 EST
As discussed, I don't think the 'light' clean up is the right thing to do. I suggest to always show a dialog. 
Comment 4 Benno Baumgartner CLA 2005-12-14 05:31:53 EST
I try to summarize what we have discussed yesterday:

We make two actions:
1. Code Style action
2. Clean Up action

Code Style action:
The code style action is executed without any dialog/wizard when invoked (with showing a status line if nothing changed, thanks tom). The idea behind the code style action is that it helps to enforce a code style standard on a project.

The settings for this action can be set on a new preference page in Java -> Code Style -> SomeGoodName. The look and feel of this page will be the same as the one for compiler warnings. 

The code style action does execute clean ups which do enforce code style rules. Such clean ups would be at the moment:
Add this qualifier
Qualify access to static field
Change non static access to static
Change indirect static access to direct
Convert control statement body to block
Add missing Override/Deprecated annotation
Convert for loops to enhanced for loops

Clean Up action
The clean up action will always show a refactoring wizard. The idea behind Clean Up Action is that quick fix/quick assists can be executed in batch mode. There will be no preference page for the clean up action. The clean up action is probably executed once or before every milestone build or so.

In the wizard following can be enabled/disabled
All clean ups which do not enforce code style rules (at the moment all remove unused code and add/remove non nls tags) 
Enforce code style (with a link to the preference page)
And maybe also:
  Format source (with a link to the format preference page)
  Organize imports (with a link to the organize imports preference page)
Comment 5 Martin Aeschlimann CLA 2005-12-15 08:55:27 EST
For now I think we should not go for another action, but just offer the 'Clean up...' action that always shows a dialog.


Comment 6 Benno Baumgartner CLA 2006-01-06 08:36:36 EST
fix > 20060105

always show the dialog