Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343336 - [compare] ClassCastException on opening compare editor for .xtext grammar
Summary: [compare] ClassCastException on opening compare editor for .xtext grammar
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-20 00:26 EDT by Karsten Thoms CLA
Modified: 2017-09-19 18:17 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments
Screenshot (445.94 KB, image/png)
2011-04-20 00:27 EDT, Karsten Thoms CLA
no flags Details
proposed patch pls verify (1.12 KB, patch)
2011-04-20 10:41 EDT, Michael Clay CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2011-04-20 00:26:10 EDT
I am facing a ClassCastException under the following situation:
- .xtext grammar is under SVN version control
- changed grammar from base revision
- opening Compare With / Base from Working Copy

=>

java.lang.ClassCastException: org.eclipse.jface.text.Document cannot be cast to org.eclipse.xtext.ui.editor.model.XtextDocument
	at org.eclipse.xtext.ui.editor.syntaxcoloring.TokenScanner.getTokens(TokenScanner.java:134)
	at org.eclipse.xtext.ui.editor.syntaxcoloring.TokenScanner$RangedReentrantIterator.setRange(TokenScanner.java:94)
	at org.eclipse.xtext.ui.editor.syntaxcoloring.TokenScanner.setRange(TokenScanner.java:130)
	at org.eclipse.jface.text.rules.DefaultDamagerRepairer.createPresentation(DefaultDamagerRepairer.java:172)
	at org.eclipse.jface.text.presentation.PresentationReconciler.createPresentation(PresentationReconciler.java:453)
	at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:566)
	at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:564)
	at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.inputDocumentChanged(PresentationReconciler.java:119)
	at org.eclipse.jface.text.TextViewer.fireInputDocumentChanged(TextViewer.java:2888)
	at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2937)
	at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:636)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.setDocument(ProjectionViewer.java:376)
	at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:570)
	at org.eclipse.compare.contentmergeviewer.TextMergeViewer$ContributorInfo.updateViewerDocument(TextMergeViewer.java:771)
	at org.eclipse.compare.contentmergeviewer.TextMergeViewer$ContributorInfo.internalSetDocument(TextMergeViewer.java:728)
	at org.eclipse.compare.contentmergeviewer.TextMergeViewer$ContributorInfo.setDocument(TextMergeViewer.java:646)
	at org.eclipse.compare.contentmergeviewer.TextMergeViewer.updateContent(TextMergeViewer.java:2837)
	at org.eclipse.xtext.ui.compare.DefaultMergeViewer.updateContent(DefaultMergeViewer.java:61)
	at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.internalRefresh(ContentMergeViewer.java:743)
	at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.inputChanged(ContentMergeViewer.java:643)
	at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:280)
	at org.eclipse.compare.CompareViewerSwitchingPane.setInput(CompareViewerSwitchingPane.java:277)
	at org.eclipse.compare.internal.CompareContentViewerSwitchingPane.setInput(CompareContentViewerSwitchingPane.java:158)
	at org.eclipse.compare.CompareEditorInput.internalSetContentPaneInput(CompareEditorInput.java:845)
	at org.eclipse.compare.CompareEditorInput.access$8(CompareEditorInput.java:843)
	at org.eclipse.compare.CompareEditorInput$11.run(CompareEditorInput.java:779)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.compare.CompareEditorInput.feed1(CompareEditorInput.java:773)
	at org.eclipse.compare.CompareEditorInput.feedInput(CompareEditorInput.java:751)
	at org.eclipse.compare.CompareEditorInput.createContents(CompareEditorInput.java:555)
	at org.eclipse.compare.internal.CompareEditor.createCompareControl(CompareEditor.java:462)
	at org.eclipse.compare.internal.CompareEditor.createPartControl(CompareEditor.java:414)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
Comment 1 Karsten Thoms CLA 2011-04-20 00:27:40 EDT
Created attachment 193647 [details]
Screenshot
Comment 2 Sebastian Zarnekow CLA 2011-04-20 02:02:57 EDT
Hi Karsten,

thanks for the bug report.
Which Eclipse Version do you use? Which Xtext build is installed?
Comment 3 Michael Clay CLA 2011-04-20 10:41:12 EDT
Created attachment 193707 [details]
proposed patch pls verify
Comment 4 Sebastian Zarnekow CLA 2011-04-20 10:43:42 EDT
Looks good to me. Please apply.

Would it be too much effort to provide a testcase, too?
Comment 5 Michael Clay CLA 2011-04-20 11:53:33 EDT
pushed to master
Comment 6 Karsten Thoms CLA 2017-09-19 18:08:12 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 18:17:42 EDT
Closing all bugs that were set to RESOLVED before Neon.0