Bug 195063 - [api][clean up] Add Clean Up on Save (push down from JDT Text)
Summary: [api][clean up] Add Clean Up on Save (push down from JDT Text)
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement with 10 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks: 123287 180349 221696 244458
  Show dependency tree
 
Reported: 2007-07-01 16:43 EDT by Karthik CLA
Modified: 2021-09-23 05:05 EDT (History)
21 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karthik CLA 2007-07-01 16:43:33 EDT
The save actions options (in the java plug-in) is great! However, it would be fantastic if a generic set of save options could be applied to all files. Tasks such as removing trailing whitespace etc. are more or less common for all types.

Thanks!
Comment 1 Nitin Dahyabhai CLA 2007-07-10 14:57:24 EDT
It would need to be pluggable--WTP has "Clean Up" functionality as well.
Comment 2 Dani Megert CLA 2007-07-11 03:59:20 EDT
Yes, of course. However, we probably won't have time to work on this for now.
Comment 3 Valentin Baciu CLA 2008-01-09 14:52:06 EST
This enhancement - making the clean-up profiles API/UI and save participant mechanism extensible and part of the platform - has a strong vote and support from the WTP XML Web Services team too. We can work closely with our WTP SSE friends and be early adopters.

Shouldn't anyone from the JDT team be ccd as well?
Comment 4 Dani Megert CLA 2008-01-10 03:16:54 EST
>Shouldn't anyone from the JDT team be ccd as well?
The Text team covers/watches Platform Text and JDT Text.
Comment 5 Dani Megert CLA 2008-12-08 09:24:15 EST
Sorry, we have to shift this to M5.
Comment 6 Dani Megert CLA 2009-01-12 07:04:38 EST
Depending on what clients expect from the generalized solution, different approaches will be needed.

When to trigger:
* on save in editor
  + can choose simple save using Text editor
  - save actions are not executed, e.g. doing a refactoring
  
* on save of a file of a certain content type
  + works whenever that file is saved
  - user no longer has simple text editor
  - can have unexpected results/breakage for existing clients that don't expect
    additional operations done on save
  - expect more troubles/conflicts with this approach

Currently, we trigger it when saving in the Java editor but some people also want it when touching the file with a refactoring (see e.g. bug 244458).

==> Both approaches are appealing. We probably need a registry with save actions and clients can then either honor them or not, i.e. opt-in instead of always doing it when a file is saved.


Where to add the hook:
* file buffers
* saveable
* document provider
* editor
* combination of the above

Currently it is in the document provider with the exception of error reporting to the user, which is in the CU editor.


Other issues:
* I think project specific settings are needed for save actions to be usable 
  but currently this is not supported by Platform UI. We would have to provide 
  this as well.
* do we only want a save action hook or is the whole clean up stuff required?
* relation between clean up (profiles) and save actions:
  in JDT we have clean ups and save actions (which are able to run most but not
  all of the clean ups). Clean ups are stored in profiles but the save action 
  is currently not able to use/specify a clean up profile (see bug 178429).


Unfortunately, given the open questions/issues and other priorities we won't be able to do this for 3.5. Sorry. Nevertheless, I encourage interested parties to comment in this bug what their concrete expectations are (e.g. execute per content type or only when in a certain editor).
Comment 7 Chris Aniszczyk CLA 2009-06-24 17:13:50 EDT
I would like to see something like this investigate in 3.6... PDE would love to take advantage of this.
Comment 8 anatoly techtonik CLA 2010-05-18 10:47:37 EDT
Need removal of trailing whitespaces.
Comment 9 anatoly techtonik CLA 2010-05-21 09:47:35 EDT
Ok, as an interested party I want trailing whitespaces to be stripped off in edited lines for all text files by default.

I do not care about any other Save Actions for now, but I really don't want any other edits to happen without my review. This makes me think that perhaps it is not a save action that should strip whitespaces, but the text editor component that should do it once I leave the edited line.
Comment 10 Markus Rathgeb CLA 2015-12-08 05:22:15 EST
Still missing "Save actions" for e.g. HTML, XML and others.
Is this still in progress?
Comment 11 Dani Megert CLA 2015-12-08 13:25:36 EST
(In reply to Markus Rathgeb from comment #10)
> Still missing "Save actions" for e.g. HTML, XML and others.
> Is this still in progress?

No one is working on this.