Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED] How to get ride of the scrollbars in EmbeddedEditor
[SOLVED] How to get ride of the scrollbars in EmbeddedEditor [message #1728494] Tue, 05 April 2016 01:40 Go to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member
Hi,

I am trying to view xtext embedded editor. However it shows the scrollbars which are really disturbing, e.g. when a single line is enough to show the text !

my code is as below:
EmbeddedEditorFactory factory = new EmbeddedEditorFactory();
			
		xtextInjector.injectMembers(factory);
		xTextEmbeddedEditor = factory.newEditor(new IEditedResourceProvider() {

			@Override
			public XtextResource createResource() {
				return xtextResource;
			}
		}).showErrorAndWarningAnnotations().withParent(xtextEditorComposite); 

		
		xtextPartialEditor = xTextEmbeddedEditor.createPartialEditor(prefix,
				editablePart, suffix, true);
		
		xtextEditorComposite.update();


I found that in WithParent() method in the EmbeddedEditorFactory there is a code as below which forces scroll bars !
public EmbeddedEditor withParent(final Composite parent) {
			if (editorBuild)
				throw new IllegalStateException();
			editorBuild = true;
//			/*fProjectionSupport =*/installProjectionSupport(this.fSourceViewer);
			final CompositeRuler annotationRuler;
			if (annotationTypes != null && annotationTypes.length != 0) {
				annotationRuler = new CompositeRuler();
			} else {
				annotationRuler = null;
			}
			final XtextSourceViewer viewer = this.sourceViewerFactory.createSourceViewer(
					parent, 
					annotationRuler, 
					null, // overviewRuler
					false, // showAnnotationOverview 
					SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
			final XtextSourceViewerConfiguration viewerConfiguration = this.sourceViewerConfigurationProvider.get();
			viewer.configure(viewerConfiguration);
...


Also, can you please guide me to some code examples for this slide :
http://fr.slideshare.net/meysholdt/lightweight-xtext-editorsasswtwidgets

Thanks,
Bests,
Parsa

[Updated on: Tue, 05 April 2016 20:58]

Report message to a moderator

Re: How to get ride of the scrollbars in EmbeddedEditor [message #1728600 is a reply to message #1728494] Tue, 05 April 2016 18:21 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Hi Parsa,

this is unfortunately not easy to extend.
You'll need to copy change and override the whole method and then bind your subclass to Builder.

Sven
Re: How to get ride of the scrollbars in EmbeddedEditor [message #1728611 is a reply to message #1728600] Tue, 05 April 2016 20:57 Go to previous message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member
Hi Sven,

Thank you for your reply,

I have copied the whole class body (EmbeddedEditorFactory and EmbeddedEditorActions classes) and it is working fine now.

Thanks,
Parsa
Previous Topic:DSL validation across multiple files
Next Topic:Embedded Editor Auto Completion does not work properly.
Goto Forum:
  


Current Time: Thu Apr 25 13:53:38 GMT 2024

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

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

Back to the top