Bug 492303 - Activator in ui project isn't generated properly with customized project names
Summary: Activator in ui project isn't generated properly with customized project names
Status: ASSIGNED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.9.0   Edit
Hardware: PC Windows 8
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Karsten Thoms CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-04-23 09:52 EDT by Niek Hulsman CLA
Modified: 2017-12-14 04:00 EST (History)
4 users (show)

See Also:


Attachments
Sample project (1.54 MB, application/x-zip-compressed)
2016-04-23 09:52 EDT, Niek Hulsman CLA
no flags Details
Screenshot (43.43 KB, image/png)
2016-09-21 03:39 EDT, Karsten Thoms CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Niek Hulsman CLA 2016-04-23 09:52:23 EDT
Created attachment 261192 [details]
Sample project

The Activator package and class name are wrongly generated, when i change the project names from the standard org.company.mydsl to for example company-dsl and change the plugin project names accordingly.

The name of the Activator becomes: Company-lang-uiActivator instead of LangActivator. I've included a sample project as attachment.

The configuration looks like this:

configuration = {
			project = StandardProjectConfig {
				baseName = "company-lang"
				rootPath = rootPath
				genericIde = {
					name = "company-lang-ide"
				}
				eclipsePlugin = {
					enabled = true
					 name = "company-lang-ui"
				}
				createEclipseMetaData = true
			}
			code = {
				encoding = "UTF-8"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
			}
		}
Comment 1 Karsten Thoms CLA 2016-09-21 03:39:39 EDT
Created attachment 264299 [details]
Screenshot

This shows what is generated.
Comment 2 Karsten Thoms CLA 2016-09-21 04:07:59 EDT
A basic problem is here that the UI Activator is generated only once and there could be multiple languages defined in the workflow.

The method that computes the activator name is org.eclipse.xtext.xtext.generator.XtextGeneratorNaming.getEclipsePluginActivator()

It is the only naming method that is not grammar dependent.

One possible solution is to provide a grammar specific version of the method and use always the grammar of the first language defined.
Comment 3 Christian Dietrich CLA 2017-07-27 06:40:25 EDT
@Karsten what do you think about

new TypeReference(pluginName.replaceAll("-","_") + '.internal', activatorName.replaceAll("-","_"))

as proposed here:

https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html