Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » EMF-Edit - mapping features to table columns
EMF-Edit - mapping features to table columns [message #1736711] Fri, 01 July 2016 09:44 Go to next message
Robert Onslow is currently offline Robert OnslowFriend
Messages: 27
Registered: March 2016
Junior Member
Looking at http://git.eclipse.org/c/efxclipse/org.eclipse.efxclipse.git/tree/demos/org.eclipse.fx.demo.contacts.app/src/org/eclipse/fx/demo/contacts/views/ContactsTableView.java

which is the line which specifies which feature of the EObject is shown in which TableColumn?

I can see that, for editing, this is in the line

firstNameCellFactory.addCellEditHandler(new EAttributeCellEditHandler(ContactsPackage.eINSTANCE.getContact_FirstName(),
				editingDomain));


But without editing?

Robert
Re: EMF-Edit - mapping features to table columns [message #1736836 is a reply to message #1736711] Sat, 02 July 2016 14:56 Go to previous message
Robert Onslow is currently offline Robert OnslowFriend
Messages: 27
Registered: March 2016
Junior Member
The line which maps the feature in the EMF object to the table column is this:

AdapterFactoryTableCellFactory<Object, Object> firstNameCellFactory = new AdapterFactoryTableCellFactory<>(adapterFactory, 0);
		


It is the index '0' which selects out the feature of the EMF object, and in order to map the index to the feature, AdapterFactoryTableCellFactory delegates to any AdapterFactory supporting ITableItemLabelProvider.

The default AdapterFactory generated by EMF.Edit does not support ITableItemLabelProvider. So in order to display an EMF object in a table, as per the Contacts demo, add support for ITableItemLabelProvider into the AdapterFactory, following http://eclipseo.blogspot.co.uk/2014/11/displaying-your-emf-model-on-tableviewer.html

Robert
Previous Topic:Tycho build compiler cannot find javafx classes
Next Topic:Is e(fx)clipse compatible with the eclipse neon?
Goto Forum:
  


Current Time: Sat May 27 00:31:58 GMT 2017

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

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