Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Problems with folding text in viewpart(Use of ProjectionViewer in a ViewPart to create foldable text .)
Problems with folding text in viewpart [message #1236360] Mon, 27 January 2014 02:30
Jens Vevstad is currently offline Jens VevstadFriend
Messages: 1
Registered: January 2014
Junior Member
I'm fairly new to RCP programming and I do have problems in creating fold-able text in a ViewPart
I'm using a ProjectionViewer and the text is partitioned and styled OK but the folding tag (+/- icons) is placed to the very left on the vertical grey ruler.
Nothing happen when I'm clicking the folding icon. I have done some tracing and for me it looks like the mouse event of the vertical ruler is fired instead of an folding icon event.

Everything works as expected when placing the folding code inside a TextEditor, the folding icon is nicely placed to the right of the vertical ruler and works as expected.

Do anybody have example code for placing a folding text inside a ViewPart?

My code for defining and activating the viewPart is as follows:

public class TextView extends ViewPart {


public TextView(){
this.colorManager = new ColorManager();
this.annotationModel = new ProjectionAnnotationModel();
this.annotationAccess = new DefaultMarkerAnnotationAccess();
this.verticalRuler = (new VerticalRuler( 12 ));
this.overviewRuler = new OverviewRuler(annotationAccess, 20, colorManager);

public void createPartControl(Composite parent) {
parent.setLayout(new FillLayout());
composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout(SWT.VERTICAL));

public void setResources(MySourceViewerConfiguration sourceViewConfiguration, MyDocumentProvider documentProvider, String txt){
this.documentProvider = documentProvider;
this.sourceViewConfiguration = sourceViewConfiguration;
projectionViewer = new ProjectionViewer( composite,getVerticalRuler(), getOverviewRuler(), false, i_style );
projectionViewer.setRangeIndicator(new DefaultRangeIndicator());
projectionSupport = new ProjectionSupport( projectionViewer,getAnnotationAccess(), getSharedColors() );


fSourceViewerDecorationSupport= new SourceViewerDecorationSupport(projectionViewer, getOverviewRuler(), getAnnotationAccess(), getSharedColors());
projectionViewer.showAnnotationsOverview( true );

try {
IDocument doc = documentProvider.createAnDocument(txt); // A simple wrapper for private method createDocument
projectionViewer.setDocument( doc,annotationModel);
} catch (CoreException e) {
// TODO Auto-generated catch block

projectionViewer.doOperation( ProjectionViewer.TOGGLE );
Previous Topic:What does eclipse package into an RCP?
Next Topic:Bundling web browser with RCP app
Goto Forum:

Current Time: Thu Apr 26 07:43:42 GMT 2018

Powered by FUDForum. Page generated in 0.01356 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software