Skip to main content



      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] Mon, 04 April 2016 21:40 Go to next message
Eclipse UserFriend
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 16:58] by Moderator

Re: How to get ride of the scrollbars in EmbeddedEditor [message #1728600 is a reply to message #1728494] Tue, 05 April 2016 14:21 Go to previous messageGo to next message
Eclipse UserFriend
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 16:57 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 16:35:18 EDT 2025

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

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

Back to the top