Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] TableFactory with EditingSupport
[EMF Forms] TableFactory with EditingSupport [message #1753729] Thu, 09 February 2017 11:50 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 25
Registered: January 2016
Junior Member
Hi there,

following the blog post [1] I created a table for some EMF object list. Now I want to make the cells editable but do not really find the right way to configure the TableViewerSWTBuilder.

        builder.addColumn(true,             // resizeable
                        true,               // moveable
                        SWT.LEFT,           // styleBits
                        10,                 // weight
                        50,                 // minWidth
                        "Name",             // columnText
                        "Name des Knotens", // tooltipText
                        nameProvider,       // CellLabelProvider
                        nameEditingSupport, // editingSupportProvider
                        null                // Image
        );


How do I obtain the EditingSupportCreator? Some EditingSupportUtil requires a CellEditorCreator. A naive implementation of that results in NPEs [2] cause of problems with databinding.

final EditingSupportCreator nameEditingSupport = EditingSupportUtil.createEditingSupport(
                        new MyCellEditorCreator(), infra, CorePackage.eINSTANCE.getNamedObject_Name());

class MyCellEditorCreator implements CellEditorCreator {
        @Override
        public CellEditor createCellEditor(final TableViewer viewer) {
            return new StringCellEditor();
        }
}


How can the editing support configured correctly?

A side question: Creating the table colums with the builder methods of the TableViewerSWTBuilder is a little bulky. At first sight it looks like a wrapper around plain JFace Tables. What's the major advantage of this builder over plain JFace?

Cheers,
Hauke

[1] http://eclipsesource.com/blogs/2016/03/09/emf-forms-1-8-0-feature-factories-for-treeviewer-and-tableviewer/
[2] NPE at org.eclipse.jface.viewers.ColumnViewerEditor.activateCellEditor(ColumnViewerEditor.java:199)

Re: [EMF Forms] TableFactory with EditingSupport [message #1754063 is a reply to message #1753729] Tue, 14 February 2017 09:24 Go to previous message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 81
Registered: December 2013
Member

Hi,

I think you have to pass a parent-composite to your Cell Editor (viewer.getTable()). Otherwise the cell editor's control will not be created, causing a NPE.

Regarding the side question, this builder is nothing more but a wrapper around the JFace API allowing to use the fluent pattern. The main advantage is, that you may reuse some of the building blocks very easily without subclassing. Main use case for us was to make it easy to create custom Tables which look like the ones created with EMFForms renderers. So it is used by us to create very custom tables with the same look and feel as the generic table renderer.

Cheers
Johannes


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:Genmodel Dynamic Template Empty Class File
Next Topic:Need to Filter some objects in Select Element dialog.
Goto Forum:
  


Current Time: Sun Jul 15 20:59:57 GMT 2018

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

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

Back to the top