| Summary: | [actions] Format Element formats (marks dirty) read-only file | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Rajesh <rthakkar> | ||||||||||
| Component: | Text | Assignee: | Rajesh <rthakkar> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | daniel_megert, deepakazad, markus.kell.r | ||||||||||
| Version: | 3.7 | Flags: | daniel_megert:
review+
|
||||||||||
| Target Milestone: | 3.7 M6 | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Rajesh
(In reply to comment #0) > Current behavior is as follows - > Step 1: Open Read only file in Java editor > Step 2: Select Source > Format Element from the main menu > Step 3: The read-only file is formatted and marked dirty Before step 2 focus should be in Java Editor. Plus I see this (funny ?) behavior - On GTK the action is not enabled for a read only file, focus can be in JE or Outline view - On Win XP the action is sometimes enabled sometimes disabled Steps for Win - Open a file and focus in JE => Action is enabled - Make it read only, focus in JE => Action is enabled - Now try to edit it and save - a dialog comes up asking to make it writable => action is disabled now. Is this expected ? >Outline view
>- On Win XP the action is sometimes enabled sometimes disabled
"sometimes" is not very specific. Steps?
(In reply to comment #2) > >Outline view > >- On Win XP the action is sometimes enabled sometimes disabled > "sometimes" is not very specific. Steps? They are there... (In reply to comment #1) > Steps for Win > - Open a file and focus in JE => Action is enabled > - Make it read only, focus in JE => Action is enabled > - Now try to edit it and save - a dialog comes up asking to make it writable => > action is disabled now. > They are there...
Yep. I was confused since you talked about outline and editor (I think in the Outline the action is always enabled except for class files) and you write "the action" but actually, those are two different actions hooked up to the same command by different parts ;-).
The action enable state is not consistent: some actions update their state when the read-only state changes and some stay enabled and do the check each time. We don't plan to invest time to change this.
Important is that we don't change read-only files and that before changing we call validateEdit.
Created attachment 187166 [details]
Patch
Comment on attachment 187166 [details]
Patch
The direction is OK, but the '&' in the dialog title after pressing 'No' is not good.
Created attachment 187404 [details]
Patch
Comment on attachment 187404 [details] Patch This is exactly the same patch as before - how can it then fix the problem mentioned in comment 6? Created attachment 187495 [details]
Patch
Oops!! Apologies. Didn't realize I had mistakenly named the new patch differently and so managed to upload the old patch again.
You already added ActionMessages.FormatElementAction_label for the same thing in the JavaOutlinePage. We should only have 1 message for it (in JavaEditorMessages). Otherwise the patch looks fine. Created attachment 188258 [details]
Patch
Removed the duplicate message from ActionMessages.
Patch is good! Committed to HEAD. Available in builds >= N20110204-2000. |