Bug 45162 - Source Formatter: Customizable headers and footers using template variables.
Summary: Source Formatter: Customizable headers and footers using template variables.
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 49898 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-18 11:51 EDT by Robert (Kraythe) Simmons CLA
Modified: 2004-04-16 12:28 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert (Kraythe) Simmons CLA 2003-10-18 11:51:05 EDT
You should be able to customize the formatter to use a custom header and 
footer and to remove old headers and footers. I use this to put the license 
description along with some file information (such as file name and package 
and encoding) in the header. Whenever I format a new file, it should insert 
the header. Whenever i format a file that already has a header, it should 
remove that header in preference to my header. 

The header configuration should be on its own tab with the options to add some 
number of blank line (enter in a spinner or text field) after the header and 
before the footer.
Comment 1 Olivier Thomann CLA 2003-10-20 13:39:53 EDT
From my point of view, this has nothing to do with code formatting. Code
formatters should not change the source code. They should simply rearrange it.
Comment 2 Robert (Kraythe) Simmons CLA 2003-10-20 21:31:17 EDT
Actually I disagree. You should see how Jalopy uses headers. It allows you to 
do really cool things such as attach license notes and make SURE they stay 
there. Headers are not part of the "source" per se. They are merely .. well .. 
headers. Things that are standard and developers shouldnt be messing with 
them. 
Comment 3 Olivier Thomann CLA 2003-10-21 08:28:19 EDT
In Eclipse, headers can be handled by setting the type comment in the template 
section. It is not because Jalopy is handling headers that all code formatters 
have to do the same thing.
Comment 4 Robert (Kraythe) Simmons CLA 2003-10-21 08:34:31 EDT
That only works if you create a new type using the new -> class approach. That 
does NOT work if the class was created outside of eclipse or by another user 
using a different template (such as a new junior developer who doesnt have 
that information).

In addition, the templates are only applied at generation time so that if a 
user accidentally makes a mistake and changes them, you will never know. 

Finally, headers can be embedded with variables such as $fileName$ $package$ 
(those 2 are for jalopy) that change if you move or rename the file. With a 
code formatter these are automatically updated. 

Overall if you want to implement consistent headers and footers, templates are 
the way to go.
Comment 5 Robert (Kraythe) Simmons CLA 2003-10-21 08:35:18 EDT
I mean templates in the code formatter. 
Comment 6 Olivier Thomann CLA 2004-01-13 10:46:00 EST
*** Bug 49898 has been marked as a duplicate of this bug. ***
Comment 7 Olivier Thomann CLA 2004-04-16 12:28:07 EDT
The code formatter doesn't change the code (add or remove tokens).
This should be addressed by a separate tool.
Close as WONTFIX