Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Table Developer Documentation

WORK IN PROGRESS

The Papyrus Table uses the NatTable widget. Its documentation is available here and here. These new table will be available for the Papyrus Release 0.10 in June 2013.

The NatTable source code can be downloaded with git http://git.eclipse.org/gitroot/nattable/org.eclipse.nebula.widgets.nattable.git

Label Providers

For the label provider, we divided the tables into 2 areas :

  1. Headers
  2. Body


for each areas we declared a label provider context (using the Papyrus Label Provider extension point):

  1. org.eclipse.papyrus.infra.nattable.full.labelprovider : the context to use to find the label provider used in the table. This one calls the others label providers according to the region for which we are looking for the text/image to display.
  2. org.eclipse.papyrus.infra.nattable.body.labelprovider : the context to use to find the label provider used to get the text in the body of the table
  3. org.eclipse.papyrus.infra.nattable.header.labelprovider : the context to use to find the label provider used to get the text in the header of the table (display icon, display label)
  4. org.eclipse.papyrus.infra.nattable.header.feature.labelprovider : the context to use to find the label provider used to display feature in a header. This label provider allows to define the text to display according to the configuration of the axis ( display icon, display label, display multiciplicity, display type, display a "/" for the derived feature)

These contexts are declared into the plugin org.eclipse.papyrus.infra.nattable.

All label provider declared on these context must accept elements implementing ILabelProviderCellContextElement. This object encapsulate the cell for which we want display a text AND useful elements which can be used to define the text/image/color/... to display in the cell.


Papyrus Extension Point For Table :

  1. Axis Manager
  2. Cell Manager
  3. Cell Editor Configuration




Selection synchronization

Some changes have been applied to the code in order to allow a selection synchronization between the tables and the model explorer. The affected classes are the following :
In these changes, IRevealSemanticElement and its associated method revealSemanticElement is at the core of the modifications.

1. org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java

where we implement the interface and add the call for the newly created revealSemanticElement method in AbstractNattableWidgetManager and giving it the list of selected objects.

2. org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java

the method goes through the lines and columns of the tables to find all the elements contained in the list and then proceed to select them graphically in the table.
the method used for this is org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.doCommand(ILayerCommand command)

3. org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java

in the original method the selection only allowed the first selected element found to show. we now collect all found IGraphicalEditParts and proceed to set the selection in the graphicalViewer.

4. org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java

in the handleSelectionChangedFromDiagramEditor method the principal problem was that, if revealSemanticElement was called, it shunned the model explorer as it was not an IEditPart and the redundacy of the IAdaptable verification crashed the process.
when we are in an IIeditorPart, as we were interested in the Eobject for the contruction of the list of selected elements and that org.eclipse.papyrus.infra.emf.utils.EMFHelper.getEObject(Object source) already checked for the IAdaptability, the direct replacement of the verification was done.
as for the selection in the model explorer, we went through org.eclipse.ui.navigator.LinkHelperService.getLinkHelpersFor(Object anObject) to get the list of LinkHelpers and used the LinkHelper in org.eclipse.papyrus.views.modelexplorer.LinkHelper.activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) to handle the selection with revealSemantiElement.

Back to the top