Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331681 - Please add support for abstract templates/modules
Summary: Please add support for abstract templates/modules
Status: CLOSED WONTFIX
Alias: None
Product: Acceleo
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-02 10:35 EST by Glenview Jeff CLA
Modified: 2016-03-30 11:09 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Glenview Jeff CLA 2010-12-02 10:35:04 EST
Build Identifier: M20100211-1343

Please add an abstract keyword to support automatically generating errors when trying to required templates are not overridden.  See menuItemExecuteBody in below (sloppy) example.

Thanks
Jeff

[module main()/]

[template public mainTop(anItem : Item)]
	[comment @main /]
	[for (aDelete : Delete | anItem.menu.items->select(oclIsKindOf(Delete)))]
		[aDelete.Delete(anItem)/]
	[/for]
	[for (anEdit : Edit | anItem.menu.items->select(oclIsKindOf(Edit)))]
		[anEdit.Edit(anItem)/]
	[/for]
[/template]



[module Edit() extends MenuItemTemplate /]

[template public menuItemExecuteBody(anItem : Item) overrides menuItemExecuteBody]
	anItem.execute1(anItem.execute1);
[/template]

[template public Edit(e : Edit, anItem : Item)]
	[file ('/src/com/xyz/menuitems/'.concat(e.name.toUpperFirst().concat('.java')), false, 'Cp1252')]
		[menuItemMain(e,anItem)/]
	[/file]
[/template]



[module Delete() extends MenuItemTemplate/]

[template public Delete(d : Delete, anItem : Item)]
	[file ('/src/com/xyz/menuitems/'.concat(d.name.toUpperFirst().concat('.java')), false, 'Cp1252')]
		[menuItemMain(d,anItem)/]
	[/file]
[/template]

[template public menuItemExecuteBody(anItem : Item) overrides menuItemExecuteBody]
    execute2(an[anItem.name.toUpperFirst()/])
[/template]



[module MenuItemTemplate()/]

[template public menuItemTemplate(m : Item, anItem : Item)]
	[menuItemMain(m, anItem)/]
[/template]

[template public menuItemMain(m : Item, anItem : Item)]
	[menuItemPackage(anItem)/]
	[menuItemImports(anItem)/]
	[menuItemClass(m, anItem)/]		
[/template]

[template public menuItemClass(m : Item, anItem : Item)]
	public class [m.name.toUpperFirst()/] implements MenuItem {
		[menuItemExecuteMethod(anItem)/]
	}
[/template]

[template public menuItemPackage(anItem : Item)]
package com.xyz.[anItem.name.toLower()/].menuitems;
[/template]

[template public menuItemImports(anItem : Item)]
import com.xyz.[anItem.name.toLower()/].[anItem.name.toUpperFirst()/];
[/template]

[template public menuItemExecuteMethod(anItem : Item)]
	public void execute(final [anItem.name.toUpperFirst()/] an[anItem.name.toUpperFirst()/]) {
		[menuItemExecuteBody()/]
	}	
[/template]

[template public menuItemExecuteBody(anItem : Item)]
	error: unimplemented (by the way Acceleo team, it would be nice if there were language support for erroring here with an abstract keyword.)
[/template]


Reproducible: Always
Comment 1 Laurent Goubet CLA 2016-03-30 11:09:20 EDT
There are no abstract templates in the specification, and no plans to support this keyword.