Bug 309591 - Duplicate Code Template Context Keywords
Summary: Duplicate Code Template Context Keywords
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2010-04-18 08:20 EDT by Ed Willink CLA
Modified: 2016-09-09 05:58 EDT (History)
3 users (show)

See Also:
sebastian.zarnekow: helios+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2010-04-18 08:20:20 EDT
M6: (Demonstrated by the OCLinEcore.xtext in org.eclipse.ocl.examples.xtext.* as of today's date).

My core EssentialOCL grammar uses a variety of punctuation elements such as {, } as well as using 'e' and 'E in two ways (real exponent and
Identifier contribution).

My OCLinEcore grammar extends the EssentialOCL grammar and introduces new rules that also involve punctuation elements such as {, }.

When I try to define a CodeTemplate for the OCLinEcore grammar using the Window->Preferences->OCLinEcore->Tempaltes page, the list of contexts offers me "Keyword '{'" and "Keyword 'e'" twice, presumably
once from each grammar.

Is this an indication of deeper problems in store, or just an inelegance? Which of the keywords should I use for Code Templates.
Is there a multi-selection facility?
Comment 1 Sebastian Zarnekow CLA 2010-04-28 15:48:06 EDT
There shouldn't be duplicte entries in the default list for template contexts.
Comment 2 Karsten Thoms CLA 2016-07-20 11:24:43 EDT
Reproducible with v2.10
Comment 3 Christian Dietrich CLA 2016-09-06 12:07:41 EDT
see org.eclipse.xtext.ui.editor.templates.XtextTemplateContextTypeRegistry.registerContextTypes(IGrammarAccess, Provider<XtextTemplateContextType>)


i asume we should (additionally to handle the keywords) do there something similar to

org.eclipse.xtext.ui.codetemplates.scoping.CodetemplatesScopeProvider.scope_Codetemplate_context(Codetemplate, EReference)

i am not sure if we need the duplicate keywords anyway. (for super rulecalls)
Comment 4 Christian Dietrich CLA 2016-09-06 12:21:50 EDT
i did some testing.
since the contexts are both needed we need to distingusish both values.

this may lead to some adoptions to org.eclipse.xtext.ui.codetemplates.ui.preferences.EditTemplateDialog.getContextName() as well