Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XtextStyledTextCellEditor(Xtext Editor in JFace TableViewer)
icon5.gif  XtextStyledTextCellEditor [message #911796] Wed, 12 September 2012 10:40
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 16
Registered: March 2010
Junior Member
Hi,

I would like to integrate my Xtext editor for my DSL into a JFace TableViewer.
I tried to do this with the XtextStyledTextCellEditor from Itemis' YAKINDU, but apart from this "TMF meets GMF"-presentation, I hardly found any documentation.

I already have an EditingSupport class that returns that editor (see below).

public class MyEditingSupport extends EditingSupport {

	private ColumnViewer viewer;

	public MyEditingSupport(ColumnViewer viewer) {
		super(viewer);
		this.viewer = viewer;
	}

	@Override
	protected CellEditor getCellEditor(Object element) {

		XtextStyledTextCellEditor xTextCellEditor = new XtextStyledTextCellEditor(SWT.SINGLE, MyDSLActivator
				.getInstance().getInjector(MyDSLActivator.MY_DSL));
		xTextCellEditor.create((Composite) viewer.getControl());
		return xTextCellEditor;
	}

	@Override
	protected boolean canEdit(Object element) {
		return true;
	}

	@Override
	protected Object getValue(Object element) {
		return element.toString();
	}

	@Override
	protected void setValue(Object element, Object value) {
		viewer.update(element, null);
		viewer.refresh();
	}

}


How do I implement the getValue method so that the generated DSL-String is shown so that the user can edit it using the Xtext editor?

Thanks for your help!
Previous Topic:Need assistance with formatting...
Next Topic:Problem markers don't get cleaned if project doesn't have xtext nature
Goto Forum:
  


Current Time: Sat Feb 29 10:23:18 GMT 2020

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

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

Back to the top