Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338247

Summary: Xpand: Feature Request: Include Statement to include static text like copyright headers for source files
Product: [Modeling] M2T Reporter: Olaf Bigalk <bib.odo>
Component: XpandAssignee: Project Inbox <m2t.xpand-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: karsten.thoms, sebastian.zarnekow, sven.efftinge
Version: unspecifiedFlags: karsten.thoms: kepler+
Target Milestone: M6   
Hardware: All   
OS: All   
Whiteboard:

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.