Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315365 - [templates] ClassCastException when using ${todo} in file template
Summary: [templates] ClassCastException when using ${todo} in file template
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 7.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 7.0   Edit
Assignee: Anton Leherbauer CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-02 05:50 EDT by Anton Leherbauer CLA
Modified: 2010-06-02 10:23 EDT (History)
0 users

See Also:


Attachments
Fix (3.87 KB, patch)
2010-06-02 10:15 EDT, Anton Leherbauer CLA
aleherb+eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Leherbauer CLA 2010-06-02 05:50:10 EDT
When creating a file from a template which contains ${todo} an exception is logged and the wizard does not complete:

java.lang.ClassCastException: org.eclipse.cdt.internal.corext.template.c.FileTemplateContext cannot be cast to org.eclipse.cdt.internal.corext.template.c.CodeTemplateContext
at org.eclipse.cdt.internal.corext.template.c.CodeTemplateContextType$Todo.resolve(CodeTemplateContextType.java:102)
at org.eclipse.jface.text.templates.TemplateVariableResolver.resolveAll(TemplateVariableResolver.java:98)
at org.eclipse.jface.text.templates.TemplateVariableResolver.resolve(TemplateVariableResolver.java:114)
at org.eclipse.cdt.internal.corext.template.c.FileTemplateContextType.resolve(FileTemplateContextType.java:218)
at org.eclipse.jface.text.templates.TemplateContextType.resolve(TemplateContextType.java:240)
at org.eclipse.cdt.internal.corext.template.c.FileTemplateContext.evaluate(FileTemplateContext.java:67)
at org.eclipse.cdt.internal.corext.codemanipulation.StubUtility.evaluateTemplate(StubUtility.java:379)
at org.eclipse.cdt.internal.corext.codemanipulation.StubUtility.getFileContent(StubUtility.java:141)
at org.eclipse.cdt.internal.ui.wizards.filewizard.WizardNewFileFromTemplateCreationPage.getInitialContents(WizardNewFileFromTemplateCreationPage.java:146)
at org.eclipse.ui.dialogs.WizardNewFileCreationPage.createNewFile(WizardNewFileCreationPage.java:380)
at org.eclipse.cdt.internal.ui.wizards.filewizard.NewFileFromTemplateWizard.performFinish(NewFileFromTemplateWizard.java:84)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430)
[...]
Comment 1 Anton Leherbauer CLA 2010-06-02 10:15:51 EDT
Created attachment 170803 [details]
Fix
Comment 2 Anton Leherbauer CLA 2010-06-02 10:16:48 EDT
The fix is safe.  Committed to HEAD.