I need to implement code folding on client project. And I have done the prototype https://github.com/vladimirkozhaev/simpleeditor.
Problem is that in my prototype I use TextEditorActionContributor
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.editors">
<editor
class="org.newlanguageservice.editor.MinimalEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
extensions="min"
icon="icons/sample.gif"
id="org.eclipse.faq.examples.editor.MinimalEditor"
name="Minimal Editor">
</editor>
</extension>
</plugin>
But in the project I use MultiPageEditorContributor
<extension
point="org.eclipse.ui.editors">
<editor
name="Omega Editor"
extensions="txt"
contributorClass="com.idc.eclipseplugin.editors.MultiPageEditorContributor"
class="com.idc.eclipseplugin.editors.OmegaMultiPageEditor"
id="com.idc.eclipseplugin.editors.OmegaMultiPageEditor">
</editor>
</extension>
That's why in the code I have class cast exception.
@Override public void createPartControl(Composite pParent) {
super.createPartControl(pParent);
........
ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
mProjectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
mProjectionSupport.install();
// turn projection mode on
viewer.doOperation(ProjectionViewer.TOGGLE);
mAnnotationModel = viewer.getProjectionAnnotationModel();
}
method getSourceViewer return instance of the SourceViewer class instead of ProjectionViewer.
So, my question is: how to create projection viewer?