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

Bug 193178

Summary: Generated Code does not compile
Product: [Modeling] GMF-Tooling Reporter: Steffen Becker <steffen.becker>
Component: CoreAssignee: Artem Tikhomirov <tikhomirov.artem>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akarjakina
Version: 2.0Flags: richard.gronback: pmc_approved+
Ed.Merks: pmc_approved+
dimzzy: review+
boris.blajer: review+
Target Milestone: 2.0   
Hardware: PC   
OS: Windows NT   
Whiteboard:
Attachments:
Description Flags
Our model files
none
NavigatorLabelProvider.xpt none

Description Steffen Becker CLA 2007-06-18 15:20:29 EDT
Eclipse Build ID: 3.3RC4

My generated code contains methods in ???NavigatorLabelProvider
	/**
	 * @generated
	 */
	private String getProvidedRole_4101Text(View view) {
	}

	/**
	 * @generated
	 */
	private String getRequiredRole_4102Text(View view) {
	}

	/**
	 * @generated
	 */
	private String getImplementationComponentTypeParentCompleteComponentTypes_4103Text(
			View view) {
	}

	/**
	 * @generated
	 */
	private String getCompleteComponentTypeParentProvidesComponentTypes_4104Text(
			View view) {
	}

which the compiler won't compile as they obviously don't return a string

More information:
It's even not working with 18.6. Nightly build. gmfmap and genmodel validate nicely. All labels are read-only, static labels which show as stereotype <<Role>> on a link.
Last time it worked for me was M7, I didn't test RC1
Comment 1 Dmitry Stadnik CLA 2007-06-19 06:52:52 EDT
Could you please attach the model that exhibits this behaviour? I can't reproduce the issue.
Comment 2 Steffen Becker CLA 2007-06-19 08:34:19 EDT
I can try to upload it, the problem is, that the ecore model is split into many partial models. I can upload them, however, I'm unsure about the referential integrity. But maybe it is sufficient for you to locate the problem.
Comment 3 Steffen Becker CLA 2007-06-19 08:38:50 EDT
Created attachment 71728 [details]
Our model files

The GMF Models for all our editor are in gmfmodels subfolder. The problem I reported is in repository editor. However, it also happens in SEFF editor and may be in the others (I stopped testing the other models as they require manuall code fixes)
Comment 4 Anna Karjakina CLA 2007-06-19 16:08:45 EDT
I am not sure yet if this could be of any help, but just as an investigation from xPand debugger for me to remember: 
that code comes from xpt::navigator::NavigatorLabelProvider:275 for Gen Link Label child of Gen Link (for example, ProvidesStereotypeLabelEditPart inside of ProvidedRoleEditPart in your repositoryeditor.gmfgen), as it has no any modelFacet (in the template we have label.modelFacet == null, so getDiagramLabelText for label.modelFacet does not get called at all)
Comment 5 Steffen Becker CLA 2007-06-19 16:58:21 EDT
I can confirm that the code compiles when you add a DiagramModelFacet to each of the links manually and regenerate. How did it come that it was not there? I can not test if the generated code is correct because of bug 193180, but i'm continuing to try to get it running
Comment 6 Steffen Becker CLA 2007-06-19 17:22:04 EDT
After working around bug 193180 I can confirm that the generated editor behaves as expected, so the only remaining question is why the Diagram Label Facet was missing, right?
Comment 7 Steffen Becker CLA 2007-06-19 17:27:48 EDT
Ok, I have to correct myself. There is a strange 'dummy label' in the top left corner of the diagram which shows "<...>" and can not be drag dropped. It vanishes as soon as all diagram links are removed from the diagram. So, there is another issue besides the not compiling code and the missing facet
Comment 8 Steffen Becker CLA 2007-06-19 17:35:06 EDT
Final comment: The dummy label comes from my gmfgraph which declares two labels as children of the role link figure but later in the gmfmap only one label is mapped. Earlier versions of GMF only generated code for mapped labels, the current version obviously generates code for all labels. So, the dummy label can be fixed in the gmfgraph model - possibly manually.
Comment 9 Artem Tikhomirov CLA 2007-06-20 10:46:18 EDT
(In reply to comment #5)
> I can confirm that the code compiles when you add a DiagramModelFacet to each
> of the links manually and regenerate. How did it come that it was not there? 

The reason there's no model facet in the .gmfgen is that you use LabelMapping for your labels. Basically, there are three options, LabelMapping, and two subclasses, DesignLabelMapping and FeatureLabelMapping. Using former means we generate no code to implement your labels and rather rely on you to implement and plug in parser provider, for two subclasses we do generate some additional support.

So, I'm going to fix NavigatorLabelProvider to consult ParserService when there are no model facet, but if custom parser provider is not what you were tryying to accomplish, I'd suggest you to try some other LabelMapping.

Comment 10 Steffen Becker CLA 2007-06-20 11:09:37 EDT
Diagram Label is just what i need, so I'll change it appropriately. I didn't change the mapping at all. It was transformed into this state by applying all the time "migrate to gmf2" actions. Some time in the past there must have been the change from label mapping to more refined label mappings and it did not transform it then
Comment 11 Artem Tikhomirov CLA 2007-06-20 11:26:58 EDT
(In reply to comment #10)
You are rigth, some time ago we introduced that logic, and since old LabelMapping value (witout any features defined) is legal, it's hard to tell whether it should be transformed or not, so we keep it as is. Eventually, this seems to be helpful to find out the problem with NavigatorLabelProvider ;)
Comment 12 Artem Tikhomirov CLA 2007-06-20 12:20:51 EDT
Created attachment 71924 [details]
NavigatorLabelProvider.xpt

Proposed fix touches only cases with null modelFacet, generating code to consult ParserService.
Comment 13 Artem Tikhomirov CLA 2007-06-21 05:26:37 EDT
delivered.
Comment 14 Richard Gronback CLA 2008-08-13 13:12:11 EDT
[target cleanup] 2.0 RC was the original target milestone for this bug
Comment 15 Eclipse Webmaster CLA 2010-07-19 22:19:19 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Generation was the original product and component for this bug