views:

194

answers:

3

This is a simple question :

Is there any automatic indentation alignment on Eclipse PDT when you do a copy-paste ?

Because it doesn't work on my installation (raw copy-paste), but maybe this is because I use tabs instead of spaces, so I want to know if it will work if I switch to spaces.

Thanks

A: 

I don't know specifically about PDT, but normally you can indent code with Ctrl + i, and format code with Ctrl + Shift + f (under Preferences -> Java -> Code Style -> Formatter you can specify how the formatter should work).

You can even select multiple files in the navigator and select Source -> Format to format several files then.

David Sauter
Yep, but I would like that to be performed on a "paste" automatically.
Matthieu
A: 

A similar idea to Davids is the use of Save actions: in the Preferences selecting Java/Editor/Save actions you can define an action to format the java code files during saves. It would solve the paste format problems during the save.

If you manage codes with different coding standards, where this formatting might have problems, define multiple formats, on a per-project basis (using the Project properties window).

Zoltán Ujhelyi
There is no such option in Eclipse PHP ("PHP/Editor/Save actions"). Lucky Java. But still it would be on save, this is too bad it doesn't exists on a paste...
Matthieu
Sorry - I missed PDT for PDE. I hate these acronyms :).
Zoltán Ujhelyi
A: 

Ok then I guess the answer is : no, this functionnality doesn't exists yet.

Matthieu