Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338247 - Xpand: Feature Request: Include Statement to include static text like copyright headers for source files
Summary: Xpand: Feature Request: Include Statement to include static text like copyrig...
Status: CLOSED FIXED
Alias: None
Product: M2T
Classification: Modeling
Component: Xpand (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: M6   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-25 12:17 EST by Olaf Bigalk CLA
Modified: 2017-10-31 11:26 EDT (History)
3 users (show)

See Also:
karsten.thoms: kepler+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Bigalk CLA 2011-02-25 12:17:49 EST
Build Identifier: 

It would be nice if the Xpand language had an INCLUDE statement to include boilderplate text like copyright and licence text. Even nicer would it be if the included text is parsed for Xpand statements.

Reproducible: Always

Steps to Reproduce:
N/A
Comment 1 Karsten Thoms CLA 2011-02-25 13:45:58 EST
I'm not sure if this would be realized. We try to keep the language as small as possible and don't introduce concepts that could be solved with existing means. In this case, this could be solved (and is so in many projects) by providing an Xtend function that does the job. You could even call the XpandFacade in this function, which would solve your second need. 

But maybe it would be a good idea to add such a function to stdlib?
Comment 2 Sven Efftinge CLA 2013-02-13 11:05:02 EST
@Karsten: Could you outline briefly what you are going to do here?
Comment 3 Karsten Thoms CLA 2013-02-13 11:06:52 EST
I would add extensions to org::eclipse::xtend::util::stdlib::io named "includeFile":

   String includeFile (String filePath, String encoding)
   String includeFile (String filePath)

In Xpand it could be used like this:

   «EXTENSION org::eclipse::xtend::util::stdlib::io»
   ...
   «includeFile("header.txt")»
Comment 4 Sven Efftinge CLA 2013-02-13 11:07:46 EST
I see sounds good.
Comment 5 Karsten Thoms CLA 2013-02-13 12:02:46 EST
Added with changeset 10f89fbae927c8ecd0e3e8e35f819cda98ea0062
Comment 6 Sebastian Zarnekow CLA 2013-02-13 12:24:12 EST
You may want to use the value of the coding parameter.
Comment 7 Karsten Thoms CLA 2013-02-14 03:00:14 EST
Fixed
Comment 8 Eclipse Webmaster CLA 2017-10-31 11:26:22 EDT
Requested via bug 522520.

-M.