Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/Activator.java190
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/accumulator/CustomRowOverrideLabelAccumulator.java140
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/advice/DeleteNatTableContextAdvice.java148
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractComboAction.java168
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractPapyrusStyledTextCellEditor.java450
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ButtonConfiguration.java240
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java354
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditor.java182
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditorEx.java304
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/TextCellEditor.java910
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfiguration.java90
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java222
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/CellAxisConfigurationRegistry.java316
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisCellEditorConfiguration.java226
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisEStructuralFeatureCellEditorConfiguration.java70
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/ICellAxisConfiguration.java80
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/TableCommands.java862
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/AbstractAxisComparator.java164
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/DoubleFilterComparator.java148
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/RowComparator.java176
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CornerConfiguration.java158
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/EditConfiguration.java190
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnHeaderStyleConfiguration.java88
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java108
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusDefaultEditBindings.java126
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusHeaderMenuConfiguration.java128
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusPopupMenuAction.java466
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowHeaderStyleConfiguration.java90
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusTreeLayerConfiguration.java120
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/StyleConfiguration.java94
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/converter/GenericDisplayConverter.java212
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/copy/CopySelectionToClipboardAction.java94
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractCompositeDataProvider.java210
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractDataProvider.java142
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractHeaderDataProvider.java410
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/BodyDataProvider.java112
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnHeaderDataProvider.java270
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnIndexHeaderDataProvider.java176
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnLabelHeaderDataProvider.java182
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeColumnHeaderDataProvider.java126
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeRowHeaderDataProvider.java128
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/HierarchicalRowLabelHeaderDataProvider.java210
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowIndexHeaderDataProvider.java262
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowLabelHeaderDataProvider.java184
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/DisplayedAxisSelectorDialog.java256
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/LoadCurrentAxisProvidersDialog.java456
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java90
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/glazedlists/copy/MouseOnlySortingStrategy.java134
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeHeaderConfigurationHandler.java108
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeLabelConfigurationValueHandler.java158
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractParametricTreeTableHandler.java142
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeHeaderConfigurationHandler.java114
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeLabelConfigurationValueHandler.java160
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeRowHideShowCategoryHandler.java138
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeTableHandler.java104
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ChangeHierarchicalTableStyle.java170
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/CollapseAndExpandTreeHandler.java202
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java96
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java142
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java134
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayIndexHeaderHandler.java76
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureIsDerivedHandler.java78
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureMultiplicityHandler.java78
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureNameHandler.java74
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureTypeHandler.java74
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelHeaderHandler.java76
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelImageHandler.java76
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelTextHandler.java78
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnEditAliasHeaderHandler.java122
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java84
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ConfigureCategoriesHandler.java86
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ExportToXLSHandler.java64
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InvertAxisHandler.java82
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadColumnAxisProvidersHandler.java174
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadRowAxisProvidersHandler.java172
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeColumnsHandler.java210
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeRowsHandler.java210
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedColumnsHandler.java286
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedRowsHandler.java286
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeTableHandler.java104
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PrintTableHandler.java88
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java98
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java134
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java134
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayIndexHeaderHandler.java74
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabeTextHandler.java78
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureIsDerivedHandler.java76
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureMultiplicityHandler.java76
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureNameHandler.java76
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureTypeHandler.java76
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java74
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelImageHandler.java76
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowEditAliasHeaderHandler.java126
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java84
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentColumnAxisProvidersHandler.java120
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentRowAxisProvidersHandler.java164
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectAllHandler.java72
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectColumnsHandler.java120
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectRowsHandler.java120
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortColumnsHandler.java126
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortRowsHandler.java124
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesCommandHandler.java168
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesHandler.java198
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideShowCategoryHandler.java274
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowAllCategoriesHandler.java126
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowHideCategoryCommandHandler.java80
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/DestroyTableAdviceHelper.java44
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/TableContentsAdviceHelper.java232
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/BodyLayerStack.java300
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java692
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/HideShowCategoriesTableListener.java636
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/NatTableDropListener.java602
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/UpdateTableContentListener.java610
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManagerForEventList.java466
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IAxisManagerForEventList.java88
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ICompositeAxisManagerForEventList.java62
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IIdAxisManager.java62
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisManagerForEventList.java198
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/TreeFillingConfigurationCellManager.java130
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITableAxisElementProvider.java144
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java224
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java236
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomImagePainter.java104
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusBeveledBorderDecorator.java156
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/AddToResource.java146
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IPastePostAction.java160
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IValueSetter.java72
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PastePostActionRegistry.java288
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PasteSeparator.java202
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/ReferenceValueSetter.java220
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/TextDelimiter.java148
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/PapyrusTablePreferenceStore.java136
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/TablePreferencesConstantsHelper.java172
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/IndexHeaderLabelProvider.java106
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/ProblemLabelProvider.java192
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomCellDragModeForColumn.java178
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomColumnReorderDragMode.java170
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java116
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ISelectionExtractor.java72
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ObjectsSelectionExtractor.java120
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/ColumnSortModel.java534
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/IPapyrusSortModel.java74
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/ITableTester.java68
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/TableTesterRegistry.java144
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/CollapseAndExpandActionsEnum.java126
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/DatumExpansionModel.java142
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisComparator.java216
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisConfigurationUtils.java160
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellMapKey.java174
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CollapseExpandActionHelper.java908
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/DefaultSizeUtils.java182
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/EventListHelper.java228
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/FillingConfigurationUtils.java870
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java412
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderCellContextElementWrapper.java56
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderContextElementWrapper.java82
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/INattableModelManagerUtils.java94
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelConfigurationManagementUtils.java620
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderCellContextElementWrapper.java486
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderContextElementWrapper.java206
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LocationValue.java458
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableMergePropertyTester.java404
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteConfigurationUtils.java164
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteEnablementStatus.java196
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteHelper.java308
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteModeEnumeration.java92
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteSeverityCode.java144
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteTreeUtils.java238
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StringComparator.java70
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableClipboardUtils.java376
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableEditingDomainUtils.java150
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableGridRegion.java46
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableSelectionHelper.java278
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java516
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/CategoriesWizardUtils.java140
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ChooseCategoriesSelectionWidget.java1464
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesSelectionWidget.java154
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesWizardPage.java134
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ITreeItemContentProvider.java198
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportCSVConfigurationPage.java436
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportInvertedTableErrorPage.java134
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportTableErrorPage.java136
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/SelectCategoriesWizardPage.java390
183 files changed, 18837 insertions, 18837 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/Activator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/Activator.java
index 9d449e2b73c..4035589452d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/Activator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/Activator.java
@@ -1,95 +1,95 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable;
-
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.papyrus.infra.nattable.preferences.PapyrusTablePreferenceStore;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.nattable"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- public static LogHelper log;
-
- /**
- * Storage for preferences.
- */
- protected IPreferenceStore papyrusPreferenceStore;
-
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
- *
- * @return
- */
- @Override
- public IPreferenceStore getPreferenceStore() {
- // Create the preference store lazily.
- if (this.papyrusPreferenceStore == null) {
- this.papyrusPreferenceStore = new PapyrusTablePreferenceStore(new InstanceScope(), getBundle().getSymbolicName());
- }
- return this.papyrusPreferenceStore;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.papyrus.infra.nattable.preferences.PapyrusTablePreferenceStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.nattable"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * Storage for preferences.
+ */
+ protected IPreferenceStore papyrusPreferenceStore;
+
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
+ *
+ * @return
+ */
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ // Create the preference store lazily.
+ if (this.papyrusPreferenceStore == null) {
+ this.papyrusPreferenceStore = new PapyrusTablePreferenceStore(new InstanceScope(), getBundle().getSymbolicName());
+ }
+ return this.papyrusPreferenceStore;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/accumulator/CustomRowOverrideLabelAccumulator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/accumulator/CustomRowOverrideLabelAccumulator.java
index fe56ce48ea5..31918c3e605 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/accumulator/CustomRowOverrideLabelAccumulator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/accumulator/CustomRowOverrideLabelAccumulator.java
@@ -1,70 +1,70 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.accumulator;
-
-import java.util.List;
-
-import org.eclipse.nebula.widgets.nattable.layer.ILayer;
-import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
-import org.eclipse.nebula.widgets.nattable.layer.cell.AbstractOverrider;
-
-/**
- *
- * This accumulator is used to register CellEditor on rows
- *
- */
-public class CustomRowOverrideLabelAccumulator extends AbstractOverrider {
-
- private final ILayer layer;
-
- public CustomRowOverrideLabelAccumulator(ILayer layer) {
- this.layer = layer;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator#accumulateConfigLabels(org.eclipse.nebula.widgets.nattable.layer.LabelStack, int, int)
- *
- * @param configLabels
- * @param columnPosition
- * @param rowPosition
- */
- @Override
- public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
- int rowIndex = layer.getRowIndexByPosition(rowPosition);
- List<String> overrides = getOverrides(Integer.valueOf(rowIndex));
- if (overrides != null) {
- for (String configLabel : overrides) {
- configLabels.addLabel(configLabel);
- }
- }
- }
-
- /**
- * Register labels to be contributed a column. This label will be applied to<br/>
- * all cells in the column.
- */
- public void registerRowOverrides(int rowIndex, String... configLabels) {
- super.registerOverrides(Integer.valueOf(rowIndex), configLabels);
- }
-
- /**
- * Register labels to be contributed a column. This label will be applied to<br/>
- * all cells in the column.
- */
- public void registerRowOverridesOnTop(int rowIndex, String... configLabels) {
- super.registerOverridesOnTop(Integer.valueOf(rowIndex), configLabels);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.accumulator;
+
+import java.util.List;
+
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
+import org.eclipse.nebula.widgets.nattable.layer.cell.AbstractOverrider;
+
+/**
+ *
+ * This accumulator is used to register CellEditor on rows
+ *
+ */
+public class CustomRowOverrideLabelAccumulator extends AbstractOverrider {
+
+ private final ILayer layer;
+
+ public CustomRowOverrideLabelAccumulator(ILayer layer) {
+ this.layer = layer;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator#accumulateConfigLabels(org.eclipse.nebula.widgets.nattable.layer.LabelStack, int, int)
+ *
+ * @param configLabels
+ * @param columnPosition
+ * @param rowPosition
+ */
+ @Override
+ public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
+ int rowIndex = layer.getRowIndexByPosition(rowPosition);
+ List<String> overrides = getOverrides(Integer.valueOf(rowIndex));
+ if (overrides != null) {
+ for (String configLabel : overrides) {
+ configLabels.addLabel(configLabel);
+ }
+ }
+ }
+
+ /**
+ * Register labels to be contributed a column. This label will be applied to<br/>
+ * all cells in the column.
+ */
+ public void registerRowOverrides(int rowIndex, String... configLabels) {
+ super.registerOverrides(Integer.valueOf(rowIndex), configLabels);
+ }
+
+ /**
+ * Register labels to be contributed a column. This label will be applied to<br/>
+ * all cells in the column.
+ */
+ public void registerRowOverridesOnTop(int rowIndex, String... configLabels) {
+ super.registerOverridesOnTop(Integer.valueOf(rowIndex), configLabels);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/advice/DeleteNatTableContextAdvice.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/advice/DeleteNatTableContextAdvice.java
index 2ee302e19fb..ad89427edfd 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/advice/DeleteNatTableContextAdvice.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/advice/DeleteNatTableContextAdvice.java
@@ -1,74 +1,74 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.advice;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-
-/**
- * Destroy the NatTable
- *
- *
- * @author Vincent Lorenzo
- *
- */
-public class DeleteNatTableContextAdvice extends AbstractEditHelperAdvice {
-
- /**
- *
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeDestroyDependentsCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) {
- final EObject objectToDestroy = request.getElementToDestroy();
- if (objectToDestroy == null) {
- return null;
- }
-
- final ECrossReferenceAdapter crossReferencerAdapter = ECrossReferenceAdapter.getCrossReferenceAdapter(objectToDestroy);
- if (crossReferencerAdapter != null) {
- final Collection<Setting> settings = crossReferencerAdapter.getNonNavigableInverseReferences(objectToDestroy);
- CompositeCommand cmd = new CompositeCommand(Messages.DeleteNatTableContextAdvice_DestroyNattableCommand);
- for (Setting currentSetting : settings) {
- final EObject currentEObject = currentSetting.getEObject();
- final EStructuralFeature currentfeature = currentSetting.getEStructuralFeature();
- if (currentEObject instanceof Table && currentfeature == NattablePackage.eINSTANCE.getTable_Context()) {
- final DestroyElementRequest request2 = new DestroyElementRequest(currentEObject, false);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(currentEObject);
- cmd.add(provider.getEditCommand(request2));
- }
- }
- if (!cmd.isEmpty()) {
- return cmd;
- }
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.advice;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+
+/**
+ * Destroy the NatTable
+ *
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class DeleteNatTableContextAdvice extends AbstractEditHelperAdvice {
+
+ /**
+ *
+ * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeDestroyDependentsCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest)
+ *
+ * @param request
+ * @return
+ */
+ @Override
+ protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) {
+ final EObject objectToDestroy = request.getElementToDestroy();
+ if (objectToDestroy == null) {
+ return null;
+ }
+
+ final ECrossReferenceAdapter crossReferencerAdapter = ECrossReferenceAdapter.getCrossReferenceAdapter(objectToDestroy);
+ if (crossReferencerAdapter != null) {
+ final Collection<Setting> settings = crossReferencerAdapter.getNonNavigableInverseReferences(objectToDestroy);
+ CompositeCommand cmd = new CompositeCommand(Messages.DeleteNatTableContextAdvice_DestroyNattableCommand);
+ for (Setting currentSetting : settings) {
+ final EObject currentEObject = currentSetting.getEObject();
+ final EStructuralFeature currentfeature = currentSetting.getEStructuralFeature();
+ if (currentEObject instanceof Table && currentfeature == NattablePackage.eINSTANCE.getTable_Context()) {
+ final DestroyElementRequest request2 = new DestroyElementRequest(currentEObject, false);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(currentEObject);
+ cmd.add(provider.getEditCommand(request2));
+ }
+ }
+ if (!cmd.isEmpty()) {
+ return cmd;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractComboAction.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractComboAction.java
index 1e9deab6d89..b24b778f504 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractComboAction.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractComboAction.java
@@ -1,84 +1,84 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor;
-
-import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
-import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
-
-/**
- *
- * This abstract class is used to declare addition action for a button located near a NatCombo
- *
- */
-public abstract class AbstractComboAction {
-
- /**
- * The NatCombo
- */
- protected NatCombo combo;
-
- /**
- * the column index of the edited cell
- */
- protected int columnIndex;
-
- /**
- * the row index of the edited cell
- */
- protected int rowIndex;
-
- /**
- * The combo box data provider
- */
- protected IComboBoxDataProvider dataProvider;
-
- /**
- *
- * Constructor.
- *
- * @param dataProvider
- * the data provider used for the combo
- */
- public AbstractComboAction(final IComboBoxDataProvider dataProvider) {
- this.dataProvider = dataProvider;
- }
-
- /**
- *
- * @param combo
- * the NatCombo
- */
- public void setNatCombo(final NatCombo combo) {
- this.combo = combo;
- }
-
- /**
- * This method is called when the button is pressed
- */
- public abstract void run();
-
-
- /**
- * Setter for the edited cell location
- *
- * @param columnIndex
- * the column index of the edited cell
- * @param rowIndex
- * the row index of the edited cell
- */
- public final void setCellLocation(int columnIndex, int rowIndex) {
- this.columnIndex = columnIndex;
- this.rowIndex = rowIndex;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor;
+
+import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
+import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
+
+/**
+ *
+ * This abstract class is used to declare addition action for a button located near a NatCombo
+ *
+ */
+public abstract class AbstractComboAction {
+
+ /**
+ * The NatCombo
+ */
+ protected NatCombo combo;
+
+ /**
+ * the column index of the edited cell
+ */
+ protected int columnIndex;
+
+ /**
+ * the row index of the edited cell
+ */
+ protected int rowIndex;
+
+ /**
+ * The combo box data provider
+ */
+ protected IComboBoxDataProvider dataProvider;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param dataProvider
+ * the data provider used for the combo
+ */
+ public AbstractComboAction(final IComboBoxDataProvider dataProvider) {
+ this.dataProvider = dataProvider;
+ }
+
+ /**
+ *
+ * @param combo
+ * the NatCombo
+ */
+ public void setNatCombo(final NatCombo combo) {
+ this.combo = combo;
+ }
+
+ /**
+ * This method is called when the button is pressed
+ */
+ public abstract void run();
+
+
+ /**
+ * Setter for the edited cell location
+ *
+ * @param columnIndex
+ * the column index of the edited cell
+ * @param rowIndex
+ * the row index of the edited cell
+ */
+ public final void setCellLocation(int columnIndex, int rowIndex) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractPapyrusStyledTextCellEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractPapyrusStyledTextCellEditor.java
index 1621ddefdc4..945a9b31fec 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractPapyrusStyledTextCellEditor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractPapyrusStyledTextCellEditor.java
@@ -1,225 +1,225 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.window.Window;
-import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
-import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * Abstract Class for StyledText cell editor.
- * This class is used for XText Cell Editor and text editor with completion
- *
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractPapyrusStyledTextCellEditor extends AbstractStyledTextCellEditor{
-
- /**
- * the table
- */
- protected final Table table;
-
- /**
- * the axis element on which this cell editor is declared
- */
- protected final Object axisElement;
-
- /**
- * the table element provider
- */
- protected final ITableAxisElementProvider elementProvider;
-
- /**
- * the configuration of the additional button
- */
- protected AbstractOpenDialogCellEditorButtonAction buttonConfiguration;
-
- /**
- * the controller of the editor
- */
- private Control editorControl;
-
- /**
- * the initial value
- */
- private Object originalValue;
-
- /**
- * the styled text
- */
- private StyledText text;
-
-
- /**
- *
- * Constructor.
- *
- * @param table
- * @param axisElement
- * @param elementProvider
- * @param commitOnUpDown
- * @param moveSelectionOnEnter
- */
- public AbstractPapyrusStyledTextCellEditor(final Table table, final Object axisElement, final ITableAxisElementProvider elementProvider, boolean commitOnUpDown, boolean moveSelectionOnEnter) {
- super(commitOnUpDown, moveSelectionOnEnter);
- this.table = table;
- this.axisElement = axisElement;
- this.elementProvider = elementProvider;
- }
-
- /**
- *
- * Constructor.
- *
- * @param table
- * @param axisElement
- * @param elementProvider
- */
- public AbstractPapyrusStyledTextCellEditor(final Table table, final Object axisElement, final ITableAxisElementProvider elementProvider) {
- this(table, axisElement, elementProvider, false);
- }
-
- /**
- *
- * Constructor.
- *
- * @param table
- * @param axisElement
- * @param elementProvider
- * @param commitOnUpDown
- */
- public AbstractPapyrusStyledTextCellEditor(final Table table, final Object axisElement, final ITableAxisElementProvider elementProvider, boolean commitOnUpDown) {
- this(table, axisElement, elementProvider, commitOnUpDown, false);
- }
-
- /**
- *
- * @return the edited object
- */
- protected abstract EObject getEditedEObject();
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.celleditor.AbstractStyledTextCellEditor#activateCell(org.eclipse.swt.widgets.Composite, java.lang.Object)
- *
- * @param parent
- * @param originalCanonicalValue
- * @return
- */
- @Override
- protected Control activateCell(Composite parent, Object originalCanonicalValue) {
- this.originalValue = originalCanonicalValue;
- Composite realParent = parent;
- if (this.buttonConfiguration != null) {
- realParent = new Composite(parent, SWT.NONE);
- }
- this.text = (StyledText) super.activateCell(realParent, originalCanonicalValue);
- if (this.buttonConfiguration != null) {
- this.editorControl = realParent;
- GridLayout gridLayout = new GridLayout(2, false);
- gridLayout.horizontalSpacing = 0;
- gridLayout.verticalSpacing = 0;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- realParent.setLayout(gridLayout);
-
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- text.setLayoutData(gridData);
-
- Button b = createAdditionalButton(realParent);
- GridData buttonGridData = new GridData(SWT.RIGHT, SWT.FILL, false, true);
- b.setLayoutData(buttonGridData);
- this.buttonConfiguration.setCellLocation(layerCell.getColumnIndex(), layerCell.getRowIndex());
- } else {
- this.editorControl = text;
- }
- return this.editorControl;
- }
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.celleditor.AbstractStyledTextCellEditor#getEditorControl()
- *
- * @return
- */
- @Override
- public Control getEditorControl() {
- return editorControl;
- }
-
- /**
- *
- * @param composite
- * the composite parent
- * @return
- * the created button
- *
- */
- protected Button createAdditionalButton(Composite composite) {
- Button button = new Button(composite, SWT.NONE);
- button.setText(this.buttonConfiguration.getText());
- button.setToolTipText(this.buttonConfiguration.getTooltipText());
- button.setImage(this.buttonConfiguration.getImage());
- button.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- runButtonAction();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- return button;
- }
-
-
- /**
- * execute the action declared in the button
- */
- protected void runButtonAction() {
- if (Window.OK == this.buttonConfiguration.openDialog(parent, originalValue, layerCell, configRegistry)) {
- setCanonicalValue(this.buttonConfiguration.getEditorValue());
- commit(MoveDirectionEnum.NONE);
- } else {
- close();
- }
- }
-
- /**
- * This method allow to define the behavior of the an additional button located at the right of the text field in the cell
- *
- * @param additionalAction
- */
- public void setOpenDialogCellEditorButtonAction(AbstractOpenDialogCellEditorButtonAction additionalAction) {
- this.buttonConfiguration = additionalAction;
- if (additionalAction != null) {
- Assert.isNotNull(additionalAction);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.window.Window;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * Abstract Class for StyledText cell editor.
+ * This class is used for XText Cell Editor and text editor with completion
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractPapyrusStyledTextCellEditor extends AbstractStyledTextCellEditor{
+
+ /**
+ * the table
+ */
+ protected final Table table;
+
+ /**
+ * the axis element on which this cell editor is declared
+ */
+ protected final Object axisElement;
+
+ /**
+ * the table element provider
+ */
+ protected final ITableAxisElementProvider elementProvider;
+
+ /**
+ * the configuration of the additional button
+ */
+ protected AbstractOpenDialogCellEditorButtonAction buttonConfiguration;
+
+ /**
+ * the controller of the editor
+ */
+ private Control editorControl;
+
+ /**
+ * the initial value
+ */
+ private Object originalValue;
+
+ /**
+ * the styled text
+ */
+ private StyledText text;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param table
+ * @param axisElement
+ * @param elementProvider
+ * @param commitOnUpDown
+ * @param moveSelectionOnEnter
+ */
+ public AbstractPapyrusStyledTextCellEditor(final Table table, final Object axisElement, final ITableAxisElementProvider elementProvider, boolean commitOnUpDown, boolean moveSelectionOnEnter) {
+ super(commitOnUpDown, moveSelectionOnEnter);
+ this.table = table;
+ this.axisElement = axisElement;
+ this.elementProvider = elementProvider;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param table
+ * @param axisElement
+ * @param elementProvider
+ */
+ public AbstractPapyrusStyledTextCellEditor(final Table table, final Object axisElement, final ITableAxisElementProvider elementProvider) {
+ this(table, axisElement, elementProvider, false);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param table
+ * @param axisElement
+ * @param elementProvider
+ * @param commitOnUpDown
+ */
+ public AbstractPapyrusStyledTextCellEditor(final Table table, final Object axisElement, final ITableAxisElementProvider elementProvider, boolean commitOnUpDown) {
+ this(table, axisElement, elementProvider, commitOnUpDown, false);
+ }
+
+ /**
+ *
+ * @return the edited object
+ */
+ protected abstract EObject getEditedEObject();
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.AbstractStyledTextCellEditor#activateCell(org.eclipse.swt.widgets.Composite, java.lang.Object)
+ *
+ * @param parent
+ * @param originalCanonicalValue
+ * @return
+ */
+ @Override
+ protected Control activateCell(Composite parent, Object originalCanonicalValue) {
+ this.originalValue = originalCanonicalValue;
+ Composite realParent = parent;
+ if (this.buttonConfiguration != null) {
+ realParent = new Composite(parent, SWT.NONE);
+ }
+ this.text = (StyledText) super.activateCell(realParent, originalCanonicalValue);
+ if (this.buttonConfiguration != null) {
+ this.editorControl = realParent;
+ GridLayout gridLayout = new GridLayout(2, false);
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.verticalSpacing = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 0;
+ realParent.setLayout(gridLayout);
+
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ text.setLayoutData(gridData);
+
+ Button b = createAdditionalButton(realParent);
+ GridData buttonGridData = new GridData(SWT.RIGHT, SWT.FILL, false, true);
+ b.setLayoutData(buttonGridData);
+ this.buttonConfiguration.setCellLocation(layerCell.getColumnIndex(), layerCell.getRowIndex());
+ } else {
+ this.editorControl = text;
+ }
+ return this.editorControl;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.AbstractStyledTextCellEditor#getEditorControl()
+ *
+ * @return
+ */
+ @Override
+ public Control getEditorControl() {
+ return editorControl;
+ }
+
+ /**
+ *
+ * @param composite
+ * the composite parent
+ * @return
+ * the created button
+ *
+ */
+ protected Button createAdditionalButton(Composite composite) {
+ Button button = new Button(composite, SWT.NONE);
+ button.setText(this.buttonConfiguration.getText());
+ button.setToolTipText(this.buttonConfiguration.getTooltipText());
+ button.setImage(this.buttonConfiguration.getImage());
+ button.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ runButtonAction();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ return button;
+ }
+
+
+ /**
+ * execute the action declared in the button
+ */
+ protected void runButtonAction() {
+ if (Window.OK == this.buttonConfiguration.openDialog(parent, originalValue, layerCell, configRegistry)) {
+ setCanonicalValue(this.buttonConfiguration.getEditorValue());
+ commit(MoveDirectionEnum.NONE);
+ } else {
+ close();
+ }
+ }
+
+ /**
+ * This method allow to define the behavior of the an additional button located at the right of the text field in the cell
+ *
+ * @param additionalAction
+ */
+ public void setOpenDialogCellEditorButtonAction(AbstractOpenDialogCellEditorButtonAction additionalAction) {
+ this.buttonConfiguration = additionalAction;
+ if (additionalAction != null) {
+ Assert.isNotNull(additionalAction);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ButtonConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ButtonConfiguration.java
index 779363e7890..cfcbed6eacc 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ButtonConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ButtonConfiguration.java
@@ -1,120 +1,120 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * This class allows to store required information to customize
- * a Button and define the action done when it is pressed.
- */
-public class ButtonConfiguration {
-
- /** The text to use for the button. */
- private String text;
-
- /** The tooltip to use for the button. */
- private String tooltipText;
-
- /** the action done by the button. */
- private AbstractComboAction action;
-
- /** the image to set on the button. */
- private Image image;
-
-
- /**
- * Gets the image.
- *
- * @return the image
- */
- public Image getImage() {
- return image;
- }
-
-
- /**
- * Sets the image.
- *
- * @param image
- * the new image
- */
- public void setImage(Image image) {
- this.image = image;
- }
-
-
- /**
- * Gets the text.
- *
- * @return the text
- */
- public String getText() {
- return text;
- }
-
-
- /**
- * Sets the text.
- *
- * @param text
- * the new text
- */
- public void setText(String text) {
- this.text = text;
- }
-
-
- /**
- * Gets the tooltip text.
- *
- * @return the tooltip text
- */
- public String getTooltipText() {
- return tooltipText;
- }
-
-
- /**
- * Sets the tooltip text.
- *
- * @param tooltipText
- * the new tooltip text
- */
- public void setTooltipText(String tooltipText) {
- this.tooltipText = tooltipText;
- }
-
-
- /**
- * Gets the action.
- *
- * @return the action
- */
- public AbstractComboAction getAction() {
- return action;
- }
-
-
- /**
- * Sets the action.
- *
- * @param action
- * the new action
- */
- public void setAction(AbstractComboAction action) {
- this.action = action;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This class allows to store required information to customize
+ * a Button and define the action done when it is pressed.
+ */
+public class ButtonConfiguration {
+
+ /** The text to use for the button. */
+ private String text;
+
+ /** The tooltip to use for the button. */
+ private String tooltipText;
+
+ /** the action done by the button. */
+ private AbstractComboAction action;
+
+ /** the image to set on the button. */
+ private Image image;
+
+
+ /**
+ * Gets the image.
+ *
+ * @return the image
+ */
+ public Image getImage() {
+ return image;
+ }
+
+
+ /**
+ * Sets the image.
+ *
+ * @param image
+ * the new image
+ */
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+
+ /**
+ * Gets the text.
+ *
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+
+ /**
+ * Sets the text.
+ *
+ * @param text
+ * the new text
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+
+ /**
+ * Gets the tooltip text.
+ *
+ * @return the tooltip text
+ */
+ public String getTooltipText() {
+ return tooltipText;
+ }
+
+
+ /**
+ * Sets the tooltip text.
+ *
+ * @param tooltipText
+ * the new tooltip text
+ */
+ public void setTooltipText(String tooltipText) {
+ this.tooltipText = tooltipText;
+ }
+
+
+ /**
+ * Gets the action.
+ *
+ * @return the action
+ */
+ public AbstractComboAction getAction() {
+ return action;
+ }
+
+
+ /**
+ * Sets the action.
+ *
+ * @param action
+ * the new action
+ */
+ public void setAction(AbstractComboAction action) {
+ this.action = action;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java
index 92411549901..c48fdc07d57 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java
@@ -1,177 +1,177 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor;
-
-import java.util.List;
-
-import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
-import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
-import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum;
-import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
-import org.eclipse.papyrus.infra.nattable.widget.NatComboButton;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class ComboBoxWithButtonCellEditor extends ComboBoxCellEditor {
-
- /**
- * the action done by the button
- */
- private ButtonConfiguration buttonConfiguration;
-
- /**
- *
- * Constructor.
- *
- * @param dataProvider
- * @param maxVisibleItems
- * @param freeEdit
- * @param multiselect
- * @param buttonConfig
- * the action done by the button
- */
- public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, boolean freeEdit, boolean multiselect, ButtonConfiguration buttonConfig) {
- this(dataProvider, maxVisibleItems, freeEdit, buttonConfig);
- setMultiselect(multiselect);
- }
-
- /**
- *
- * Constructor.
- *
- * @param dataProvider
- * @param maxVisibleItems
- * @param freeEdit
- * @param action
- */
- public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, boolean freeEdit, ButtonConfiguration action) {
- this(dataProvider, maxVisibleItems, action);
- setFreeEdit(freeEdit);
- }
-
- /**
- *
- * Constructor.
- *
- * @param dataProvider
- * @param maxVisibleItems
- * @param action
- */
- public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, ButtonConfiguration action) {
- super(dataProvider, maxVisibleItems);
- this.buttonConfiguration = action;
- }
-
- /**
- *
- * Constructor.
- *
- * @param dataProvider
- * @param action
- */
- public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, ButtonConfiguration action) {
- super(dataProvider);
- this.buttonConfiguration = action;
- }
-
- /**
- *
- * Constructor.
- *
- * @param canonicalValues
- * @param maxVisibleItems
- * @param freeEdit
- * @param multiselect
- * @param action
- */
- public ComboBoxWithButtonCellEditor(List<?> canonicalValues, int maxVisibleItems, boolean freeEdit, boolean multiselect, ButtonConfiguration action) {
- this(canonicalValues, maxVisibleItems, freeEdit, action);
- setMultiselect(multiselect);
- }
-
- /**
- *
- * Constructor.
- *
- * @param canonicalValues
- * @param maxVisibleItems
- * @param freeEdit
- * @param action
- */
- public ComboBoxWithButtonCellEditor(List<?> canonicalValues, int maxVisibleItems, boolean freeEdit, ButtonConfiguration action) {
- this(canonicalValues, maxVisibleItems, action);
- setFreeEdit(freeEdit);
- }
-
- /**
- *
- * Constructor.
- *
- * @param canonicalValues
- * @param maxVisibleItems
- * @param action
- */
- public ComboBoxWithButtonCellEditor(List<?> canonicalValues, int maxVisibleItems, ButtonConfiguration action) {
- super(canonicalValues, maxVisibleItems);
- this.buttonConfiguration = action;
- }
-
- /**
- *
- * Constructor.
- *
- * @param canonicalValues
- * @param action
- */
- public ComboBoxWithButtonCellEditor(List<?> canonicalValues, ButtonConfiguration action) {
- super(canonicalValues);
- this.buttonConfiguration = action;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor#createEditorControl(org.eclipse.swt.widgets.Composite)
- *
- * @param parent
- * @return
- */
- @Override
- public NatCombo createEditorControl(Composite parent) {
- int style = this.editMode == EditModeEnum.INLINE ? SWT.NONE : SWT.BORDER;
- final NatCombo combo = this.iconImage == null ? new NatComboButton(parent, this.cellStyle, this.maxVisibleItems, this.freeEdit, this.multiselect, style, buttonConfiguration) : new NatComboButton(parent, this.cellStyle, this.maxVisibleItems,
- this.freeEdit, this.multiselect, style, this.iconImage, buttonConfiguration);
-
- combo.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_IBEAM));
-
- if (multiselect) {
- combo.setMultiselectValueSeparator(this.multiselectValueSeparator);
- combo.setMultiselectTextBracket(this.multiselectTextPrefix, this.multiselectTextSuffix);
- }
-
- addNatComboListener(combo);
- // configure the action done by the button
- buttonConfiguration.getAction().setCellLocation(layerCell.getColumnIndex(), layerCell.getRowIndex());
- buttonConfiguration.getAction().setNatCombo(combo);
- return combo;
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor;
+
+import java.util.List;
+
+import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
+import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum;
+import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
+import org.eclipse.papyrus.infra.nattable.widget.NatComboButton;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ComboBoxWithButtonCellEditor extends ComboBoxCellEditor {
+
+ /**
+ * the action done by the button
+ */
+ private ButtonConfiguration buttonConfiguration;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param dataProvider
+ * @param maxVisibleItems
+ * @param freeEdit
+ * @param multiselect
+ * @param buttonConfig
+ * the action done by the button
+ */
+ public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, boolean freeEdit, boolean multiselect, ButtonConfiguration buttonConfig) {
+ this(dataProvider, maxVisibleItems, freeEdit, buttonConfig);
+ setMultiselect(multiselect);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param dataProvider
+ * @param maxVisibleItems
+ * @param freeEdit
+ * @param action
+ */
+ public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, boolean freeEdit, ButtonConfiguration action) {
+ this(dataProvider, maxVisibleItems, action);
+ setFreeEdit(freeEdit);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param dataProvider
+ * @param maxVisibleItems
+ * @param action
+ */
+ public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, ButtonConfiguration action) {
+ super(dataProvider, maxVisibleItems);
+ this.buttonConfiguration = action;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param dataProvider
+ * @param action
+ */
+ public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, ButtonConfiguration action) {
+ super(dataProvider);
+ this.buttonConfiguration = action;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param canonicalValues
+ * @param maxVisibleItems
+ * @param freeEdit
+ * @param multiselect
+ * @param action
+ */
+ public ComboBoxWithButtonCellEditor(List<?> canonicalValues, int maxVisibleItems, boolean freeEdit, boolean multiselect, ButtonConfiguration action) {
+ this(canonicalValues, maxVisibleItems, freeEdit, action);
+ setMultiselect(multiselect);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param canonicalValues
+ * @param maxVisibleItems
+ * @param freeEdit
+ * @param action
+ */
+ public ComboBoxWithButtonCellEditor(List<?> canonicalValues, int maxVisibleItems, boolean freeEdit, ButtonConfiguration action) {
+ this(canonicalValues, maxVisibleItems, action);
+ setFreeEdit(freeEdit);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param canonicalValues
+ * @param maxVisibleItems
+ * @param action
+ */
+ public ComboBoxWithButtonCellEditor(List<?> canonicalValues, int maxVisibleItems, ButtonConfiguration action) {
+ super(canonicalValues, maxVisibleItems);
+ this.buttonConfiguration = action;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param canonicalValues
+ * @param action
+ */
+ public ComboBoxWithButtonCellEditor(List<?> canonicalValues, ButtonConfiguration action) {
+ super(canonicalValues);
+ this.buttonConfiguration = action;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor#createEditorControl(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ * @return
+ */
+ @Override
+ public NatCombo createEditorControl(Composite parent) {
+ int style = this.editMode == EditModeEnum.INLINE ? SWT.NONE : SWT.BORDER;
+ final NatCombo combo = this.iconImage == null ? new NatComboButton(parent, this.cellStyle, this.maxVisibleItems, this.freeEdit, this.multiselect, style, buttonConfiguration) : new NatComboButton(parent, this.cellStyle, this.maxVisibleItems,
+ this.freeEdit, this.multiselect, style, this.iconImage, buttonConfiguration);
+
+ combo.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_IBEAM));
+
+ if (multiselect) {
+ combo.setMultiselectValueSeparator(this.multiselectValueSeparator);
+ combo.setMultiselectTextBracket(this.multiselectTextPrefix, this.multiselectTextSuffix);
+ }
+
+ addNatComboListener(combo);
+ // configure the action done by the button
+ buttonConfiguration.getAction().setCellLocation(layerCell.getColumnIndex(), layerCell.getRowIndex());
+ buttonConfiguration.getAction().setNatCombo(combo);
+ return combo;
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditor.java
index 132abde0c9d..3b97367c2ff 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditor.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
- * Vincent Lorenzo (vincent.lorenzo@cea.fr) - duplicate this class from nattable (change super class)
- *******************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
-import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * A specialization of {@link TextCellEditor} that uses a multi line text editor as
- * editor control. To support multi line editing correctly, the behaviour to commit
- * on pressing the enter key is disabled.
- * <p>
- * A multi line editor usually needs some space. Therefore it might be a good decision to set the configuration attribute {@link EditConfigAttributes#OPEN_IN_DIALOG} to <code>true</code> for this editor, so the editor always opens in a subdialog.
- * </p>
- * <p>
- * As some table layouts may support enough space for an inline cell editor, this editor does not specify {@link ICellEditor#openInline(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.util.List)} to always return <code>false</code>.
- * </p>
- *
- * @author Dirk Fauth
- *
- */
-public class MultiLineTextCellEditor extends TextCellEditor {
-
- /**
- * Flag to configure whether the text control should enable automatic line wrap behaviour
- * or not. By default this editor will support automatic line wrapping.
- */
- private boolean lineWrap = true;
-
- /**
- * Create a new multi line text editor that ensures to not commit the editor
- * value in case enter is typed. The text control will support automatic line wrapping.
- */
- public MultiLineTextCellEditor() {
- this(true);
- }
-
- /**
- * Create a new multi line text editor that ensures to not commit the editor
- * value in case enter is typed.
- *
- * @param lineWrap
- * Flag to configure whether the text control should enable automatic line
- * wrap behaviour or not.
- */
- public MultiLineTextCellEditor(boolean lineWrap) {
- this.commitOnEnter = false;
- this.lineWrap = lineWrap;
- }
-
- @Override
- public Text createEditorControl(Composite parent) {
- int style = HorizontalAlignmentEnum.getSWTStyle(this.cellStyle) | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL;
- if (lineWrap) {
- style = style | SWT.WRAP;
- } else {
- style = style | SWT.H_SCROLL;
- }
- final Text textControl = super.createEditorControl(parent, style);
-
- if (!openInline(this.configRegistry, this.labelStack.getLabels())) {
- // add the layout data directly so it will not be layouted by the CellEditDialog
- GridDataFactory.fillDefaults().grab(true, true).hint(100, 50).applyTo(textControl);
- }
-
- return textControl;
- }
-
- /**
- * @param lineWrap
- * <code>true</code> if the text control should enable automatic line
- * wrap behaviour, <code>false</code> if not
- */
- public void setLineWrap(boolean lineWrap) {
- this.lineWrap = lineWrap;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013 Dirk Fauth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Vincent Lorenzo (vincent.lorenzo@cea.fr) - duplicate this class from nattable (change super class)
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * A specialization of {@link TextCellEditor} that uses a multi line text editor as
+ * editor control. To support multi line editing correctly, the behaviour to commit
+ * on pressing the enter key is disabled.
+ * <p>
+ * A multi line editor usually needs some space. Therefore it might be a good decision to set the configuration attribute {@link EditConfigAttributes#OPEN_IN_DIALOG} to <code>true</code> for this editor, so the editor always opens in a subdialog.
+ * </p>
+ * <p>
+ * As some table layouts may support enough space for an inline cell editor, this editor does not specify {@link ICellEditor#openInline(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.util.List)} to always return <code>false</code>.
+ * </p>
+ *
+ * @author Dirk Fauth
+ *
+ */
+public class MultiLineTextCellEditor extends TextCellEditor {
+
+ /**
+ * Flag to configure whether the text control should enable automatic line wrap behaviour
+ * or not. By default this editor will support automatic line wrapping.
+ */
+ private boolean lineWrap = true;
+
+ /**
+ * Create a new multi line text editor that ensures to not commit the editor
+ * value in case enter is typed. The text control will support automatic line wrapping.
+ */
+ public MultiLineTextCellEditor() {
+ this(true);
+ }
+
+ /**
+ * Create a new multi line text editor that ensures to not commit the editor
+ * value in case enter is typed.
+ *
+ * @param lineWrap
+ * Flag to configure whether the text control should enable automatic line
+ * wrap behaviour or not.
+ */
+ public MultiLineTextCellEditor(boolean lineWrap) {
+ this.commitOnEnter = false;
+ this.lineWrap = lineWrap;
+ }
+
+ @Override
+ public Text createEditorControl(Composite parent) {
+ int style = HorizontalAlignmentEnum.getSWTStyle(this.cellStyle) | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL;
+ if (lineWrap) {
+ style = style | SWT.WRAP;
+ } else {
+ style = style | SWT.H_SCROLL;
+ }
+ final Text textControl = super.createEditorControl(parent, style);
+
+ if (!openInline(this.configRegistry, this.labelStack.getLabels())) {
+ // add the layout data directly so it will not be layouted by the CellEditDialog
+ GridDataFactory.fillDefaults().grab(true, true).hint(100, 50).applyTo(textControl);
+ }
+
+ return textControl;
+ }
+
+ /**
+ * @param lineWrap
+ * <code>true</code> if the text control should enable automatic line
+ * wrap behaviour, <code>false</code> if not
+ */
+ public void setLineWrap(boolean lineWrap) {
+ this.lineWrap = lineWrap;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditorEx.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditorEx.java
index 73d04de17d6..84982531c15 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditorEx.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/MultiLineTextCellEditorEx.java
@@ -1,152 +1,152 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA-LIST) - vincent.lorenzo@cea.fr
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.keys.IBindingService;
-
-/**
- *
- * @author Vincent Lorenzo
- * This multi line cell editor has the same behavior than spreadsheet (ALT+ENTER (Excel)for new line and ENTER to commit).
- * To get this behavior, we desactivate the filtering done by org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher. This class
- * set event.doit==false if the keypressed are binding for eclipse command (ALT-ENTER is registered to show property view)
- *
- * //TODO : the next version of nattable seems support this behavior with ALT-ENTER,
- */
-public class MultiLineTextCellEditorEx extends MultiLineTextCellEditor {
-
- /**
- * boolean indicating if the eclipse filter was activated when the editor has been created
- */
- private boolean initialValueForFilteringKeyPress;
-
- /**
- *
- * Constructor.
- *
- */
- public MultiLineTextCellEditorEx() {
- super();
- this.commitOnEnter = true;
- }
-
- /**
- *
- * Constructor.
- *
- * @param lineWrap
- */
- public MultiLineTextCellEditorEx(boolean lineWrap) {
- super(lineWrap);
- this.commitOnEnter = true;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.MultiLineTextCellEditor#createEditorControl(org.eclipse.swt.widgets.Composite)
- *
- * @param parent
- * @return
- */
- @Override
- public Text createEditorControl(Composite parent) {
- IBindingService service = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
- this.initialValueForFilteringKeyPress = service.isKeyFilterEnabled();
- if (this.initialValueForFilteringKeyPress) {
- service.setKeyFilterEnabled(false);
- }
- final Text text = super.createEditorControl(parent);
-
- // this listener allows us to initialize the text widget wit the best size in order to display the full lines of the text
- text.addControlListener(new ControlListener() {
-
- @Override
- public void controlResized(ControlEvent e) {
- final Rectangle bounds = text.getBounds();
- final int nbLines = text.getLineCount();
- text.removeControlListener(this);
- if (nbLines > 1) {
- text.setBounds(bounds.x, bounds.y, bounds.width, getBestHeight(text));
- }
- text.removeControlListener(this);
-
- }
-
- /**
- *
- * @see org.eclipse.swt.events.ControlListener#controlMoved(org.eclipse.swt.events.ControlEvent)
- *
- * @param e
- */
- @Override
- public void controlMoved(ControlEvent e) {
- // nothing to do
- }
- });
- return text;
- }
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.TextCellEditor#close()
- *
- */
- @Override
- public void close() {
- if (this.initialValueForFilteringKeyPress) {
- IBindingService service = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
- service.setKeyFilterEnabled(this.initialValueForFilteringKeyPress);
- }
- super.close();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.TextCellEditor#keyPressed(org.eclipse.swt.widgets.Composite, org.eclipse.swt.widgets.Text, org.eclipse.swt.events.KeyEvent)
- *
- * @param parent
- * @param text
- * @param event
- */
- @Override
- protected void keyPressed(Composite parent, Text text, KeyEvent event) {
- if (event.stateMask == SWT.ALT && (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR)) {
- text.insert(text.getLineDelimiter());
- // we resize the text widget in order to display all lines
- final Rectangle bounds = text.getBounds();
- text.setBounds(bounds.x, bounds.y, bounds.width, getBestHeight(text));
- } else {
- super.keyPressed(parent, text, event);
- }
- }
-
- /**
- *
- * @param text
- * the text widget
- * @return
- * the best height for the text widget according to the number of new line in the text + the height ot a line
- */
- protected final int getBestHeight(final Text text) {
- return (text.getLineCount() + 1) * text.getLineHeight();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) - vincent.lorenzo@cea.fr
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.keys.IBindingService;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ * This multi line cell editor has the same behavior than spreadsheet (ALT+ENTER (Excel)for new line and ENTER to commit).
+ * To get this behavior, we desactivate the filtering done by org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher. This class
+ * set event.doit==false if the keypressed are binding for eclipse command (ALT-ENTER is registered to show property view)
+ *
+ * //TODO : the next version of nattable seems support this behavior with ALT-ENTER,
+ */
+public class MultiLineTextCellEditorEx extends MultiLineTextCellEditor {
+
+ /**
+ * boolean indicating if the eclipse filter was activated when the editor has been created
+ */
+ private boolean initialValueForFilteringKeyPress;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public MultiLineTextCellEditorEx() {
+ super();
+ this.commitOnEnter = true;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param lineWrap
+ */
+ public MultiLineTextCellEditorEx(boolean lineWrap) {
+ super(lineWrap);
+ this.commitOnEnter = true;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.MultiLineTextCellEditor#createEditorControl(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ * @return
+ */
+ @Override
+ public Text createEditorControl(Composite parent) {
+ IBindingService service = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
+ this.initialValueForFilteringKeyPress = service.isKeyFilterEnabled();
+ if (this.initialValueForFilteringKeyPress) {
+ service.setKeyFilterEnabled(false);
+ }
+ final Text text = super.createEditorControl(parent);
+
+ // this listener allows us to initialize the text widget wit the best size in order to display the full lines of the text
+ text.addControlListener(new ControlListener() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ final Rectangle bounds = text.getBounds();
+ final int nbLines = text.getLineCount();
+ text.removeControlListener(this);
+ if (nbLines > 1) {
+ text.setBounds(bounds.x, bounds.y, bounds.width, getBestHeight(text));
+ }
+ text.removeControlListener(this);
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.swt.events.ControlListener#controlMoved(org.eclipse.swt.events.ControlEvent)
+ *
+ * @param e
+ */
+ @Override
+ public void controlMoved(ControlEvent e) {
+ // nothing to do
+ }
+ });
+ return text;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.TextCellEditor#close()
+ *
+ */
+ @Override
+ public void close() {
+ if (this.initialValueForFilteringKeyPress) {
+ IBindingService service = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
+ service.setKeyFilterEnabled(this.initialValueForFilteringKeyPress);
+ }
+ super.close();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.TextCellEditor#keyPressed(org.eclipse.swt.widgets.Composite, org.eclipse.swt.widgets.Text, org.eclipse.swt.events.KeyEvent)
+ *
+ * @param parent
+ * @param text
+ * @param event
+ */
+ @Override
+ protected void keyPressed(Composite parent, Text text, KeyEvent event) {
+ if (event.stateMask == SWT.ALT && (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR)) {
+ text.insert(text.getLineDelimiter());
+ // we resize the text widget in order to display all lines
+ final Rectangle bounds = text.getBounds();
+ text.setBounds(bounds.x, bounds.y, bounds.width, getBestHeight(text));
+ } else {
+ super.keyPressed(parent, text, event);
+ }
+ }
+
+ /**
+ *
+ * @param text
+ * the text widget
+ * @return
+ * the best height for the text widget according to the number of new line in the text + the height ot a line
+ */
+ protected final int getBestHeight(final Text text) {
+ return (text.getLineCount() + 1) * text.getLineHeight();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/TextCellEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/TextCellEditor.java
index faf2f154f57..56db4750355 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/TextCellEditor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/TextCellEditor.java
@@ -1,455 +1,455 @@
-/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA-LIST) - duplicated and adapted code from nattable project.
- *
- ******************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor;
-
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.edit.config.RenderErrorHandling;
-import org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor;
-import org.eclipse.nebula.widgets.nattable.edit.editor.ControlDecorationProvider;
-import org.eclipse.nebula.widgets.nattable.edit.editor.EditorSelectionEnum;
-import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
-import org.eclipse.nebula.widgets.nattable.edit.editor.IEditErrorHandler;
-import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
-import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum;
-import org.eclipse.nebula.widgets.nattable.style.IStyle;
-import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * {@link ICellEditor} implementation that wraps a SWT {@link Text} control to support
- * text editing. This is also the default editor in NatTable if you didn't configure
- * something else.
- *
- * duplicated and adapted code from nattable project. Add the method {@link #keyPressed(Composite, KeyEvent)} to allow to ovveride it
- */
-public class TextCellEditor extends AbstractCellEditor {
-
- /**
- * The Text control which is the editor wrapped by this TextCellEditor.
- */
- private Text text = null;
-
- /**
- * Flag to configure if the wrapped text editor control is editable or not.
- */
- private boolean editable = true;
-
- /**
- * Flag to configure whether the editor should commit and move the selection
- * in the corresponding way if the up or down key is pressed.
- */
- private final boolean commitOnUpDown;
-
- /**
- * Flag to configure whether the selection should move after a value was
- * committed after pressing enter.
- */
- private final boolean moveSelectionOnEnter;
-
- /**
- * The selection mode that should be used on activating the wrapped text control.
- * By default the behaviour is to set the selection at the end of the containing text
- * if the text editor control is activated with an initial value. If it is activated
- * only specifying the original canonical value, the default behaviour is to select
- * the whole text contained in the text editor control.
- *
- * <p>
- * You can override this default behaviour by setting an {@link EditorSelectionEnum} explicitly. With this you are able e.g. to set the selection at the beginning of the contained text, so writing in the text control will result in prefixing.
- *
- * <p>
- * Note that on overriding the behaviour, you override both activation cases.
- */
- private EditorSelectionEnum selectionMode;
-
- /**
- * The {@link ControlDecorationProvider} responsible for adding a {@link ControlDecoration} to the wrapped editor control. Can be configured via
- * convenience methods of this TextCellEditor.
- */
- protected final ControlDecorationProvider decorationProvider = new ControlDecorationProvider();
-
- /**
- * The {@link IEditErrorHandler} that is used for showing conversion errors on typing into
- * this editor. By default this is the {@link RenderErrorHandling} which will render the
- * content in the editor red to indicate a conversion error.
- */
- private IEditErrorHandler inputConversionErrorHandler = new RenderErrorHandling(decorationProvider);
-
- /**
- * The {@link IEditErrorHandler} that is used for showing validation errors on typing into
- * this editor. By default this is the {@link RenderErrorHandling} which will render the
- * content in the editor red to indicate a validation error.
- */
- private IEditErrorHandler inputValidationErrorHandler = new RenderErrorHandling(decorationProvider);
-
- /**
- * Flag to determine whether this editor should try to commit and close on pressing the enter key.
- * The default is of course <code>true</code>, but for a multi line text editor, the enter key
- * should be treated as inserting a new line instead of committing.
- */
- protected boolean commitOnEnter = true;
-
- /**
- * Creates the default TextCellEditor that does not commit on pressing the up/down arrow keys
- * and will not move the selection on committing a value by pressing enter.
- */
- public TextCellEditor() {
- this(false);
- }
-
- /**
- * Creates a TextCellEditor that will not move the selection on committing a value by pressing enter.
- *
- * @param commitOnUpDown
- * Flag to configure whether the editor should commit
- * and move the selection in the corresponding way if the up or down key is pressed.
- */
- public TextCellEditor(boolean commitOnUpDown) {
- this(commitOnUpDown, false);
- }
-
- /**
- * Creates a TextCellEditor.
- *
- * @param commitOnUpDown
- * Flag to configure whether the editor should commit
- * and move the selection in the corresponding way if the up or down key is pressed.
- * @param moveSelectionOnEnter
- * Flag to configure whether the selection should move after a value was
- * committed after pressing enter.
- */
- public TextCellEditor(boolean commitOnUpDown, boolean moveSelectionOnEnter) {
- this.commitOnUpDown = commitOnUpDown;
- this.moveSelectionOnEnter = moveSelectionOnEnter;
- }
-
- @Override
- protected Control activateCell(final Composite parent, Object originalCanonicalValue) {
- this.text = createEditorControl(parent);
-
- // If the originalCanonicalValue is a Character it is possible the editor is activated by keypress
- if (originalCanonicalValue instanceof Character) {
- this.text.setText(originalCanonicalValue.toString());
- selectText(this.selectionMode != null ? this.selectionMode : EditorSelectionEnum.END);
- }
- // if there is no initial value, handle the original canonical value to transfer it to the text control
- else {
- setCanonicalValue(originalCanonicalValue);
- selectText(this.selectionMode != null ? this.selectionMode : EditorSelectionEnum.ALL);
- }
-
- if (!isEditable()) {
- this.text.setEditable(false);
- }
-
- // show an error decoration if this is enabled
- this.decorationProvider.createErrorDecorationIfRequired(this.text);
-
- // if the input error handlers are of type RenderErrorHandler (default) than
- // we also check for a possible configured error styling in the configuration
- // Note: this is currently only implemented in here, as the TextCellEditor is
- // the only editor that supports just in time conversion/validation
- if (this.inputConversionErrorHandler instanceof RenderErrorHandling) {
- IStyle conversionErrorStyle = this.configRegistry.getConfigAttribute(EditConfigAttributes.CONVERSION_ERROR_STYLE, DisplayMode.EDIT, this.labelStack.getLabels());
-
- ((RenderErrorHandling) this.inputConversionErrorHandler).setErrorStyle(conversionErrorStyle);
- }
-
- if (this.inputValidationErrorHandler instanceof RenderErrorHandling) {
- IStyle validationErrorStyle = this.configRegistry.getConfigAttribute(EditConfigAttributes.VALIDATION_ERROR_STYLE, DisplayMode.EDIT, this.labelStack.getLabels());
-
- ((RenderErrorHandling) this.inputValidationErrorHandler).setErrorStyle(validationErrorStyle);
- }
-
- this.text.forceFocus();
-
- return this.text;
- }
-
- @Override
- public String getEditorValue() {
- return this.text.getText();
- }
-
- @Override
- public void setEditorValue(Object value) {
- this.text.setText(value != null && value.toString().length() > 0 ? value.toString() : ""); //$NON-NLS-1$
- }
-
- @Override
- public Text getEditorControl() {
- return this.text;
- }
-
- @Override
- public Text createEditorControl(Composite parent) {
- int style = HorizontalAlignmentEnum.getSWTStyle(this.cellStyle);
- if (this.editMode == EditModeEnum.DIALOG) {
- style = style | SWT.BORDER;
- }
- return createEditorControl(parent, style);
- }
-
- /**
- * Creates the editor control that is wrapped by this ICellEditor.
- * Will use the style configurations in ConfigRegistry for styling the control.
- *
- * @param parent
- * The Composite that will be the parent of the new editor control.
- * Can not be <code>null</code>
- * @param style
- * The SWT style of the text control to create.
- * @return The created editor control that is wrapped by this ICellEditor.
- */
- protected Text createEditorControl(final Composite parent, int style) {
- // create the Text control based on the specified style
- final Text textControl = new Text(parent, style);
-
- // set style information configured in the associated cell style
- textControl.setBackground(this.cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));
- textControl.setForeground(this.cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));
- textControl.setFont(this.cellStyle.getAttributeValue(CellStyleAttributes.FONT));
-
- textControl.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_IBEAM));
-
- // add a key listener that will commit or close the editor for special key strokes
- // and executes conversion/validation on input to the editor
- textControl.addKeyListener(new KeyAdapter() {
-
- @Override
- public void keyPressed(KeyEvent event) {
- TextCellEditor.this.keyPressed(parent, textControl, event);
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- try {
- // always do the conversion
- Object canonicalValue = getCanonicalValue(inputConversionErrorHandler);
- // and always do the validation
- // even if for commiting the validation should be skipped, on editing
- // a validation failure should be made visible
- // otherwise there would be no need for validation!
- validateCanonicalValue(canonicalValue, inputValidationErrorHandler);
- } catch (Exception ex) {
- // do nothing as exceptions caused by conversion or validation are handled already
- // we just need this catch block for stopping the process if conversion failed with
- // an exception
- }
- }
- });
-
- return textControl;
- }
-
- protected void keyPressed(Composite parent, Text text, KeyEvent event) {
- if (commitOnEnter && (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR)) {
-
- MoveDirectionEnum move = MoveDirectionEnum.NONE;
- if (moveSelectionOnEnter && editMode == EditModeEnum.INLINE) {
- if (event.stateMask == 0) {
- move = MoveDirectionEnum.DOWN;
- } else if (event.stateMask == SWT.SHIFT) {
- move = MoveDirectionEnum.UP;
- }
- }
-
- commit(move);
-
- if (editMode == EditModeEnum.DIALOG) {
- parent.forceFocus();
- }
- } else if (event.keyCode == SWT.ESC && event.stateMask == 0) {
- close();
- } else if (commitOnUpDown && editMode == EditModeEnum.INLINE) {
- if (event.keyCode == SWT.ARROW_UP) {
- commit(MoveDirectionEnum.UP);
- } else if (event.keyCode == SWT.ARROW_DOWN) {
- commit(MoveDirectionEnum.DOWN);
- }
- }
- }
-
- @Override
- public void close() {
- super.close();
-
- this.decorationProvider.dispose();
- }
-
- /**
- * @return <code>true</code> if the wrapped Text control is editable, <code>false</code> if not.
- */
- public boolean isEditable() {
- return editable;
- }
-
- /**
- *
- * @param editable
- * <code>true</code> if the wrapped Text control should be editable, <code>false</code> if not.
- */
- public void setEditable(boolean editable) {
- this.editable = editable;
- }
-
- /**
- * Returns the current configured selection mode that is used on activating the wrapped
- * text editor control. By default this is <code>null</code> which causes the following
- * default behaviour. If the text editor control is activated with an initial value then
- * the selection is set at the end of the containing text. If it is activated
- * only specifying the original canonical value, the default behaviour is to select
- * the whole text contained in the text editor control.
- *
- * @return The current configured selection mode, <code>null</code> for default behaviour.
- */
- public final EditorSelectionEnum getSelectionMode() {
- return selectionMode;
- }
-
- /**
- * Set the selection mode that should be used on the content of the wrapped text editor control
- * when it gets activated. By setting a value explicitly you configure the selection mode for
- * both cases, activating the wrapped text editor control with and without an initial value.
- * Setting this value to <code>null</code> will reactivate the default behaviour like described
- * here {@link TextCellEditor#getSelectionMode()}.
- *
- * @param selectionMode
- * The selection mode that should be used on the content of the
- * wrapped text editor control when it gets activated.
- */
- public final void setSelectionMode(EditorSelectionEnum selectionMode) {
- this.selectionMode = selectionMode;
- }
-
- /**
- * Will set the selection to the wrapped text control regarding the configured {@link EditorSelectionEnum}.
- *
- * <p>
- * This method is called
- *
- * @see Text#setSelection(int, int)
- */
- private void selectText(EditorSelectionEnum selectionMode) {
- int textLength = this.text.getText().length();
- if (textLength > 0) {
- if (selectionMode == EditorSelectionEnum.ALL) {
- this.text.setSelection(0, textLength);
- } else if (selectionMode == EditorSelectionEnum.END) {
- this.text.setSelection(textLength, textLength);
- } else if (selectionMode == EditorSelectionEnum.START) {
- this.text.setSelection(0);
- }
- }
- }
-
- /**
- * @return The {@link ControlDecorationProvider} responsible for adding a {@link ControlDecoration} to the wrapped editor control.
- */
- public ControlDecorationProvider getDecorationProvider() {
- return this.decorationProvider;
- }
-
- /**
- * Enables/disables the error decoration for the wrapped text control.
- *
- * @param enabled
- * <code>true</code> if an error decoration should be added to
- * the wrapped text control, <code>false</code> if not.
- */
- public void setErrorDecorationEnabled(boolean enabled) {
- this.decorationProvider.setErrorDecorationEnabled(enabled);
- }
-
- /**
- * Set the error description text that will be shown in the decoration hover.
- *
- * @param errorText
- * The text to be shown as a description for the decoration, or <code>null</code> if there should be no description.
- *
- * @see ControlDecoration#setDescriptionText(String)
- */
- public void setErrorDecorationText(String errorText) {
- this.decorationProvider.setErrorDecorationText(errorText);
- }
-
- /**
- * Force the error decoration hover to show immediately.
- *
- * @param customErrorText
- * The text to show in the hover popup.
- *
- * @see ControlDecoration#show()
- * @see ControlDecoration#showHoverText(String)
- */
- public void showErrorDecorationHover(String customErrorText) {
- this.decorationProvider.showErrorDecorationHover(customErrorText);
- }
-
- /**
- * Set the position of the control decoration relative to the control.
- * It should include style bits describing both the vertical and horizontal orientation.
- *
- * @param decorationPositionOverride
- * bit-wise or of position constants (<code>SWT.TOP</code>, <code>SWT.BOTTOM</code>, <code>SWT.LEFT</code>, <code>SWT.RIGHT</code>, and <code>SWT.CENTER</code>).
- *
- * @see ControlDecoration#ControlDecoration(Control, int)
- */
- public void setDecorationPositionOverride(int decorationPositionOverride) {
- this.decorationProvider.setDecorationPositionOverride(decorationPositionOverride);
- }
-
- /**
- * @return The {@link IEditErrorHandler} that is used for showing conversion errors on typing into
- * this editor. By default this is the {@link RenderErrorHandling} which will render the
- * content in the editor red to indicate a conversion error.
- */
- public IEditErrorHandler getInputConversionErrorHandler() {
- return this.inputConversionErrorHandler;
- }
-
- /**
- * @param inputConversionErrorHandler
- * The {@link IEditErrorHandler} that is should be used for showing
- * conversion errors on typing into this editor.
- */
- public void setInputConversionErrorHandler(IEditErrorHandler inputConversionErrorHandler) {
- this.inputConversionErrorHandler = inputConversionErrorHandler;
- }
-
- /**
- * @return The {@link IEditErrorHandler} that is used for showing validation errors on typing into
- * this editor. By default this is the {@link RenderErrorHandling} which will render the
- * content in the editor red to indicate a validation error.
- */
- public IEditErrorHandler getInputValidationErrorHandler() {
- return this.inputValidationErrorHandler;
- }
-
- /**
- * @param inputValidationErrorHandler
- * The {@link IEditErrorHandler} that is should used for showing
- * validation errors on typing into this editor.
- */
- public void setInputValidationErrorHandler(IEditErrorHandler inputValidationErrorHandler) {
- this.inputValidationErrorHandler = inputValidationErrorHandler;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) - duplicated and adapted code from nattable project.
+ *
+ ******************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor;
+
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.edit.config.RenderErrorHandling;
+import org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ControlDecorationProvider;
+import org.eclipse.nebula.widgets.nattable.edit.editor.EditorSelectionEnum;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.IEditErrorHandler;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
+import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum;
+import org.eclipse.nebula.widgets.nattable.style.IStyle;
+import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * {@link ICellEditor} implementation that wraps a SWT {@link Text} control to support
+ * text editing. This is also the default editor in NatTable if you didn't configure
+ * something else.
+ *
+ * duplicated and adapted code from nattable project. Add the method {@link #keyPressed(Composite, KeyEvent)} to allow to ovveride it
+ */
+public class TextCellEditor extends AbstractCellEditor {
+
+ /**
+ * The Text control which is the editor wrapped by this TextCellEditor.
+ */
+ private Text text = null;
+
+ /**
+ * Flag to configure if the wrapped text editor control is editable or not.
+ */
+ private boolean editable = true;
+
+ /**
+ * Flag to configure whether the editor should commit and move the selection
+ * in the corresponding way if the up or down key is pressed.
+ */
+ private final boolean commitOnUpDown;
+
+ /**
+ * Flag to configure whether the selection should move after a value was
+ * committed after pressing enter.
+ */
+ private final boolean moveSelectionOnEnter;
+
+ /**
+ * The selection mode that should be used on activating the wrapped text control.
+ * By default the behaviour is to set the selection at the end of the containing text
+ * if the text editor control is activated with an initial value. If it is activated
+ * only specifying the original canonical value, the default behaviour is to select
+ * the whole text contained in the text editor control.
+ *
+ * <p>
+ * You can override this default behaviour by setting an {@link EditorSelectionEnum} explicitly. With this you are able e.g. to set the selection at the beginning of the contained text, so writing in the text control will result in prefixing.
+ *
+ * <p>
+ * Note that on overriding the behaviour, you override both activation cases.
+ */
+ private EditorSelectionEnum selectionMode;
+
+ /**
+ * The {@link ControlDecorationProvider} responsible for adding a {@link ControlDecoration} to the wrapped editor control. Can be configured via
+ * convenience methods of this TextCellEditor.
+ */
+ protected final ControlDecorationProvider decorationProvider = new ControlDecorationProvider();
+
+ /**
+ * The {@link IEditErrorHandler} that is used for showing conversion errors on typing into
+ * this editor. By default this is the {@link RenderErrorHandling} which will render the
+ * content in the editor red to indicate a conversion error.
+ */
+ private IEditErrorHandler inputConversionErrorHandler = new RenderErrorHandling(decorationProvider);
+
+ /**
+ * The {@link IEditErrorHandler} that is used for showing validation errors on typing into
+ * this editor. By default this is the {@link RenderErrorHandling} which will render the
+ * content in the editor red to indicate a validation error.
+ */
+ private IEditErrorHandler inputValidationErrorHandler = new RenderErrorHandling(decorationProvider);
+
+ /**
+ * Flag to determine whether this editor should try to commit and close on pressing the enter key.
+ * The default is of course <code>true</code>, but for a multi line text editor, the enter key
+ * should be treated as inserting a new line instead of committing.
+ */
+ protected boolean commitOnEnter = true;
+
+ /**
+ * Creates the default TextCellEditor that does not commit on pressing the up/down arrow keys
+ * and will not move the selection on committing a value by pressing enter.
+ */
+ public TextCellEditor() {
+ this(false);
+ }
+
+ /**
+ * Creates a TextCellEditor that will not move the selection on committing a value by pressing enter.
+ *
+ * @param commitOnUpDown
+ * Flag to configure whether the editor should commit
+ * and move the selection in the corresponding way if the up or down key is pressed.
+ */
+ public TextCellEditor(boolean commitOnUpDown) {
+ this(commitOnUpDown, false);
+ }
+
+ /**
+ * Creates a TextCellEditor.
+ *
+ * @param commitOnUpDown
+ * Flag to configure whether the editor should commit
+ * and move the selection in the corresponding way if the up or down key is pressed.
+ * @param moveSelectionOnEnter
+ * Flag to configure whether the selection should move after a value was
+ * committed after pressing enter.
+ */
+ public TextCellEditor(boolean commitOnUpDown, boolean moveSelectionOnEnter) {
+ this.commitOnUpDown = commitOnUpDown;
+ this.moveSelectionOnEnter = moveSelectionOnEnter;
+ }
+
+ @Override
+ protected Control activateCell(final Composite parent, Object originalCanonicalValue) {
+ this.text = createEditorControl(parent);
+
+ // If the originalCanonicalValue is a Character it is possible the editor is activated by keypress
+ if (originalCanonicalValue instanceof Character) {
+ this.text.setText(originalCanonicalValue.toString());
+ selectText(this.selectionMode != null ? this.selectionMode : EditorSelectionEnum.END);
+ }
+ // if there is no initial value, handle the original canonical value to transfer it to the text control
+ else {
+ setCanonicalValue(originalCanonicalValue);
+ selectText(this.selectionMode != null ? this.selectionMode : EditorSelectionEnum.ALL);
+ }
+
+ if (!isEditable()) {
+ this.text.setEditable(false);
+ }
+
+ // show an error decoration if this is enabled
+ this.decorationProvider.createErrorDecorationIfRequired(this.text);
+
+ // if the input error handlers are of type RenderErrorHandler (default) than
+ // we also check for a possible configured error styling in the configuration
+ // Note: this is currently only implemented in here, as the TextCellEditor is
+ // the only editor that supports just in time conversion/validation
+ if (this.inputConversionErrorHandler instanceof RenderErrorHandling) {
+ IStyle conversionErrorStyle = this.configRegistry.getConfigAttribute(EditConfigAttributes.CONVERSION_ERROR_STYLE, DisplayMode.EDIT, this.labelStack.getLabels());
+
+ ((RenderErrorHandling) this.inputConversionErrorHandler).setErrorStyle(conversionErrorStyle);
+ }
+
+ if (this.inputValidationErrorHandler instanceof RenderErrorHandling) {
+ IStyle validationErrorStyle = this.configRegistry.getConfigAttribute(EditConfigAttributes.VALIDATION_ERROR_STYLE, DisplayMode.EDIT, this.labelStack.getLabels());
+
+ ((RenderErrorHandling) this.inputValidationErrorHandler).setErrorStyle(validationErrorStyle);
+ }
+
+ this.text.forceFocus();
+
+ return this.text;
+ }
+
+ @Override
+ public String getEditorValue() {
+ return this.text.getText();
+ }
+
+ @Override
+ public void setEditorValue(Object value) {
+ this.text.setText(value != null && value.toString().length() > 0 ? value.toString() : ""); //$NON-NLS-1$
+ }
+
+ @Override
+ public Text getEditorControl() {
+ return this.text;
+ }
+
+ @Override
+ public Text createEditorControl(Composite parent) {
+ int style = HorizontalAlignmentEnum.getSWTStyle(this.cellStyle);
+ if (this.editMode == EditModeEnum.DIALOG) {
+ style = style | SWT.BORDER;
+ }
+ return createEditorControl(parent, style);
+ }
+
+ /**
+ * Creates the editor control that is wrapped by this ICellEditor.
+ * Will use the style configurations in ConfigRegistry for styling the control.
+ *
+ * @param parent
+ * The Composite that will be the parent of the new editor control.
+ * Can not be <code>null</code>
+ * @param style
+ * The SWT style of the text control to create.
+ * @return The created editor control that is wrapped by this ICellEditor.
+ */
+ protected Text createEditorControl(final Composite parent, int style) {
+ // create the Text control based on the specified style
+ final Text textControl = new Text(parent, style);
+
+ // set style information configured in the associated cell style
+ textControl.setBackground(this.cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));
+ textControl.setForeground(this.cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));
+ textControl.setFont(this.cellStyle.getAttributeValue(CellStyleAttributes.FONT));
+
+ textControl.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_IBEAM));
+
+ // add a key listener that will commit or close the editor for special key strokes
+ // and executes conversion/validation on input to the editor
+ textControl.addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent event) {
+ TextCellEditor.this.keyPressed(parent, textControl, event);
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ try {
+ // always do the conversion
+ Object canonicalValue = getCanonicalValue(inputConversionErrorHandler);
+ // and always do the validation
+ // even if for commiting the validation should be skipped, on editing
+ // a validation failure should be made visible
+ // otherwise there would be no need for validation!
+ validateCanonicalValue(canonicalValue, inputValidationErrorHandler);
+ } catch (Exception ex) {
+ // do nothing as exceptions caused by conversion or validation are handled already
+ // we just need this catch block for stopping the process if conversion failed with
+ // an exception
+ }
+ }
+ });
+
+ return textControl;
+ }
+
+ protected void keyPressed(Composite parent, Text text, KeyEvent event) {
+ if (commitOnEnter && (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR)) {
+
+ MoveDirectionEnum move = MoveDirectionEnum.NONE;
+ if (moveSelectionOnEnter && editMode == EditModeEnum.INLINE) {
+ if (event.stateMask == 0) {
+ move = MoveDirectionEnum.DOWN;
+ } else if (event.stateMask == SWT.SHIFT) {
+ move = MoveDirectionEnum.UP;
+ }
+ }
+
+ commit(move);
+
+ if (editMode == EditModeEnum.DIALOG) {
+ parent.forceFocus();
+ }
+ } else if (event.keyCode == SWT.ESC && event.stateMask == 0) {
+ close();
+ } else if (commitOnUpDown && editMode == EditModeEnum.INLINE) {
+ if (event.keyCode == SWT.ARROW_UP) {
+ commit(MoveDirectionEnum.UP);
+ } else if (event.keyCode == SWT.ARROW_DOWN) {
+ commit(MoveDirectionEnum.DOWN);
+ }
+ }
+ }
+
+ @Override
+ public void close() {
+ super.close();
+
+ this.decorationProvider.dispose();
+ }
+
+ /**
+ * @return <code>true</code> if the wrapped Text control is editable, <code>false</code> if not.
+ */
+ public boolean isEditable() {
+ return editable;
+ }
+
+ /**
+ *
+ * @param editable
+ * <code>true</code> if the wrapped Text control should be editable, <code>false</code> if not.
+ */
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ /**
+ * Returns the current configured selection mode that is used on activating the wrapped
+ * text editor control. By default this is <code>null</code> which causes the following
+ * default behaviour. If the text editor control is activated with an initial value then
+ * the selection is set at the end of the containing text. If it is activated
+ * only specifying the original canonical value, the default behaviour is to select
+ * the whole text contained in the text editor control.
+ *
+ * @return The current configured selection mode, <code>null</code> for default behaviour.
+ */
+ public final EditorSelectionEnum getSelectionMode() {
+ return selectionMode;
+ }
+
+ /**
+ * Set the selection mode that should be used on the content of the wrapped text editor control
+ * when it gets activated. By setting a value explicitly you configure the selection mode for
+ * both cases, activating the wrapped text editor control with and without an initial value.
+ * Setting this value to <code>null</code> will reactivate the default behaviour like described
+ * here {@link TextCellEditor#getSelectionMode()}.
+ *
+ * @param selectionMode
+ * The selection mode that should be used on the content of the
+ * wrapped text editor control when it gets activated.
+ */
+ public final void setSelectionMode(EditorSelectionEnum selectionMode) {
+ this.selectionMode = selectionMode;
+ }
+
+ /**
+ * Will set the selection to the wrapped text control regarding the configured {@link EditorSelectionEnum}.
+ *
+ * <p>
+ * This method is called
+ *
+ * @see Text#setSelection(int, int)
+ */
+ private void selectText(EditorSelectionEnum selectionMode) {
+ int textLength = this.text.getText().length();
+ if (textLength > 0) {
+ if (selectionMode == EditorSelectionEnum.ALL) {
+ this.text.setSelection(0, textLength);
+ } else if (selectionMode == EditorSelectionEnum.END) {
+ this.text.setSelection(textLength, textLength);
+ } else if (selectionMode == EditorSelectionEnum.START) {
+ this.text.setSelection(0);
+ }
+ }
+ }
+
+ /**
+ * @return The {@link ControlDecorationProvider} responsible for adding a {@link ControlDecoration} to the wrapped editor control.
+ */
+ public ControlDecorationProvider getDecorationProvider() {
+ return this.decorationProvider;
+ }
+
+ /**
+ * Enables/disables the error decoration for the wrapped text control.
+ *
+ * @param enabled
+ * <code>true</code> if an error decoration should be added to
+ * the wrapped text control, <code>false</code> if not.
+ */
+ public void setErrorDecorationEnabled(boolean enabled) {
+ this.decorationProvider.setErrorDecorationEnabled(enabled);
+ }
+
+ /**
+ * Set the error description text that will be shown in the decoration hover.
+ *
+ * @param errorText
+ * The text to be shown as a description for the decoration, or <code>null</code> if there should be no description.
+ *
+ * @see ControlDecoration#setDescriptionText(String)
+ */
+ public void setErrorDecorationText(String errorText) {
+ this.decorationProvider.setErrorDecorationText(errorText);
+ }
+
+ /**
+ * Force the error decoration hover to show immediately.
+ *
+ * @param customErrorText
+ * The text to show in the hover popup.
+ *
+ * @see ControlDecoration#show()
+ * @see ControlDecoration#showHoverText(String)
+ */
+ public void showErrorDecorationHover(String customErrorText) {
+ this.decorationProvider.showErrorDecorationHover(customErrorText);
+ }
+
+ /**
+ * Set the position of the control decoration relative to the control.
+ * It should include style bits describing both the vertical and horizontal orientation.
+ *
+ * @param decorationPositionOverride
+ * bit-wise or of position constants (<code>SWT.TOP</code>, <code>SWT.BOTTOM</code>, <code>SWT.LEFT</code>, <code>SWT.RIGHT</code>, and <code>SWT.CENTER</code>).
+ *
+ * @see ControlDecoration#ControlDecoration(Control, int)
+ */
+ public void setDecorationPositionOverride(int decorationPositionOverride) {
+ this.decorationProvider.setDecorationPositionOverride(decorationPositionOverride);
+ }
+
+ /**
+ * @return The {@link IEditErrorHandler} that is used for showing conversion errors on typing into
+ * this editor. By default this is the {@link RenderErrorHandling} which will render the
+ * content in the editor red to indicate a conversion error.
+ */
+ public IEditErrorHandler getInputConversionErrorHandler() {
+ return this.inputConversionErrorHandler;
+ }
+
+ /**
+ * @param inputConversionErrorHandler
+ * The {@link IEditErrorHandler} that is should be used for showing
+ * conversion errors on typing into this editor.
+ */
+ public void setInputConversionErrorHandler(IEditErrorHandler inputConversionErrorHandler) {
+ this.inputConversionErrorHandler = inputConversionErrorHandler;
+ }
+
+ /**
+ * @return The {@link IEditErrorHandler} that is used for showing validation errors on typing into
+ * this editor. By default this is the {@link RenderErrorHandling} which will render the
+ * content in the editor red to indicate a validation error.
+ */
+ public IEditErrorHandler getInputValidationErrorHandler() {
+ return this.inputValidationErrorHandler;
+ }
+
+ /**
+ * @param inputValidationErrorHandler
+ * The {@link IEditErrorHandler} that is should used for showing
+ * validation errors on typing into this editor.
+ */
+ public void setInputValidationErrorHandler(IEditErrorHandler inputValidationErrorHandler) {
+ this.inputValidationErrorHandler = inputValidationErrorHandler;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfiguration.java
index a5e2aa34df0..d46096592e8 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfiguration.java
@@ -1,45 +1,45 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor.config;
-
-import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-
-
-
-public abstract class AbstractCellEditorConfiguration implements IAxisCellEditorConfiguration {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getDataValidator(Table, Object)
- *
- * @return
- * <code>null</code>
- */
- @Override
- public IDataValidator getDataValidator(Table table, Object axisElement) {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getEditorDescription()
- *
- * @return
- */
- @Override
- public String getEditorDescription() {
- return "No Existing Description"; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor.config;
+
+import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+
+
+public abstract class AbstractCellEditorConfiguration implements IAxisCellEditorConfiguration {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getDataValidator(Table, Object)
+ *
+ * @return
+ * <code>null</code>
+ */
+ @Override
+ public IDataValidator getDataValidator(Table table, Object axisElement) {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getEditorDescription()
+ *
+ * @return
+ */
+ @Override
+ public String getEditorDescription() {
+ return "No Existing Description"; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java
index 8ac0c7b2de0..dcb6d65e131 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java
@@ -1,111 +1,111 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor.config;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-
-/**
- *
- * The abstract class to used for CellEditorFactory
- *
- */
-public abstract class AbstractCellEditorConfigurationFactory {
-
- /**
- * the id of the factory
- */
- private String id;
-
- /**
- * the id of the extension point used to register contribution
- */
- public static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.celleditor.configuration"; //$NON-NLS-1$
-
- public static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
-
- public static final String FACTORY_ID_ATTRIBUTE = "factoryId"; //$NON-NLS-1$
-
- public static final String ORDER_ATTRIBUTE = "order"; //$NON-NLS-1$
-
- /**
- *
- * @param id
- * the id of the factory
- */
- public void initFactory(String id) {
- this.id = id;
- }
-
- /**
- *
- * @return
- * the id of the factory
- */
- public final String getFactoryId() {
- return this.id;
- }
-
- /**
- *
- * @return
- * the registered element for this factory
- */
- public Collection<IConfigurationElement> getAllRegisteredCellEditorConfiguration() {
- Collection<IConfigurationElement> elements = new ArrayList<IConfigurationElement>();
- final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
- for (final IConfigurationElement iConfigurationElement : configElements) {
- final String current = iConfigurationElement.getAttribute(FACTORY_ID_ATTRIBUTE);
- if (current.equals(this.id)) {
- elements.add(iConfigurationElement);
- }
- }
- return elements;
- }
-
- /**
- *
- * @param editorId
- * the editor id
- * @return
- * the configuration for this editor or <code>null</code> if the editor is not registered in this factory
- */
- public abstract IAxisCellEditorConfiguration getCellEditorConfiguration(final String editorId);
-
- /**
- *
- * @param table
- * the table
- * @param axisElement
- * an eobject
- * @return
- * <code>true</code> if this factory allows to edit the object for this table
- */
- public abstract boolean handles(final Table table, final Object axisElement);
-
- /**
- *
- * @param table
- * the table
- * @param axisElement
- * an eobject
- * @return
- * the cell editor configuration for the couple table - axisElement
- */
- public abstract IAxisCellEditorConfiguration getCellEditorConfiguration(Table table, final Object axisElement);
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor.config;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ *
+ * The abstract class to used for CellEditorFactory
+ *
+ */
+public abstract class AbstractCellEditorConfigurationFactory {
+
+ /**
+ * the id of the factory
+ */
+ private String id;
+
+ /**
+ * the id of the extension point used to register contribution
+ */
+ public static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.celleditor.configuration"; //$NON-NLS-1$
+
+ public static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
+ public static final String FACTORY_ID_ATTRIBUTE = "factoryId"; //$NON-NLS-1$
+
+ public static final String ORDER_ATTRIBUTE = "order"; //$NON-NLS-1$
+
+ /**
+ *
+ * @param id
+ * the id of the factory
+ */
+ public void initFactory(String id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ * @return
+ * the id of the factory
+ */
+ public final String getFactoryId() {
+ return this.id;
+ }
+
+ /**
+ *
+ * @return
+ * the registered element for this factory
+ */
+ public Collection<IConfigurationElement> getAllRegisteredCellEditorConfiguration() {
+ Collection<IConfigurationElement> elements = new ArrayList<IConfigurationElement>();
+ final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+ for (final IConfigurationElement iConfigurationElement : configElements) {
+ final String current = iConfigurationElement.getAttribute(FACTORY_ID_ATTRIBUTE);
+ if (current.equals(this.id)) {
+ elements.add(iConfigurationElement);
+ }
+ }
+ return elements;
+ }
+
+ /**
+ *
+ * @param editorId
+ * the editor id
+ * @return
+ * the configuration for this editor or <code>null</code> if the editor is not registered in this factory
+ */
+ public abstract IAxisCellEditorConfiguration getCellEditorConfiguration(final String editorId);
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * an eobject
+ * @return
+ * <code>true</code> if this factory allows to edit the object for this table
+ */
+ public abstract boolean handles(final Table table, final Object axisElement);
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * an eobject
+ * @return
+ * the cell editor configuration for the couple table - axisElement
+ */
+ public abstract IAxisCellEditorConfiguration getCellEditorConfiguration(Table table, final Object axisElement);
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/CellAxisConfigurationRegistry.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/CellAxisConfigurationRegistry.java
index 4f30cc60088..0defb7ecf30 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/CellAxisConfigurationRegistry.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/CellAxisConfigurationRegistry.java
@@ -1,158 +1,158 @@
-/*****************************************************************************
- * Copyright (c) 2015, 2017 CEA LIST, Christian W. Damus, and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 516309
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.celleditor.config;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.papyrus.infra.emf.Activator;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-
-/**
- * @author MA244259
- *
- */
-public class CellAxisConfigurationRegistry {
-
- private List<ICellAxisConfiguration> registry;
-
- public static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.celleditor.configuration"; //$NON-NLS-1$
-
- public static final String CELL_EDITOR_CONFIGURATION_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
-
- public static final String ORDER_ATTRIBUTE = "order"; //$NON-NLS-1$
-
- public static final CellAxisConfigurationRegistry INSTANCE = new CellAxisConfigurationRegistry();
-
- // public static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.papyrus.infra.nattable.celleditor";
-
- public static final String CONFIGURATION_EXT_NEW = "cellAxisConfiguration";
-
- /**
- *
- * Constructor.
- * Initial the registry of the configuration factories
- */
- private CellAxisConfigurationRegistry() {
- // to prevent instantiation
- final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
- // final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_NAMESPACE, EXTENSION_POINT_NAME, EXTENSION_ID);
- this.registry = new ArrayList<ICellAxisConfiguration>(configElements.length);
- final Map<ICellAxisConfiguration, Integer> ordering = new HashMap<ICellAxisConfiguration, Integer>();
- for (final IConfigurationElement iConfigurationElement : configElements) {
- if (CONFIGURATION_EXT_NEW.equals(iConfigurationElement.getName())) {
- // final String id = iConfigurationElement.getAttribute(FACTORY_ID_ATTRIBUTE);
- final Integer order = new Integer(iConfigurationElement.getAttribute(ORDER_ATTRIBUTE));
- try {
- final ICellAxisConfiguration factory = (ICellAxisConfiguration) iConfigurationElement.createExecutableExtension(CELL_EDITOR_CONFIGURATION_CLASS_ATTRIBUTE);
- // factory.initFactory(id);
-
- if (factory != null) {
- ordering.put(factory, order);
- this.registry.add(factory);
- }
- } catch (final CoreException e) {
- Activator.log.error(e);
- }
- }
- }
-
- // Sort by ordering key
- Collections.sort(this.registry, new Comparator<ICellAxisConfiguration>() {
- @Override
- public int compare(ICellAxisConfiguration o1, ICellAxisConfiguration o2) {
- return ordering.get(o1) - ordering.get(o2);
- }
- });
- }
-
- /**
- *
- * @param configurationId
- * the id of the factory
- * @return
- * the cellEditorFactory declared on this id or <code>null</code> if not found
- *
- *
- */
- public ICellAxisConfiguration getCellEditorConfiguration(final String configurationId) {
- Assert.isNotNull(configurationId);
- for (final ICellAxisConfiguration current : this.registry) {
- if (configurationId.equals(current.getConfigurationId())) {
- return current;
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * the table for which we are looking for a cell editor factory
- * @param obj
- * the object for which we are looking for a cell editor factory
- * @return
- * the first cell editor configuration factory which is able to manage this object
- */
- public ICellAxisConfiguration getFirstCellEditorConfiguration(final Table table, final Object obj) {
- final List<ICellAxisConfiguration> configurations = getCellEditorConfigurationFactories(table, obj);
- if (!configurations.isEmpty()) {
- return configurations.get(0);
- }
- return null;
- }
-
-
- /**
- *
- * @param tableManager
- * the table manager for which we are looking for a cell editor factory
- * @param obj
- * the object for which we are looking for a cell editor factory
- * @return
- * the first cell editor configuration factory which is able to manage this object
- */
- public ICellAxisConfiguration getFirstCellEditorConfiguration(final INattableModelManager tableManager, final Object obj) {
- return getFirstCellEditorConfiguration(tableManager.getTable(), obj);
- }
-
- /**
- *
- * @param table
- * the table for which we are looking for a cell editor factory
- * @param obj
- * the object for which we are looking for a cell editor factory
- * @return
- * the list of the cell editor configuration which are able to manage this object
- */
- public List<ICellAxisConfiguration> getCellEditorConfigurationFactories(final Table table, final Object obj) {
- final List<ICellAxisConfiguration> factories = new ArrayList<ICellAxisConfiguration>();
- for (final ICellAxisConfiguration current : this.registry) {
- if (current.handles(table, obj)) {
- factories.add(current);
- }
- }
- return factories;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015, 2017 CEA LIST, Christian W. Damus, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 516309
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.celleditor.config;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.infra.emf.Activator;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ * @author MA244259
+ *
+ */
+public class CellAxisConfigurationRegistry {
+
+ private List<ICellAxisConfiguration> registry;
+
+ public static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.celleditor.configuration"; //$NON-NLS-1$
+
+ public static final String CELL_EDITOR_CONFIGURATION_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
+ public static final String ORDER_ATTRIBUTE = "order"; //$NON-NLS-1$
+
+ public static final CellAxisConfigurationRegistry INSTANCE = new CellAxisConfigurationRegistry();
+
+ // public static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.papyrus.infra.nattable.celleditor";
+
+ public static final String CONFIGURATION_EXT_NEW = "cellAxisConfiguration";
+
+ /**
+ *
+ * Constructor.
+ * Initial the registry of the configuration factories
+ */
+ private CellAxisConfigurationRegistry() {
+ // to prevent instantiation
+ final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+ // final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_NAMESPACE, EXTENSION_POINT_NAME, EXTENSION_ID);
+ this.registry = new ArrayList<ICellAxisConfiguration>(configElements.length);
+ final Map<ICellAxisConfiguration, Integer> ordering = new HashMap<ICellAxisConfiguration, Integer>();
+ for (final IConfigurationElement iConfigurationElement : configElements) {
+ if (CONFIGURATION_EXT_NEW.equals(iConfigurationElement.getName())) {
+ // final String id = iConfigurationElement.getAttribute(FACTORY_ID_ATTRIBUTE);
+ final Integer order = new Integer(iConfigurationElement.getAttribute(ORDER_ATTRIBUTE));
+ try {
+ final ICellAxisConfiguration factory = (ICellAxisConfiguration) iConfigurationElement.createExecutableExtension(CELL_EDITOR_CONFIGURATION_CLASS_ATTRIBUTE);
+ // factory.initFactory(id);
+
+ if (factory != null) {
+ ordering.put(factory, order);
+ this.registry.add(factory);
+ }
+ } catch (final CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ // Sort by ordering key
+ Collections.sort(this.registry, new Comparator<ICellAxisConfiguration>() {
+ @Override
+ public int compare(ICellAxisConfiguration o1, ICellAxisConfiguration o2) {
+ return ordering.get(o1) - ordering.get(o2);
+ }
+ });
+ }
+
+ /**
+ *
+ * @param configurationId
+ * the id of the factory
+ * @return
+ * the cellEditorFactory declared on this id or <code>null</code> if not found
+ *
+ *
+ */
+ public ICellAxisConfiguration getCellEditorConfiguration(final String configurationId) {
+ Assert.isNotNull(configurationId);
+ for (final ICellAxisConfiguration current : this.registry) {
+ if (configurationId.equals(current.getConfigurationId())) {
+ return current;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * the table for which we are looking for a cell editor factory
+ * @param obj
+ * the object for which we are looking for a cell editor factory
+ * @return
+ * the first cell editor configuration factory which is able to manage this object
+ */
+ public ICellAxisConfiguration getFirstCellEditorConfiguration(final Table table, final Object obj) {
+ final List<ICellAxisConfiguration> configurations = getCellEditorConfigurationFactories(table, obj);
+ if (!configurations.isEmpty()) {
+ return configurations.get(0);
+ }
+ return null;
+ }
+
+
+ /**
+ *
+ * @param tableManager
+ * the table manager for which we are looking for a cell editor factory
+ * @param obj
+ * the object for which we are looking for a cell editor factory
+ * @return
+ * the first cell editor configuration factory which is able to manage this object
+ */
+ public ICellAxisConfiguration getFirstCellEditorConfiguration(final INattableModelManager tableManager, final Object obj) {
+ return getFirstCellEditorConfiguration(tableManager.getTable(), obj);
+ }
+
+ /**
+ *
+ * @param table
+ * the table for which we are looking for a cell editor factory
+ * @param obj
+ * the object for which we are looking for a cell editor factory
+ * @return
+ * the list of the cell editor configuration which are able to manage this object
+ */
+ public List<ICellAxisConfiguration> getCellEditorConfigurationFactories(final Table table, final Object obj) {
+ final List<ICellAxisConfiguration> factories = new ArrayList<ICellAxisConfiguration>();
+ for (final ICellAxisConfiguration current : this.registry) {
+ if (current.handles(table, obj)) {
+ factories.add(current);
+ }
+ }
+ return factories;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisCellEditorConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisCellEditorConfiguration.java
index 2425a64f6ab..96f0bc86cbb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisCellEditorConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisCellEditorConfiguration.java
@@ -1,113 +1,113 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor.config;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
-import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
-import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
-import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
-import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-
-/**
- *
- * This interface declares the methods used to get the element for the configuration of celleditors when they are declared by axis
- *
- */
-public interface IAxisCellEditorConfiguration {
-
- /**
- *
- * @param table
- * the table
- * @param axisElement
- * the axis element
- * @param provider
- * the label provider to use
- * @return
- * the display converter
- */
- public IDisplayConverter getDisplayConvert(Table table, Object axisElement, final ILabelProvider provider);
-
- /**
- *
- * @param table
- * the table
- * @param axisElement
- * the axis element
- * @return
- * the cell painter for the editor
- */
- public ICellPainter getCellPainter(Table table, Object axisElement);
-
- /**
- *
- * @param table
- * the table
- * @param axisElement
- * the edited element axis
- * @param elementProvider
- * @return
- */
- public ICellEditor getICellEditor(Table table, Object axisElement, ITableAxisElementProvider elementProvider);
-
-
- /**
- *
- * @param table
- * the table
- * @param axisElement
- * the axis element
- * @return
- * the display mode to use for the editor
- */
- public String getDisplayMode(Table table, Object axisElement);
-
- /**
- *
- * @return
- * the id of the editor
- */
- public String getEditorConfigId();
-
- /**
- *
- *
- * @param table
- * the table
- * @param axisElement
- * the axis element
- * @return the data validator
- */
- public IDataValidator getDataValidator(Table table, Object axisElement);
-
- /**
- *
- * @return
- * the description for the editor (should be used by the preferences)
- */
- public String getEditorDescription();
-
- /**
- *
- * @param table
- * the table
- * @param object
- * an object
- * @return
- * <code>true</code> if the cell editor configuration is able to manage the object
- */
- public boolean handles(Table table, Object object);
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor.config;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ *
+ * This interface declares the methods used to get the element for the configuration of celleditors when they are declared by axis
+ *
+ */
+public interface IAxisCellEditorConfiguration {
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * the axis element
+ * @param provider
+ * the label provider to use
+ * @return
+ * the display converter
+ */
+ public IDisplayConverter getDisplayConvert(Table table, Object axisElement, final ILabelProvider provider);
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * the axis element
+ * @return
+ * the cell painter for the editor
+ */
+ public ICellPainter getCellPainter(Table table, Object axisElement);
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * the edited element axis
+ * @param elementProvider
+ * @return
+ */
+ public ICellEditor getICellEditor(Table table, Object axisElement, ITableAxisElementProvider elementProvider);
+
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * the axis element
+ * @return
+ * the display mode to use for the editor
+ */
+ public String getDisplayMode(Table table, Object axisElement);
+
+ /**
+ *
+ * @return
+ * the id of the editor
+ */
+ public String getEditorConfigId();
+
+ /**
+ *
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * the axis element
+ * @return the data validator
+ */
+ public IDataValidator getDataValidator(Table table, Object axisElement);
+
+ /**
+ *
+ * @return
+ * the description for the editor (should be used by the preferences)
+ */
+ public String getEditorDescription();
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param object
+ * an object
+ * @return
+ * <code>true</code> if the cell editor configuration is able to manage the object
+ */
+ public boolean handles(Table table, Object object);
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisEStructuralFeatureCellEditorConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisEStructuralFeatureCellEditorConfiguration.java
index 9b11dc6aa1c..b287f42cde0 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisEStructuralFeatureCellEditorConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/IAxisEStructuralFeatureCellEditorConfiguration.java
@@ -1,35 +1,35 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.celleditor.config;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- *
- * A specific interface to declare editor on specific EStructuralFeature
- *
- * @deprecated because never used, since Papyrus 1.1.0
- */
-@Deprecated
-public interface IAxisEStructuralFeatureCellEditorConfiguration extends IAxisCellEditorConfiguration {
-
- /**
- *
- * @return
- * the edited feature
- */
- public Collection<EStructuralFeature> getEditedFeature();
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.celleditor.config;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ *
+ * A specific interface to declare editor on specific EStructuralFeature
+ *
+ * @deprecated because never used, since Papyrus 1.1.0
+ */
+@Deprecated
+public interface IAxisEStructuralFeatureCellEditorConfiguration extends IAxisCellEditorConfiguration {
+
+ /**
+ *
+ * @return
+ * the edited feature
+ */
+ public Collection<EStructuralFeature> getEditedFeature();
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/ICellAxisConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/ICellAxisConfiguration.java
index 362c2b086c3..bd0c82b3fc3 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/ICellAxisConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/ICellAxisConfiguration.java
@@ -1,40 +1,40 @@
-/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.celleditor.config;
-
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-
-/**
- * @author MA244259
- *
- */
-public interface ICellAxisConfiguration extends IPapyrusNatTableConfiguration{
-
- /**
- * @param table
- * @param axisElement
- * @return
- */
- boolean handles(Table table, Object axisElement);
-
- /**
- * @param configRegistry
- * @param axis
- * @param configLabel
- */
- void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.celleditor.config;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ * @author MA244259
+ *
+ */
+public interface ICellAxisConfiguration extends IPapyrusNatTableConfiguration{
+
+ /**
+ * @param table
+ * @param axisElement
+ * @return
+ */
+ boolean handles(Table table, Object axisElement);
+
+ /**
+ * @param configRegistry
+ * @param axis
+ * @param configLabel
+ */
+ void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel);
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/TableCommands.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/TableCommands.java
index 2b6ffeb1e21..e77afef60d1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/TableCommands.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/TableCommands.java
@@ -1,431 +1,431 @@
-/*****************************************************************************
- * Copyright (c) 2013, 2017 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 527734
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-
-/**
- * This class provides some useful commands used to edit the table properties
- *
- * @author Vincent Lorenzo
- *
- */
-public class TableCommands {
-
- /**
- *
- * Constructor.
- *
- */
- private TableCommands() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param table
- * the table
- * @param feature
- * the edited feature
- * @param newValue
- * the new value for this feature
- * @return
- * the command to change a value in the row configuration header of a table
- */
- // TODO : the handler must use me
- public static ICommand getSetRowHeaderConfigurationValueCommand(final Table table, final EStructuralFeature feature, final Object newValue) {
- final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
- final CompositeCommand compositeCommand = new CompositeCommand("SetRowHeaderConfigurationCommand"); //$NON-NLS-1$
- EObject elementToEdit = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisUsedInTable(table);
- if (elementToEdit instanceof TableHeaderAxisConfiguration) {
- elementToEdit = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) elementToEdit);
- SetRequest request = null;
- if (!table.isInvertAxis()) {
- request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration(), elementToEdit);
- } else {
- request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration(), elementToEdit);
- }
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
- final ICommand cmd = provider.getEditCommand(request);
- compositeCommand.add(cmd);
- }
- final SetRequest request = new SetRequest(domain, elementToEdit, feature, newValue);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToEdit);
- final ICommand cmd = provider.getEditCommand(request);
- compositeCommand.add(cmd);
- return compositeCommand;
- }
-
- /**
- *
- * @param table
- * the table
- * @param feature
- * the edited feature
- * @param newValue
- * the new value for this feature
- * @return
- * the command to change a value in the column configuration header of a table
- */
- // TODO : the handler must use me
- public static ICommand getSetColumnHeaderConfigurationValueCommand(final Table table, final EStructuralFeature feature, final Object newValue) {
- final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
- final CompositeCommand compositeCommand = new CompositeCommand("SetColumnHeaderConfigurationCommand"); //$NON-NLS-1$
- EObject elementToEdit = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(table);
- if (elementToEdit instanceof TableHeaderAxisConfiguration) {
- elementToEdit = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) elementToEdit);
- SetRequest request = null;
- if (table.isInvertAxis()) {
- request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration(), elementToEdit);
- } else {
- request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration(), elementToEdit);
- }
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
- final ICommand cmd = provider.getEditCommand(request);
- compositeCommand.add(cmd);
- }
- final SetRequest request = new SetRequest(domain, elementToEdit, feature, newValue);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToEdit);
- final ICommand cmd = provider.getEditCommand(request);
- compositeCommand.add(cmd);
- return compositeCommand;
- }
-
- /**
- *
- * @param table
- * the table
- * @param usedLabelConfiguration
- * the used label configuration
- * @param editedFeature
- * the edited feature
- * @param newValue
- * the new value for this feature
- * @return
- * the command to modify the feature value in the label configuration of the table. This command adds the localLabelConfiguration when it
- * is required
- */
- // TODO the handler must use me
- public static final ICommand getSetColumnLabelConfigurationValueCommand(final Table table, final ILabelProviderConfiguration usedLabelConfiguration, final EStructuralFeature editedFeature, final Object newValue) {
- final CompositeCommand cmd = new CompositeCommand("ChangeColumnLabelConfigurationValueCommand"); //$NON-NLS-1$
- TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
- ILabelProviderConfiguration editedLabelConf;
- if (usedLabelConfiguration.eContainer() instanceof TableHeaderAxisConfiguration) {
- editedLabelConf = EcoreUtil.copy(usedLabelConfiguration);
- cmd.add(getRegisterLocalColumnLabelConfigurationCommand(table, usedLabelConfiguration, editedLabelConf));
- } else {
- editedLabelConf = usedLabelConfiguration;
- }
- final IEditCommandRequest request = new SetRequest(domain, editedLabelConf, editedFeature, newValue);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(editedLabelConf);
- cmd.add(provider.getEditCommand(request));
- return cmd;
- }
-
- /**
- *
- * @param table
- * the table
- * @param usedLabelConfiguration
- * the used label configuration
- * @param editedFeature
- * the edited feature
- * @param newValue
- * the new value for this feature
- * @return
- * the command to modify the feature value in the label configuration of the table. This command adds the localLabelConfiguration when it
- * is required
- */
- // TODO the handler must use me
- public static final ICommand getSetRowLabelConfigurationValueCommand(final Table table, final ILabelProviderConfiguration usedLabelConfiguration, final EStructuralFeature editedFeature, final Object newValue) {
- final CompositeCommand cmd = new CompositeCommand("ChangeRowLabelConfigurationValueCommand"); //$NON-NLS-1$
- TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
- ILabelProviderConfiguration editedLabelConf;
- if (usedLabelConfiguration.eContainer() instanceof TableHeaderAxisConfiguration) {
- editedLabelConf = EcoreUtil.copy(usedLabelConfiguration);
- cmd.add(getRegisterLocalRowLabelConfigurationCommand(table, usedLabelConfiguration, editedLabelConf));
- } else {
- editedLabelConf = usedLabelConfiguration;
- }
- final IEditCommandRequest request = new SetRequest(domain, editedLabelConf, editedFeature, newValue);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(editedLabelConf);
- cmd.add(provider.getEditCommand(request));
- return cmd;
- }
-
-
- /**
- *
- * @param table
- * the table
- * @param tableLabelConfiguration
- * the table LabelConfiguration
- * @param localTableLabelConfiguration
- * the local table label configuration
- * @return
- * the command to register the local column label configuration to the table
- */
- private static final ICommand getRegisterLocalColumnLabelConfigurationCommand(final Table table, final ILabelProviderConfiguration tableLabelConfiguration, final ILabelProviderConfiguration localTableLabelConfiguration) {
- final AbstractHeaderAxisConfiguration abstractHeaderAxisUsedInTable = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(table);
-
- EStructuralFeature axisConfigurationFeature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- axisConfigurationFeature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
- }
-
- final TableHeaderAxisConfiguration headerAxisConfig = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(table);
- return getRegisterLocalLabelConfigurationCommand("ChangeColumnHeaderLabelConfigurationCommand", table, abstractHeaderAxisUsedInTable, headerAxisConfig, axisConfigurationFeature, localTableLabelConfiguration, tableLabelConfiguration); //$NON-NLS-1$
- }
-
-
- /**
- *
- * @param table
- * the table
- * @param tableLabelConfiguration
- * the table LabelConfiguration
- * @param localTableLabelConfiguration
- * the local table label configuration
- * @return
- * the command to register the local row label configuration to the table
- */
- private static final ICommand getRegisterLocalRowLabelConfigurationCommand(final Table table, final ILabelProviderConfiguration tableLabelConfiguration, final ILabelProviderConfiguration localTableLabelConfiguration) {
- AbstractHeaderAxisConfiguration abstractHeaderAxisUsedInTable = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisUsedInTable(table);
-
- EStructuralFeature axisConfigurationFeature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- axisConfigurationFeature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
- }
-
- final TableHeaderAxisConfiguration headerAxisConfig = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
- return getRegisterLocalLabelConfigurationCommand("ChangeRowHeaderLabelConfigurationCommand", table, abstractHeaderAxisUsedInTable, headerAxisConfig, axisConfigurationFeature, localTableLabelConfiguration, tableLabelConfiguration); //$NON-NLS-1$
- }
-
- /**
- *
- * @param commandName
- * the name of the command
- * @param table
- * the table to edit
- * @param headerAxisConfigurationUsedInTable
- * the headerAxisConfiguration currently used in the table
- * @param tableHeaderAxisConfiguration
- * the table header axis configuration defined in the table configuration
- * @param axisConfigurationFeature
- * the feature to use to register a local HeaderAxisConfiguration if it is required
- * @param localTableLabelConfiguration
- * the local table label configuration to register
- * @param tableLabelConfiguration
- * the table label configuration
- * @return
- * the command to register the local label configuration
- */
- private static final ICommand getRegisterLocalLabelConfigurationCommand(final String commandName, final Table table, final AbstractHeaderAxisConfiguration headerAxisConfigurationUsedInTable, final TableHeaderAxisConfiguration tableHeaderAxisConfiguration,
- final EStructuralFeature axisConfigurationFeature, final ILabelProviderConfiguration localTableLabelConfiguration, final ILabelProviderConfiguration tableLabelConfiguration) {
- final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
- final CompositeCommand cmd = new CompositeCommand(commandName);
-
- // 1. we must get or create the required LocalTableHeaderAxisConfiguration
- LocalTableHeaderAxisConfiguration localConfig = null;
- if (headerAxisConfigurationUsedInTable instanceof LocalTableHeaderAxisConfiguration) {
- localConfig = (LocalTableHeaderAxisConfiguration) headerAxisConfigurationUsedInTable;
- } else if (headerAxisConfigurationUsedInTable instanceof TableHeaderAxisConfiguration) {
- // we can't edit it, because it's comes from the initial configuration
- localConfig = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) headerAxisConfigurationUsedInTable);
- final IEditCommandRequest request = new SetRequest(domain, table, axisConfigurationFeature, localConfig);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
- cmd.add(provider.getEditCommand(request));
- }
-
- // 2. this one must store the new label configuration
- final IEditCommandRequest request = new SetRequest(domain, localConfig, NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_OwnedLabelConfigurations(), localTableLabelConfiguration);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(localConfig);
- cmd.add(provider.getEditCommand(request));
-
- // 3. we must get or create the AxisManagerConfiguration(s)
- final List<AxisManagerConfiguration> axisManagerConfiguration = new ArrayList<AxisManagerConfiguration>();
- for (final AxisManagerRepresentation current : tableHeaderAxisConfiguration.getAxisManagers()) {
- // we look for defined axis manager which uses the labelconfiguration defined in the table config
- if (current.getHeaderLabelConfiguration() == tableLabelConfiguration) {
- AxisManagerConfiguration currentConf = null;
- // we look for an axis manager configuration mapped in this axis manager representation
- for (final AxisManagerConfiguration axisConf : localConfig.getAxisManagerConfigurations()) {
- if (axisConf.getAxisManager() == current) {
- currentConf = axisConf;
- }
- }
- if (currentConf == null) {
- currentConf = NattableaxisconfigurationFactory.eINSTANCE.createAxisManagerConfiguration();
- currentConf.setAxisManager(current);
- final IEditCommandRequest request2 = new SetRequest(domain, localConfig, NattableaxisconfigurationPackage.eINSTANCE.getLocalTableHeaderAxisConfiguration_AxisManagerConfigurations(), currentConf);
- final IElementEditService provider2 = ElementEditServiceUtils.getCommandProvider(localConfig);
- cmd.add(provider2.getEditCommand(request2));
- }
- axisManagerConfiguration.add(currentConf);
- }
- }
-
- // 4. these one must reference the LabelConfiguration
- for (final AxisManagerConfiguration current : axisManagerConfiguration) {
- final IEditCommandRequest request2 = new SetRequest(domain, current, NattableaxisconfigurationPackage.eINSTANCE.getAxisManagerConfiguration_LocalHeaderLabelConfiguration(), localTableLabelConfiguration);
- final IElementEditService provider2 = ElementEditServiceUtils.getCommandProvider(current);
- cmd.add(provider2.getEditCommand(request2));
- }
- return cmd;
- }
-
-
- /**
- *
- * @param table
- * @param localHeaderAxisConfiguration
- * @param column
- * @return
- * the command to register the local table configuration into the table
- */
- private static final ICommand getRegisterLocalHeaderAxisConfigurationCommand(final Table table, final LocalTableHeaderAxisConfiguration localHeaderAxisConfiguration, final boolean workOnColumn) {
- final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
- final EStructuralFeature feature;
- if (registerOnColumn(table, workOnColumn)) {
- feature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
- } else {
- feature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
- }
- final SetRequest request = new SetRequest(domain, table, feature, localHeaderAxisConfiguration);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
- return provider.getEditCommand(request);
- }
-
-
- /**
- *
- * @param table
- * the table
- * @param configurationToAdd
- * the configuration to add
- * @param onColumn
- * boolean indicating if the user is editing dislpayed column or displayed row
- * @return
- * the command to add the axis configuration to the table
- */
- private static final ICommand getAddIAxisConfigurationToLocalTableHeaderAxisConfiguration(final Table table, final IAxisConfiguration configurationToAdd, final boolean onColumn) {
- final CompositeCommand compositeCommand = new CompositeCommand("Add IAxis Configuration to table header"); //$NON-NLS-1$
- final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
-
- // 1.we look for an existing local headerAxisConfigruation on the table
- AbstractHeaderAxisConfiguration headerAxisConfiguration = null;
- if (registerOnColumn(table, onColumn)) {
- headerAxisConfiguration = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTable(table);
- } else {
- headerAxisConfiguration = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTable(table);
- }
-
- // 2. if the local header axis doen't exist we create and register it
- if (headerAxisConfiguration == null) {
- final TableHeaderAxisConfiguration tableHeaderAxisConfiguration;
- final EStructuralFeature feature;
- if (registerOnColumn(table, onColumn)) {
- tableHeaderAxisConfiguration = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(table);
- feature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
- } else {
- tableHeaderAxisConfiguration = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
- feature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
- }
- headerAxisConfiguration = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration(tableHeaderAxisConfiguration);
- final SetRequest request = new SetRequest(domain, table, feature, headerAxisConfiguration);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
- compositeCommand.add(provider.getEditCommand(request));
- }
-
- // 3. we register the axis configuration to the local table header axis
- final SetRequest request = new SetRequest(domain, headerAxisConfiguration, NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_OwnedAxisConfigurations(), configurationToAdd);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(headerAxisConfiguration);
- compositeCommand.add(provider.getEditCommand(request));
- return compositeCommand;
- }
-
- /**
- *
- * @param table
- * the table
- * @param workOnColumn
- * a boolean indication if the user is work on displayed columns or on displayed row
- * @return
- * <code>true</code> if the operations must be done on column and false if the operations must be done on rows
- */
- private static final boolean registerOnColumn(final Table table, final boolean workOnColumn) {
- return workOnColumn || (!workOnColumn && table.isInvertAxis());
- }
-
- /**
- *
- * @param table
- * the table
- * @param editedConfiguration
- * the edited configuration
- * @param managedFeature
- * the managed feature
- * @param value
- * the new value for this feature
- * @param onColumn
- * <code>true</code> if we are working on column
- * @return
- * the command doing the set value
- */
- public static ICommand getSetIAxisConfigurationValueCommand(final Table table, final IAxisConfiguration editedConfiguration, final EStructuralFeature managedFeature, final Object value, boolean onColumn) {
- final CompositeCommand compositeCommand = new CompositeCommand("Set IAxis Value Command"); //$NON-NLS-1$
- final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
- final EObject parent = editedConfiguration.eContainer();
- IAxisConfiguration realEditedObject = editedConfiguration;
- // the current configuration doesn't exist in the instance of the table, we must add it
- if (parent == null) {
- compositeCommand.add(getAddIAxisConfigurationToLocalTableHeaderAxisConfiguration(table, editedConfiguration, onColumn));
- } else if (parent instanceof TableHeaderAxisConfiguration) {
- realEditedObject = EcoreUtil.copy(editedConfiguration);
- compositeCommand.add(getAddIAxisConfigurationToLocalTableHeaderAxisConfiguration(table, realEditedObject, onColumn));
- }
- final SetRequest request = new SetRequest(domain, realEditedObject, managedFeature, value);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(realEditedObject);
- compositeCommand.add(provider.getEditCommand(request));
- return compositeCommand;
- }
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013, 2017 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 527734
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+
+/**
+ * This class provides some useful commands used to edit the table properties
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class TableCommands {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ private TableCommands() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param feature
+ * the edited feature
+ * @param newValue
+ * the new value for this feature
+ * @return
+ * the command to change a value in the row configuration header of a table
+ */
+ // TODO : the handler must use me
+ public static ICommand getSetRowHeaderConfigurationValueCommand(final Table table, final EStructuralFeature feature, final Object newValue) {
+ final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
+ final CompositeCommand compositeCommand = new CompositeCommand("SetRowHeaderConfigurationCommand"); //$NON-NLS-1$
+ EObject elementToEdit = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisUsedInTable(table);
+ if (elementToEdit instanceof TableHeaderAxisConfiguration) {
+ elementToEdit = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) elementToEdit);
+ SetRequest request = null;
+ if (!table.isInvertAxis()) {
+ request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration(), elementToEdit);
+ } else {
+ request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration(), elementToEdit);
+ }
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
+ final ICommand cmd = provider.getEditCommand(request);
+ compositeCommand.add(cmd);
+ }
+ final SetRequest request = new SetRequest(domain, elementToEdit, feature, newValue);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToEdit);
+ final ICommand cmd = provider.getEditCommand(request);
+ compositeCommand.add(cmd);
+ return compositeCommand;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param feature
+ * the edited feature
+ * @param newValue
+ * the new value for this feature
+ * @return
+ * the command to change a value in the column configuration header of a table
+ */
+ // TODO : the handler must use me
+ public static ICommand getSetColumnHeaderConfigurationValueCommand(final Table table, final EStructuralFeature feature, final Object newValue) {
+ final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
+ final CompositeCommand compositeCommand = new CompositeCommand("SetColumnHeaderConfigurationCommand"); //$NON-NLS-1$
+ EObject elementToEdit = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(table);
+ if (elementToEdit instanceof TableHeaderAxisConfiguration) {
+ elementToEdit = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) elementToEdit);
+ SetRequest request = null;
+ if (table.isInvertAxis()) {
+ request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration(), elementToEdit);
+ } else {
+ request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration(), elementToEdit);
+ }
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
+ final ICommand cmd = provider.getEditCommand(request);
+ compositeCommand.add(cmd);
+ }
+ final SetRequest request = new SetRequest(domain, elementToEdit, feature, newValue);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToEdit);
+ final ICommand cmd = provider.getEditCommand(request);
+ compositeCommand.add(cmd);
+ return compositeCommand;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param usedLabelConfiguration
+ * the used label configuration
+ * @param editedFeature
+ * the edited feature
+ * @param newValue
+ * the new value for this feature
+ * @return
+ * the command to modify the feature value in the label configuration of the table. This command adds the localLabelConfiguration when it
+ * is required
+ */
+ // TODO the handler must use me
+ public static final ICommand getSetColumnLabelConfigurationValueCommand(final Table table, final ILabelProviderConfiguration usedLabelConfiguration, final EStructuralFeature editedFeature, final Object newValue) {
+ final CompositeCommand cmd = new CompositeCommand("ChangeColumnLabelConfigurationValueCommand"); //$NON-NLS-1$
+ TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
+ ILabelProviderConfiguration editedLabelConf;
+ if (usedLabelConfiguration.eContainer() instanceof TableHeaderAxisConfiguration) {
+ editedLabelConf = EcoreUtil.copy(usedLabelConfiguration);
+ cmd.add(getRegisterLocalColumnLabelConfigurationCommand(table, usedLabelConfiguration, editedLabelConf));
+ } else {
+ editedLabelConf = usedLabelConfiguration;
+ }
+ final IEditCommandRequest request = new SetRequest(domain, editedLabelConf, editedFeature, newValue);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(editedLabelConf);
+ cmd.add(provider.getEditCommand(request));
+ return cmd;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param usedLabelConfiguration
+ * the used label configuration
+ * @param editedFeature
+ * the edited feature
+ * @param newValue
+ * the new value for this feature
+ * @return
+ * the command to modify the feature value in the label configuration of the table. This command adds the localLabelConfiguration when it
+ * is required
+ */
+ // TODO the handler must use me
+ public static final ICommand getSetRowLabelConfigurationValueCommand(final Table table, final ILabelProviderConfiguration usedLabelConfiguration, final EStructuralFeature editedFeature, final Object newValue) {
+ final CompositeCommand cmd = new CompositeCommand("ChangeRowLabelConfigurationValueCommand"); //$NON-NLS-1$
+ TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
+ ILabelProviderConfiguration editedLabelConf;
+ if (usedLabelConfiguration.eContainer() instanceof TableHeaderAxisConfiguration) {
+ editedLabelConf = EcoreUtil.copy(usedLabelConfiguration);
+ cmd.add(getRegisterLocalRowLabelConfigurationCommand(table, usedLabelConfiguration, editedLabelConf));
+ } else {
+ editedLabelConf = usedLabelConfiguration;
+ }
+ final IEditCommandRequest request = new SetRequest(domain, editedLabelConf, editedFeature, newValue);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(editedLabelConf);
+ cmd.add(provider.getEditCommand(request));
+ return cmd;
+ }
+
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param tableLabelConfiguration
+ * the table LabelConfiguration
+ * @param localTableLabelConfiguration
+ * the local table label configuration
+ * @return
+ * the command to register the local column label configuration to the table
+ */
+ private static final ICommand getRegisterLocalColumnLabelConfigurationCommand(final Table table, final ILabelProviderConfiguration tableLabelConfiguration, final ILabelProviderConfiguration localTableLabelConfiguration) {
+ final AbstractHeaderAxisConfiguration abstractHeaderAxisUsedInTable = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(table);
+
+ EStructuralFeature axisConfigurationFeature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ axisConfigurationFeature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+ }
+
+ final TableHeaderAxisConfiguration headerAxisConfig = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(table);
+ return getRegisterLocalLabelConfigurationCommand("ChangeColumnHeaderLabelConfigurationCommand", table, abstractHeaderAxisUsedInTable, headerAxisConfig, axisConfigurationFeature, localTableLabelConfiguration, tableLabelConfiguration); //$NON-NLS-1$
+ }
+
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param tableLabelConfiguration
+ * the table LabelConfiguration
+ * @param localTableLabelConfiguration
+ * the local table label configuration
+ * @return
+ * the command to register the local row label configuration to the table
+ */
+ private static final ICommand getRegisterLocalRowLabelConfigurationCommand(final Table table, final ILabelProviderConfiguration tableLabelConfiguration, final ILabelProviderConfiguration localTableLabelConfiguration) {
+ AbstractHeaderAxisConfiguration abstractHeaderAxisUsedInTable = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisUsedInTable(table);
+
+ EStructuralFeature axisConfigurationFeature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ axisConfigurationFeature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+ }
+
+ final TableHeaderAxisConfiguration headerAxisConfig = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
+ return getRegisterLocalLabelConfigurationCommand("ChangeRowHeaderLabelConfigurationCommand", table, abstractHeaderAxisUsedInTable, headerAxisConfig, axisConfigurationFeature, localTableLabelConfiguration, tableLabelConfiguration); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @param commandName
+ * the name of the command
+ * @param table
+ * the table to edit
+ * @param headerAxisConfigurationUsedInTable
+ * the headerAxisConfiguration currently used in the table
+ * @param tableHeaderAxisConfiguration
+ * the table header axis configuration defined in the table configuration
+ * @param axisConfigurationFeature
+ * the feature to use to register a local HeaderAxisConfiguration if it is required
+ * @param localTableLabelConfiguration
+ * the local table label configuration to register
+ * @param tableLabelConfiguration
+ * the table label configuration
+ * @return
+ * the command to register the local label configuration
+ */
+ private static final ICommand getRegisterLocalLabelConfigurationCommand(final String commandName, final Table table, final AbstractHeaderAxisConfiguration headerAxisConfigurationUsedInTable, final TableHeaderAxisConfiguration tableHeaderAxisConfiguration,
+ final EStructuralFeature axisConfigurationFeature, final ILabelProviderConfiguration localTableLabelConfiguration, final ILabelProviderConfiguration tableLabelConfiguration) {
+ final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
+ final CompositeCommand cmd = new CompositeCommand(commandName);
+
+ // 1. we must get or create the required LocalTableHeaderAxisConfiguration
+ LocalTableHeaderAxisConfiguration localConfig = null;
+ if (headerAxisConfigurationUsedInTable instanceof LocalTableHeaderAxisConfiguration) {
+ localConfig = (LocalTableHeaderAxisConfiguration) headerAxisConfigurationUsedInTable;
+ } else if (headerAxisConfigurationUsedInTable instanceof TableHeaderAxisConfiguration) {
+ // we can't edit it, because it's comes from the initial configuration
+ localConfig = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) headerAxisConfigurationUsedInTable);
+ final IEditCommandRequest request = new SetRequest(domain, table, axisConfigurationFeature, localConfig);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
+ cmd.add(provider.getEditCommand(request));
+ }
+
+ // 2. this one must store the new label configuration
+ final IEditCommandRequest request = new SetRequest(domain, localConfig, NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_OwnedLabelConfigurations(), localTableLabelConfiguration);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(localConfig);
+ cmd.add(provider.getEditCommand(request));
+
+ // 3. we must get or create the AxisManagerConfiguration(s)
+ final List<AxisManagerConfiguration> axisManagerConfiguration = new ArrayList<AxisManagerConfiguration>();
+ for (final AxisManagerRepresentation current : tableHeaderAxisConfiguration.getAxisManagers()) {
+ // we look for defined axis manager which uses the labelconfiguration defined in the table config
+ if (current.getHeaderLabelConfiguration() == tableLabelConfiguration) {
+ AxisManagerConfiguration currentConf = null;
+ // we look for an axis manager configuration mapped in this axis manager representation
+ for (final AxisManagerConfiguration axisConf : localConfig.getAxisManagerConfigurations()) {
+ if (axisConf.getAxisManager() == current) {
+ currentConf = axisConf;
+ }
+ }
+ if (currentConf == null) {
+ currentConf = NattableaxisconfigurationFactory.eINSTANCE.createAxisManagerConfiguration();
+ currentConf.setAxisManager(current);
+ final IEditCommandRequest request2 = new SetRequest(domain, localConfig, NattableaxisconfigurationPackage.eINSTANCE.getLocalTableHeaderAxisConfiguration_AxisManagerConfigurations(), currentConf);
+ final IElementEditService provider2 = ElementEditServiceUtils.getCommandProvider(localConfig);
+ cmd.add(provider2.getEditCommand(request2));
+ }
+ axisManagerConfiguration.add(currentConf);
+ }
+ }
+
+ // 4. these one must reference the LabelConfiguration
+ for (final AxisManagerConfiguration current : axisManagerConfiguration) {
+ final IEditCommandRequest request2 = new SetRequest(domain, current, NattableaxisconfigurationPackage.eINSTANCE.getAxisManagerConfiguration_LocalHeaderLabelConfiguration(), localTableLabelConfiguration);
+ final IElementEditService provider2 = ElementEditServiceUtils.getCommandProvider(current);
+ cmd.add(provider2.getEditCommand(request2));
+ }
+ return cmd;
+ }
+
+
+ /**
+ *
+ * @param table
+ * @param localHeaderAxisConfiguration
+ * @param column
+ * @return
+ * the command to register the local table configuration into the table
+ */
+ private static final ICommand getRegisterLocalHeaderAxisConfigurationCommand(final Table table, final LocalTableHeaderAxisConfiguration localHeaderAxisConfiguration, final boolean workOnColumn) {
+ final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
+ final EStructuralFeature feature;
+ if (registerOnColumn(table, workOnColumn)) {
+ feature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+ } else {
+ feature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+ }
+ final SetRequest request = new SetRequest(domain, table, feature, localHeaderAxisConfiguration);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
+ return provider.getEditCommand(request);
+ }
+
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param configurationToAdd
+ * the configuration to add
+ * @param onColumn
+ * boolean indicating if the user is editing dislpayed column or displayed row
+ * @return
+ * the command to add the axis configuration to the table
+ */
+ private static final ICommand getAddIAxisConfigurationToLocalTableHeaderAxisConfiguration(final Table table, final IAxisConfiguration configurationToAdd, final boolean onColumn) {
+ final CompositeCommand compositeCommand = new CompositeCommand("Add IAxis Configuration to table header"); //$NON-NLS-1$
+ final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
+
+ // 1.we look for an existing local headerAxisConfigruation on the table
+ AbstractHeaderAxisConfiguration headerAxisConfiguration = null;
+ if (registerOnColumn(table, onColumn)) {
+ headerAxisConfiguration = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTable(table);
+ } else {
+ headerAxisConfiguration = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTable(table);
+ }
+
+ // 2. if the local header axis doen't exist we create and register it
+ if (headerAxisConfiguration == null) {
+ final TableHeaderAxisConfiguration tableHeaderAxisConfiguration;
+ final EStructuralFeature feature;
+ if (registerOnColumn(table, onColumn)) {
+ tableHeaderAxisConfiguration = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(table);
+ feature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+ } else {
+ tableHeaderAxisConfiguration = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
+ feature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+ }
+ headerAxisConfiguration = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration(tableHeaderAxisConfiguration);
+ final SetRequest request = new SetRequest(domain, table, feature, headerAxisConfiguration);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table);
+ compositeCommand.add(provider.getEditCommand(request));
+ }
+
+ // 3. we register the axis configuration to the local table header axis
+ final SetRequest request = new SetRequest(domain, headerAxisConfiguration, NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_OwnedAxisConfigurations(), configurationToAdd);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(headerAxisConfiguration);
+ compositeCommand.add(provider.getEditCommand(request));
+ return compositeCommand;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param workOnColumn
+ * a boolean indication if the user is work on displayed columns or on displayed row
+ * @return
+ * <code>true</code> if the operations must be done on column and false if the operations must be done on rows
+ */
+ private static final boolean registerOnColumn(final Table table, final boolean workOnColumn) {
+ return workOnColumn || (!workOnColumn && table.isInvertAxis());
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param editedConfiguration
+ * the edited configuration
+ * @param managedFeature
+ * the managed feature
+ * @param value
+ * the new value for this feature
+ * @param onColumn
+ * <code>true</code> if we are working on column
+ * @return
+ * the command doing the set value
+ */
+ public static ICommand getSetIAxisConfigurationValueCommand(final Table table, final IAxisConfiguration editedConfiguration, final EStructuralFeature managedFeature, final Object value, boolean onColumn) {
+ final CompositeCommand compositeCommand = new CompositeCommand("Set IAxis Value Command"); //$NON-NLS-1$
+ final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
+ final EObject parent = editedConfiguration.eContainer();
+ IAxisConfiguration realEditedObject = editedConfiguration;
+ // the current configuration doesn't exist in the instance of the table, we must add it
+ if (parent == null) {
+ compositeCommand.add(getAddIAxisConfigurationToLocalTableHeaderAxisConfiguration(table, editedConfiguration, onColumn));
+ } else if (parent instanceof TableHeaderAxisConfiguration) {
+ realEditedObject = EcoreUtil.copy(editedConfiguration);
+ compositeCommand.add(getAddIAxisConfigurationToLocalTableHeaderAxisConfiguration(table, realEditedObject, onColumn));
+ }
+ final SetRequest request = new SetRequest(domain, realEditedObject, managedFeature, value);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(realEditedObject);
+ compositeCommand.add(provider.getEditCommand(request));
+ return compositeCommand;
+ }
+
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/AbstractAxisComparator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/AbstractAxisComparator.java
index 40ac8e24915..9669c824990 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/AbstractAxisComparator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/AbstractAxisComparator.java
@@ -1,82 +1,82 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.comparator;
-
-import java.util.Comparator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.nattable.layerstack.BodyLayerStack;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-
-/**
- * Abstract class for axis comparator
- *
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractAxisComparator implements Comparator<Object> {
-
- /**
- * the table manager
- */
- protected final INattableModelManager tableManager;
-
- /**
- * the sort direction
- */
- protected final SortDirectionEnum direction;
-
- /**
- * the label provider service
- */
- protected final LabelProviderService serv;
-
- /**
- * the body layer stack
- */
- protected final BodyLayerStack stack;
-
- /**
- * the config registry
- */
- protected final IConfigRegistry configRegistry;
-
- /**
- * the selected column object
- */
- protected final Object selectedColumn;
-
- /**
- *
- * Constructor.
- *
- * @param selectedColumn
- * @param direction
- * @param tableManager
- */
- public AbstractAxisComparator(final Object selectedColumn, final SortDirectionEnum direction, final INattableModelManager tableManager) {
- this.configRegistry = ((NatTable) ((IAdaptable) tableManager).getAdapter(NatTable.class)).getConfigRegistry();
- this.tableManager = tableManager;
- this.direction = direction;
- this.selectedColumn = selectedColumn;
- this.serv = this.configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- this.stack = tableManager.getBodyLayerStack();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.comparator;
+
+import java.util.Comparator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.nattable.layerstack.BodyLayerStack;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+
+/**
+ * Abstract class for axis comparator
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractAxisComparator implements Comparator<Object> {
+
+ /**
+ * the table manager
+ */
+ protected final INattableModelManager tableManager;
+
+ /**
+ * the sort direction
+ */
+ protected final SortDirectionEnum direction;
+
+ /**
+ * the label provider service
+ */
+ protected final LabelProviderService serv;
+
+ /**
+ * the body layer stack
+ */
+ protected final BodyLayerStack stack;
+
+ /**
+ * the config registry
+ */
+ protected final IConfigRegistry configRegistry;
+
+ /**
+ * the selected column object
+ */
+ protected final Object selectedColumn;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param selectedColumn
+ * @param direction
+ * @param tableManager
+ */
+ public AbstractAxisComparator(final Object selectedColumn, final SortDirectionEnum direction, final INattableModelManager tableManager) {
+ this.configRegistry = ((NatTable) ((IAdaptable) tableManager).getAdapter(NatTable.class)).getConfigRegistry();
+ this.tableManager = tableManager;
+ this.direction = direction;
+ this.selectedColumn = selectedColumn;
+ this.serv = this.configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ this.stack = tableManager.getBodyLayerStack();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/DoubleFilterComparator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/DoubleFilterComparator.java
index 48f20426a4e..84f6ddf282c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/DoubleFilterComparator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/DoubleFilterComparator.java
@@ -1,74 +1,74 @@
-/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.comparator;
-
-import java.math.BigDecimal;
-import java.util.Comparator;
-
-import org.eclipse.papyrus.infra.nattable.filter.FilterPreferences;
-import org.eclipse.papyrus.infra.tools.util.TypeUtils;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class DoubleFilterComparator implements Comparator<Object> {
-
- private static DoubleFilterComparator singleton;
-
- /**
- *
- * @return
- */
- public static final DoubleFilterComparator getInstance() {
- if (singleton == null) {
- singleton = new DoubleFilterComparator();
- }
- return singleton;
- }
-
- /**
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- *
- * @param o1
- * @param o2
- * @return
- */
- @Override
- public int compare(Object o1, Object o2) {
- if (o1 instanceof Double && o2 instanceof Double) {
- Double d1 = (Double) o1;
- Double d2 = (Double) o2;
- return d1.compareTo(d2);
- }
- if (!(o1 instanceof Double)) {
- return FilterPreferences.INCONSISTENT_VALUE;
- }
- // o1 is the cell value and o2 the value to match
- if (o1 instanceof Double) {
- Double d1 = (Double) o1;
- Double d2 = null;
- if (o2 instanceof Double) {
- if (TypeUtils.isDoubleValue(o2.toString())) {
- // big decimal to avoid to get comma as separator instead of dot
- d2 = new BigDecimal(o2.toString()).doubleValue();
- return d1.compareTo(d2);
- }
- return FilterPreferences.INCONSISTENT_VALUE;
- }
- }
- return FilterPreferences.INCONSISTENT_VALUE;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.comparator;
+
+import java.math.BigDecimal;
+import java.util.Comparator;
+
+import org.eclipse.papyrus.infra.nattable.filter.FilterPreferences;
+import org.eclipse.papyrus.infra.tools.util.TypeUtils;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class DoubleFilterComparator implements Comparator<Object> {
+
+ private static DoubleFilterComparator singleton;
+
+ /**
+ *
+ * @return
+ */
+ public static final DoubleFilterComparator getInstance() {
+ if (singleton == null) {
+ singleton = new DoubleFilterComparator();
+ }
+ return singleton;
+ }
+
+ /**
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ @Override
+ public int compare(Object o1, Object o2) {
+ if (o1 instanceof Double && o2 instanceof Double) {
+ Double d1 = (Double) o1;
+ Double d2 = (Double) o2;
+ return d1.compareTo(d2);
+ }
+ if (!(o1 instanceof Double)) {
+ return FilterPreferences.INCONSISTENT_VALUE;
+ }
+ // o1 is the cell value and o2 the value to match
+ if (o1 instanceof Double) {
+ Double d1 = (Double) o1;
+ Double d2 = null;
+ if (o2 instanceof Double) {
+ if (TypeUtils.isDoubleValue(o2.toString())) {
+ // big decimal to avoid to get comma as separator instead of dot
+ d2 = new BigDecimal(o2.toString()).doubleValue();
+ return d1.compareTo(d2);
+ }
+ return FilterPreferences.INCONSISTENT_VALUE;
+ }
+ }
+ return FilterPreferences.INCONSISTENT_VALUE;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/RowComparator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/RowComparator.java
index d7893d18ea2..67c4336e96d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/RowComparator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/RowComparator.java
@@ -1,88 +1,88 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.comparator;
-
-import java.text.Collator;
-
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.utils.Constants;
-import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
-
-/**
- * Axis Comparator used to sort the rows according to the selected column
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowComparator extends AbstractAxisComparator {
-
- private LabelProviderCellContextElementWrapper wrapper1;
-
- private LabelProviderCellContextElementWrapper wrapper2;
-
- /**
- *
- * Constructor.
- *
- * @param selectedColumn
- * the selected column
- * @param direction
- * the direction to do the sort
- * @param tableManager
- * the table manager
- */
- public RowComparator(final Object selectedColumn, final SortDirectionEnum direction, final INattableModelManager tableManager) {
- super(selectedColumn, direction, tableManager);
- wrapper1 = new LabelProviderCellContextElementWrapper();
- wrapper2 = new LabelProviderCellContextElementWrapper();
- wrapper1.setConfigRegistry(configRegistry);
- wrapper2.setConfigRegistry(configRegistry);
- }
-
- /**
- *
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- *
- * @param o1
- * @param o2
- * @return
- */
- @Override
- public int compare(final Object o1, final Object o2) {
- int index_01 = tableManager.getRowElementsList().indexOf(o1);
- int index_02 = tableManager.getRowElementsList().indexOf(o2);
- int columnIndex = tableManager.getColumnElementsList().indexOf(selectedColumn);
- if (columnIndex == -1) {
- return 0;
- }
- final ILayerCell cell_O1 = stack.getSelectionLayer().getCellByPosition(columnIndex, index_01);
- final ILayerCell cell_O2 = stack.getSelectionLayer().getCellByPosition(columnIndex, index_02);
-
- wrapper1.setCell(cell_O1);
- wrapper1.setObject(cell_O1.getDataValue());
- wrapper2.setCell(cell_O2);
- wrapper2.setObject(cell_O2.getDataValue());
- final String txt1 = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT).getText(wrapper1);
- final String txt2 = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT).getText(wrapper2);
- final int res;
- if (direction == SortDirectionEnum.DESC) {
- res = Collator.getInstance().compare(txt2, txt1);
- } else {
- res = Collator.getInstance().compare(txt1, txt2);
- }
- return res;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.comparator;
+
+import java.text.Collator;
+
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.Constants;
+import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
+
+/**
+ * Axis Comparator used to sort the rows according to the selected column
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowComparator extends AbstractAxisComparator {
+
+ private LabelProviderCellContextElementWrapper wrapper1;
+
+ private LabelProviderCellContextElementWrapper wrapper2;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param selectedColumn
+ * the selected column
+ * @param direction
+ * the direction to do the sort
+ * @param tableManager
+ * the table manager
+ */
+ public RowComparator(final Object selectedColumn, final SortDirectionEnum direction, final INattableModelManager tableManager) {
+ super(selectedColumn, direction, tableManager);
+ wrapper1 = new LabelProviderCellContextElementWrapper();
+ wrapper2 = new LabelProviderCellContextElementWrapper();
+ wrapper1.setConfigRegistry(configRegistry);
+ wrapper2.setConfigRegistry(configRegistry);
+ }
+
+ /**
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ @Override
+ public int compare(final Object o1, final Object o2) {
+ int index_01 = tableManager.getRowElementsList().indexOf(o1);
+ int index_02 = tableManager.getRowElementsList().indexOf(o2);
+ int columnIndex = tableManager.getColumnElementsList().indexOf(selectedColumn);
+ if (columnIndex == -1) {
+ return 0;
+ }
+ final ILayerCell cell_O1 = stack.getSelectionLayer().getCellByPosition(columnIndex, index_01);
+ final ILayerCell cell_O2 = stack.getSelectionLayer().getCellByPosition(columnIndex, index_02);
+
+ wrapper1.setCell(cell_O1);
+ wrapper1.setObject(cell_O1.getDataValue());
+ wrapper2.setCell(cell_O2);
+ wrapper2.setObject(cell_O2.getDataValue());
+ final String txt1 = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT).getText(wrapper1);
+ final String txt2 = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT).getText(wrapper2);
+ final int res;
+ if (direction == SortDirectionEnum.DESC) {
+ res = Collator.getInstance().compare(txt2, txt1);
+ } else {
+ res = Collator.getInstance().compare(txt1, txt2);
+ }
+ return res;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CornerConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CornerConfiguration.java
index 2479f404fd7..d847f292ddc 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CornerConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CornerConfiguration.java
@@ -1,79 +1,79 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
-import org.eclipse.nebula.widgets.nattable.ui.action.IMouseAction;
-import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.swt.events.MouseEvent;
-
-/**
- *
- * This configuration allows to add action clicking on the top left corner of the table
- *
- */
-public class CornerConfiguration extends AbstractRegistryConfiguration {
-
- /**
- * the manager of the table
- */
- private INattableModelManager manager;
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the manager of the table
- */
- public CornerConfiguration(final INattableModelManager manager) {
- this.manager = manager;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
- *
- * @param uiBindingRegistry
- */
- @Override
- public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
- super.configureUiBindings(uiBindingRegistry);
- uiBindingRegistry.registerSingleClickBinding(new MouseEventMatcher(GridRegion.CORNER), new IMouseAction() {
-
- @Override
- public void run(final NatTable natTable, final MouseEvent event) {
- manager.selectAll();
- }
- });
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param configRegistry
- */
- @Override
- public void configureRegistry(IConfigRegistry configRegistry) {
- // nothing to do
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.ui.action.IMouseAction;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.swt.events.MouseEvent;
+
+/**
+ *
+ * This configuration allows to add action clicking on the top left corner of the table
+ *
+ */
+public class CornerConfiguration extends AbstractRegistryConfiguration {
+
+ /**
+ * the manager of the table
+ */
+ private INattableModelManager manager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the manager of the table
+ */
+ public CornerConfiguration(final INattableModelManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ super.configureUiBindings(uiBindingRegistry);
+ uiBindingRegistry.registerSingleClickBinding(new MouseEventMatcher(GridRegion.CORNER), new IMouseAction() {
+
+ @Override
+ public void run(final NatTable natTable, final MouseEvent event) {
+ manager.selectAll();
+ }
+ });
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param configRegistry
+ */
+ @Override
+ public void configureRegistry(IConfigRegistry configRegistry) {
+ // nothing to do
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/EditConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/EditConfiguration.java
index 347d7a23901..cfd73f6b64a 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/EditConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/EditConfiguration.java
@@ -1,95 +1,95 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Vincent Lorenzo (CEA-MIST) - 463058: [Table 2] Invert Axis + add/remove columns break the display of the table
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.config.EditableRule;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
-
-
-/**
- *
- * The configuration for the edition of the table.
- *
- * This configuration listen some elements to reset the cell editor declaration when required:
- * <li>the elements list to be able to reset the cell editor configuration after add/remove axis</li>
- * <li>the attribute invert axis of the table</li>
- * <li>the nattable widget to be able to remove added listener when the widget is disposed</li>
- *
- */
-public class EditConfiguration extends DefaultEditConfiguration {
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param configRegistry
- */
- @Override
- public void configureRegistry(IConfigRegistry configRegistry) {
- // we call the super implementation
- super.configureRegistry(configRegistry);
-
- // we remove the default cell editor
- configRegistry.unregisterConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.NORMAL, null);
-
- INattableModelManager manager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, new PapyrusEditableRule(manager));
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, null, DisplayMode.EDIT, ""); //$NON-NLS-1$
- }
-
- /**
- *
- * Rule for edition
- *
- */
- private static final class PapyrusEditableRule extends EditableRule {
-
- /**
- * the nattable manager
- */
- private INattableModelManager manager;
-
- /**
- *
- * Constructor.
- *
- * @param tableManager
- * the table manager
- */
- private PapyrusEditableRule(INattableModelManager tableManager) {
- this.manager = tableManager;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.config.EditableRule#isEditable(int, int)
- *
- * @param columnIndex
- * @param rowIndex
- * @return
- */
- @Override
- public boolean isEditable(final int columnIndex, final int rowIndex) {
- final Object rowElement = manager.getRowElement(rowIndex);
- final Object columnElement = manager.getColumnElement(columnIndex);
- return CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement, this.manager);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-MIST) - 463058: [Table 2] Invert Axis + add/remove columns break the display of the table
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.EditableRule;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+
+
+/**
+ *
+ * The configuration for the edition of the table.
+ *
+ * This configuration listen some elements to reset the cell editor declaration when required:
+ * <li>the elements list to be able to reset the cell editor configuration after add/remove axis</li>
+ * <li>the attribute invert axis of the table</li>
+ * <li>the nattable widget to be able to remove added listener when the widget is disposed</li>
+ *
+ */
+public class EditConfiguration extends DefaultEditConfiguration {
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param configRegistry
+ */
+ @Override
+ public void configureRegistry(IConfigRegistry configRegistry) {
+ // we call the super implementation
+ super.configureRegistry(configRegistry);
+
+ // we remove the default cell editor
+ configRegistry.unregisterConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.NORMAL, null);
+
+ INattableModelManager manager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, new PapyrusEditableRule(manager));
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, null, DisplayMode.EDIT, ""); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * Rule for edition
+ *
+ */
+ private static final class PapyrusEditableRule extends EditableRule {
+
+ /**
+ * the nattable manager
+ */
+ private INattableModelManager manager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableManager
+ * the table manager
+ */
+ private PapyrusEditableRule(INattableModelManager tableManager) {
+ this.manager = tableManager;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.config.EditableRule#isEditable(int, int)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @return
+ */
+ @Override
+ public boolean isEditable(final int columnIndex, final int rowIndex) {
+ final Object rowElement = manager.getRowElement(rowIndex);
+ final Object columnElement = manager.getColumnElement(columnIndex);
+ return CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement, this.manager);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnHeaderStyleConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnHeaderStyleConfiguration.java
index cbfc1954e5b..1cbcf550f6c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnHeaderStyleConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnHeaderStyleConfiguration.java
@@ -1,44 +1,44 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration;
-import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator;
-import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
-import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
-import org.eclipse.papyrus.infra.nattable.painter.CustomImagePainter;
-import org.eclipse.papyrus.infra.nattable.painter.CustomizedCellPainter;
-
-/**
- *
- * The default style for the column. We provide a specific label provider and image painter
- *
- */
-public class PapyrusColumnHeaderStyleConfiguration extends DefaultColumnHeaderStyleConfiguration {
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param configRegistry
- */
- @Override
- public void configureRegistry(final IConfigRegistry configRegistry) {
- this.cellPainter = new BeveledBorderDecorator(new CellPainterDecorator(new CustomizedCellPainter(), CellEdgeEnum.LEFT, new CustomImagePainter()));// new CustomizedCellPainter());
- super.configureRegistry(configRegistry);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration;
+import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator;
+import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
+import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
+import org.eclipse.papyrus.infra.nattable.painter.CustomImagePainter;
+import org.eclipse.papyrus.infra.nattable.painter.CustomizedCellPainter;
+
+/**
+ *
+ * The default style for the column. We provide a specific label provider and image painter
+ *
+ */
+public class PapyrusColumnHeaderStyleConfiguration extends DefaultColumnHeaderStyleConfiguration {
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param configRegistry
+ */
+ @Override
+ public void configureRegistry(final IConfigRegistry configRegistry) {
+ this.cellPainter = new BeveledBorderDecorator(new CellPainterDecorator(new CustomizedCellPainter(), CellEdgeEnum.LEFT, new CustomImagePainter()));// new CustomizedCellPainter());
+ super.configureRegistry(configRegistry);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java
index 7bb1989beec..2f3051b0648 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java
@@ -1,54 +1,54 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
-import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
-import org.eclipse.nebula.widgets.nattable.resize.action.ColumnResizeCursorAction;
-import org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEventMatcher;
-import org.eclipse.nebula.widgets.nattable.resize.mode.ColumnResizeDragMode;
-import org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction;
-import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
-import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
-import org.eclipse.swt.SWT;
-
-/**
- * Adapted code from DefaultRowResizeBindings. Allow to resize the columns on all regions of the table (corner, body, row header, column header)
- *
- * @author Vincent Lorenzo
- *
- */
-public class PapyrusColumnResizeBindingsConfiguration extends AbstractUiBindingConfiguration {
-
- @Override
- public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
- // Mouse move - Show resize cursor
- uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 0), new ColumnResizeCursorAction());
- uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 0), new ColumnResizeCursorAction());
- uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 0), new ColumnResizeCursorAction());
- uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.BODY, 0), new ColumnResizeCursorAction());
-
- uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
-
- // Column resize
- uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new ColumnResizeDragMode());
- uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new ColumnResizeDragMode());
- uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 1), new ColumnResizeDragMode());
- uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.BODY, 1), new ColumnResizeDragMode());
-
- // uiBindingRegistry.registerDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new AutoResizeColumnAction());
- uiBindingRegistry.registerSingleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new NoOpMouseAction());
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.resize.action.ColumnResizeCursorAction;
+import org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEventMatcher;
+import org.eclipse.nebula.widgets.nattable.resize.mode.ColumnResizeDragMode;
+import org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction;
+import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.swt.SWT;
+
+/**
+ * Adapted code from DefaultRowResizeBindings. Allow to resize the columns on all regions of the table (corner, body, row header, column header)
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class PapyrusColumnResizeBindingsConfiguration extends AbstractUiBindingConfiguration {
+
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ // Mouse move - Show resize cursor
+ uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 0), new ColumnResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 0), new ColumnResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 0), new ColumnResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.BODY, 0), new ColumnResizeCursorAction());
+
+ uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
+
+ // Column resize
+ uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new ColumnResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new ColumnResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 1), new ColumnResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.BODY, 1), new ColumnResizeDragMode());
+
+ // uiBindingRegistry.registerDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new AutoResizeColumnAction());
+ uiBindingRegistry.registerSingleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new NoOpMouseAction());
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusDefaultEditBindings.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusDefaultEditBindings.java
index 414360966d1..9ba39ba39f9 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusDefaultEditBindings.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusDefaultEditBindings.java
@@ -1,63 +1,63 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
-import org.eclipse.nebula.widgets.nattable.edit.action.CellEditDragMode;
-import org.eclipse.nebula.widgets.nattable.edit.action.KeyEditAction;
-import org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction;
-import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings;
-import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
-import org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter;
-import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.LetterOrDigitKeyEventMatcher;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
-import org.eclipse.swt.SWT;
-
-/**
- *
- * @author Vincent Lorenzo
- * Copy of {@link DefaultEditBindings} excepted for edition on double click replacing edition on single click
- */
-public class PapyrusDefaultEditBindings extends AbstractUiBindingConfiguration {
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
- *
- * @param uiBindingRegistry
- */
- @Override
- public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
- // configure the space key to activate a cell editor via keyboard
- // this is especially useful for changing the value for a checkbox
- uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, 32), new KeyEditAction());
- uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.F2), new KeyEditAction());
- uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(), new KeyEditAction());
- uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(SWT.SHIFT), new KeyEditAction());
-
- uiBindingRegistry.registerDoubleClickBinding(new CellEditorMouseEventMatcher(GridRegion.BODY), new MouseEditAction());
-
- uiBindingRegistry.registerMouseDragMode(new CellEditorMouseEventMatcher(GridRegion.BODY), new CellEditDragMode());
-
- uiBindingRegistry.registerFirstSingleClickBinding(new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class), new MouseEditAction());
-
- uiBindingRegistry.registerFirstMouseDragMode(new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class), new CellEditDragMode());
-
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
+import org.eclipse.nebula.widgets.nattable.edit.action.CellEditDragMode;
+import org.eclipse.nebula.widgets.nattable.edit.action.KeyEditAction;
+import org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction;
+import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.LetterOrDigitKeyEventMatcher;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.swt.SWT;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ * Copy of {@link DefaultEditBindings} excepted for edition on double click replacing edition on single click
+ */
+public class PapyrusDefaultEditBindings extends AbstractUiBindingConfiguration {
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ // configure the space key to activate a cell editor via keyboard
+ // this is especially useful for changing the value for a checkbox
+ uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, 32), new KeyEditAction());
+ uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.F2), new KeyEditAction());
+ uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(), new KeyEditAction());
+ uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(SWT.SHIFT), new KeyEditAction());
+
+ uiBindingRegistry.registerDoubleClickBinding(new CellEditorMouseEventMatcher(GridRegion.BODY), new MouseEditAction());
+
+ uiBindingRegistry.registerMouseDragMode(new CellEditorMouseEventMatcher(GridRegion.BODY), new CellEditDragMode());
+
+ uiBindingRegistry.registerFirstSingleClickBinding(new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class), new MouseEditAction());
+
+ uiBindingRegistry.registerFirstMouseDragMode(new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class), new CellEditDragMode());
+
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusHeaderMenuConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusHeaderMenuConfiguration.java
index d5eab42972b..92cd6dfbf0b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusHeaderMenuConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusHeaderMenuConfiguration.java
@@ -1,64 +1,64 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
-import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
-import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
-import org.eclipse.swt.SWT;
-
-/**
- * The configuration for the popup to use in the header of the table
- *
- * Adapted code from AbstractHeaderMenuConfiguration
- *
- * @author Vincent Lorenzo
- *
- * @deprecated since Papyrus 1.2 (Eclipse Neon), Use TablePopupMenuConfiguration instead or a subclass)
- */
-@Deprecated
-public class PapyrusHeaderMenuConfiguration extends AbstractUiBindingConfiguration {
-
- /**
- * the category used for the column command
- *
- * @deprecated with no replacement, because useless now
- *
- */
- @Deprecated
- public static final String COLUMN_COMMANDS_CATEGORY_ID = "org.eclipse.papyrus.infra.nattable.columns.command.category"; //$NON-NLS-1$
-
- /**
- * the category used for the row command
- *
- * @deprecated with no replacement, because useless now
- */
- @Deprecated
- public static final String ROW_COMMANDS_CATEGORY_ID = "org.eclipse.papyrus.infra.nattable.rows.command.category"; //$NON-NLS-1$
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
- *
- * @param uiBindingRegistry
- */
- @Override
- public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
- uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, MouseEventMatcher.RIGHT_BUTTON), new PapyrusPopupMenuAction(COLUMN_COMMANDS_CATEGORY_ID));
- uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, MouseEventMatcher.RIGHT_BUTTON), new PapyrusPopupMenuAction(ROW_COMMANDS_CATEGORY_ID));
-
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.swt.SWT;
+
+/**
+ * The configuration for the popup to use in the header of the table
+ *
+ * Adapted code from AbstractHeaderMenuConfiguration
+ *
+ * @author Vincent Lorenzo
+ *
+ * @deprecated since Papyrus 1.2 (Eclipse Neon), Use TablePopupMenuConfiguration instead or a subclass)
+ */
+@Deprecated
+public class PapyrusHeaderMenuConfiguration extends AbstractUiBindingConfiguration {
+
+ /**
+ * the category used for the column command
+ *
+ * @deprecated with no replacement, because useless now
+ *
+ */
+ @Deprecated
+ public static final String COLUMN_COMMANDS_CATEGORY_ID = "org.eclipse.papyrus.infra.nattable.columns.command.category"; //$NON-NLS-1$
+
+ /**
+ * the category used for the row command
+ *
+ * @deprecated with no replacement, because useless now
+ */
+ @Deprecated
+ public static final String ROW_COMMANDS_CATEGORY_ID = "org.eclipse.papyrus.infra.nattable.rows.command.category"; //$NON-NLS-1$
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, MouseEventMatcher.RIGHT_BUTTON), new PapyrusPopupMenuAction(COLUMN_COMMANDS_CATEGORY_ID));
+ uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, MouseEventMatcher.RIGHT_BUTTON), new PapyrusPopupMenuAction(ROW_COMMANDS_CATEGORY_ID));
+
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusPopupMenuAction.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusPopupMenuAction.java
index 8662cf85412..3464316ea78 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusPopupMenuAction.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusPopupMenuAction.java
@@ -1,233 +1,233 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.NotEnabledException;
-import org.eclipse.core.commands.NotHandledException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuAction;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.handler.TreeRowHideShowCategoryHandler;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.utils.Constants;
-import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
-import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
-import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
-import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * PopupAction for Papyrus -> The contents of the popup is builded for each right click and not builded only one time as in NatTable
- *
- * @author Vincent Lorenzo
- *
- * @deprecated since Papyrus 1.2 (Eclipse Neon)
- */
-@Deprecated
-public class PapyrusPopupMenuAction extends PopupMenuAction {
-
- /** the category of the commands to add to this menu */
- private final String category;
-
- /**
- *
- * Constructor.
- *
- * @param categoryId
- * the category of the commands to add to this menu
- */
- public PapyrusPopupMenuAction(final String categoryId) {
- super(null);// because we create the menu for each run
- this.category = categoryId;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuAction#run(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
- *
- * @param natTable
- * @param event
- */
- @Override
- public void run(NatTable natTable, MouseEvent event) {
- // we need to recreate the menu each time (we need to verify for each action if it is enabled or not
- Menu menu = new Menu(natTable.getShell());
-
- buildMenu(menu, natTable);
- //menu.setData(event.data); //commented to fix the bug 469376: [Table] Memory Leak : (Tree)NattableWidgetManager, EObjectTreeItemAxis and others objects are not disposed when the table is closed
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=469376
-
-
- // PopupMenuBuilder builder = new PopupMenuBuilder(natTable, menu).withHideRowMenuItem();
- // builder.withShowAllRowsMenuItem();
- menu.setVisible(true);
- }
-
- /**
- *
- * @param popupMenu
- */
- private void buildMenu(final Menu popupMenu, final NatTable natTable) {
- final Collection<Command> commands = EclipseCommandUtils.getAllExistingCommandsInCategory(category);
-
- for (final Command command : commands) {
- final IHandler handler = command.getHandler();
- if (handler == null || !(handler instanceof AbstractHandler)) {
- continue;
- }
- // TODO : we should use the EclipseContext to transfert the eventData from here to the handler, but currently we can't have dependency on e4 plugins
- // ((AbstractHandler)handler).setEnabled(eclipseContext);
- ((AbstractHandler) handler).setEnabled(null);
- boolean isEnabled = handler.isEnabled();
-
- if (isEnabled) {
- if (this.category.equals(Constants.ROW_HEADER_COMMANDS_CATEGORY) && TreeRowHideShowCategoryHandler.COMMAND_ID.equals(command.getId())) {
- addShowHideCategoryCommandToMenu(popupMenu, command, natTable);
- continue;
- }
- MenuItem item = new MenuItem(popupMenu, SWT.PUSH);
- item.setEnabled(true);
- ImageDescriptor imageDescriptor = EclipseCommandUtils.getCommandIcon(command);
- if (imageDescriptor != null) {
- item.setImage(imageDescriptor.createImage());
- }
- try {
- item.setText(command.getName());
- } catch (NotDefinedException e) {
- Activator.log.error(e);
- }
- item.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- executeCommand(command.getId());
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // nothing do to
- }
- });
- }
- }
- }
-
- /**
- * execute the command
- */
- private void executeCommand(String commandId) {
- IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
- if (handlerService == null) {
- Activator.log.warn("Handler service not found"); //$NON-NLS-1$
- return;
- }
- try {
- handlerService.executeCommand(commandId, new Event());
- } catch (ExecutionException e) {
- Activator.log.error(e);
- } catch (NotDefinedException e) {
- Activator.log.error(e);
- } catch (NotEnabledException e) {
- Activator.log.error(e);
- } catch (NotHandledException e) {
- Activator.log.error(e);
- }
- }
-
-
- /**
- *
- * @param menu
- * @param command
- * @param natTable
- */
- private void addShowHideCategoryCommandToMenu(final Menu menu, final Command command, final NatTable natTable) {
- Table table = getTable(natTable);
- int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(table);
- int min = 0;
- if (!FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(table, 0)) {
- min++;
- }
- final IHandler handler = command.getHandler();
- for (int depth = min; depth <= maxDepth; depth++) {
- MenuItem item = new MenuItem(menu, SWT.CHECK);
- final boolean isHidden = isHidden(table, depth);
- item.setSelection(!isHidden);
- String text = null;
- text = NLS.bind(Messages.PapyrusPopupMenuAction_ShowCategoriesOnDepth, depth);
- item.setText(text);
- final Integer index = depth;
- item.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent arg0) {
- // TODO : we must be able to give the SelectionEvent to the handler using EclispeContext
- Map<Object, Object> parameters = new HashMap<Object, Object>();
- parameters.put(TreeRowHideShowCategoryHandler.DEPTH_PARAMETER_KEY, index);
- parameters.put(TreeRowHideShowCategoryHandler.HIDE_CATEGORY_PARAMETER_KEY, Boolean.valueOf(!isHidden));
- try {
- handler.execute(new ExecutionEvent(command, parameters, null, null));
- } catch (ExecutionException e) {
- Activator.log.error(e);
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent arg0) {
- }
- });
- }
- }
-
- private boolean isHidden(Table table, int depth) {
- return StyleUtils.getHiddenDepths(table).contains(Integer.valueOf(depth));
- }
-
- /**
- *
- * @param natTable
- * the natTable widget
- * @return
- * the table
- */
- private Table getTable(NatTable natTable) {
- IConfigRegistry configRegistry = natTable.getConfigRegistry();
- INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- return modelManager.getTable();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuAction;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.handler.TreeRowHideShowCategoryHandler;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.utils.Constants;
+import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
+import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerService;
+
+/**
+ * PopupAction for Papyrus -> The contents of the popup is builded for each right click and not builded only one time as in NatTable
+ *
+ * @author Vincent Lorenzo
+ *
+ * @deprecated since Papyrus 1.2 (Eclipse Neon)
+ */
+@Deprecated
+public class PapyrusPopupMenuAction extends PopupMenuAction {
+
+ /** the category of the commands to add to this menu */
+ private final String category;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param categoryId
+ * the category of the commands to add to this menu
+ */
+ public PapyrusPopupMenuAction(final String categoryId) {
+ super(null);// because we create the menu for each run
+ this.category = categoryId;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuAction#run(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
+ *
+ * @param natTable
+ * @param event
+ */
+ @Override
+ public void run(NatTable natTable, MouseEvent event) {
+ // we need to recreate the menu each time (we need to verify for each action if it is enabled or not
+ Menu menu = new Menu(natTable.getShell());
+
+ buildMenu(menu, natTable);
+ //menu.setData(event.data); //commented to fix the bug 469376: [Table] Memory Leak : (Tree)NattableWidgetManager, EObjectTreeItemAxis and others objects are not disposed when the table is closed
+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=469376
+
+
+ // PopupMenuBuilder builder = new PopupMenuBuilder(natTable, menu).withHideRowMenuItem();
+ // builder.withShowAllRowsMenuItem();
+ menu.setVisible(true);
+ }
+
+ /**
+ *
+ * @param popupMenu
+ */
+ private void buildMenu(final Menu popupMenu, final NatTable natTable) {
+ final Collection<Command> commands = EclipseCommandUtils.getAllExistingCommandsInCategory(category);
+
+ for (final Command command : commands) {
+ final IHandler handler = command.getHandler();
+ if (handler == null || !(handler instanceof AbstractHandler)) {
+ continue;
+ }
+ // TODO : we should use the EclipseContext to transfert the eventData from here to the handler, but currently we can't have dependency on e4 plugins
+ // ((AbstractHandler)handler).setEnabled(eclipseContext);
+ ((AbstractHandler) handler).setEnabled(null);
+ boolean isEnabled = handler.isEnabled();
+
+ if (isEnabled) {
+ if (this.category.equals(Constants.ROW_HEADER_COMMANDS_CATEGORY) && TreeRowHideShowCategoryHandler.COMMAND_ID.equals(command.getId())) {
+ addShowHideCategoryCommandToMenu(popupMenu, command, natTable);
+ continue;
+ }
+ MenuItem item = new MenuItem(popupMenu, SWT.PUSH);
+ item.setEnabled(true);
+ ImageDescriptor imageDescriptor = EclipseCommandUtils.getCommandIcon(command);
+ if (imageDescriptor != null) {
+ item.setImage(imageDescriptor.createImage());
+ }
+ try {
+ item.setText(command.getName());
+ } catch (NotDefinedException e) {
+ Activator.log.error(e);
+ }
+ item.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ executeCommand(command.getId());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // nothing do to
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * execute the command
+ */
+ private void executeCommand(String commandId) {
+ IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ if (handlerService == null) {
+ Activator.log.warn("Handler service not found"); //$NON-NLS-1$
+ return;
+ }
+ try {
+ handlerService.executeCommand(commandId, new Event());
+ } catch (ExecutionException e) {
+ Activator.log.error(e);
+ } catch (NotDefinedException e) {
+ Activator.log.error(e);
+ } catch (NotEnabledException e) {
+ Activator.log.error(e);
+ } catch (NotHandledException e) {
+ Activator.log.error(e);
+ }
+ }
+
+
+ /**
+ *
+ * @param menu
+ * @param command
+ * @param natTable
+ */
+ private void addShowHideCategoryCommandToMenu(final Menu menu, final Command command, final NatTable natTable) {
+ Table table = getTable(natTable);
+ int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(table);
+ int min = 0;
+ if (!FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(table, 0)) {
+ min++;
+ }
+ final IHandler handler = command.getHandler();
+ for (int depth = min; depth <= maxDepth; depth++) {
+ MenuItem item = new MenuItem(menu, SWT.CHECK);
+ final boolean isHidden = isHidden(table, depth);
+ item.setSelection(!isHidden);
+ String text = null;
+ text = NLS.bind(Messages.PapyrusPopupMenuAction_ShowCategoriesOnDepth, depth);
+ item.setText(text);
+ final Integer index = depth;
+ item.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ // TODO : we must be able to give the SelectionEvent to the handler using EclispeContext
+ Map<Object, Object> parameters = new HashMap<Object, Object>();
+ parameters.put(TreeRowHideShowCategoryHandler.DEPTH_PARAMETER_KEY, index);
+ parameters.put(TreeRowHideShowCategoryHandler.HIDE_CATEGORY_PARAMETER_KEY, Boolean.valueOf(!isHidden));
+ try {
+ handler.execute(new ExecutionEvent(command, parameters, null, null));
+ } catch (ExecutionException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ }
+ });
+ }
+ }
+
+ private boolean isHidden(Table table, int depth) {
+ return StyleUtils.getHiddenDepths(table).contains(Integer.valueOf(depth));
+ }
+
+ /**
+ *
+ * @param natTable
+ * the natTable widget
+ * @return
+ * the table
+ */
+ private Table getTable(NatTable natTable) {
+ IConfigRegistry configRegistry = natTable.getConfigRegistry();
+ INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
+ return modelManager.getTable();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowHeaderStyleConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowHeaderStyleConfiguration.java
index e24f37c4147..49002bdb96c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowHeaderStyleConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowHeaderStyleConfiguration.java
@@ -1,45 +1,45 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.layer.config.DefaultRowHeaderStyleConfiguration;
-import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
-import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
-import org.eclipse.papyrus.infra.nattable.painter.CustomImagePainter;
-import org.eclipse.papyrus.infra.nattable.painter.CustomizedCellPainter;
-import org.eclipse.papyrus.infra.nattable.painter.PapyrusBeveledBorderDecorator;
-
-/**
- *
- * The default style for the row header. We provide a specific label provider and image painter
- *
- */
-public class PapyrusRowHeaderStyleConfiguration extends DefaultRowHeaderStyleConfiguration {
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.layer.config.DefaultRowHeaderStyleConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param configRegistry
- */
- @Override
- public void configureRegistry(final IConfigRegistry configRegistry) {
- this.cellPainter = new PapyrusBeveledBorderDecorator(new CellPainterDecorator(new CustomizedCellPainter(), CellEdgeEnum.LEFT, new CustomImagePainter()));
- // configureHeaderHasSelectionStyle(configRegistry);
- super.configureRegistry(configRegistry);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.layer.config.DefaultRowHeaderStyleConfiguration;
+import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
+import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
+import org.eclipse.papyrus.infra.nattable.painter.CustomImagePainter;
+import org.eclipse.papyrus.infra.nattable.painter.CustomizedCellPainter;
+import org.eclipse.papyrus.infra.nattable.painter.PapyrusBeveledBorderDecorator;
+
+/**
+ *
+ * The default style for the row header. We provide a specific label provider and image painter
+ *
+ */
+public class PapyrusRowHeaderStyleConfiguration extends DefaultRowHeaderStyleConfiguration {
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.layer.config.DefaultRowHeaderStyleConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param configRegistry
+ */
+ @Override
+ public void configureRegistry(final IConfigRegistry configRegistry) {
+ this.cellPainter = new PapyrusBeveledBorderDecorator(new CellPainterDecorator(new CustomizedCellPainter(), CellEdgeEnum.LEFT, new CustomImagePainter()));
+ // configureHeaderHasSelectionStyle(configRegistry);
+ super.configureRegistry(configRegistry);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusTreeLayerConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusTreeLayerConfiguration.java
index 900c3c75781..8224d846810 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusTreeLayerConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusTreeLayerConfiguration.java
@@ -1,60 +1,60 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
-import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
-import org.eclipse.nebula.widgets.nattable.tree.action.TreeExpandCollapseAction;
-import org.eclipse.nebula.widgets.nattable.tree.config.DefaultTreeLayerConfiguration;
-import org.eclipse.nebula.widgets.nattable.tree.painter.TreeImagePainter;
-import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
-import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class PapyrusTreeLayerConfiguration extends DefaultTreeLayerConfiguration {
-
- /**
- *
- * Constructor.
- *
- * @param treeLayer
- */
- public PapyrusTreeLayerConfiguration(TreeLayer treeLayer) {
- super(treeLayer);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.tree.config.DefaultTreeLayerConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
- *
- * @param uiBindingRegistry
- */
- @Override
- public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
- TreeExpandCollapseAction treeExpandCollapseAction = new TreeExpandCollapseAction();
- // override GridRegion.BODY by GridRegion.ROW_HEADER
- CellPainterMouseEventMatcher treeImagePainterMouseEventMatcher = new CellPainterMouseEventMatcher(GridRegion.ROW_HEADER, MouseEventMatcher.LEFT_BUTTON, TreeImagePainter.class);
-
- uiBindingRegistry.registerFirstSingleClickBinding(treeImagePainterMouseEventMatcher, treeExpandCollapseAction);
-
- // Obscure any mouse down bindings for this image painter
- uiBindingRegistry.registerFirstMouseDownBinding(treeImagePainterMouseEventMatcher, new NoOpMouseAction());
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
+import org.eclipse.nebula.widgets.nattable.tree.action.TreeExpandCollapseAction;
+import org.eclipse.nebula.widgets.nattable.tree.config.DefaultTreeLayerConfiguration;
+import org.eclipse.nebula.widgets.nattable.tree.painter.TreeImagePainter;
+import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class PapyrusTreeLayerConfiguration extends DefaultTreeLayerConfiguration {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param treeLayer
+ */
+ public PapyrusTreeLayerConfiguration(TreeLayer treeLayer) {
+ super(treeLayer);
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.tree.config.DefaultTreeLayerConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ TreeExpandCollapseAction treeExpandCollapseAction = new TreeExpandCollapseAction();
+ // override GridRegion.BODY by GridRegion.ROW_HEADER
+ CellPainterMouseEventMatcher treeImagePainterMouseEventMatcher = new CellPainterMouseEventMatcher(GridRegion.ROW_HEADER, MouseEventMatcher.LEFT_BUTTON, TreeImagePainter.class);
+
+ uiBindingRegistry.registerFirstSingleClickBinding(treeImagePainterMouseEventMatcher, treeExpandCollapseAction);
+
+ // Obscure any mouse down bindings for this image painter
+ uiBindingRegistry.registerFirstMouseDownBinding(treeImagePainterMouseEventMatcher, new NoOpMouseAction());
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/StyleConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/StyleConfiguration.java
index f193518f0b8..0744b2cf04b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/StyleConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/StyleConfiguration.java
@@ -1,47 +1,47 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.export.ExportConfigAttributes;
-import org.eclipse.papyrus.infra.nattable.converter.GenericDisplayConverter;
-import org.eclipse.papyrus.infra.nattable.formatter.PapyrusExportFormatter;
-import org.eclipse.papyrus.infra.nattable.painter.CustomizedCellPainter;
-
-/**
- * Register a specific Cellpainter
- *
- * @author Vincent Lorenzo
- *
- */
-public class StyleConfiguration extends DefaultNatTableStyleConfiguration {
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param configRegistry
- */
- @Override
- public void configureRegistry(final IConfigRegistry configRegistry) {
- super.configureRegistry(configRegistry);
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CustomizedCellPainter());
- configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new GenericDisplayConverter());
- configRegistry.registerConfigAttribute(ExportConfigAttributes.EXPORT_FORMATTER, new PapyrusExportFormatter());
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.export.ExportConfigAttributes;
+import org.eclipse.papyrus.infra.nattable.converter.GenericDisplayConverter;
+import org.eclipse.papyrus.infra.nattable.formatter.PapyrusExportFormatter;
+import org.eclipse.papyrus.infra.nattable.painter.CustomizedCellPainter;
+
+/**
+ * Register a specific Cellpainter
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class StyleConfiguration extends DefaultNatTableStyleConfiguration {
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param configRegistry
+ */
+ @Override
+ public void configureRegistry(final IConfigRegistry configRegistry) {
+ super.configureRegistry(configRegistry);
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CustomizedCellPainter());
+ configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new GenericDisplayConverter());
+ configRegistry.registerConfigAttribute(ExportConfigAttributes.EXPORT_FORMATTER, new PapyrusExportFormatter());
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/converter/GenericDisplayConverter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/converter/GenericDisplayConverter.java
index 469f2ca8d3c..74a408bed75 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/converter/GenericDisplayConverter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/converter/GenericDisplayConverter.java
@@ -1,106 +1,106 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.converter;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.nattable.utils.Constants;
-import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
-import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-
-/**
- * This converter uses the label provider service to display the correct text
- *
- * @author Vincent Lorenzo
- *
- */
-public class GenericDisplayConverter implements IDisplayConverter {
-
- /**
- * wrapper used to get the label of the element to convert
- */
- private LabelProviderCellContextElementWrapper contextElement = new LabelProviderCellContextElementWrapper();
-
- /**
- * throw new UnsupportedOperationException();
- *
- * @see org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter#canonicalToDisplayValue(java.lang.Object)
- *
- * @param canonicalValue
- * @return
- */
- @Override
- public Object canonicalToDisplayValue(Object canonicalValue) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * throw new UnsupportedOperationException();
- *
- * @see org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter#displayToCanonicalValue(java.lang.Object)
- *
- * @param displayValue
- * @return
- */
- @Override
- public Object displayToCanonicalValue(Object displayValue) {
- return displayValue.toString();
- }
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter#canonicalToDisplayValue(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object)
- *
- * @param cell
- * @param configRegistry
- * @param canonicalValue
- * @return
- */
- @Override
- public Object canonicalToDisplayValue(ILayerCell cell, final IConfigRegistry configRegistry, final Object canonicalValue) {
- if (canonicalValue == null) {
- return null;
- }
-
- final LabelProviderService service = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- final ILabelProvider labelProvider = service.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT);
- contextElement.setConfigRegistry(configRegistry);
- contextElement.setCell(cell);
- contextElement.setObject(canonicalValue);
- Assert.isNotNull(labelProvider);
- return labelProvider.getText(contextElement);
- }
-
- /**
- * throw new UnsupportedOperationException();
- *
- * @see org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter#displayToCanonicalValue(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object)
- *
- * @param cell
- * @param configRegistry
- * @param displayValue
- * @return
- */
- @Override
- public Object displayToCanonicalValue(ILayerCell cell, IConfigRegistry configRegistry, Object displayValue) {
- return displayValue;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.converter;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.nattable.utils.Constants;
+import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
+import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+
+/**
+ * This converter uses the label provider service to display the correct text
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class GenericDisplayConverter implements IDisplayConverter {
+
+ /**
+ * wrapper used to get the label of the element to convert
+ */
+ private LabelProviderCellContextElementWrapper contextElement = new LabelProviderCellContextElementWrapper();
+
+ /**
+ * throw new UnsupportedOperationException();
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter#canonicalToDisplayValue(java.lang.Object)
+ *
+ * @param canonicalValue
+ * @return
+ */
+ @Override
+ public Object canonicalToDisplayValue(Object canonicalValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * throw new UnsupportedOperationException();
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter#displayToCanonicalValue(java.lang.Object)
+ *
+ * @param displayValue
+ * @return
+ */
+ @Override
+ public Object displayToCanonicalValue(Object displayValue) {
+ return displayValue.toString();
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter#canonicalToDisplayValue(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object)
+ *
+ * @param cell
+ * @param configRegistry
+ * @param canonicalValue
+ * @return
+ */
+ @Override
+ public Object canonicalToDisplayValue(ILayerCell cell, final IConfigRegistry configRegistry, final Object canonicalValue) {
+ if (canonicalValue == null) {
+ return null;
+ }
+
+ final LabelProviderService service = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ final ILabelProvider labelProvider = service.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT);
+ contextElement.setConfigRegistry(configRegistry);
+ contextElement.setCell(cell);
+ contextElement.setObject(canonicalValue);
+ Assert.isNotNull(labelProvider);
+ return labelProvider.getText(contextElement);
+ }
+
+ /**
+ * throw new UnsupportedOperationException();
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter#displayToCanonicalValue(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object)
+ *
+ * @param cell
+ * @param configRegistry
+ * @param displayValue
+ * @return
+ */
+ @Override
+ public Object displayToCanonicalValue(ILayerCell cell, IConfigRegistry configRegistry, Object displayValue) {
+ return displayValue;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/copy/CopySelectionToClipboardAction.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/copy/CopySelectionToClipboardAction.java
index dd05c3f7cd3..9593fe27dbf 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/copy/CopySelectionToClipboardAction.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/copy/CopySelectionToClipboardAction.java
@@ -1,47 +1,47 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.copy;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler;
-import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-
-/**
- * The handler for the copy selection to clipboard action
- *
- * @author Vincent Lorenzo
- *
- */
-public class CopySelectionToClipboardAction extends AbstractTableHandler {
-
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- INattableModelManager manager = getCurrentNattableModelManager();
- ((AbstractNattableWidgetManager) manager).copyToClipboard();
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.copy;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler;
+import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+
+/**
+ * The handler for the copy selection to clipboard action
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class CopySelectionToClipboardAction extends AbstractTableHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ INattableModelManager manager = getCurrentNattableModelManager();
+ ((AbstractNattableWidgetManager) manager).copyToClipboard();
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractCompositeDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractCompositeDataProvider.java
index 228d4581752..17f1c3cd24e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractCompositeDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractCompositeDataProvider.java
@@ -1,105 +1,105 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * The Class AbstractCompositeDataProvider.
- *
- * @author Vincent Lorenzo
- */
-public abstract class AbstractCompositeDataProvider implements IDataProvider, IDisposable {
-
- /** the data providers. */
- protected List<IDataProvider> providers;
-
- /** the nattable model manager. */
- protected INattableModelManager manager;
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the nattable model manager
- */
- public AbstractCompositeDataProvider(final INattableModelManager manager) {
- this.providers = new ArrayList<IDataProvider>();
- this.manager = manager;
- }
-
- /**
- * Adds the data provider.
- *
- * @param provider
- * a provider to had
- */
- public void addDataProvider(final IDataProvider provider) {
- providers.add(provider);
- }
-
- /**
- * Gets the data value.
- *
- * @param columnIndex
- * the column index
- * @param rowIndex
- * the row index
- * @return the data value
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getDataValue(int, int)
- */
- @Override
- public Object getDataValue(int columnIndex, int rowIndex) {
- throw new UnsupportedOperationException("not yet supported"); //$NON-NLS-1$
- }
-
- /**
- * Sets the data value.
- *
- * @param columnIndex
- * the column index
- * @param rowIndex
- * the row index
- * @param newValue
- * the new value
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
- */
- @Override
- public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
- throw new UnsupportedOperationException("not yet supported"); //$NON-NLS-1$
- }
-
-
- /**
- *
- * @see org.eclipse.ui.services.IDisposable#dispose()
- *
- */
- @Override
- public void dispose() {
- for (final IDataProvider current : this.providers) {
- if (current instanceof IDisposable) {
- ((IDisposable) current).dispose();
- }
- }
- providers.clear();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.ui.services.IDisposable;
+
+/**
+ * The Class AbstractCompositeDataProvider.
+ *
+ * @author Vincent Lorenzo
+ */
+public abstract class AbstractCompositeDataProvider implements IDataProvider, IDisposable {
+
+ /** the data providers. */
+ protected List<IDataProvider> providers;
+
+ /** the nattable model manager. */
+ protected INattableModelManager manager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the nattable model manager
+ */
+ public AbstractCompositeDataProvider(final INattableModelManager manager) {
+ this.providers = new ArrayList<IDataProvider>();
+ this.manager = manager;
+ }
+
+ /**
+ * Adds the data provider.
+ *
+ * @param provider
+ * a provider to had
+ */
+ public void addDataProvider(final IDataProvider provider) {
+ providers.add(provider);
+ }
+
+ /**
+ * Gets the data value.
+ *
+ * @param columnIndex
+ * the column index
+ * @param rowIndex
+ * the row index
+ * @return the data value
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getDataValue(int, int)
+ */
+ @Override
+ public Object getDataValue(int columnIndex, int rowIndex) {
+ throw new UnsupportedOperationException("not yet supported"); //$NON-NLS-1$
+ }
+
+ /**
+ * Sets the data value.
+ *
+ * @param columnIndex
+ * the column index
+ * @param rowIndex
+ * the row index
+ * @param newValue
+ * the new value
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
+ */
+ @Override
+ public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
+ throw new UnsupportedOperationException("not yet supported"); //$NON-NLS-1$
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.ui.services.IDisposable#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ for (final IDataProvider current : this.providers) {
+ if (current instanceof IDisposable) {
+ ((IDisposable) current).dispose();
+ }
+ }
+ providers.clear();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractDataProvider.java
index 157b4f8f787..a9bfb269ac1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractDataProvider.java
@@ -1,71 +1,71 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.ui.services.IDisposable;
-
-
-public abstract class AbstractDataProvider implements IDataProvider, IDisposable {
-
- /**
- * the manager used to manage the table
- */
- protected INattableModelManager manager;
-
- /**
- *
- * Constructor.
- *
- * @param tableModelManager
- * the manager of the table
- */
- public AbstractDataProvider(final INattableModelManager tableModelManager) {
- this.manager = tableModelManager;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getColumnCount()
- *
- * @return
- */
- @Override
- public int getColumnCount() {
- return this.manager.getColumnCount();
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getRowCount()
- *
- * @return
- */
- @Override
- public int getRowCount() {
- return this.manager.getRowCount();
- }
-
- /**
- *
- * @see org.eclipse.ui.services.IDisposable#dispose()
- *
- */
- @Override
- public void dispose() {
- this.manager = null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.ui.services.IDisposable;
+
+
+public abstract class AbstractDataProvider implements IDataProvider, IDisposable {
+
+ /**
+ * the manager used to manage the table
+ */
+ protected INattableModelManager manager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableModelManager
+ * the manager of the table
+ */
+ public AbstractDataProvider(final INattableModelManager tableModelManager) {
+ this.manager = tableModelManager;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getColumnCount()
+ *
+ * @return
+ */
+ @Override
+ public int getColumnCount() {
+ return this.manager.getColumnCount();
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getRowCount()
+ *
+ * @return
+ */
+ @Override
+ public int getRowCount() {
+ return this.manager.getRowCount();
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.services.IDisposable#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ this.manager = null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractHeaderDataProvider.java
index cbc47c88036..8be649c3b23 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/AbstractHeaderDataProvider.java
@@ -1,205 +1,205 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-import org.eclipse.papyrus.infra.tools.util.IntegerAndSpreadsheetNumberConverter;
-
-/**
- * Abstract class for the header data provider
- *
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractHeaderDataProvider extends AbstractDataProvider {
-
- /** fields used to know what display in the headers */
- protected boolean displayIndex;
-
- protected boolean displayLabel;
-
- protected boolean displayFilter;
-
- protected AxisIndexStyle style;
-
- /** listener on {@link Table#isInvertAxis()} feature */
- private Adapter invertedListener;
-
- /**
- * listener on the axis configuration
- */
- private Adapter axisListener;
-
- /**
- * listener on the table
- */
- private Adapter localHeaderConfigListener;
-
- /**
- * the listen axis configuration
- */
- private AbstractHeaderAxisConfiguration listenAxisConfiguration;
-
-
- /**
- *
- * Constructor.
- *
- * @param tableModelManager
- */
- public AbstractHeaderDataProvider(INattableModelManager tableModelManager) {// TODO : we don't manage the remove of the axis configuration (possible when we return to the initial configuration
- super(tableModelManager);
- this.listenAxisConfiguration = getAxisConfiguration();
- initListeners();
- this.manager.getTable().eAdapters().add(this.invertedListener);
- this.manager.getTable().eAdapters().add(this.localHeaderConfigListener);
- initFields();
- }
-
- /**
- * Create the listeners, but doesn't assign them to an object
- */
- protected void initListeners() {
- this.axisListener = new AdapterImpl() {
-
- @Override
- public void notifyChanged(Notification msg) {
- final Object feature = msg.getFeature();
- if (feature != null) {
- if (feature.equals(NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayFilter())) {
- AbstractHeaderDataProvider.this.displayFilter = msg.getNewBooleanValue();
- updateAxisCount();
- } else if (feature.equals(NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayIndex())) {
- AbstractHeaderDataProvider.this.displayIndex = msg.getNewBooleanValue();
- updateAxisCount();
- } else if (feature.equals(NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayLabel())) {
- AbstractHeaderDataProvider.this.displayLabel = msg.getNewBooleanValue();
- updateAxisCount();
- } else if (feature.equals(NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_IndexStyle())) {
- AbstractHeaderDataProvider.this.style = AxisIndexStyle.get(msg.getNewStringValue());
- updateAxisCount();
- }
- }
- }
- };
- this.invertedListener = new AdapterImpl() {
-
- @Override
- public void notifyChanged(Notification msg) {
- if (msg.getFeature() == NattablePackage.eINSTANCE.getTable_InvertAxis()) {
- final Object oldValue = msg.getOldValue();
- final Object newValue = msg.getNewValue();
- if (oldValue != null && newValue != null) {
- initFields();
- }
- }
- }
- };
-
- this.localHeaderConfigListener = new AdapterImpl() {
-
- @Override
- public void notifyChanged(Notification msg) {
- if (msg.getFeature() == NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration() || msg.getFeature() == NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration()) {
- initFields();
- }
- }
- };
- }
-
- /**
- * init the field value, and update the listen axis if required
- */
- private void initFields() {
- if (this.listenAxisConfiguration != getAxisConfiguration() && this.listenAxisConfiguration != null) {
- this.listenAxisConfiguration.eAdapters().remove(this.axisListener);
- }
- this.listenAxisConfiguration = getAxisConfiguration();
- if (this.listenAxisConfiguration != null) {
- this.listenAxisConfiguration.eAdapters().add(this.axisListener);
- if (this.listenAxisConfiguration instanceof AbstractHeaderAxisConfiguration) {
- AbstractHeaderAxisConfiguration config = this.listenAxisConfiguration;
- this.style = config.getIndexStyle();
- this.displayFilter = config.isDisplayFilter();
- this.displayLabel = config.isDisplayLabel();
- this.displayIndex = config.isDisplayIndex();
- }
- }
- updateAxisCount();
- }
-
- /**
- * this method is used to update the values in the inherited classes
- */
- protected abstract void updateAxisCount();
-
- /**
- *
- * @return
- * the axis configuration to listen
- */
- protected abstract AbstractHeaderAxisConfiguration getAxisConfiguration();
-
- /**
- *
- * @see org.eclipse.ui.services.IDisposable#dispose()
- *
- */
- @Override
- public void dispose() {
- removeListeners();
- this.listenAxisConfiguration = null;
- super.dispose();
- }
-
- /**
- * remove the listener
- */
- protected void removeListeners() {
- if (this.listenAxisConfiguration != null) {
- this.listenAxisConfiguration.eAdapters().remove(this.axisListener);
- }
- this.manager.getTable().eAdapters().remove(this.invertedListener);
- this.manager.getTable().eAdapters().remove(this.localHeaderConfigListener);
- }
-
- /**
- *
- * @param axisIndex
- * the index of the axis
- * @return
- * the index to display according to the index style
- */
- protected Object getAxisIndex(int axisIndex) {
- if (axisIndex > -1) {
- switch (this.style) {
- case ALPHABETIC:
- return IntegerAndSpreadsheetNumberConverter.toString(axisIndex + 1);
- case NUMERIC:
- return axisIndex;
- }
- }
- return null;
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+import org.eclipse.papyrus.infra.tools.util.IntegerAndSpreadsheetNumberConverter;
+
+/**
+ * Abstract class for the header data provider
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractHeaderDataProvider extends AbstractDataProvider {
+
+ /** fields used to know what display in the headers */
+ protected boolean displayIndex;
+
+ protected boolean displayLabel;
+
+ protected boolean displayFilter;
+
+ protected AxisIndexStyle style;
+
+ /** listener on {@link Table#isInvertAxis()} feature */
+ private Adapter invertedListener;
+
+ /**
+ * listener on the axis configuration
+ */
+ private Adapter axisListener;
+
+ /**
+ * listener on the table
+ */
+ private Adapter localHeaderConfigListener;
+
+ /**
+ * the listen axis configuration
+ */
+ private AbstractHeaderAxisConfiguration listenAxisConfiguration;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableModelManager
+ */
+ public AbstractHeaderDataProvider(INattableModelManager tableModelManager) {// TODO : we don't manage the remove of the axis configuration (possible when we return to the initial configuration
+ super(tableModelManager);
+ this.listenAxisConfiguration = getAxisConfiguration();
+ initListeners();
+ this.manager.getTable().eAdapters().add(this.invertedListener);
+ this.manager.getTable().eAdapters().add(this.localHeaderConfigListener);
+ initFields();
+ }
+
+ /**
+ * Create the listeners, but doesn't assign them to an object
+ */
+ protected void initListeners() {
+ this.axisListener = new AdapterImpl() {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ final Object feature = msg.getFeature();
+ if (feature != null) {
+ if (feature.equals(NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayFilter())) {
+ AbstractHeaderDataProvider.this.displayFilter = msg.getNewBooleanValue();
+ updateAxisCount();
+ } else if (feature.equals(NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayIndex())) {
+ AbstractHeaderDataProvider.this.displayIndex = msg.getNewBooleanValue();
+ updateAxisCount();
+ } else if (feature.equals(NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayLabel())) {
+ AbstractHeaderDataProvider.this.displayLabel = msg.getNewBooleanValue();
+ updateAxisCount();
+ } else if (feature.equals(NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_IndexStyle())) {
+ AbstractHeaderDataProvider.this.style = AxisIndexStyle.get(msg.getNewStringValue());
+ updateAxisCount();
+ }
+ }
+ }
+ };
+ this.invertedListener = new AdapterImpl() {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ if (msg.getFeature() == NattablePackage.eINSTANCE.getTable_InvertAxis()) {
+ final Object oldValue = msg.getOldValue();
+ final Object newValue = msg.getNewValue();
+ if (oldValue != null && newValue != null) {
+ initFields();
+ }
+ }
+ }
+ };
+
+ this.localHeaderConfigListener = new AdapterImpl() {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ if (msg.getFeature() == NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration() || msg.getFeature() == NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration()) {
+ initFields();
+ }
+ }
+ };
+ }
+
+ /**
+ * init the field value, and update the listen axis if required
+ */
+ private void initFields() {
+ if (this.listenAxisConfiguration != getAxisConfiguration() && this.listenAxisConfiguration != null) {
+ this.listenAxisConfiguration.eAdapters().remove(this.axisListener);
+ }
+ this.listenAxisConfiguration = getAxisConfiguration();
+ if (this.listenAxisConfiguration != null) {
+ this.listenAxisConfiguration.eAdapters().add(this.axisListener);
+ if (this.listenAxisConfiguration instanceof AbstractHeaderAxisConfiguration) {
+ AbstractHeaderAxisConfiguration config = this.listenAxisConfiguration;
+ this.style = config.getIndexStyle();
+ this.displayFilter = config.isDisplayFilter();
+ this.displayLabel = config.isDisplayLabel();
+ this.displayIndex = config.isDisplayIndex();
+ }
+ }
+ updateAxisCount();
+ }
+
+ /**
+ * this method is used to update the values in the inherited classes
+ */
+ protected abstract void updateAxisCount();
+
+ /**
+ *
+ * @return
+ * the axis configuration to listen
+ */
+ protected abstract AbstractHeaderAxisConfiguration getAxisConfiguration();
+
+ /**
+ *
+ * @see org.eclipse.ui.services.IDisposable#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ removeListeners();
+ this.listenAxisConfiguration = null;
+ super.dispose();
+ }
+
+ /**
+ * remove the listener
+ */
+ protected void removeListeners() {
+ if (this.listenAxisConfiguration != null) {
+ this.listenAxisConfiguration.eAdapters().remove(this.axisListener);
+ }
+ this.manager.getTable().eAdapters().remove(this.invertedListener);
+ this.manager.getTable().eAdapters().remove(this.localHeaderConfigListener);
+ }
+
+ /**
+ *
+ * @param axisIndex
+ * the index of the axis
+ * @return
+ * the index to display according to the index style
+ */
+ protected Object getAxisIndex(int axisIndex) {
+ if (axisIndex > -1) {
+ switch (this.style) {
+ case ALPHABETIC:
+ return IntegerAndSpreadsheetNumberConverter.toString(axisIndex + 1);
+ case NUMERIC:
+ return axisIndex;
+ }
+ }
+ return null;
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/BodyDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/BodyDataProvider.java
index 4ec409bb366..81b93302af7 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/BodyDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/BodyDataProvider.java
@@ -1,56 +1,56 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class BodyDataProvider extends AbstractDataProvider {
-
- /**
- *
- * Constructor.
- *
- * @param tableModelManager
- * the table manager
- */
- public BodyDataProvider(final INattableModelManager tableModelManager) {
- super(tableModelManager);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getDataValue(int, int)
- *
- * @param columnIndex
- * @param rowIndex
- * @return
- */
- @Override
- public Object getDataValue(int columnIndex, int rowIndex) {
- IDataProvider provider = this.manager.getBodyDataProvider();
- return provider.getDataValue(columnIndex, rowIndex);
- }
-
- @Override
- public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
- this.manager.setDataValue(columnIndex, rowIndex, newValue);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class BodyDataProvider extends AbstractDataProvider {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableModelManager
+ * the table manager
+ */
+ public BodyDataProvider(final INattableModelManager tableModelManager) {
+ super(tableModelManager);
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getDataValue(int, int)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @return
+ */
+ @Override
+ public Object getDataValue(int columnIndex, int rowIndex) {
+ IDataProvider provider = this.manager.getBodyDataProvider();
+ return provider.getDataValue(columnIndex, rowIndex);
+ }
+
+ @Override
+ public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
+ this.manager.setDataValue(columnIndex, rowIndex, newValue);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnHeaderDataProvider.java
index c0f2c30fe3d..7fc5f10a984 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnHeaderDataProvider.java
@@ -1,135 +1,135 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-
-/**
- *
- * This manager is used to manage the column header.
- *
- *
- */
-@Deprecated
-public class ColumnHeaderDataProvider extends AbstractHeaderDataProvider {
-
- private int rowCount;
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the manager used to manage the table
- */
- public ColumnHeaderDataProvider(final INattableModelManager manager) {
- super(manager);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getRowCount()
- *
- * @return
- */
- @Override
- public int getRowCount() {
- return this.rowCount;
- }
-
-
- /**
- * This class does not support multiple rows in the column header layer.
- */
- @Override
- public Object getDataValue(final int columnIndex, final int rowIndex) {
- switch (this.rowCount) {
- case 0:
- return null;
- case 1:
- if (this.displayFilter) {
- return null;// TODO not tested
- } else if (this.displayIndex) {
- return getAxisIndex(columnIndex);
- } else if (this.displayLabel) {
- return this.manager.getColumnElement(columnIndex);
- }
- case 2:
- if (!this.displayFilter) {
- if (rowIndex == 0) {
- return getAxisIndex(columnIndex);
- }
- if (rowIndex == 1) {
- return this.manager.getColumnElement(columnIndex);
- }
- } else {
- // TODO not tested
- }
- break;
- case 3:
- if (!this.displayFilter) {
- if (rowIndex == 0) {
- return getAxisIndex(columnIndex);
- }
- if (rowIndex == 1) {
- return this.manager.getColumnElement(columnIndex);
- }
- if (rowIndex == 2) {
- // TODO not tested
- }
- }
- break;
- }
- return null;
- }
-
- @Override
- public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
- // TODO
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
- *
- * @return
- */
- @Override
- protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
- return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#updateAxisCount()
- *
- */
- @Override
- protected void updateAxisCount() {
- int newAxisCOunt = 0;
- if (this.displayFilter) {
- newAxisCOunt++;
- }
- if (this.displayIndex) {
- newAxisCOunt++;
- }
- if (this.displayLabel) {
- newAxisCOunt++;
- }
- this.rowCount = newAxisCOunt;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+
+/**
+ *
+ * This manager is used to manage the column header.
+ *
+ *
+ */
+@Deprecated
+public class ColumnHeaderDataProvider extends AbstractHeaderDataProvider {
+
+ private int rowCount;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the manager used to manage the table
+ */
+ public ColumnHeaderDataProvider(final INattableModelManager manager) {
+ super(manager);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getRowCount()
+ *
+ * @return
+ */
+ @Override
+ public int getRowCount() {
+ return this.rowCount;
+ }
+
+
+ /**
+ * This class does not support multiple rows in the column header layer.
+ */
+ @Override
+ public Object getDataValue(final int columnIndex, final int rowIndex) {
+ switch (this.rowCount) {
+ case 0:
+ return null;
+ case 1:
+ if (this.displayFilter) {
+ return null;// TODO not tested
+ } else if (this.displayIndex) {
+ return getAxisIndex(columnIndex);
+ } else if (this.displayLabel) {
+ return this.manager.getColumnElement(columnIndex);
+ }
+ case 2:
+ if (!this.displayFilter) {
+ if (rowIndex == 0) {
+ return getAxisIndex(columnIndex);
+ }
+ if (rowIndex == 1) {
+ return this.manager.getColumnElement(columnIndex);
+ }
+ } else {
+ // TODO not tested
+ }
+ break;
+ case 3:
+ if (!this.displayFilter) {
+ if (rowIndex == 0) {
+ return getAxisIndex(columnIndex);
+ }
+ if (rowIndex == 1) {
+ return this.manager.getColumnElement(columnIndex);
+ }
+ if (rowIndex == 2) {
+ // TODO not tested
+ }
+ }
+ break;
+ }
+ return null;
+ }
+
+ @Override
+ public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
+ // TODO
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
+ return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#updateAxisCount()
+ *
+ */
+ @Override
+ protected void updateAxisCount() {
+ int newAxisCOunt = 0;
+ if (this.displayFilter) {
+ newAxisCOunt++;
+ }
+ if (this.displayIndex) {
+ newAxisCOunt++;
+ }
+ if (this.displayLabel) {
+ newAxisCOunt++;
+ }
+ this.rowCount = newAxisCOunt;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnIndexHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnIndexHeaderDataProvider.java
index d78ec70857e..bbeb548c255 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnIndexHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnIndexHeaderDataProvider.java
@@ -1,88 +1,88 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-
-/**
- *
- * @author Vincent Lorenzo
- * DataProvider for row index header
- */
-public class ColumnIndexHeaderDataProvider extends AbstractIndexHeaderDataProvider {
-
- /**
- *
- * Constructor.
- *
- * @param tableModelManager
- */
- public ColumnIndexHeaderDataProvider(final INattableModelManager tableModelManager) {
- super(tableModelManager);
- }
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
- *
- * @param columnIndex
- * @param rowIndex
- * @param newValue
- */
- @Override
- public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
- *
- * @return
- */
- @Override
- protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
- return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
- }
-
- /**
- * @Override
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getRowCount()
- *
- * @return
- */
- @Override
- public int getRowCount() {
- if (this.displayIndex) {
- return 1;
- }
- return 0;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDataValue(int, int)
- *
- * @param columnIndex
- * @param rowIndex
- * @return
- */
- @Override
- public Object getDataValue(int columnIndex, int rowIndex) {
- return getAxisIndex(columnIndex);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ * DataProvider for row index header
+ */
+public class ColumnIndexHeaderDataProvider extends AbstractIndexHeaderDataProvider {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableModelManager
+ */
+ public ColumnIndexHeaderDataProvider(final INattableModelManager tableModelManager) {
+ super(tableModelManager);
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @param newValue
+ */
+ @Override
+ public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
+ return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
+ }
+
+ /**
+ * @Override
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getRowCount()
+ *
+ * @return
+ */
+ @Override
+ public int getRowCount() {
+ if (this.displayIndex) {
+ return 1;
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDataValue(int, int)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @return
+ */
+ @Override
+ public Object getDataValue(int columnIndex, int rowIndex) {
+ return getAxisIndex(columnIndex);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnLabelHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnLabelHeaderDataProvider.java
index d389dd806a4..cc4394dec38 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnLabelHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/ColumnLabelHeaderDataProvider.java
@@ -1,91 +1,91 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-
-/**
- *
- * @author Vincent Lorenzo
- * DataProvider for row index header
- */
-public class ColumnLabelHeaderDataProvider extends AbstractLabelHeaderDataProvider {
-
- /**
- *
- * Constructor.
- *
- * @param tableModelManager
- */
- public ColumnLabelHeaderDataProvider(INattableModelManager tableModelManager) {
- super(tableModelManager);
- }
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
- *
- * @param columnIndex
- * @param rowIndex
- * @param newValue
- */
- @Override
- public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
- *
- * @return
- */
- @Override
- protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
- return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getColumnCount()
- *
- * @return
- */
- @Override
- public int getRowCount() {
- if (displayLabel) {
- return 1;
- }
- return 0;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDataValue(int, int)
- *
- * @param columnIndex
- * @param rowIndex
- * @return
- */
- @Override
- public Object getDataValue(int columnIndex, int rowIndex) {
- if (columnIndex >= 0) {
- return this.manager.getColumnElement(columnIndex);
- }
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ * DataProvider for row index header
+ */
+public class ColumnLabelHeaderDataProvider extends AbstractLabelHeaderDataProvider {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableModelManager
+ */
+ public ColumnLabelHeaderDataProvider(INattableModelManager tableModelManager) {
+ super(tableModelManager);
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @param newValue
+ */
+ @Override
+ public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
+ return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getColumnCount()
+ *
+ * @return
+ */
+ @Override
+ public int getRowCount() {
+ if (displayLabel) {
+ return 1;
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDataValue(int, int)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @return
+ */
+ @Override
+ public Object getDataValue(int columnIndex, int rowIndex) {
+ if (columnIndex >= 0) {
+ return this.manager.getColumnElement(columnIndex);
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeColumnHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeColumnHeaderDataProvider.java
index 4d21bce860f..e43ff5a3c04 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeColumnHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeColumnHeaderDataProvider.java
@@ -1,63 +1,63 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- * The Class CompositeColumnHeaderDataProvider.
- *
- * @author Vincent Lorenzo
- */
-public class CompositeColumnHeaderDataProvider extends AbstractCompositeDataProvider {
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the nattable model manager
- */
- public CompositeColumnHeaderDataProvider(INattableModelManager manager) {
- super(manager);
- }
-
-
- /**
- * Gets the row count.
- *
- * @return the row count
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractCompositeDataProvider#getColumnCount()
- */
- @Override
- public int getRowCount() {
- int i = 0;
- for (IDataProvider current : providers) {
- i += current.getRowCount();
- }
- return i;
- }
-
- /**
- * Gets the column count.
- *
- * @return the column count
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractCompositeDataProvider#getRowCount()
- */
- @Override
- public int getColumnCount() {
- return this.manager.getColumnElementsList().size();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ * The Class CompositeColumnHeaderDataProvider.
+ *
+ * @author Vincent Lorenzo
+ */
+public class CompositeColumnHeaderDataProvider extends AbstractCompositeDataProvider {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the nattable model manager
+ */
+ public CompositeColumnHeaderDataProvider(INattableModelManager manager) {
+ super(manager);
+ }
+
+
+ /**
+ * Gets the row count.
+ *
+ * @return the row count
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractCompositeDataProvider#getColumnCount()
+ */
+ @Override
+ public int getRowCount() {
+ int i = 0;
+ for (IDataProvider current : providers) {
+ i += current.getRowCount();
+ }
+ return i;
+ }
+
+ /**
+ * Gets the column count.
+ *
+ * @return the column count
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractCompositeDataProvider#getRowCount()
+ */
+ @Override
+ public int getColumnCount() {
+ return this.manager.getColumnElementsList().size();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeRowHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeRowHeaderDataProvider.java
index 056933d7af4..a71617507e5 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeRowHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/CompositeRowHeaderDataProvider.java
@@ -1,64 +1,64 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- *
- * @author Vincent Lorenzo
- * a composite header data provider
- *
- */
-public class CompositeRowHeaderDataProvider extends AbstractCompositeDataProvider {
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the nattable model manager
- */
- public CompositeRowHeaderDataProvider(final INattableModelManager manager) {
- super(manager);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractCompositeDataProvider#getColumnCount()
- *
- * @return
- */
- @Override
- public int getColumnCount() {
- int i = 0;
- for (IDataProvider current : providers) {
- i += current.getColumnCount();
- }
- return i;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractCompositeDataProvider#getRowCount()
- *
- * @return
- */
- @Override
- public int getRowCount() {
- return this.manager.getRowElementsList().size();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ * a composite header data provider
+ *
+ */
+public class CompositeRowHeaderDataProvider extends AbstractCompositeDataProvider {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the nattable model manager
+ */
+ public CompositeRowHeaderDataProvider(final INattableModelManager manager) {
+ super(manager);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractCompositeDataProvider#getColumnCount()
+ *
+ * @return
+ */
+ @Override
+ public int getColumnCount() {
+ int i = 0;
+ for (IDataProvider current : providers) {
+ i += current.getColumnCount();
+ }
+ return i;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractCompositeDataProvider#getRowCount()
+ *
+ * @return
+ */
+ @Override
+ public int getRowCount() {
+ return this.manager.getRowElementsList().size();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/HierarchicalRowLabelHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/HierarchicalRowLabelHeaderDataProvider.java
index 598e1a1d1b1..0c0e6d5e6fa 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/HierarchicalRowLabelHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/HierarchicalRowLabelHeaderDataProvider.java
@@ -1,105 +1,105 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
-import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
-import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class HierarchicalRowLabelHeaderDataProvider extends RowLabelHeaderDataProvider {
-
- /**
- * Constructor.
- *
- * @param tableModelManager
- */
- public HierarchicalRowLabelHeaderDataProvider(INattableModelManager tableModelManager) {
- super(tableModelManager);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getColumnCount()
- *
- * @return
- */
- @Override
- public int getColumnCount() {
- if (displayLabel) {
- final DisplayStyle style = TableHelper.getTableDisplayStyle(this.manager);
- if (DisplayStyle.NORMAL.equals(style) || DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(style)) {
- return 1;
- } else if (DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(style)) {
- boolean hasConfForFirstLevel = FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(this.manager.getTable(), 0);
- int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(this.manager.getTable());
- int depth = maxDepth * 2;
- if (!hasConfForFirstLevel) {
- depth += 1;
- } else {
- depth += 2;
- }
- return depth;
- }
- }
- return 0;
- }
-
- /**
- *
- * @param axis
- * a tree item axis
- * @return
- * the depth of the element
- */
- protected final int getDepth(final ITreeItemAxis axis) {
- if (this.manager instanceof ITreeNattableModelManager) {
- return ((ITreeNattableModelManager) this.manager).getTreeItemDepth(axis);
- }
- return 0;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDa_itaValue(int, int)
- *
- * @param columnIndex
- * @param rowIndex
- * @return
- */
- @Override
- public Object getDataValue(int columnIndex, int rowIndex) {
- if (rowIndex >= 0) {
- Object rowElement = this.manager.getRowElement(rowIndex);
- final DisplayStyle style = TableHelper.getTableDisplayStyle(this.manager.getTable());
- if (DisplayStyle.NORMAL.equals(style) || DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(style)) {
- return rowElement;
- } else if (DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(style)) {
- if (rowElement instanceof ITreeItemAxis) {
- int depth = getDepth((ITreeItemAxis) rowElement);
- if (depth == columnIndex) {
- return rowElement;
- }
- }
- }
- }
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
+import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
+import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class HierarchicalRowLabelHeaderDataProvider extends RowLabelHeaderDataProvider {
+
+ /**
+ * Constructor.
+ *
+ * @param tableModelManager
+ */
+ public HierarchicalRowLabelHeaderDataProvider(INattableModelManager tableModelManager) {
+ super(tableModelManager);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getColumnCount()
+ *
+ * @return
+ */
+ @Override
+ public int getColumnCount() {
+ if (displayLabel) {
+ final DisplayStyle style = TableHelper.getTableDisplayStyle(this.manager);
+ if (DisplayStyle.NORMAL.equals(style) || DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(style)) {
+ return 1;
+ } else if (DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(style)) {
+ boolean hasConfForFirstLevel = FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(this.manager.getTable(), 0);
+ int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(this.manager.getTable());
+ int depth = maxDepth * 2;
+ if (!hasConfForFirstLevel) {
+ depth += 1;
+ } else {
+ depth += 2;
+ }
+ return depth;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @param axis
+ * a tree item axis
+ * @return
+ * the depth of the element
+ */
+ protected final int getDepth(final ITreeItemAxis axis) {
+ if (this.manager instanceof ITreeNattableModelManager) {
+ return ((ITreeNattableModelManager) this.manager).getTreeItemDepth(axis);
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDa_itaValue(int, int)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @return
+ */
+ @Override
+ public Object getDataValue(int columnIndex, int rowIndex) {
+ if (rowIndex >= 0) {
+ Object rowElement = this.manager.getRowElement(rowIndex);
+ final DisplayStyle style = TableHelper.getTableDisplayStyle(this.manager.getTable());
+ if (DisplayStyle.NORMAL.equals(style) || DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(style)) {
+ return rowElement;
+ } else if (DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(style)) {
+ if (rowElement instanceof ITreeItemAxis) {
+ int depth = getDepth((ITreeItemAxis) rowElement);
+ if (depth == columnIndex) {
+ return rowElement;
+ }
+ }
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowIndexHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowIndexHeaderDataProvider.java
index 5880d3ae0d5..0a622a4778f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowIndexHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowIndexHeaderDataProvider.java
@@ -1,131 +1,131 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
-
-/**
- *
- * @author Vincent Lorenzo
- * DataProvider for row index header
- */
-public class RowIndexHeaderDataProvider extends AbstractIndexHeaderDataProvider {
-
- /**
- *
- * Constructor.
- *
- * @param tableModelManager
- */
- public RowIndexHeaderDataProvider(final INattableModelManager tableModelManager) {
- super(tableModelManager);
- }
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
- *
- * @param columnIndex
- * @param rowIndex
- * @param newValue
- */
- @Override
- public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
- *
- * @return
- */
- @Override
- protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
- return HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getColumnCount()
- *
- * @return
- */
- @Override
- public int getColumnCount() {
- if (this.displayIndex) {
- return 1;
- }
- return 0;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDataValue(int, int)
- *
- * @param columnIndex
- * @param rowIndex
- * @return
- */
- @Override
- public Object getDataValue(int columnIndex, int rowIndex) {
- if (this.style == AxisIndexStyle.NUMERIC && displayIndexWithDepth() && TableHelper.isTreeTable(manager)) {
- return getTreeRowIndex(rowIndex);
- }
- return getAxisIndex(rowIndex);
- }
-
- /**
- *
- * @return
- * <code>true</code> if the index must be displayed as depth
- */
- protected boolean displayIndexWithDepth() {
- return false;
- }
-
- /**
- *
- * @param rowIndex
- * a row index
- * @return
- * a tree row index (1.0.0.1) ...
- */
- private Object getTreeRowIndex(int rowIndex) {
- // not finished just here for try
- ITreeItemAxis axis = (ITreeItemAxis) manager.getRowElementsList().get(rowIndex);
- StringBuilder builder = new StringBuilder();
- ITreeItemAxis parent = axis;
- while (parent != null) {
- ITreeItemAxis p = parent.getParent();
- if (p != null) {
- int index = p.getChildren().indexOf(parent);
- builder.append(index);
- builder.append(".");//$NON-NLS-1$
- } else {
- builder.append("1");//$//$NON-NLS-1$
- }
-
- parent = p;
-
- }
- return builder.reverse().toString();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ * DataProvider for row index header
+ */
+public class RowIndexHeaderDataProvider extends AbstractIndexHeaderDataProvider {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableModelManager
+ */
+ public RowIndexHeaderDataProvider(final INattableModelManager tableModelManager) {
+ super(tableModelManager);
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @param newValue
+ */
+ @Override
+ public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
+ return HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getColumnCount()
+ *
+ * @return
+ */
+ @Override
+ public int getColumnCount() {
+ if (this.displayIndex) {
+ return 1;
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDataValue(int, int)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @return
+ */
+ @Override
+ public Object getDataValue(int columnIndex, int rowIndex) {
+ if (this.style == AxisIndexStyle.NUMERIC && displayIndexWithDepth() && TableHelper.isTreeTable(manager)) {
+ return getTreeRowIndex(rowIndex);
+ }
+ return getAxisIndex(rowIndex);
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> if the index must be displayed as depth
+ */
+ protected boolean displayIndexWithDepth() {
+ return false;
+ }
+
+ /**
+ *
+ * @param rowIndex
+ * a row index
+ * @return
+ * a tree row index (1.0.0.1) ...
+ */
+ private Object getTreeRowIndex(int rowIndex) {
+ // not finished just here for try
+ ITreeItemAxis axis = (ITreeItemAxis) manager.getRowElementsList().get(rowIndex);
+ StringBuilder builder = new StringBuilder();
+ ITreeItemAxis parent = axis;
+ while (parent != null) {
+ ITreeItemAxis p = parent.getParent();
+ if (p != null) {
+ int index = p.getChildren().indexOf(parent);
+ builder.append(index);
+ builder.append(".");//$NON-NLS-1$
+ } else {
+ builder.append("1");//$//$NON-NLS-1$
+ }
+
+ parent = p;
+
+ }
+ return builder.reverse().toString();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowLabelHeaderDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowLabelHeaderDataProvider.java
index 3bbd9e4b357..4d591999b60 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowLabelHeaderDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dataprovider/RowLabelHeaderDataProvider.java
@@ -1,92 +1,92 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dataprovider;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-
-/**
- *
- * @author Vincent Lorenzo
- * DataProvider for row index header
- */
-public class RowLabelHeaderDataProvider extends AbstractLabelHeaderDataProvider {
-
- /**
- *
- * Constructor.
- *
- * @param tableModelManager
- */
- public RowLabelHeaderDataProvider(INattableModelManager tableModelManager) {
- super(tableModelManager);
- }
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
- *
- * @param columnIndex
- * @param rowIndex
- * @param newValue
- */
- @Override
- public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
- *
- * @return
- */
- @Override
- protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
- return HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getColumnCount()
- *
- * @return
- */
- @Override
- public int getColumnCount() {
- if (displayLabel) {
- return 1;
- }
- return 0;
- }
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDa_itaValue(int, int)
- *
- * @param columnIndex
- * @param rowIndex
- * @return
- */
- @Override
- public Object getDataValue(int columnIndex, int rowIndex) {
- if (rowIndex >= 0) {
- return this.manager.getRowElement(rowIndex);
- }
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dataprovider;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ * DataProvider for row index header
+ */
+public class RowLabelHeaderDataProvider extends AbstractLabelHeaderDataProvider {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableModelManager
+ */
+ public RowLabelHeaderDataProvider(INattableModelManager tableModelManager) {
+ super(tableModelManager);
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @param newValue
+ */
+ @Override
+ public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractHeaderDataProvider#getAxisConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getAxisConfiguration() {
+ return HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(this.manager.getTable());
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractDataProvider#getColumnCount()
+ *
+ * @return
+ */
+ @Override
+ public int getColumnCount() {
+ if (displayLabel) {
+ return 1;
+ }
+ return 0;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.dataprovider.AbstractIndexHeaderDataProvider#getDa_itaValue(int, int)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @return
+ */
+ @Override
+ public Object getDataValue(int columnIndex, int rowIndex) {
+ if (rowIndex >= 0) {
+ return this.manager.getRowElement(rowIndex);
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/DisplayedAxisSelectorDialog.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/DisplayedAxisSelectorDialog.java
index 770fe206308..575b9d30628 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/DisplayedAxisSelectorDialog.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/DisplayedAxisSelectorDialog.java
@@ -1,128 +1,128 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dialog;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
-import org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectionWithCheckBoxDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * This dialog adds a specific action on the okPressed() (opening a dialog)
- *
- * @author Vincent Lorenzo
- *
- */
-public class DisplayedAxisSelectorDialog extends MultipleValueSelectionWithCheckBoxDialog {
-
- /**
- * the title of the information dialog
- */
- private String informationDialogTitle;
-
- /**
- * the message of the information dialog
- */
- private String informationDialogMessage;
-
- /**
- * Constructor.
- *
- * @param parentShell
- * @param selector
- * @param unique
- */
- public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector, boolean unique) {
- super(parentShell, selector, unique);
- }
-
- /**
- * Constructor.
- *
- * @param parentShell
- * @param selector
- * @param title
- * @param unique
- * @param ordered
- * @param upperBound
- */
- public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector, String title, boolean unique, boolean ordered, int upperBound) {
- super(parentShell, selector, title, unique, ordered, upperBound);
- }
-
- /**
- * Constructor.
- *
- * @param parentShell
- * @param selector
- * @param title
- * @param unique
- * @param ordered
- */
- public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector, String title, boolean unique, boolean ordered) {
- super(parentShell, selector, title, unique, ordered);
- }
-
- /**
- * Constructor.
- *
- * @param parentShell
- * @param selector
- * @param title
- */
- public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector, String title) {
- super(parentShell, selector, title);
- }
-
- /**
- * Constructor.
- *
- * @param parentShell
- * @param selector
- */
- public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector) {
- super(parentShell, selector);
- }
-
- /**
- *
- * @param title
- * the title for the information dialog
- * @param message
- * the message for the information dialog
- */
- public void setInformationDialogValues(final String title, final String message) {
- this.informationDialogTitle = title;
- this.informationDialogMessage = message;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectorDialog#okPressed()
- *
- */
- @Override
- protected void okPressed() {
- boolean mustContinue = true;
-
- if (isDisplayingCheckBox() && !isChecked()) {
- mustContinue = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), informationDialogTitle, informationDialogMessage);
- }
- if (mustContinue) {
- super.okPressed();
- }
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dialog;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
+import org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectionWithCheckBoxDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * This dialog adds a specific action on the okPressed() (opening a dialog)
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class DisplayedAxisSelectorDialog extends MultipleValueSelectionWithCheckBoxDialog {
+
+ /**
+ * the title of the information dialog
+ */
+ private String informationDialogTitle;
+
+ /**
+ * the message of the information dialog
+ */
+ private String informationDialogMessage;
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * @param selector
+ * @param unique
+ */
+ public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector, boolean unique) {
+ super(parentShell, selector, unique);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * @param selector
+ * @param title
+ * @param unique
+ * @param ordered
+ * @param upperBound
+ */
+ public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector, String title, boolean unique, boolean ordered, int upperBound) {
+ super(parentShell, selector, title, unique, ordered, upperBound);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * @param selector
+ * @param title
+ * @param unique
+ * @param ordered
+ */
+ public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector, String title, boolean unique, boolean ordered) {
+ super(parentShell, selector, title, unique, ordered);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * @param selector
+ * @param title
+ */
+ public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector, String title) {
+ super(parentShell, selector, title);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * @param selector
+ */
+ public DisplayedAxisSelectorDialog(Shell parentShell, IElementSelector selector) {
+ super(parentShell, selector);
+ }
+
+ /**
+ *
+ * @param title
+ * the title for the information dialog
+ * @param message
+ * the message for the information dialog
+ */
+ public void setInformationDialogValues(final String title, final String message) {
+ this.informationDialogTitle = title;
+ this.informationDialogMessage = message;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectorDialog#okPressed()
+ *
+ */
+ @Override
+ protected void okPressed() {
+ boolean mustContinue = true;
+
+ if (isDisplayingCheckBox() && !isChecked()) {
+ mustContinue = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), informationDialogTitle, informationDialogMessage);
+ }
+ if (mustContinue) {
+ super.okPressed();
+ }
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/LoadCurrentAxisProvidersDialog.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/LoadCurrentAxisProvidersDialog.java
index 93e1ccee908..5f179b19848 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/LoadCurrentAxisProvidersDialog.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/dialog/LoadCurrentAxisProvidersDialog.java
@@ -1,228 +1,228 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.dialog;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-/**
- * This dialog displays in a table the axis providers stored in a table's historic. It allows to choose one of them.
- *
- */
-public class LoadCurrentAxisProvidersDialog extends Dialog {
-
- private TableViewer viewer;
-
- private EList<AbstractAxisProvider> iAxisProvidersHistory;
-
- private final AbstractAxisProvider currentColumnAxisProvider;
-
- private AbstractAxisProvider selectedAxisProvider;
-
- private ILabelProvider labelProvider;
-
- private IConfigRegistry registry;
-
- /**
- *
- * Constructor.
- *
- * @param parentShell
- * @param iAxisProvidersHistory
- * @param currentColumnAxisProvider
- * @param registry
- */
- public LoadCurrentAxisProvidersDialog(Shell parentShell, EList<AbstractAxisProvider> iAxisProvidersHistory, AbstractAxisProvider currentColumnAxisProvider, IConfigRegistry registry) {
- super(parentShell);
- this.iAxisProvidersHistory = iAxisProvidersHistory;
- this.currentColumnAxisProvider = currentColumnAxisProvider;
- this.registry = registry;
- }
-
- /**
- * Create the dialog.
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- *
- * @param parent
- * @return
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- final Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout layout = new GridLayout(1, false);
- composite.setLayout(layout);
- viewer = new TableViewer(composite, (SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER));
- int[] bounds = { 300, 400, 400 };
- String[] titles = { Messages.LoadCurrentAxisProvidersDialog_0, Messages.LoadCurrentAxisProvidersDialog_1, Messages.LoadCurrentAxisProvidersDialog_2 };
-
- TableViewerColumn colName = createTableViewerColumn(titles[0], bounds[0], 0, viewer);
- colName.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(Object element) {
- AbstractAxisProvider provider = (AbstractAxisProvider) element;
- String text = provider.getName();
- if (currentColumnAxisProvider.equals(element)) {
- text += Messages.LoadCurrentAxisProvidersDialog_3;
- }
- return text;
- }
-
- @Override
- public Font getFont(Object element) {
- Font font = super.getFont(element);
-
- return font;
- }
-
- });
- TableViewerColumn colDescription = createTableViewerColumn(titles[1], bounds[1], 1, viewer);
- colDescription.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(Object element) {
- AbstractAxisProvider provider = (AbstractAxisProvider) element;
- return provider.getDescription();
- }
- });
- TableViewerColumn colColumns = createTableViewerColumn(titles[2], bounds[2], 2, viewer);
- colColumns.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(Object element) {
- AbstractAxisProvider provider = (AbstractAxisProvider) element;
- String text = ""; //$NON-NLS-1$
- for (IAxis axis : provider.getAxis()) {
- final Object representedElement = axis.getElement();
- // ILabelProviderContextElement contextEl = new LabelProviderContextElement(axis, registry);
- // LabelProviderService labelProvider = (ILabelProvider)registry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- if (labelProvider != null) {
- // text += labelProvider.getText(contextEl) + ", ";
- } else {
- if (representedElement instanceof ENamedElement) {
- text += ((ENamedElement) representedElement).getName() + ", "; //$NON-NLS-1$
- } else {
- final String string = representedElement.toString();
- text += string.substring(string.lastIndexOf("::") + 2) + ", "; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
- // We cut the remaining comma and space
- if (!text.isEmpty()) {
- text = text.substring(0, text.length() - 2);
- }
- return text;
- }
- });
- final Table table = viewer.getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- viewer.setContentProvider(new ArrayContentProvider());
- viewer.setInput(iAxisProvidersHistory);
-
- // We add the listener for the selection
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- setSelectedAxisProvider(selection.getFirstElement());
- }
-
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(DoubleClickEvent event) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- setSelectedAxisProvider(selection.getFirstElement());
- close();
- }
- });
-
- viewer.refresh();
- return composite;
- }
-
- /**
- * Set the axis provider selected by the user.
- *
- * @param firstElement
- */
- private void setSelectedAxisProvider(Object firstElement) {
- selectedAxisProvider = (AbstractAxisProvider) firstElement;
- }
-
-
- /**
- * Getter for the selected provider
- *
- * @return
- */
- public AbstractAxisProvider getSelectedAxisProvider() {
- return selectedAxisProvider;
- }
-
-
- /**
- * Create columns
- *
- * @param title
- * @param bound
- * @param colNumber
- * @param viewer
- * @return
- */
- private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber, TableViewer viewer) {
- final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
- final TableColumn column = viewerColumn.getColumn();
- column.setText(title);
- column.setWidth(bound);
- column.setResizable(true);
- column.setMoveable(true);
- return viewerColumn;
- }
-
- /**
- * Set a label provider to show labels for each one of the axis of every axis provider
- *
- * @param labelProvider
- */
- public void setLabelProvider(ILabelProvider labelProvider) {
- this.labelProvider = labelProvider;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.dialog;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * This dialog displays in a table the axis providers stored in a table's historic. It allows to choose one of them.
+ *
+ */
+public class LoadCurrentAxisProvidersDialog extends Dialog {
+
+ private TableViewer viewer;
+
+ private EList<AbstractAxisProvider> iAxisProvidersHistory;
+
+ private final AbstractAxisProvider currentColumnAxisProvider;
+
+ private AbstractAxisProvider selectedAxisProvider;
+
+ private ILabelProvider labelProvider;
+
+ private IConfigRegistry registry;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parentShell
+ * @param iAxisProvidersHistory
+ * @param currentColumnAxisProvider
+ * @param registry
+ */
+ public LoadCurrentAxisProvidersDialog(Shell parentShell, EList<AbstractAxisProvider> iAxisProvidersHistory, AbstractAxisProvider currentColumnAxisProvider, IConfigRegistry registry) {
+ super(parentShell);
+ this.iAxisProvidersHistory = iAxisProvidersHistory;
+ this.currentColumnAxisProvider = currentColumnAxisProvider;
+ this.registry = registry;
+ }
+
+ /**
+ * Create the dialog.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ * @return
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ final Composite composite = (Composite) super.createDialogArea(parent);
+ GridLayout layout = new GridLayout(1, false);
+ composite.setLayout(layout);
+ viewer = new TableViewer(composite, (SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER));
+ int[] bounds = { 300, 400, 400 };
+ String[] titles = { Messages.LoadCurrentAxisProvidersDialog_0, Messages.LoadCurrentAxisProvidersDialog_1, Messages.LoadCurrentAxisProvidersDialog_2 };
+
+ TableViewerColumn colName = createTableViewerColumn(titles[0], bounds[0], 0, viewer);
+ colName.setLabelProvider(new ColumnLabelProvider() {
+
+ @Override
+ public String getText(Object element) {
+ AbstractAxisProvider provider = (AbstractAxisProvider) element;
+ String text = provider.getName();
+ if (currentColumnAxisProvider.equals(element)) {
+ text += Messages.LoadCurrentAxisProvidersDialog_3;
+ }
+ return text;
+ }
+
+ @Override
+ public Font getFont(Object element) {
+ Font font = super.getFont(element);
+
+ return font;
+ }
+
+ });
+ TableViewerColumn colDescription = createTableViewerColumn(titles[1], bounds[1], 1, viewer);
+ colDescription.setLabelProvider(new ColumnLabelProvider() {
+
+ @Override
+ public String getText(Object element) {
+ AbstractAxisProvider provider = (AbstractAxisProvider) element;
+ return provider.getDescription();
+ }
+ });
+ TableViewerColumn colColumns = createTableViewerColumn(titles[2], bounds[2], 2, viewer);
+ colColumns.setLabelProvider(new ColumnLabelProvider() {
+
+ @Override
+ public String getText(Object element) {
+ AbstractAxisProvider provider = (AbstractAxisProvider) element;
+ String text = ""; //$NON-NLS-1$
+ for (IAxis axis : provider.getAxis()) {
+ final Object representedElement = axis.getElement();
+ // ILabelProviderContextElement contextEl = new LabelProviderContextElement(axis, registry);
+ // LabelProviderService labelProvider = (ILabelProvider)registry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ if (labelProvider != null) {
+ // text += labelProvider.getText(contextEl) + ", ";
+ } else {
+ if (representedElement instanceof ENamedElement) {
+ text += ((ENamedElement) representedElement).getName() + ", "; //$NON-NLS-1$
+ } else {
+ final String string = representedElement.toString();
+ text += string.substring(string.lastIndexOf("::") + 2) + ", "; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+ // We cut the remaining comma and space
+ if (!text.isEmpty()) {
+ text = text.substring(0, text.length() - 2);
+ }
+ return text;
+ }
+ });
+ final Table table = viewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ viewer.setContentProvider(new ArrayContentProvider());
+ viewer.setInput(iAxisProvidersHistory);
+
+ // We add the listener for the selection
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ setSelectedAxisProvider(selection.getFirstElement());
+ }
+
+ });
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ setSelectedAxisProvider(selection.getFirstElement());
+ close();
+ }
+ });
+
+ viewer.refresh();
+ return composite;
+ }
+
+ /**
+ * Set the axis provider selected by the user.
+ *
+ * @param firstElement
+ */
+ private void setSelectedAxisProvider(Object firstElement) {
+ selectedAxisProvider = (AbstractAxisProvider) firstElement;
+ }
+
+
+ /**
+ * Getter for the selected provider
+ *
+ * @return
+ */
+ public AbstractAxisProvider getSelectedAxisProvider() {
+ return selectedAxisProvider;
+ }
+
+
+ /**
+ * Create columns
+ *
+ * @param title
+ * @param bound
+ * @param colNumber
+ * @param viewer
+ * @return
+ */
+ private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber, TableViewer viewer) {
+ final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
+ final TableColumn column = viewerColumn.getColumn();
+ column.setText(title);
+ column.setWidth(bound);
+ column.setResizable(true);
+ column.setMoveable(true);
+ return viewerColumn;
+ }
+
+ /**
+ * Set a label provider to show labels for each one of the axis of every axis provider
+ *
+ * @param labelProvider
+ */
+ public void setLabelProvider(ILabelProvider labelProvider) {
+ this.labelProvider = labelProvider;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java
index ad5e22afc88..65bfe56c4c8 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java
@@ -1,45 +1,45 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.formatter;
-
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
-import org.eclipse.nebula.widgets.nattable.export.excel.DefaultExportFormatter;
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-
-/**
- * The export formatter to use to export the same text as the text displayed in the cells
- *
- * @author Vincent Lorenzo
- *
- */
-public class PapyrusExportFormatter extends DefaultExportFormatter {
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.export.IExportFormatter#formatForExport(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param cell
- * @param configRegistry
- * @return
- */
- @Override
- public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
- Object dataValue = cell.getDataValue();
- IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
- return displayConverter.canonicalToDisplayValue(cell, configRegistry, dataValue);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.formatter;
+
+import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.export.excel.DefaultExportFormatter;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+
+/**
+ * The export formatter to use to export the same text as the text displayed in the cells
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class PapyrusExportFormatter extends DefaultExportFormatter {
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.export.IExportFormatter#formatForExport(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param cell
+ * @param configRegistry
+ * @return
+ */
+ @Override
+ public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
+ Object dataValue = cell.getDataValue();
+ IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
+ return displayConverter.canonicalToDisplayValue(cell, configRegistry, dataValue);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/glazedlists/copy/MouseOnlySortingStrategy.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/glazedlists/copy/MouseOnlySortingStrategy.java
index b89ceda5751..dd6f59d5586 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/glazedlists/copy/MouseOnlySortingStrategy.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/glazedlists/copy/MouseOnlySortingStrategy.java
@@ -1,68 +1,68 @@
-/* Glazed Lists (c) 2003-2006 */
-/* http://publicobject.com/glazedlists/ publicobject.com,*/
-/* O'Dell Engineering Ltd.*/
-package org.eclipse.papyrus.infra.nattable.glazedlists.copy;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @see ca.odell.glazedlists.gui.AbstractTableComparatorChooser#SINGLE_COLUMN
- * @see ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE
- *
- * @author <a href="mailto:jesse@swank.ca">Jesse Wilson</a>
- */
-public final class MouseOnlySortingStrategy implements SortingStrategy {
-
- /** if false, other sorting columns will be cleared before a click takes effect */
- private final boolean multipleColumnSort;
-
- /**
- * Create a new {@link8 ca.odell.glazedlists.impl.gui.MouseOnlySortingStrategy}, sorting multiple
- * columns or not as specified.
- */
- public MouseOnlySortingStrategy(boolean multipleColumnSort) {
- this.multipleColumnSort = multipleColumnSort;
- }
-
- /**
- * Adjust the sorting state based on receiving the specified clicks.
- */
- public void columnClicked(SortingState sortingState, int column, int clicks, boolean shift, boolean control) {
- SortingState.SortingColumn clickedColumn = sortingState.getColumns().get(column);
- if (clickedColumn.getComparators().isEmpty())
- return;
-
- List<SortingState.SortingColumn> recentlyClickedColumns = sortingState.getRecentlyClickedColumns();
-
- // on a double click, clear all click counts
- if (clicks == 2) {
- for (Iterator<SortingState.SortingColumn> i = recentlyClickedColumns.iterator(); i.hasNext();) {
- SortingState.SortingColumn sortingColumn = i.next();
- sortingColumn.clear();
- }
- recentlyClickedColumns.clear();
-
- // if we're only sorting one column at a time, clear other columns
- } else if (!multipleColumnSort) {
- for (Iterator<SortingState.SortingColumn> i = recentlyClickedColumns.iterator(); i.hasNext();) {
- SortingState.SortingColumn sortingColumn = i.next();
- if (sortingColumn != clickedColumn) {
- sortingColumn.clear();
- }
- }
- recentlyClickedColumns.clear();
- }
-
- // add a click to the newly clicked column if it has any comparators
- int netClicks = 1 + clickedColumn.getComparatorIndex() * 2 + (clickedColumn.isReverse() ? 1 : 0);
- clickedColumn.setComparatorIndex((netClicks / 2) % clickedColumn.getComparators().size());
- clickedColumn.setReverse(netClicks % 2 != 0);
- if (!recentlyClickedColumns.contains(clickedColumn)) {
- recentlyClickedColumns.add(clickedColumn);
- }
-
- // rebuild the sorting state
- sortingState.fireSortingChanged();
- }
+/* Glazed Lists (c) 2003-2006 */
+/* http://publicobject.com/glazedlists/ publicobject.com,*/
+/* O'Dell Engineering Ltd.*/
+package org.eclipse.papyrus.infra.nattable.glazedlists.copy;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @see ca.odell.glazedlists.gui.AbstractTableComparatorChooser#SINGLE_COLUMN
+ * @see ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE
+ *
+ * @author <a href="mailto:jesse@swank.ca">Jesse Wilson</a>
+ */
+public final class MouseOnlySortingStrategy implements SortingStrategy {
+
+ /** if false, other sorting columns will be cleared before a click takes effect */
+ private final boolean multipleColumnSort;
+
+ /**
+ * Create a new {@link8 ca.odell.glazedlists.impl.gui.MouseOnlySortingStrategy}, sorting multiple
+ * columns or not as specified.
+ */
+ public MouseOnlySortingStrategy(boolean multipleColumnSort) {
+ this.multipleColumnSort = multipleColumnSort;
+ }
+
+ /**
+ * Adjust the sorting state based on receiving the specified clicks.
+ */
+ public void columnClicked(SortingState sortingState, int column, int clicks, boolean shift, boolean control) {
+ SortingState.SortingColumn clickedColumn = sortingState.getColumns().get(column);
+ if (clickedColumn.getComparators().isEmpty())
+ return;
+
+ List<SortingState.SortingColumn> recentlyClickedColumns = sortingState.getRecentlyClickedColumns();
+
+ // on a double click, clear all click counts
+ if (clicks == 2) {
+ for (Iterator<SortingState.SortingColumn> i = recentlyClickedColumns.iterator(); i.hasNext();) {
+ SortingState.SortingColumn sortingColumn = i.next();
+ sortingColumn.clear();
+ }
+ recentlyClickedColumns.clear();
+
+ // if we're only sorting one column at a time, clear other columns
+ } else if (!multipleColumnSort) {
+ for (Iterator<SortingState.SortingColumn> i = recentlyClickedColumns.iterator(); i.hasNext();) {
+ SortingState.SortingColumn sortingColumn = i.next();
+ if (sortingColumn != clickedColumn) {
+ sortingColumn.clear();
+ }
+ }
+ recentlyClickedColumns.clear();
+ }
+
+ // add a click to the newly clicked column if it has any comparators
+ int netClicks = 1 + clickedColumn.getComparatorIndex() * 2 + (clickedColumn.isReverse() ? 1 : 0);
+ clickedColumn.setComparatorIndex((netClicks / 2) % clickedColumn.getComparators().size());
+ clickedColumn.setReverse(netClicks % 2 != 0);
+ if (!recentlyClickedColumns.contains(clickedColumn)) {
+ recentlyClickedColumns.add(clickedColumn);
+ }
+
+ // rebuild the sorting state
+ sortingState.fireSortingChanged();
+ }
} \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeHeaderConfigurationHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeHeaderConfigurationHandler.java
index 8bdf6f943b6..7fdfe368b41 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeHeaderConfigurationHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeHeaderConfigurationHandler.java
@@ -1,54 +1,54 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-
-/**
- * Abstract class to edit the header cofniguration
- *
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractColumnChangeHeaderConfigurationHandler extends AbstractChangeHeaderConfigurationHandler {
-
- /**
- *
- * @return
- * the edited axis configuration or <code>null</code> if it doesn't exists in the table
- */
- @Override
- protected AbstractHeaderAxisConfiguration getEditedAxisConfiguration() {
- return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(getCurrentNattableModelManager().getTable());
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getLocalHeaderAxisConfigurationFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getLocalHeaderAxisConfigurationFeature() {
- final Table table = getCurrentNattableModelManager().getTable();
- if (!table.isInvertAxis()) {
- return NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
- }
- return NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+
+/**
+ * Abstract class to edit the header cofniguration
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractColumnChangeHeaderConfigurationHandler extends AbstractChangeHeaderConfigurationHandler {
+
+ /**
+ *
+ * @return
+ * the edited axis configuration or <code>null</code> if it doesn't exists in the table
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getEditedAxisConfiguration() {
+ return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(getCurrentNattableModelManager().getTable());
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getLocalHeaderAxisConfigurationFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getLocalHeaderAxisConfigurationFeature() {
+ final Table table = getCurrentNattableModelManager().getTable();
+ if (!table.isInvertAxis()) {
+ return NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+ }
+ return NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeLabelConfigurationValueHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeLabelConfigurationValueHandler.java
index db570156514..fb0dac3c0e7 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeLabelConfigurationValueHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractColumnChangeLabelConfigurationValueHandler.java
@@ -1,79 +1,79 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-import org.eclipse.papyrus.infra.nattable.utils.LabelConfigurationManagementUtils;
-
-/**
- * The abstract handler used to change the column header label configuration
- *
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractColumnChangeLabelConfigurationValueHandler extends AbstractChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getLabelProviderConfiguration()
- *
- * @return
- */
- @Override
- protected ILabelProviderConfiguration getLabelProviderConfiguration() {
- return LabelConfigurationManagementUtils.getUsedColumnFeatureLabelConfiguration(getCurrentNattableModelManager().getTable());
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getLocalHeaderAxisConfigurationFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getLocalHeaderAxisConfigurationFeature() {
- Table table = getCurrentNattableModelManager().getTable();
- if (!table.isInvertAxis()) {
- return NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
- }
- return NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
- }
-
- /**
- *
- * @return
- * the edited axis configuration
- */
- @Override
- protected AbstractHeaderAxisConfiguration getHeaderAxisConfiguration() {
- return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(getCurrentNattableModelManager().getTable());
- }
-
-
- /**
- *
- * @return
- * the table header axis defined in the TableConfiguration and used for edited label axis configuration
- */
- @Override
- protected TableHeaderAxisConfiguration getTableHeaderAxisConfiguration() {
- return (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(getCurrentNattableModelManager().getTable());
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+import org.eclipse.papyrus.infra.nattable.utils.LabelConfigurationManagementUtils;
+
+/**
+ * The abstract handler used to change the column header label configuration
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractColumnChangeLabelConfigurationValueHandler extends AbstractChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getLabelProviderConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected ILabelProviderConfiguration getLabelProviderConfiguration() {
+ return LabelConfigurationManagementUtils.getUsedColumnFeatureLabelConfiguration(getCurrentNattableModelManager().getTable());
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getLocalHeaderAxisConfigurationFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getLocalHeaderAxisConfigurationFeature() {
+ Table table = getCurrentNattableModelManager().getTable();
+ if (!table.isInvertAxis()) {
+ return NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+ }
+ return NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+ }
+
+ /**
+ *
+ * @return
+ * the edited axis configuration
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getHeaderAxisConfiguration() {
+ return HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(getCurrentNattableModelManager().getTable());
+ }
+
+
+ /**
+ *
+ * @return
+ * the table header axis defined in the TableConfiguration and used for edited label axis configuration
+ */
+ @Override
+ protected TableHeaderAxisConfiguration getTableHeaderAxisConfiguration() {
+ return (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(getCurrentNattableModelManager().getTable());
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractParametricTreeTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractParametricTreeTableHandler.java
index ee019687b26..232b403e945 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractParametricTreeTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractParametricTreeTableHandler.java
@@ -1,71 +1,71 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-
-/**
- * @author Vincent Lorenzo
- *
- *
- */
-public abstract class AbstractParametricTreeTableHandler extends AbstractTreeTableHandler implements IExecutableExtension {
-
- /**
- * the id of the parameter declared for the handler in the plugin.xml
- */
- private String parameterId;
-
- /**
- * the value of the par
- */
- private String parameterValue;
-
-
- /**
- * Constructor.
- *
- * @param expandedDepthArgName
- */
- public AbstractParametricTreeTableHandler(String parameterId) {
- this.parameterId = parameterId;
- }
-
- /**
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- *
- * @param arg0
- * @param arg1
- * @param arg2
- * @throws CoreException
- */
- @Override
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- if (data instanceof Hashtable<?, ?> && this.parameterId != null) {
- this.parameterValue = (String) ((Hashtable<?, ?>) data).get(this.parameterId);
- }
- }
-
-
- /**
- * @return the parameterValue
- */
- public String getParameterValue() {
- return parameterValue;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ *
+ */
+public abstract class AbstractParametricTreeTableHandler extends AbstractTreeTableHandler implements IExecutableExtension {
+
+ /**
+ * the id of the parameter declared for the handler in the plugin.xml
+ */
+ private String parameterId;
+
+ /**
+ * the value of the par
+ */
+ private String parameterValue;
+
+
+ /**
+ * Constructor.
+ *
+ * @param expandedDepthArgName
+ */
+ public AbstractParametricTreeTableHandler(String parameterId) {
+ this.parameterId = parameterId;
+ }
+
+ /**
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ *
+ * @param arg0
+ * @param arg1
+ * @param arg2
+ * @throws CoreException
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ if (data instanceof Hashtable<?, ?> && this.parameterId != null) {
+ this.parameterValue = (String) ((Hashtable<?, ?>) data).get(this.parameterId);
+ }
+ }
+
+
+ /**
+ * @return the parameterValue
+ */
+ public String getParameterValue() {
+ return parameterValue;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeHeaderConfigurationHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeHeaderConfigurationHandler.java
index d49489f6d6f..e565304292e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeHeaderConfigurationHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeHeaderConfigurationHandler.java
@@ -1,57 +1,57 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-
-/**
- * Abstract class to edit the header cofniguration
- *
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractRowChangeHeaderConfigurationHandler extends AbstractChangeHeaderConfigurationHandler {
-
- /**
- *
- * @return
- * the axis configuration used by the table, can't be <code>null</code>;
- */
- @Override
- protected AbstractHeaderAxisConfiguration getEditedAxisConfiguration() {
- AbstractHeaderAxisConfiguration conf = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(getCurrentNattableModelManager().getTable());
- return conf;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getLocalHeaderAxisConfigurationFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getLocalHeaderAxisConfigurationFeature() {
- final Table table = getCurrentNattableModelManager().getTable();
- if (table.isInvertAxis()) {
- return NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
- }
- return NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+
+/**
+ * Abstract class to edit the header cofniguration
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractRowChangeHeaderConfigurationHandler extends AbstractChangeHeaderConfigurationHandler {
+
+ /**
+ *
+ * @return
+ * the axis configuration used by the table, can't be <code>null</code>;
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getEditedAxisConfiguration() {
+ AbstractHeaderAxisConfiguration conf = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(getCurrentNattableModelManager().getTable());
+ return conf;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getLocalHeaderAxisConfigurationFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getLocalHeaderAxisConfigurationFeature() {
+ final Table table = getCurrentNattableModelManager().getTable();
+ if (table.isInvertAxis()) {
+ return NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+ }
+ return NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeLabelConfigurationValueHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeLabelConfigurationValueHandler.java
index f5d2ee032e2..2e7b9e63c8f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeLabelConfigurationValueHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractRowChangeLabelConfigurationValueHandler.java
@@ -1,80 +1,80 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-import org.eclipse.papyrus.infra.nattable.utils.LabelConfigurationManagementUtils;
-
-
-/**
- * The abstract handler used to change the row header label configuration
- *
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractRowChangeLabelConfigurationValueHandler extends AbstractChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getLabelProviderConfiguration()
- *
- * @return
- */
- @Override
- protected ILabelProviderConfiguration getLabelProviderConfiguration() {
- return LabelConfigurationManagementUtils.getUsedRowObjectLabelConfiguration(getCurrentNattableModelManager().getTable());
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getLocalHeaderAxisConfigurationFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getLocalHeaderAxisConfigurationFeature() {
- Table table = getCurrentNattableModelManager().getTable();
- if (table.isInvertAxis()) {
- return NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
- }
- return NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
- }
-
- /**
- *
- * @return
- * the edited axis configuration
- */
- @Override
- protected AbstractHeaderAxisConfiguration getHeaderAxisConfiguration() {
- return HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisUsedInTable(getCurrentNattableModelManager().getTable());
- }
-
-
- /**
- *
- * @return
- * the table header axis defined in the TableConfiguration and used for edited label axis configuration
- */
- @Override
- protected TableHeaderAxisConfiguration getTableHeaderAxisConfiguration() {
- return (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(getCurrentNattableModelManager().getTable());
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+import org.eclipse.papyrus.infra.nattable.utils.LabelConfigurationManagementUtils;
+
+
+/**
+ * The abstract handler used to change the row header label configuration
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractRowChangeLabelConfigurationValueHandler extends AbstractChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getLabelProviderConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected ILabelProviderConfiguration getLabelProviderConfiguration() {
+ return LabelConfigurationManagementUtils.getUsedRowObjectLabelConfiguration(getCurrentNattableModelManager().getTable());
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getLocalHeaderAxisConfigurationFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getLocalHeaderAxisConfigurationFeature() {
+ Table table = getCurrentNattableModelManager().getTable();
+ if (table.isInvertAxis()) {
+ return NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+ }
+ return NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+ }
+
+ /**
+ *
+ * @return
+ * the edited axis configuration
+ */
+ @Override
+ protected AbstractHeaderAxisConfiguration getHeaderAxisConfiguration() {
+ return HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisUsedInTable(getCurrentNattableModelManager().getTable());
+ }
+
+
+ /**
+ *
+ * @return
+ * the table header axis defined in the TableConfiguration and used for edited label axis configuration
+ */
+ @Override
+ protected TableHeaderAxisConfiguration getTableHeaderAxisConfiguration() {
+ return (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(getCurrentNattableModelManager().getTable());
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeRowHideShowCategoryHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeRowHideShowCategoryHandler.java
index f50718bbc37..79c5682c286 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeRowHideShowCategoryHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeRowHideShowCategoryHandler.java
@@ -1,69 +1,69 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractTreeRowHideShowCategoryHandler extends AbstractTreeTableHandler {
-
- /**
- *
- * @return
- * <code>true</code> if all categories are currently hidden
- */
- protected boolean allCategoriesAreCurrentlyHidden() {
- Table table = getTable();
- IntListValueStyle values = (IntListValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getIntListValueStyle(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
- if (values == null) {
- return false;
- }
- int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(getTable());
- return values.getIntListValue().size() == (maxDepth + 1);
- }
-
- /**
- *
- * @return
- * <code>true</code> if all categories are currently visible
- */
- protected boolean allCategoriesAreCurrentlyVisible() {
- Table table = getTable();
- IntListValueStyle values = (IntListValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getIntListValueStyle(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
- return values == null || values.getIntListValue().isEmpty();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- if (isEnabled()) {
- if (FillingConfigurationUtils.getAllTreeFillingConfiguration(getTable()).size() == 0) {
- setBaseEnabled(false);
- }
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractTreeRowHideShowCategoryHandler extends AbstractTreeTableHandler {
+
+ /**
+ *
+ * @return
+ * <code>true</code> if all categories are currently hidden
+ */
+ protected boolean allCategoriesAreCurrentlyHidden() {
+ Table table = getTable();
+ IntListValueStyle values = (IntListValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getIntListValueStyle(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
+ if (values == null) {
+ return false;
+ }
+ int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(getTable());
+ return values.getIntListValue().size() == (maxDepth + 1);
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> if all categories are currently visible
+ */
+ protected boolean allCategoriesAreCurrentlyVisible() {
+ Table table = getTable();
+ IntListValueStyle values = (IntListValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getIntListValueStyle(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
+ return values == null || values.getIntListValue().isEmpty();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ if (isEnabled()) {
+ if (FillingConfigurationUtils.getAllTreeFillingConfiguration(getTable()).size() == 0) {
+ setBaseEnabled(false);
+ }
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeTableHandler.java
index f1500beab98..53c01174912 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTreeTableHandler.java
@@ -1,52 +1,52 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager;
-import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractTreeTableHandler extends AbstractTableHandler {
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- if (isEnabled()) {
- if ((!TableHelper.isTreeTable(getCurrentNattableModelManager())) || getTreeNattableModelManager() == null) {
- setBaseEnabled(false);
- }
- }
- }
-
- /**
- *
- * @return
- * the current tree nattable model manager
- */
- public ITreeNattableModelManager getTreeNattableModelManager() {
- if (getCurrentNattableModelManager() instanceof ITreeNattableModelManager) {
- return (ITreeNattableModelManager) getCurrentNattableModelManager();
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractTreeTableHandler extends AbstractTableHandler {
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ if (isEnabled()) {
+ if ((!TableHelper.isTreeTable(getCurrentNattableModelManager())) || getTreeNattableModelManager() == null) {
+ setBaseEnabled(false);
+ }
+ }
+ }
+
+ /**
+ *
+ * @return
+ * the current tree nattable model manager
+ */
+ public ITreeNattableModelManager getTreeNattableModelManager() {
+ if (getCurrentNattableModelManager() instanceof ITreeNattableModelManager) {
+ return (ITreeNattableModelManager) getCurrentNattableModelManager();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ChangeHierarchicalTableStyle.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ChangeHierarchicalTableStyle.java
index b6c008cc291..9aa533537fc 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ChangeHierarchicalTableStyle.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ChangeHierarchicalTableStyle.java
@@ -1,85 +1,85 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.Collections;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.TableDisplayStyle;
-import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.handlers.RadioState;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class ChangeHierarchicalTableStyle extends AbstractTreeTableHandler {
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (HandlerUtil.matchesRadioState(event)) {
- return null;// we are already in the updated state - do nothing
- }
-
- String currentState = event.getParameter(RadioState.PARAMETER_ID);
- Table table = getTable();
- TableDisplayStyle style = (TableDisplayStyle) table.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
- Command cmd = null;
- DisplayStyle value = DisplayStyle.get(currentState);
- if (style == null) {
- TableDisplayStyle displayStyle = NattablestyleFactory.eINSTANCE.createTableDisplayStyle();
- displayStyle.setDisplayStyle(value);
- cmd = new AddCommand(getTableEditingDomain(), table, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), Collections.singleton(displayStyle));
- } else {
- cmd = new SetCommand(getTableEditingDomain(), style, NattablestylePackage.eINSTANCE.getTableDisplayStyle_DisplayStyle(), value);
- }
- if (cmd != null && cmd.canExecute()) {
- getTableEditingDomain().getCommandStack().execute(cmd);
- // and finally update the current state
- HandlerUtil.updateRadioState(event.getCommand(), currentState);
- }
- return null;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- if (isEnabled()) {
- final DisplayStyle style = TableHelper.getTableDisplayStyle(getCurrentNattableModelManager());
- setBaseEnabled(DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(style) || DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(style));
- }
-
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.Collections;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.TableDisplayStyle;
+import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.handlers.RadioState;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class ChangeHierarchicalTableStyle extends AbstractTreeTableHandler {
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (HandlerUtil.matchesRadioState(event)) {
+ return null;// we are already in the updated state - do nothing
+ }
+
+ String currentState = event.getParameter(RadioState.PARAMETER_ID);
+ Table table = getTable();
+ TableDisplayStyle style = (TableDisplayStyle) table.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ Command cmd = null;
+ DisplayStyle value = DisplayStyle.get(currentState);
+ if (style == null) {
+ TableDisplayStyle displayStyle = NattablestyleFactory.eINSTANCE.createTableDisplayStyle();
+ displayStyle.setDisplayStyle(value);
+ cmd = new AddCommand(getTableEditingDomain(), table, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), Collections.singleton(displayStyle));
+ } else {
+ cmd = new SetCommand(getTableEditingDomain(), style, NattablestylePackage.eINSTANCE.getTableDisplayStyle_DisplayStyle(), value);
+ }
+ if (cmd != null && cmd.canExecute()) {
+ getTableEditingDomain().getCommandStack().execute(cmd);
+ // and finally update the current state
+ HandlerUtil.updateRadioState(event.getCommand(), currentState);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ if (isEnabled()) {
+ final DisplayStyle style = TableHelper.getTableDisplayStyle(getCurrentNattableModelManager());
+ setBaseEnabled(DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(style) || DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(style));
+ }
+
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/CollapseAndExpandTreeHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/CollapseAndExpandTreeHandler.java
index bae4ddc16a1..7cf8359b114 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/CollapseAndExpandTreeHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/CollapseAndExpandTreeHandler.java
@@ -1,101 +1,101 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class CollapseAndExpandTreeHandler extends AbstractParametricTreeTableHandler {
-
- /** the name of the parameter used by this handler */
- public static final String COLLAPSED_DEPTH_ARG_NAME = "treeAction"; //$NON-NLS-1$
-
- private CollapseAndExpandActionsEnum actionId;
-
- /**
- * Constructor.
- *
- * @param parameterId
- */
- public CollapseAndExpandTreeHandler() {
- super(COLLAPSED_DEPTH_ARG_NAME);
- }
-
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param arg0
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- getTreeNattableModelManager().doCollapseExpandAction(this.actionId, null);
- return null;
- }
-
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- if (isEnabled() && this.actionId == null) {
- setBaseEnabled(false);
- return;
- }
- if (isEnabled()) {
- switch (this.actionId) {
- case COLLAPSE_ALL_FROM_SELECTION:
- case COLLAPSE_ONE_LEVEL:
- case EXPAND_ALL_FROM_SELECTION:
- case EXPAND_ONE_LEVEL:
- if (getFullSelectedRowsIndex(evaluationContext).isEmpty()) {
- setBaseEnabled(false);
- }
- break;
-
- default:
- // nothing to do
- break;
- }
- }
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractParametricTreeTableHandler#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- *
- * @param config
- * @param propertyName
- * @param data
- * @throws CoreException
- */
- @Override
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- super.setInitializationData(config, propertyName, data);
- this.actionId = CollapseAndExpandActionsEnum.valueOf(getParameterValue());
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class CollapseAndExpandTreeHandler extends AbstractParametricTreeTableHandler {
+
+ /** the name of the parameter used by this handler */
+ public static final String COLLAPSED_DEPTH_ARG_NAME = "treeAction"; //$NON-NLS-1$
+
+ private CollapseAndExpandActionsEnum actionId;
+
+ /**
+ * Constructor.
+ *
+ * @param parameterId
+ */
+ public CollapseAndExpandTreeHandler() {
+ super(COLLAPSED_DEPTH_ARG_NAME);
+ }
+
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param arg0
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ getTreeNattableModelManager().doCollapseExpandAction(this.actionId, null);
+ return null;
+ }
+
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ if (isEnabled() && this.actionId == null) {
+ setBaseEnabled(false);
+ return;
+ }
+ if (isEnabled()) {
+ switch (this.actionId) {
+ case COLLAPSE_ALL_FROM_SELECTION:
+ case COLLAPSE_ONE_LEVEL:
+ case EXPAND_ALL_FROM_SELECTION:
+ case EXPAND_ONE_LEVEL:
+ if (getFullSelectedRowsIndex(evaluationContext).isEmpty()) {
+ setBaseEnabled(false);
+ }
+ break;
+
+ default:
+ // nothing to do
+ break;
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractParametricTreeTableHandler#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ *
+ * @param config
+ * @param propertyName
+ * @param data
+ * @throws CoreException
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ super.setInitializationData(config, propertyName, data);
+ this.actionId = CollapseAndExpandActionsEnum.valueOf(getParameterValue());
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java
index a640c56c825..aff25a456c6 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java
@@ -1,48 +1,48 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeColumnsCommand;
-import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
-import org.eclipse.nebula.widgets.nattable.util.GCFactory;
-
-/**
- * Handler to resize columns
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnAutoResizeHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- NatEventData eventData = getNatEventData();
- if (eventData != null) {
- final NatTable natTable = eventData.getNatTable();
- natTable.doCommand(new InitializeAutoResizeColumnsCommand(natTable, eventData.getColumnPosition(), natTable.getConfigRegistry(), new GCFactory(natTable)));
- }
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeColumnsCommand;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.nebula.widgets.nattable.util.GCFactory;
+
+/**
+ * Handler to resize columns
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnAutoResizeHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ NatEventData eventData = getNatEventData();
+ if (eventData != null) {
+ final NatTable natTable = eventData.getNatTable();
+ natTable.doCommand(new InitializeAutoResizeColumnsCommand(natTable, eventData.getColumnPosition(), natTable.getConfigRegistry(), new GCFactory(natTable)));
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java
index 59428e1632e..bce1bad87ba 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java
@@ -1,71 +1,71 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
-
-/**
- * The handler used to destroy the elements represented by the selected columns
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDestroyAxisElementHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- NatEventData eventData = getNatEventData();
- if (eventData != null) {
- final IAxisManager axisManager = getColumnAxisManager();
- if (axisManager != null) {
- axisManager.destroyAxisElement(getFullSelectedColumnsIndex(eventData));
- }
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- NatEventData eventData = getNatEventData();
- boolean enabled = false;
- if (isEnabled() && eventData != null) {
- final IAxisManager axisManager = getColumnAxisManager();
- if (axisManager != null) {
- final List<Integer> col = getFullSelectedColumnsIndex(eventData);
- enabled = axisManager.canDestroyAxisElement(col);
- }
- }
- setBaseEnabled(enabled);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
+
+/**
+ * The handler used to destroy the elements represented by the selected columns
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDestroyAxisElementHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ NatEventData eventData = getNatEventData();
+ if (eventData != null) {
+ final IAxisManager axisManager = getColumnAxisManager();
+ if (axisManager != null) {
+ axisManager.destroyAxisElement(getFullSelectedColumnsIndex(eventData));
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ NatEventData eventData = getNatEventData();
+ boolean enabled = false;
+ if (isEnabled() && eventData != null) {
+ final IAxisManager axisManager = getColumnAxisManager();
+ if (axisManager != null) {
+ final List<Integer> col = getFullSelectedColumnsIndex(eventData);
+ enabled = axisManager.canDestroyAxisElement(col);
+ }
+ }
+ setBaseEnabled(enabled);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java
index ff9dc6d9cfc..70b82db6033 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java
@@ -1,67 +1,67 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
-
-/**
- * The handler used to destroy the selected columns
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDestroyAxisHandler extends AbstractTableHandler {
-
- /**
- * @Override
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final IAxisManager axisManager = getColumnAxisManager();
- NatEventData eventData = getNatEventData();
- if (axisManager != null && eventData!=null) {
- axisManager.destroyAxis(getFullSelectedColumnsIndex(eventData));
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- NatEventData eventData = getNatEventData();
- boolean enabled = false;
- final IAxisManager axisManager = getColumnAxisManager();
- if (isEnabled() && axisManager != null && eventData!=null) {
- final List<Integer> col = getFullSelectedColumnsIndex(eventData);
- enabled = axisManager.canDestroyAxis(col);
- }
- setBaseEnabled(enabled);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
+
+/**
+ * The handler used to destroy the selected columns
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDestroyAxisHandler extends AbstractTableHandler {
+
+ /**
+ * @Override
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final IAxisManager axisManager = getColumnAxisManager();
+ NatEventData eventData = getNatEventData();
+ if (axisManager != null && eventData!=null) {
+ axisManager.destroyAxis(getFullSelectedColumnsIndex(eventData));
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ NatEventData eventData = getNatEventData();
+ boolean enabled = false;
+ final IAxisManager axisManager = getColumnAxisManager();
+ if (isEnabled() && axisManager != null && eventData!=null) {
+ final List<Integer> col = getFullSelectedColumnsIndex(eventData);
+ enabled = axisManager.canDestroyAxis(col);
+ }
+ setBaseEnabled(enabled);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayIndexHeaderHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayIndexHeaderHandler.java
index 075f249c7d8..da01662272f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayIndexHeaderHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayIndexHeaderHandler.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-
-
-/**
- * The handler to change the boolean value to display index header for column
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDisplayIndexHeaderHandler extends AbstractColumnChangeHeaderConfigurationHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayIndex();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+
+
+/**
+ * The handler to change the boolean value to display index header for column
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDisplayIndexHeaderHandler extends AbstractColumnChangeHeaderConfigurationHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayIndex();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureIsDerivedHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureIsDerivedHandler.java
index 88aa18054cb..c96d07fe239 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureIsDerivedHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureIsDerivedHandler.java
@@ -1,39 +1,39 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the "/" for derived feature in the column label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDisplayLabelFeatureIsDerivedHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayIsDerived();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the "/" for derived feature in the column label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDisplayLabelFeatureIsDerivedHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayIsDerived();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureMultiplicityHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureMultiplicityHandler.java
index c316051d464..065c753cb1a 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureMultiplicityHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureMultiplicityHandler.java
@@ -1,39 +1,39 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the feature multiplicity in the column label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDisplayLabelFeatureMultiplicityHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayMultiplicity();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the feature multiplicity in the column label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDisplayLabelFeatureMultiplicityHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayMultiplicity();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureNameHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureNameHandler.java
index 5aa1aa11c35..1d2e39ce328 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureNameHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureNameHandler.java
@@ -1,37 +1,37 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the name of the feature in the column label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDisplayLabelFeatureNameHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayName();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the name of the feature in the column label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDisplayLabelFeatureNameHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayName();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureTypeHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureTypeHandler.java
index 23c9d5c09df..030e27360ec 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureTypeHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelFeatureTypeHandler.java
@@ -1,37 +1,37 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the type of the feature in the column label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDisplayLabelFeatureTypeHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayType();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the type of the feature in the column label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDisplayLabelFeatureTypeHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayType();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelHeaderHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelHeaderHandler.java
index abf8e54589e..8b0ba044f30 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelHeaderHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelHeaderHandler.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-
-/**
- * The handler to change the boolean value to display label header for column
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDisplayLabelHeaderHandler extends AbstractColumnChangeHeaderConfigurationHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayLabel();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+
+/**
+ * The handler to change the boolean value to display label header for column
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDisplayLabelHeaderHandler extends AbstractColumnChangeHeaderConfigurationHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayLabel();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelImageHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelImageHandler.java
index ced182b0ff2..14c9c5cc9ba 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelImageHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelImageHandler.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the image in the column label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDisplayLabelImageHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getObjectLabelProviderConfiguration_DisplayIcon();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the image in the column label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDisplayLabelImageHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getObjectLabelProviderConfiguration_DisplayIcon();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelTextHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelTextHandler.java
index f1fcaff50ce..4a2772c44bc 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelTextHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDisplayLabelTextHandler.java
@@ -1,39 +1,39 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the text in the column label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnDisplayLabelTextHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getObjectLabelProviderConfiguration_DisplayLabel();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the text in the column label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnDisplayLabelTextHandler extends AbstractColumnChangeLabelConfigurationValueHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getObjectLabelProviderConfiguration_DisplayLabel();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnEditAliasHeaderHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnEditAliasHeaderHandler.java
index 4a596be0aa0..d5c98dd52f7 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnEditAliasHeaderHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnEditAliasHeaderHandler.java
@@ -1,61 +1,61 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
-import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
-
-//TODO : this handler should be declare on org.eclipse.ui.edit (or something like this) to be binded on F2
-
-public class ColumnEditAliasHeaderHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- NatEventData eventData = getNatEventData();
- if (eventData != null) {
- AbstractNattableWidgetManager manager = (AbstractNattableWidgetManager) getCurrentNattableModelManager();
- manager.openEditColumnAliasDialog(eventData);
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {// it must be the nattable selection event
- super.setEnabled(evaluationContext);
- final NatEventData eventData = getNatEventData();
- final NattableModelManager manager = (NattableModelManager) getCurrentNattableModelManager();
- if (isEnabled() && eventData != null && manager != null) {
- setBaseEnabled(manager.canEditColumnHeader(eventData));
- } else {
- setBaseEnabled(false);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
+
+//TODO : this handler should be declare on org.eclipse.ui.edit (or something like this) to be binded on F2
+
+public class ColumnEditAliasHeaderHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ NatEventData eventData = getNatEventData();
+ if (eventData != null) {
+ AbstractNattableWidgetManager manager = (AbstractNattableWidgetManager) getCurrentNattableModelManager();
+ manager.openEditColumnAliasDialog(eventData);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {// it must be the nattable selection event
+ super.setEnabled(evaluationContext);
+ final NatEventData eventData = getNatEventData();
+ final NattableModelManager manager = (NattableModelManager) getCurrentNattableModelManager();
+ if (isEnabled() && eventData != null && manager != null) {
+ setBaseEnabled(manager.canEditColumnHeader(eventData));
+ } else {
+ setBaseEnabled(false);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java
index 2d913f8f9ab..b161102b992 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java
@@ -1,42 +1,42 @@
-/*****************************************************************************
- * Copyright (c) 2013, 2015 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class ColumnMasterDisconnectRowSlaveHandler extends AbstractDisconnectSlaveHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractDisconnectSlaveHandler#getAxisProviderToEdit()
- *
- * @return
- */
- @Override
- protected AbstractAxisProvider getAxisProviderToEdit() {
- INattableModelManager currentNattableModelManager = getCurrentNattableModelManager();
- if (currentNattableModelManager == null ) {
- return null;
- }
- return AxisUtils.getAxisProviderUsedForColumns(currentNattableModelManager);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013, 2015 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ColumnMasterDisconnectRowSlaveHandler extends AbstractDisconnectSlaveHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractDisconnectSlaveHandler#getAxisProviderToEdit()
+ *
+ * @return
+ */
+ @Override
+ protected AbstractAxisProvider getAxisProviderToEdit() {
+ INattableModelManager currentNattableModelManager = getCurrentNattableModelManager();
+ if (currentNattableModelManager == null ) {
+ return null;
+ }
+ return AxisUtils.getAxisProviderUsedForColumns(currentNattableModelManager);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ConfigureCategoriesHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ConfigureCategoriesHandler.java
index 234d19d2563..05080a378d3 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ConfigureCategoriesHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ConfigureCategoriesHandler.java
@@ -1,43 +1,43 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.papyrus.infra.nattable.wizard.ConfigureTableCategoriesWizard;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class ConfigureCategoriesHandler extends AbstractTableHandler {
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param arg0
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- ConfigureTableCategoriesWizard wizard = new ConfigureTableCategoriesWizard(getCurrentNattableModelManager());
- WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
- dialog.open();
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.infra.nattable.wizard.ConfigureTableCategoriesWizard;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class ConfigureCategoriesHandler extends AbstractTableHandler {
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param arg0
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ ConfigureTableCategoriesWizard wizard = new ConfigureTableCategoriesWizard(getCurrentNattableModelManager());
+ WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
+ dialog.open();
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ExportToXLSHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ExportToXLSHandler.java
index fb59f602256..e9ae4402157 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ExportToXLSHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ExportToXLSHandler.java
@@ -1,32 +1,32 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-
-public class ExportToXLSHandler extends AbstractTableHandler {
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- final INattableModelManager manager = getCurrentNattableModelManager();
- if (manager != null) {
- manager.exportToXLS();
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+
+public class ExportToXLSHandler extends AbstractTableHandler {
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ final INattableModelManager manager = getCurrentNattableModelManager();
+ if (manager != null) {
+ manager.exportToXLS();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InvertAxisHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InvertAxisHandler.java
index a10b933114b..ad7a85a2ed2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InvertAxisHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InvertAxisHandler.java
@@ -1,41 +1,41 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-/**
- * The handler for the invert axis action
- *
- * @author Vincent Lorenzo
- *
- */
-public class InvertAxisHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- getCurrentNattableModelManager().invertAxis();
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/**
+ * The handler for the invert axis action
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class InvertAxisHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ getCurrentNattableModelManager().invertAxis();
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadColumnAxisProvidersHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadColumnAxisProvidersHandler.java
index 4f43514caec..14d00dcb929 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadColumnAxisProvidersHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadColumnAxisProvidersHandler.java
@@ -1,87 +1,87 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-
-/**
- * Concrete handler to load column axis providers from the table's historic.
- *
- */
-public class LoadColumnAxisProvidersHandler extends AbstractLoadAxisProvidersHandler {
-
-
- /**
- * Get the EReference where the current column provider will be set.
- *
- */
- @Override
- public EReference getCurrentAxisProviderEFeature() {
- return NattablePackage.eINSTANCE.getTable_CurrentColumnAxisProvider();
- }
-
- /**
- * Getter to obtain the current axis provider, in this case for columns.
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getCurrentAxisProvider()
- *
- * @return
- */
- @Override
- public AbstractAxisProvider getCurrentAxisProvider() {
- if (!this.getCurrentNattableModelManager().getTable().isInvertAxis()) {
- return this.getCurrentNattableModelManager().getTable().getCurrentColumnAxisProvider();
- } else {
- return this.getCurrentNattableModelManager().getTable().getCurrentRowAxisProvider();
-
- }
- }
-
- /**
- * Getter to obtain the current axis provider, in this case for columns.
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getAxisProvidersHistory()
- *
- * @return
- */
- @Override
- public EList<AbstractAxisProvider> getAxisProvidersHistory() {
- if (!this.getCurrentNattableModelManager().getTable().isInvertAxis()) {
- return this.getCurrentNattableModelManager().getTable().getColumnAxisProvidersHistory();
- } else {
- return this.getCurrentNattableModelManager().getTable().getRowAxisProvidersHistory();
- }
- }
-
- /**
- * This handler is enabled only if the concerned axis manager allows to save a configuration.
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- if (getCurrentNattableModelManager() != null && getCurrentNattableModelManager().getColumnAxisManager() != null) {
- IAxisManager columnAxisManager = this.getCurrentNattableModelManager().getColumnAxisManager();
- setBaseEnabled(columnAxisManager.canBeSavedAsConfig());
- } else {
- setBaseEnabled(false);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+
+/**
+ * Concrete handler to load column axis providers from the table's historic.
+ *
+ */
+public class LoadColumnAxisProvidersHandler extends AbstractLoadAxisProvidersHandler {
+
+
+ /**
+ * Get the EReference where the current column provider will be set.
+ *
+ */
+ @Override
+ public EReference getCurrentAxisProviderEFeature() {
+ return NattablePackage.eINSTANCE.getTable_CurrentColumnAxisProvider();
+ }
+
+ /**
+ * Getter to obtain the current axis provider, in this case for columns.
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getCurrentAxisProvider()
+ *
+ * @return
+ */
+ @Override
+ public AbstractAxisProvider getCurrentAxisProvider() {
+ if (!this.getCurrentNattableModelManager().getTable().isInvertAxis()) {
+ return this.getCurrentNattableModelManager().getTable().getCurrentColumnAxisProvider();
+ } else {
+ return this.getCurrentNattableModelManager().getTable().getCurrentRowAxisProvider();
+
+ }
+ }
+
+ /**
+ * Getter to obtain the current axis provider, in this case for columns.
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getAxisProvidersHistory()
+ *
+ * @return
+ */
+ @Override
+ public EList<AbstractAxisProvider> getAxisProvidersHistory() {
+ if (!this.getCurrentNattableModelManager().getTable().isInvertAxis()) {
+ return this.getCurrentNattableModelManager().getTable().getColumnAxisProvidersHistory();
+ } else {
+ return this.getCurrentNattableModelManager().getTable().getRowAxisProvidersHistory();
+ }
+ }
+
+ /**
+ * This handler is enabled only if the concerned axis manager allows to save a configuration.
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ if (getCurrentNattableModelManager() != null && getCurrentNattableModelManager().getColumnAxisManager() != null) {
+ IAxisManager columnAxisManager = this.getCurrentNattableModelManager().getColumnAxisManager();
+ setBaseEnabled(columnAxisManager.canBeSavedAsConfig());
+ } else {
+ setBaseEnabled(false);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadRowAxisProvidersHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadRowAxisProvidersHandler.java
index 7eba4a70043..6c3730dca90 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadRowAxisProvidersHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/LoadRowAxisProvidersHandler.java
@@ -1,87 +1,87 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-
-/**
- * Concrete handler to load row axis providers from the table's historic.
- *
- */
-public class LoadRowAxisProvidersHandler extends AbstractLoadAxisProvidersHandler {
-
- /**
- * This handler is enabled only if the concerned axis manager allows to save a configuration.
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- if (getCurrentNattableModelManager() != null && getCurrentNattableModelManager().getRowAxisManager() != null) {
- IAxisManager columnAxisManager = this.getCurrentNattableModelManager().getRowAxisManager();
- setBaseEnabled(columnAxisManager.canBeSavedAsConfig());
- } else {
- setBaseEnabled(false);
- }
- }
-
- /**
- * Getter to obtain the current axis provider, in this case for rows.
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getAxisProvidersHistory()
- *
- * @return
- */
- @Override
- public EList<AbstractAxisProvider> getAxisProvidersHistory() {
- if (!this.getCurrentNattableModelManager().getTable().isInvertAxis()) {
- return this.getCurrentNattableModelManager().getTable().getRowAxisProvidersHistory();
- } else {
- return this.getCurrentNattableModelManager().getTable().getColumnAxisProvidersHistory();
- }
- }
-
- /**
- * Getter to obtain the current axis provider, in this case for rows.
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getCurrentAxisProvider()
- *
- * @return
- */
- @Override
- public AbstractAxisProvider getCurrentAxisProvider() {
- if (!this.getCurrentNattableModelManager().getTable().isInvertAxis()) {
- return this.getCurrentNattableModelManager().getTable().getCurrentRowAxisProvider();
- } else {
- return this.getCurrentNattableModelManager().getTable().getCurrentColumnAxisProvider();
- }
- }
-
- /**
- * Get the EReference where the current column provider will be set.
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getCurrentAxisProviderEFeature()
- *
- * @return
- */
- @Override
- public EReference getCurrentAxisProviderEFeature() {
- return NattablePackage.eINSTANCE.getTable_CurrentRowAxisProvider();
- }
-
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+
+/**
+ * Concrete handler to load row axis providers from the table's historic.
+ *
+ */
+public class LoadRowAxisProvidersHandler extends AbstractLoadAxisProvidersHandler {
+
+ /**
+ * This handler is enabled only if the concerned axis manager allows to save a configuration.
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ if (getCurrentNattableModelManager() != null && getCurrentNattableModelManager().getRowAxisManager() != null) {
+ IAxisManager columnAxisManager = this.getCurrentNattableModelManager().getRowAxisManager();
+ setBaseEnabled(columnAxisManager.canBeSavedAsConfig());
+ } else {
+ setBaseEnabled(false);
+ }
+ }
+
+ /**
+ * Getter to obtain the current axis provider, in this case for rows.
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getAxisProvidersHistory()
+ *
+ * @return
+ */
+ @Override
+ public EList<AbstractAxisProvider> getAxisProvidersHistory() {
+ if (!this.getCurrentNattableModelManager().getTable().isInvertAxis()) {
+ return this.getCurrentNattableModelManager().getTable().getRowAxisProvidersHistory();
+ } else {
+ return this.getCurrentNattableModelManager().getTable().getColumnAxisProvidersHistory();
+ }
+ }
+
+ /**
+ * Getter to obtain the current axis provider, in this case for rows.
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getCurrentAxisProvider()
+ *
+ * @return
+ */
+ @Override
+ public AbstractAxisProvider getCurrentAxisProvider() {
+ if (!this.getCurrentNattableModelManager().getTable().isInvertAxis()) {
+ return this.getCurrentNattableModelManager().getTable().getCurrentRowAxisProvider();
+ } else {
+ return this.getCurrentNattableModelManager().getTable().getCurrentColumnAxisProvider();
+ }
+ }
+
+ /**
+ * Get the EReference where the current column provider will be set.
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractLoadAxisProvidersHandler#getCurrentAxisProviderEFeature()
+ *
+ * @return
+ */
+ @Override
+ public EReference getCurrentAxisProviderEFeature() {
+ return NattablePackage.eINSTANCE.getTable_CurrentRowAxisProvider();
+ }
+
} \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeColumnsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeColumnsHandler.java
index e5dc31f1f52..3c3643d54ab 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeColumnsHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeColumnsHandler.java
@@ -1,105 +1,105 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * The handler used for the merge of all the cells inside each column
- *
- * @author Quentin Le Menez
- *
- */
-public class MergeColumnsHandler extends AbstractMergeHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // the command to contain all the merge updates
- final CompositeCommand mergeCommand = new CompositeCommand("Merge/UnMerge the cells in all the columns"); //$NON-NLS-1$
- // final CompositeCommand createLocalHeaderCommand = new CompositeCommand("Creates the local header if none previously exists"); //$NON-NLS-1$
- // the domain of the currently used table
- TransactionalEditingDomain tableDomain = getTableEditingDomain();
- // necessary to identify which merge option should be activated
- final String commandId = event.getCommand().getId();
- // this boolean indicates if the currently chosen merge option is to be a merge or an unMerge
- boolean isMerged = HandlerUtil.toggleCommandState(event.getCommand());
- // the header currently used in the table
- AbstractHeaderAxisConfiguration columnHeaderUsedInTable = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(getTable());
- // the necessary merge boolean value
- BooleanValueStyle mergeColumns = (BooleanValueStyle) columnHeaderUsedInTable.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_COLUMNS);
-
-
- // identify if the merge boolean was already created and updates it, if not creates it and set its value
- if (mergeColumns != null) {
- if (mergeColumns.isBooleanValue()) {
- SetRequest mergeColumnRequest = new SetRequest(tableDomain, mergeColumns, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), false);
- SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
- mergeCommand.add(mergeColumnCommand);
- } else {
- SetRequest mergeColumnRequest = new SetRequest(tableDomain, mergeColumns, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), true);
- SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
- mergeCommand.add(mergeColumnCommand);
- }
- } else {
- // check if the header used is a local or the default, i.e. the TableHeaderAxisConfiguration, and if so create it
- if (columnHeaderUsedInTable instanceof TableHeaderAxisConfiguration) {
- // Creates the local column header if none already exists in the table
- columnHeaderUsedInTable = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) columnHeaderUsedInTable);
- EStructuralFeature localHeaderFeature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
-
- IEditCommandRequest initLocalColumnHeaderAxis = new SetRequest(tableDomain, getTable(), localHeaderFeature, columnHeaderUsedInTable);
- IElementEditService localColumnHeaderAxisProvider = ElementEditServiceUtils.getCommandProvider(getTable());
- mergeCommand.add(localColumnHeaderAxisProvider.getEditCommand(initLocalColumnHeaderAxis));
- }
-
- mergeColumns = NattablestyleFactory.eINSTANCE.createBooleanValueStyle();
- mergeColumns.setBooleanValue(true);
- mergeColumns.setName(NamedStyleConstants.MERGE_COLUMNS);
- SetRequest mergeColumnRequest = new SetRequest(tableDomain, columnHeaderUsedInTable, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), mergeColumns);
- SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
- mergeCommand.add(mergeColumnCommand);
- }
-
- // checks if the mergeRows option was already selected and, if so, switch its boolean to false as mergeColumns is activated to true
- if (!isMerged) {
- // resets the other merge booleans if any were to conflict with the current choice
- updateTableSpanBooleans(commandId, mergeCommand);
- }
-
- // apply the changes to the model
- executeMergeCommands(mergeCommand, tableDomain);
-
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler used for the merge of all the cells inside each column
+ *
+ * @author Quentin Le Menez
+ *
+ */
+public class MergeColumnsHandler extends AbstractMergeHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // the command to contain all the merge updates
+ final CompositeCommand mergeCommand = new CompositeCommand("Merge/UnMerge the cells in all the columns"); //$NON-NLS-1$
+ // final CompositeCommand createLocalHeaderCommand = new CompositeCommand("Creates the local header if none previously exists"); //$NON-NLS-1$
+ // the domain of the currently used table
+ TransactionalEditingDomain tableDomain = getTableEditingDomain();
+ // necessary to identify which merge option should be activated
+ final String commandId = event.getCommand().getId();
+ // this boolean indicates if the currently chosen merge option is to be a merge or an unMerge
+ boolean isMerged = HandlerUtil.toggleCommandState(event.getCommand());
+ // the header currently used in the table
+ AbstractHeaderAxisConfiguration columnHeaderUsedInTable = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(getTable());
+ // the necessary merge boolean value
+ BooleanValueStyle mergeColumns = (BooleanValueStyle) columnHeaderUsedInTable.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_COLUMNS);
+
+
+ // identify if the merge boolean was already created and updates it, if not creates it and set its value
+ if (mergeColumns != null) {
+ if (mergeColumns.isBooleanValue()) {
+ SetRequest mergeColumnRequest = new SetRequest(tableDomain, mergeColumns, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), false);
+ SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
+ mergeCommand.add(mergeColumnCommand);
+ } else {
+ SetRequest mergeColumnRequest = new SetRequest(tableDomain, mergeColumns, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), true);
+ SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
+ mergeCommand.add(mergeColumnCommand);
+ }
+ } else {
+ // check if the header used is a local or the default, i.e. the TableHeaderAxisConfiguration, and if so create it
+ if (columnHeaderUsedInTable instanceof TableHeaderAxisConfiguration) {
+ // Creates the local column header if none already exists in the table
+ columnHeaderUsedInTable = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) columnHeaderUsedInTable);
+ EStructuralFeature localHeaderFeature = NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration();
+
+ IEditCommandRequest initLocalColumnHeaderAxis = new SetRequest(tableDomain, getTable(), localHeaderFeature, columnHeaderUsedInTable);
+ IElementEditService localColumnHeaderAxisProvider = ElementEditServiceUtils.getCommandProvider(getTable());
+ mergeCommand.add(localColumnHeaderAxisProvider.getEditCommand(initLocalColumnHeaderAxis));
+ }
+
+ mergeColumns = NattablestyleFactory.eINSTANCE.createBooleanValueStyle();
+ mergeColumns.setBooleanValue(true);
+ mergeColumns.setName(NamedStyleConstants.MERGE_COLUMNS);
+ SetRequest mergeColumnRequest = new SetRequest(tableDomain, columnHeaderUsedInTable, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), mergeColumns);
+ SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
+ mergeCommand.add(mergeColumnCommand);
+ }
+
+ // checks if the mergeRows option was already selected and, if so, switch its boolean to false as mergeColumns is activated to true
+ if (!isMerged) {
+ // resets the other merge booleans if any were to conflict with the current choice
+ updateTableSpanBooleans(commandId, mergeCommand);
+ }
+
+ // apply the changes to the model
+ executeMergeCommands(mergeCommand, tableDomain);
+
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeRowsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeRowsHandler.java
index 5f3a0c2231f..b44c597fa3d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeRowsHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeRowsHandler.java
@@ -1,105 +1,105 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * The handler used for the merge of all the cells inside each row
- *
- * @author Quentin Le Menez
- *
- */
-public class MergeRowsHandler extends AbstractMergeHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // the command to contain all the merge updates
- final CompositeCommand mergeCommand = new CompositeCommand("Merge/UnMerge the cells in all the rows"); //$NON-NLS-1$
- // final CompositeCommand createLocalHeaderCommand = new CompositeCommand("Creates the local header if none previously exists"); //$NON-NLS-1$
- // the domain of the currently used table
- TransactionalEditingDomain tableDomain = getTableEditingDomain();
- // necessary to identify which merge option should be activated
- final String commandId = event.getCommand().getId();
- // this boolean indicates if the currently chosen merge option is to be a merge or an unMerge
- boolean isMerged = HandlerUtil.toggleCommandState(event.getCommand());
- // the header currently used in the table
- AbstractHeaderAxisConfiguration rowHeaderUsedInTable = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(getTable());
- // the necessary merge boolean value
- BooleanValueStyle mergeRows = (BooleanValueStyle) rowHeaderUsedInTable.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_ROWS);
-
-
- // identify if the merge boolean was already created and updates it, if not creates it and set its value
- if (mergeRows != null) {
- if (mergeRows.isBooleanValue()) {
- SetRequest mergeRowRequest = new SetRequest(tableDomain, mergeRows, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), false);
- SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
- mergeCommand.add(mergeRowCommand);
- } else {
- SetRequest mergeRowRequest = new SetRequest(tableDomain, mergeRows, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), true);
- SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
- mergeCommand.add(mergeRowCommand);
- }
- } else {
- // check if the header used is a local or the default, i.e. the TableHeaderAxisConfiguration, and if so create it
- if (rowHeaderUsedInTable instanceof TableHeaderAxisConfiguration) {
- // Creates the local row header if none already exists in the table
- rowHeaderUsedInTable = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) rowHeaderUsedInTable);
- EStructuralFeature localHeaderFeature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
-
- IEditCommandRequest initLocalRowHeaderAxis = new SetRequest(tableDomain, getTable(), localHeaderFeature, rowHeaderUsedInTable);
- IElementEditService localRowHeaderAxisProvider = ElementEditServiceUtils.getCommandProvider(getTable());
- mergeCommand.add(localRowHeaderAxisProvider.getEditCommand(initLocalRowHeaderAxis));
- }
-
- mergeRows = NattablestyleFactory.eINSTANCE.createBooleanValueStyle();
- mergeRows.setBooleanValue(true);
- mergeRows.setName(NamedStyleConstants.MERGE_ROWS);
- SetRequest mergeRowRequest = new SetRequest(tableDomain, rowHeaderUsedInTable, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), mergeRows);
- SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
- mergeCommand.add(mergeRowCommand);
- }
-
- // checks if the mergeColumns option was already selected and, if so, switch its boolean to false as mergeRows is activated to true
- if (!isMerged) {
- // resets the table merge booleans if any were to conflict with the current choice
- updateTableSpanBooleans(commandId, mergeCommand);
- }
-
- // apply the changes to the model
- executeMergeCommands(mergeCommand, tableDomain);
-
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler used for the merge of all the cells inside each row
+ *
+ * @author Quentin Le Menez
+ *
+ */
+public class MergeRowsHandler extends AbstractMergeHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // the command to contain all the merge updates
+ final CompositeCommand mergeCommand = new CompositeCommand("Merge/UnMerge the cells in all the rows"); //$NON-NLS-1$
+ // final CompositeCommand createLocalHeaderCommand = new CompositeCommand("Creates the local header if none previously exists"); //$NON-NLS-1$
+ // the domain of the currently used table
+ TransactionalEditingDomain tableDomain = getTableEditingDomain();
+ // necessary to identify which merge option should be activated
+ final String commandId = event.getCommand().getId();
+ // this boolean indicates if the currently chosen merge option is to be a merge or an unMerge
+ boolean isMerged = HandlerUtil.toggleCommandState(event.getCommand());
+ // the header currently used in the table
+ AbstractHeaderAxisConfiguration rowHeaderUsedInTable = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(getTable());
+ // the necessary merge boolean value
+ BooleanValueStyle mergeRows = (BooleanValueStyle) rowHeaderUsedInTable.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_ROWS);
+
+
+ // identify if the merge boolean was already created and updates it, if not creates it and set its value
+ if (mergeRows != null) {
+ if (mergeRows.isBooleanValue()) {
+ SetRequest mergeRowRequest = new SetRequest(tableDomain, mergeRows, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), false);
+ SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
+ mergeCommand.add(mergeRowCommand);
+ } else {
+ SetRequest mergeRowRequest = new SetRequest(tableDomain, mergeRows, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), true);
+ SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
+ mergeCommand.add(mergeRowCommand);
+ }
+ } else {
+ // check if the header used is a local or the default, i.e. the TableHeaderAxisConfiguration, and if so create it
+ if (rowHeaderUsedInTable instanceof TableHeaderAxisConfiguration) {
+ // Creates the local row header if none already exists in the table
+ rowHeaderUsedInTable = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) rowHeaderUsedInTable);
+ EStructuralFeature localHeaderFeature = NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration();
+
+ IEditCommandRequest initLocalRowHeaderAxis = new SetRequest(tableDomain, getTable(), localHeaderFeature, rowHeaderUsedInTable);
+ IElementEditService localRowHeaderAxisProvider = ElementEditServiceUtils.getCommandProvider(getTable());
+ mergeCommand.add(localRowHeaderAxisProvider.getEditCommand(initLocalRowHeaderAxis));
+ }
+
+ mergeRows = NattablestyleFactory.eINSTANCE.createBooleanValueStyle();
+ mergeRows.setBooleanValue(true);
+ mergeRows.setName(NamedStyleConstants.MERGE_ROWS);
+ SetRequest mergeRowRequest = new SetRequest(tableDomain, rowHeaderUsedInTable, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), mergeRows);
+ SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
+ mergeCommand.add(mergeRowCommand);
+ }
+
+ // checks if the mergeColumns option was already selected and, if so, switch its boolean to false as mergeRows is activated to true
+ if (!isMerged) {
+ // resets the table merge booleans if any were to conflict with the current choice
+ updateTableSpanBooleans(commandId, mergeCommand);
+ }
+
+ // apply the changes to the model
+ executeMergeCommands(mergeCommand, tableDomain);
+
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedColumnsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedColumnsHandler.java
index 80b94690760..d2689ca0833 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedColumnsHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedColumnsHandler.java
@@ -1,143 +1,143 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.nebula.widgets.nattable.util.ArrayUtil;
-import org.eclipse.papyrus.infra.nattable.layerstack.BodyLayerStack;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * The handler used for the merge of all the cells inside each selected columns
- *
- * @author Quentin Le Menez
- *
- */
-public class MergeSelectedColumnsHandler extends AbstractMergeHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // the command to contain all the merge updates
- final CompositeCommand mergeCommand = new CompositeCommand("Merge/UnMerge the cells in each selected columns"); //$NON-NLS-1$
- // the domain of the currently used table
- TransactionalEditingDomain tableDomain = getTableEditingDomain();
- // the layer of the table used to identify the selected rows
- BodyLayerStack bodyLayerStack = getCurrentNattableModelManager().getBodyLayerStack();
- // necessary to identify which merge option should be activated
- final String commandId = event.getCommand().getId();
- // this boolean indicates if the currently chosen merge option is to be a merge or an unMerge
- boolean isMerged = HandlerUtil.toggleCommandState(event.getCommand());
- // get the table's manager in order to browse through the axis
- INattableModelManager manager = getCurrentNattableModelManager();
- // the array of selected columns
- int[] selectedColumns = bodyLayerStack.getSelectionLayer().getFullySelectedColumnPositions();
- // the list of selected columns' indexes
- List<Integer> selectedCs = ArrayUtil.asIntegerList(bodyLayerStack.getSelectionLayer().getFullySelectedColumnPositions());
- // the list of previously merged columns' indexes
- int idex = 0;
- List<Integer> mergedColumns = new ArrayList<Integer>();
- // for(IAxis currentAxis : manager.getTable().getCurrentColumnAxisProvider().getAxis()) {
- // the currentAxisProvider lists the axis independently of the invertedAxis boolean,
- // therefore if the table is inverted it wont see the merge boolean of the axis as it will only see the boolean of the other axis
- for (Object currentObject : manager.getColumnElementsList()) {
- if (currentObject instanceof IAxis) {
- IAxis currentAxis = (IAxis) currentObject;
- BooleanValueStyle axisToMerge = (BooleanValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
- if (axisToMerge != null && axisToMerge.isBooleanValue()) {
- mergedColumns.add(idex);
- }
- idex++;
- }
- }
- // if (mergedColumns.size() > 0)
- // isMerged = true;
-
-
- // looks inside the axis and updates or creates the merge boolean of the selected axis
- if (!isMerged || (isMerged && !selectedCs.equals(mergedColumns))) {
- List<IAxis> selectedColumnAxis = new ArrayList<IAxis>();
- for (int index : selectedColumns) {
- Object currentColumnObject = getCurrentNattableModelManager().getColumnElement(index);
- if (currentColumnObject instanceof IAxis) {
- IAxis currentColumnIAxis = (IAxis) currentColumnObject;
- if (currentColumnIAxis.eContainer() != null) {
- selectedColumnAxis.add(currentColumnIAxis);
- BooleanValueStyle isSelected = (BooleanValueStyle) currentColumnIAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
- if (isSelected != null) {
- SetRequest mergeColumnRequest = new SetRequest(tableDomain, isSelected, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), true);
- SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
- mergeCommand.add(mergeColumnCommand);
-
- } else {
- isSelected = NattablestyleFactory.eINSTANCE.createBooleanValueStyle();
- isSelected.setBooleanValue(true);
- isSelected.setName(NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
- SetRequest initColumnMergeRequest = new SetRequest(tableDomain, currentColumnIAxis, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), isSelected);
- SetValueCommand mergeColumnCommand = new SetValueCommand(initColumnMergeRequest);
- mergeCommand.add(mergeColumnCommand);
- }
- }
- }
- }
-
- // if the user wants to merge another selection instead of the previous one then the merge booleans must be updated
- if (!selectedCs.equals(mergedColumns)) {
- for (int sel : mergedColumns) {
- // if an axis were previously selected but not anymore
- if (!selectedCs.contains(sel)) {
- if (manager.getColumnElement(sel) instanceof IAxis) {
- IAxis toUnMerge = (IAxis) manager.getColumnElement(sel);
- BooleanValueStyle isSelected = (BooleanValueStyle) toUnMerge.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
- // test to be sure but this element should already have the style and have its value to true
- if (isSelected != null) {
- SetRequest mergeColumnRequest = new SetRequest(tableDomain, isSelected, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), false);
- SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
- mergeCommand.add(mergeColumnCommand);
- }
- }
- }
- }
- // resets the merge booleans if the user has not selected at least one full column
- if (selectedCs.size() == 0) {
- updateAxisSpanBooleans(commandId, mergeCommand);
- }
- }
-
- } else {
- // resets the axis merge booleans
- updateAxisSpanBooleans(commandId, mergeCommand);
- }
-
- // apply the changes to the model
- executeMergeCommands(mergeCommand, tableDomain);
-
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.nebula.widgets.nattable.util.ArrayUtil;
+import org.eclipse.papyrus.infra.nattable.layerstack.BodyLayerStack;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler used for the merge of all the cells inside each selected columns
+ *
+ * @author Quentin Le Menez
+ *
+ */
+public class MergeSelectedColumnsHandler extends AbstractMergeHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // the command to contain all the merge updates
+ final CompositeCommand mergeCommand = new CompositeCommand("Merge/UnMerge the cells in each selected columns"); //$NON-NLS-1$
+ // the domain of the currently used table
+ TransactionalEditingDomain tableDomain = getTableEditingDomain();
+ // the layer of the table used to identify the selected rows
+ BodyLayerStack bodyLayerStack = getCurrentNattableModelManager().getBodyLayerStack();
+ // necessary to identify which merge option should be activated
+ final String commandId = event.getCommand().getId();
+ // this boolean indicates if the currently chosen merge option is to be a merge or an unMerge
+ boolean isMerged = HandlerUtil.toggleCommandState(event.getCommand());
+ // get the table's manager in order to browse through the axis
+ INattableModelManager manager = getCurrentNattableModelManager();
+ // the array of selected columns
+ int[] selectedColumns = bodyLayerStack.getSelectionLayer().getFullySelectedColumnPositions();
+ // the list of selected columns' indexes
+ List<Integer> selectedCs = ArrayUtil.asIntegerList(bodyLayerStack.getSelectionLayer().getFullySelectedColumnPositions());
+ // the list of previously merged columns' indexes
+ int idex = 0;
+ List<Integer> mergedColumns = new ArrayList<Integer>();
+ // for(IAxis currentAxis : manager.getTable().getCurrentColumnAxisProvider().getAxis()) {
+ // the currentAxisProvider lists the axis independently of the invertedAxis boolean,
+ // therefore if the table is inverted it wont see the merge boolean of the axis as it will only see the boolean of the other axis
+ for (Object currentObject : manager.getColumnElementsList()) {
+ if (currentObject instanceof IAxis) {
+ IAxis currentAxis = (IAxis) currentObject;
+ BooleanValueStyle axisToMerge = (BooleanValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
+ if (axisToMerge != null && axisToMerge.isBooleanValue()) {
+ mergedColumns.add(idex);
+ }
+ idex++;
+ }
+ }
+ // if (mergedColumns.size() > 0)
+ // isMerged = true;
+
+
+ // looks inside the axis and updates or creates the merge boolean of the selected axis
+ if (!isMerged || (isMerged && !selectedCs.equals(mergedColumns))) {
+ List<IAxis> selectedColumnAxis = new ArrayList<IAxis>();
+ for (int index : selectedColumns) {
+ Object currentColumnObject = getCurrentNattableModelManager().getColumnElement(index);
+ if (currentColumnObject instanceof IAxis) {
+ IAxis currentColumnIAxis = (IAxis) currentColumnObject;
+ if (currentColumnIAxis.eContainer() != null) {
+ selectedColumnAxis.add(currentColumnIAxis);
+ BooleanValueStyle isSelected = (BooleanValueStyle) currentColumnIAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
+ if (isSelected != null) {
+ SetRequest mergeColumnRequest = new SetRequest(tableDomain, isSelected, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), true);
+ SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
+ mergeCommand.add(mergeColumnCommand);
+
+ } else {
+ isSelected = NattablestyleFactory.eINSTANCE.createBooleanValueStyle();
+ isSelected.setBooleanValue(true);
+ isSelected.setName(NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
+ SetRequest initColumnMergeRequest = new SetRequest(tableDomain, currentColumnIAxis, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), isSelected);
+ SetValueCommand mergeColumnCommand = new SetValueCommand(initColumnMergeRequest);
+ mergeCommand.add(mergeColumnCommand);
+ }
+ }
+ }
+ }
+
+ // if the user wants to merge another selection instead of the previous one then the merge booleans must be updated
+ if (!selectedCs.equals(mergedColumns)) {
+ for (int sel : mergedColumns) {
+ // if an axis were previously selected but not anymore
+ if (!selectedCs.contains(sel)) {
+ if (manager.getColumnElement(sel) instanceof IAxis) {
+ IAxis toUnMerge = (IAxis) manager.getColumnElement(sel);
+ BooleanValueStyle isSelected = (BooleanValueStyle) toUnMerge.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
+ // test to be sure but this element should already have the style and have its value to true
+ if (isSelected != null) {
+ SetRequest mergeColumnRequest = new SetRequest(tableDomain, isSelected, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), false);
+ SetValueCommand mergeColumnCommand = new SetValueCommand(mergeColumnRequest);
+ mergeCommand.add(mergeColumnCommand);
+ }
+ }
+ }
+ }
+ // resets the merge booleans if the user has not selected at least one full column
+ if (selectedCs.size() == 0) {
+ updateAxisSpanBooleans(commandId, mergeCommand);
+ }
+ }
+
+ } else {
+ // resets the axis merge booleans
+ updateAxisSpanBooleans(commandId, mergeCommand);
+ }
+
+ // apply the changes to the model
+ executeMergeCommands(mergeCommand, tableDomain);
+
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedRowsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedRowsHandler.java
index 9b8fa268050..4996e6bea07 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedRowsHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeSelectedRowsHandler.java
@@ -1,143 +1,143 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.nebula.widgets.nattable.util.ArrayUtil;
-import org.eclipse.papyrus.infra.nattable.layerstack.BodyLayerStack;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * The handler used for the merge of all the cells inside each selected rows
- *
- * @author Quentin Le Menez
- *
- */
-public class MergeSelectedRowsHandler extends AbstractMergeHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // the command to contain all the merge updates
- final CompositeCommand mergeCommand = new CompositeCommand("Merge/UnMerge the cells in each selected rows"); //$NON-NLS-1$
- // the domain of the currently used table
- TransactionalEditingDomain tableDomain = getTableEditingDomain();
- // the layer of the table used to identify the selected rows
- BodyLayerStack bodyLayerStack = getCurrentNattableModelManager().getBodyLayerStack();
- // necessary to identify which merge option should be activated
- final String commandId = event.getCommand().getId();
- // this boolean indicates if the currently chosen merge option is to be a merge or an unMerge
- boolean isMerged = HandlerUtil.toggleCommandState(event.getCommand());
- // get the table's manager in order to browse through the axis
- INattableModelManager manager = getCurrentNattableModelManager();
- // the array of selected rows
- int[] selectedRows = bodyLayerStack.getSelectionLayer().getFullySelectedRowPositions();
- // the list of selected rows' indexes
- List<Integer> selectedRs = ArrayUtil.asIntegerList(selectedRows);
- // the list of previously merged rows' indexes
- int idex = 0;
- List<Integer> mergedRows = new ArrayList<Integer>();
- // for(IAxis currentAxis : manager.getTable().getCurrentRowAxisProvider().getAxis()) {
- // the currentAxisProvider lists the axis independently of the invertedAxis boolean,
- // therefore if the table is inverted it wont see the merge boolean of the axis as it will only see the boolean of the other axis
- for (Object currentObject : manager.getRowElementsList()) {
- if (currentObject instanceof IAxis) {
- IAxis currentAxis = (IAxis) currentObject;
- BooleanValueStyle axisToMerge = (BooleanValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
- if (axisToMerge != null && axisToMerge.isBooleanValue()) {
- mergedRows.add(idex);
- }
- idex++;
- }
- }
- // if (mergedRows.size() > 0)
- // isMerged = true;
-
-
- // looks inside the axis and updates or creates the merge boolean of the selected axis
- if (!isMerged || (isMerged && !selectedRs.equals(mergedRows))) {
- List<IAxis> selectedRowAxis = new ArrayList<IAxis>();
- for (int index : selectedRows) {
- Object currentRowObject = getCurrentNattableModelManager().getRowElement(index);
- if (currentRowObject instanceof IAxis) {
- IAxis currentRowIAxis = (IAxis) currentRowObject;
- if (currentRowIAxis.eContainer() != null) {
- selectedRowAxis.add(currentRowIAxis);
- BooleanValueStyle isSelected = (BooleanValueStyle) currentRowIAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
- if (isSelected != null) {
- SetRequest mergeRowRequest = new SetRequest(tableDomain, isSelected, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), true);
- SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
- mergeCommand.add(mergeRowCommand);
-
- } else {
- isSelected = NattablestyleFactory.eINSTANCE.createBooleanValueStyle();
- isSelected.setBooleanValue(true);
- isSelected.setName(NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
- SetRequest initRowMergeRequest = new SetRequest(tableDomain, currentRowIAxis, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), isSelected);
- SetValueCommand mergeRowCommand = new SetValueCommand(initRowMergeRequest);
- mergeCommand.add(mergeRowCommand);
- }
- }
- }
- }
-
- // if the user wants to merge another selection instead of the previous one then the merge booleans must be updated
- if (!selectedRs.equals(mergedRows)) {
- for (int sel : mergedRows) {
- // if an axis were previously selected but not anymore
- if (!selectedRs.contains(sel)) {
- if (manager.getRowElement(sel) instanceof IAxis) {
- IAxis toUnMerge = (IAxis) manager.getRowElement(sel);
- BooleanValueStyle isSelected = (BooleanValueStyle) toUnMerge.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
- // test to be sure but this element should already have the style and have its value to true
- if (isSelected != null) {
- SetRequest mergeRowRequest = new SetRequest(tableDomain, isSelected, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), false);
- SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
- mergeCommand.add(mergeRowCommand);
- }
- }
- }
- }
- // resets the merge booleans if the user has not selected at least one full row
- if (selectedRs.size() == 0) {
- updateAxisSpanBooleans(commandId, mergeCommand);
- }
- }
-
- } else {
- // resets the axis merge booleans
- updateAxisSpanBooleans(commandId, mergeCommand);
- }
-
- // apply the changes to the model
- executeMergeCommands(mergeCommand, tableDomain);
-
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.nebula.widgets.nattable.util.ArrayUtil;
+import org.eclipse.papyrus.infra.nattable.layerstack.BodyLayerStack;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler used for the merge of all the cells inside each selected rows
+ *
+ * @author Quentin Le Menez
+ *
+ */
+public class MergeSelectedRowsHandler extends AbstractMergeHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // the command to contain all the merge updates
+ final CompositeCommand mergeCommand = new CompositeCommand("Merge/UnMerge the cells in each selected rows"); //$NON-NLS-1$
+ // the domain of the currently used table
+ TransactionalEditingDomain tableDomain = getTableEditingDomain();
+ // the layer of the table used to identify the selected rows
+ BodyLayerStack bodyLayerStack = getCurrentNattableModelManager().getBodyLayerStack();
+ // necessary to identify which merge option should be activated
+ final String commandId = event.getCommand().getId();
+ // this boolean indicates if the currently chosen merge option is to be a merge or an unMerge
+ boolean isMerged = HandlerUtil.toggleCommandState(event.getCommand());
+ // get the table's manager in order to browse through the axis
+ INattableModelManager manager = getCurrentNattableModelManager();
+ // the array of selected rows
+ int[] selectedRows = bodyLayerStack.getSelectionLayer().getFullySelectedRowPositions();
+ // the list of selected rows' indexes
+ List<Integer> selectedRs = ArrayUtil.asIntegerList(selectedRows);
+ // the list of previously merged rows' indexes
+ int idex = 0;
+ List<Integer> mergedRows = new ArrayList<Integer>();
+ // for(IAxis currentAxis : manager.getTable().getCurrentRowAxisProvider().getAxis()) {
+ // the currentAxisProvider lists the axis independently of the invertedAxis boolean,
+ // therefore if the table is inverted it wont see the merge boolean of the axis as it will only see the boolean of the other axis
+ for (Object currentObject : manager.getRowElementsList()) {
+ if (currentObject instanceof IAxis) {
+ IAxis currentAxis = (IAxis) currentObject;
+ BooleanValueStyle axisToMerge = (BooleanValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
+ if (axisToMerge != null && axisToMerge.isBooleanValue()) {
+ mergedRows.add(idex);
+ }
+ idex++;
+ }
+ }
+ // if (mergedRows.size() > 0)
+ // isMerged = true;
+
+
+ // looks inside the axis and updates or creates the merge boolean of the selected axis
+ if (!isMerged || (isMerged && !selectedRs.equals(mergedRows))) {
+ List<IAxis> selectedRowAxis = new ArrayList<IAxis>();
+ for (int index : selectedRows) {
+ Object currentRowObject = getCurrentNattableModelManager().getRowElement(index);
+ if (currentRowObject instanceof IAxis) {
+ IAxis currentRowIAxis = (IAxis) currentRowObject;
+ if (currentRowIAxis.eContainer() != null) {
+ selectedRowAxis.add(currentRowIAxis);
+ BooleanValueStyle isSelected = (BooleanValueStyle) currentRowIAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
+ if (isSelected != null) {
+ SetRequest mergeRowRequest = new SetRequest(tableDomain, isSelected, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), true);
+ SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
+ mergeCommand.add(mergeRowCommand);
+
+ } else {
+ isSelected = NattablestyleFactory.eINSTANCE.createBooleanValueStyle();
+ isSelected.setBooleanValue(true);
+ isSelected.setName(NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
+ SetRequest initRowMergeRequest = new SetRequest(tableDomain, currentRowIAxis, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), isSelected);
+ SetValueCommand mergeRowCommand = new SetValueCommand(initRowMergeRequest);
+ mergeCommand.add(mergeRowCommand);
+ }
+ }
+ }
+ }
+
+ // if the user wants to merge another selection instead of the previous one then the merge booleans must be updated
+ if (!selectedRs.equals(mergedRows)) {
+ for (int sel : mergedRows) {
+ // if an axis were previously selected but not anymore
+ if (!selectedRs.contains(sel)) {
+ if (manager.getRowElement(sel) instanceof IAxis) {
+ IAxis toUnMerge = (IAxis) manager.getRowElement(sel);
+ BooleanValueStyle isSelected = (BooleanValueStyle) toUnMerge.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
+ // test to be sure but this element should already have the style and have its value to true
+ if (isSelected != null) {
+ SetRequest mergeRowRequest = new SetRequest(tableDomain, isSelected, NattablestylePackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), false);
+ SetValueCommand mergeRowCommand = new SetValueCommand(mergeRowRequest);
+ mergeCommand.add(mergeRowCommand);
+ }
+ }
+ }
+ }
+ // resets the merge booleans if the user has not selected at least one full row
+ if (selectedRs.size() == 0) {
+ updateAxisSpanBooleans(commandId, mergeCommand);
+ }
+ }
+
+ } else {
+ // resets the axis merge booleans
+ updateAxisSpanBooleans(commandId, mergeCommand);
+ }
+
+ // apply the changes to the model
+ executeMergeCommands(mergeCommand, tableDomain);
+
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeTableHandler.java
index a5d1df1097f..8ef42e11445 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/MergeTableHandler.java
@@ -1,53 +1,53 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-
-public class MergeTableHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- // the complete merge of the table is not supported yet
- // TODO rewrite/fix the spanning behavior when applied to both columns and rows (cells hidden under others)
-
- // if(mergeOption.equals("Merge Table")) {
- // resetSpan();
- // bodyLayerStack.getBodyLayerSpanProvider().setAutoColumnSpan(true);
- // bodyLayerStack.getBodyLayerSpanProvider().setAutoRowSpan(true);
- //
- // Integer[] testListColumn = { new Integer(11), new Integer(12), new Integer(13), new Integer(14) };
- // Integer[] testListRow = { new Integer(0), new Integer(1), new Integer(2), new Integer(3), new Integer(4), new Integer(5) };
- // bodyLayerStack.getBodyLayerSpanProvider().addAutoSpanningRowPositions(testListRow);
- // bodyLayerStack.getBodyLayerSpanProvider().addAutoSpanningColumnPositions(testListColumn);
- //
- // refreshTable();
- // }
-
- return null;
- }
-
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+
+public class MergeTableHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ // the complete merge of the table is not supported yet
+ // TODO rewrite/fix the spanning behavior when applied to both columns and rows (cells hidden under others)
+
+ // if(mergeOption.equals("Merge Table")) {
+ // resetSpan();
+ // bodyLayerStack.getBodyLayerSpanProvider().setAutoColumnSpan(true);
+ // bodyLayerStack.getBodyLayerSpanProvider().setAutoRowSpan(true);
+ //
+ // Integer[] testListColumn = { new Integer(11), new Integer(12), new Integer(13), new Integer(14) };
+ // Integer[] testListRow = { new Integer(0), new Integer(1), new Integer(2), new Integer(3), new Integer(4), new Integer(5) };
+ // bodyLayerStack.getBodyLayerSpanProvider().addAutoSpanningRowPositions(testListRow);
+ // bodyLayerStack.getBodyLayerSpanProvider().addAutoSpanningColumnPositions(testListColumn);
+ //
+ // refreshTable();
+ // }
+
+ return null;
+ }
+
} \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PrintTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PrintTableHandler.java
index 2a05efa2ace..abfa39f7415 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PrintTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PrintTableHandler.java
@@ -1,44 +1,44 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- *
- * Handler for the print table action
- *
- */
-public class PrintTableHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- final INattableModelManager manager = getCurrentNattableModelManager();
- if (manager != null) {
- manager.print();
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ *
+ * Handler for the print table action
+ *
+ */
+public class PrintTableHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final INattableModelManager manager = getCurrentNattableModelManager();
+ if (manager != null) {
+ manager.print();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java
index 9bee87cbfd2..623079f41e1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java
@@ -1,49 +1,49 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeRowsCommand;
-import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
-import org.eclipse.nebula.widgets.nattable.util.GCFactory;
-
-/**
- * Handler used to resize rows
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowAutoResizeHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- NatEventData eventData = getNatEventData();
- if (eventData != null) {
- final NatTable natTable = eventData.getNatTable();
- natTable.doCommand(new InitializeAutoResizeRowsCommand(natTable, eventData.getRowPosition(), natTable.getConfigRegistry(), new GCFactory(natTable)));
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeRowsCommand;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.nebula.widgets.nattable.util.GCFactory;
+
+/**
+ * Handler used to resize rows
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowAutoResizeHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ NatEventData eventData = getNatEventData();
+ if (eventData != null) {
+ final NatTable natTable = eventData.getNatTable();
+ natTable.doCommand(new InitializeAutoResizeRowsCommand(natTable, eventData.getRowPosition(), natTable.getConfigRegistry(), new GCFactory(natTable)));
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java
index 3877fc25923..040fe670ecb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java
@@ -1,67 +1,67 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
-
-/**
- * The handler used to destroy the element represented by the selected rows
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDestroyAxisElementHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final IAxisManager axisManager = getRowAxisManager();
- NatEventData eventData = getNatEventData();
- if (axisManager != null && eventData != null) {
- axisManager.destroyAxisElement(getFullSelectedRowsIndex(eventData));
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- boolean enabled = false;
- NatEventData eventData = getNatEventData();
- final IAxisManager axisManager = getRowAxisManager();
- if (isEnabled() && axisManager != null && eventData != null) {
- final List<Integer> rows = getFullSelectedRowsIndex(eventData);
- enabled = axisManager.canDestroyAxisElement(rows);
- }
- setBaseEnabled(enabled);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
+
+/**
+ * The handler used to destroy the element represented by the selected rows
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDestroyAxisElementHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final IAxisManager axisManager = getRowAxisManager();
+ NatEventData eventData = getNatEventData();
+ if (axisManager != null && eventData != null) {
+ axisManager.destroyAxisElement(getFullSelectedRowsIndex(eventData));
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ boolean enabled = false;
+ NatEventData eventData = getNatEventData();
+ final IAxisManager axisManager = getRowAxisManager();
+ if (isEnabled() && axisManager != null && eventData != null) {
+ final List<Integer> rows = getFullSelectedRowsIndex(eventData);
+ enabled = axisManager.canDestroyAxisElement(rows);
+ }
+ setBaseEnabled(enabled);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java
index 41238e95218..ca2fb59232c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java
@@ -1,67 +1,67 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
-
-/**
- * The handler used to destroy the element represented by the selected rows
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDestroyAxisHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final IAxisManager axisManager = getRowAxisManager();
- NatEventData eventData = getNatEventData();
- if (axisManager != null && eventData!=null) {
- axisManager.destroyAxis(getFullSelectedRowsIndex(eventData));
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- final IAxisManager axisManager = getRowAxisManager();
- boolean enabled = false;
- NatEventData eventData = getNatEventData();
- if (isEnabled() && axisManager != null && eventData!=null) {
- final List<Integer> rows = getFullSelectedRowsIndex(eventData);
- enabled = axisManager.canDestroyAxis(rows);
- }
- setBaseEnabled(enabled);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
+
+/**
+ * The handler used to destroy the element represented by the selected rows
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDestroyAxisHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final IAxisManager axisManager = getRowAxisManager();
+ NatEventData eventData = getNatEventData();
+ if (axisManager != null && eventData!=null) {
+ axisManager.destroyAxis(getFullSelectedRowsIndex(eventData));
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ final IAxisManager axisManager = getRowAxisManager();
+ boolean enabled = false;
+ NatEventData eventData = getNatEventData();
+ if (isEnabled() && axisManager != null && eventData!=null) {
+ final List<Integer> rows = getFullSelectedRowsIndex(eventData);
+ enabled = axisManager.canDestroyAxis(rows);
+ }
+ setBaseEnabled(enabled);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayIndexHeaderHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayIndexHeaderHandler.java
index 356802ccdf9..0645e0394f4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayIndexHeaderHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayIndexHeaderHandler.java
@@ -1,37 +1,37 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-
-/**
- * The handler to change the boolean value to display index header for row
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDisplayIndexHeaderHandler extends AbstractRowChangeHeaderConfigurationHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayIndex();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+
+/**
+ * The handler to change the boolean value to display index header for row
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDisplayIndexHeaderHandler extends AbstractRowChangeHeaderConfigurationHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayIndex();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabeTextHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabeTextHandler.java
index 18c89e2133d..82d278496a9 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabeTextHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabeTextHandler.java
@@ -1,39 +1,39 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the text in the row label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDisplayLabeTextHandler extends AbstractRowChangeLabelConfigurationValueHandler {
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getObjectLabelProviderConfiguration_DisplayLabel();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the text in the row label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDisplayLabeTextHandler extends AbstractRowChangeLabelConfigurationValueHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getObjectLabelProviderConfiguration_DisplayLabel();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureIsDerivedHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureIsDerivedHandler.java
index 62abf25605c..34b91dbae75 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureIsDerivedHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureIsDerivedHandler.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the "/" for derived feature in the row label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDisplayLabelFeatureIsDerivedHandler extends AbstractRowChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayIsDerived();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the "/" for derived feature in the row label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDisplayLabelFeatureIsDerivedHandler extends AbstractRowChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayIsDerived();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureMultiplicityHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureMultiplicityHandler.java
index b851980ec8e..3b88402d253 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureMultiplicityHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureMultiplicityHandler.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the feature multiplicity in the row label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDisplayLabelFeatureMultiplicityHandler extends AbstractRowChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayMultiplicity();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the feature multiplicity in the row label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDisplayLabelFeatureMultiplicityHandler extends AbstractRowChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayMultiplicity();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureNameHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureNameHandler.java
index 0d29d7ef70f..9f557e46fa2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureNameHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureNameHandler.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-
-/**
- * The handler to change the boolean value used to display the name of the feature in the row label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDisplayLabelFeatureNameHandler extends AbstractRowChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayName();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+
+/**
+ * The handler to change the boolean value used to display the name of the feature in the row label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDisplayLabelFeatureNameHandler extends AbstractRowChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayName();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureTypeHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureTypeHandler.java
index c39e09cf2c4..13c71e103bd 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureTypeHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelFeatureTypeHandler.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the type of the feature in the row label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDisplayLabelFeatureTypeHandler extends AbstractRowChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayType();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the type of the feature in the row label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDisplayLabelFeatureTypeHandler extends AbstractRowChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getFeatureLabelProviderConfiguration_DisplayType();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java
index afd4bd5d679..2efb4651518 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java
@@ -1,37 +1,37 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-
-/**
- * The handler to change the boolean value to display label header for row
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDisplayLabelHeaderHandler extends AbstractRowChangeHeaderConfigurationHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayLabel();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+
+/**
+ * The handler to change the boolean value to display label header for row
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDisplayLabelHeaderHandler extends AbstractRowChangeHeaderConfigurationHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeHeaderConfigurationHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayLabel();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelImageHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelImageHandler.java
index 9ce07b09447..c7716d75956 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelImageHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelImageHandler.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
-
-/**
- * The handler to change the boolean value used to display the image in the row label header
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowDisplayLabelImageHandler extends AbstractRowChangeLabelConfigurationValueHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
- *
- * @return
- */
- @Override
- protected EStructuralFeature getEditedFeature() {
- return NattablelabelproviderPackage.eINSTANCE.getObjectLabelProviderConfiguration_DisplayIcon();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage;
+
+/**
+ * The handler to change the boolean value used to display the image in the row label header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowDisplayLabelImageHandler extends AbstractRowChangeLabelConfigurationValueHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractChangeLabelConfigurationValueHandler#getEditedFeature()
+ *
+ * @return
+ */
+ @Override
+ protected EStructuralFeature getEditedFeature() {
+ return NattablelabelproviderPackage.eINSTANCE.getObjectLabelProviderConfiguration_DisplayIcon();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowEditAliasHeaderHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowEditAliasHeaderHandler.java
index 9635b57dc71..c91d70be62e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowEditAliasHeaderHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowEditAliasHeaderHandler.java
@@ -1,63 +1,63 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
-import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
-
-//TODO : this handler should be declare on org.eclipse.ui.edit (or something like this) to be binded on F2
-
-public class RowEditAliasHeaderHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- NatEventData eventData = getNatEventData();
- if (eventData!=null) {
- AbstractNattableWidgetManager manager = (AbstractNattableWidgetManager) getCurrentNattableModelManager();
- manager.openEditRowAliasDialog(eventData);
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {// it must be the nattable selection event
- super.setEnabled(evaluationContext);
- final NatEventData eventData = getNatEventData();
- final NattableModelManager manager = (NattableModelManager) getCurrentNattableModelManager();
- if(isEnabled() && eventData!=null && manager!=null ){
- setBaseEnabled(manager.canEditRowHeader(eventData));
- } else {
- setBaseEnabled(false);
- }
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
+
+//TODO : this handler should be declare on org.eclipse.ui.edit (or something like this) to be binded on F2
+
+public class RowEditAliasHeaderHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ NatEventData eventData = getNatEventData();
+ if (eventData!=null) {
+ AbstractNattableWidgetManager manager = (AbstractNattableWidgetManager) getCurrentNattableModelManager();
+ manager.openEditRowAliasDialog(eventData);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {// it must be the nattable selection event
+ super.setEnabled(evaluationContext);
+ final NatEventData eventData = getNatEventData();
+ final NattableModelManager manager = (NattableModelManager) getCurrentNattableModelManager();
+ if(isEnabled() && eventData!=null && manager!=null ){
+ setBaseEnabled(manager.canEditRowHeader(eventData));
+ } else {
+ setBaseEnabled(false);
+ }
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java
index 2f808544283..ea9785bd75f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java
@@ -1,42 +1,42 @@
-/*****************************************************************************
- * Copyright (c) 2013, 2015 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class RowMasterDisconnectColumnSlaveHandler extends AbstractDisconnectSlaveHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractDisconnectSlaveHandler#getAxisProviderToEdit()
- *
- * @return
- */
- @Override
- protected AbstractAxisProvider getAxisProviderToEdit() {
- INattableModelManager currentNattableModelManager = getCurrentNattableModelManager();
- if (currentNattableModelManager == null ) {
- return null;
- }
- return AxisUtils.getAxisProviderUsedForRows(currentNattableModelManager);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013, 2015 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class RowMasterDisconnectColumnSlaveHandler extends AbstractDisconnectSlaveHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractDisconnectSlaveHandler#getAxisProviderToEdit()
+ *
+ * @return
+ */
+ @Override
+ protected AbstractAxisProvider getAxisProviderToEdit() {
+ INattableModelManager currentNattableModelManager = getCurrentNattableModelManager();
+ if (currentNattableModelManager == null ) {
+ return null;
+ }
+ return AxisUtils.getAxisProviderUsedForRows(currentNattableModelManager);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentColumnAxisProvidersHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentColumnAxisProvidersHandler.java
index 04455e908e2..62c0a28fb02 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentColumnAxisProvidersHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentColumnAxisProvidersHandler.java
@@ -1,60 +1,60 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-
-/**
- * Concrete handler to save the current axis provider, in this case for columns.
- *
- */
-public class SaveCurrentColumnAxisProvidersHandler extends AbstractSaveCurrentAxisProvidersHandler {
-
- @Override
- public void setEnabled(Object evaluationContext) {
- INattableModelManager manager = this.getCurrentNattableModelManager();
- if (manager == null) {
- setBaseEnabled(false);
- return;
- }
-
- IAxisManager columnAxisManager = manager.getColumnAxisManager();
- if (columnAxisManager == null) {
- setBaseEnabled(false);
- return;
- }
- setBaseEnabled(columnAxisManager.canBeSavedAsConfig());
- }
-
- @Override
- public AbstractAxisProvider getAxisProvider() {
- return this.getCurrentNattableModelManager().getVerticalAxisProvider();
- }
-
- @Override
- public EList<AbstractAxisProvider> getAxisProviderHistory() {
- return this.getCurrentNattableModelManager().getTable().getColumnAxisProvidersHistory();
- }
-
- @Override
- public EReference getAxisProviderHistoryEReference() {
- return NattablePackage.eINSTANCE.getTable_ColumnAxisProvidersHistory();
- }
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+
+/**
+ * Concrete handler to save the current axis provider, in this case for columns.
+ *
+ */
+public class SaveCurrentColumnAxisProvidersHandler extends AbstractSaveCurrentAxisProvidersHandler {
+
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ INattableModelManager manager = this.getCurrentNattableModelManager();
+ if (manager == null) {
+ setBaseEnabled(false);
+ return;
+ }
+
+ IAxisManager columnAxisManager = manager.getColumnAxisManager();
+ if (columnAxisManager == null) {
+ setBaseEnabled(false);
+ return;
+ }
+ setBaseEnabled(columnAxisManager.canBeSavedAsConfig());
+ }
+
+ @Override
+ public AbstractAxisProvider getAxisProvider() {
+ return this.getCurrentNattableModelManager().getVerticalAxisProvider();
+ }
+
+ @Override
+ public EList<AbstractAxisProvider> getAxisProviderHistory() {
+ return this.getCurrentNattableModelManager().getTable().getColumnAxisProvidersHistory();
+ }
+
+ @Override
+ public EReference getAxisProviderHistoryEReference() {
+ return NattablePackage.eINSTANCE.getTable_ColumnAxisProvidersHistory();
+ }
+
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentRowAxisProvidersHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentRowAxisProvidersHandler.java
index 35ade0f472e..80f0a927f07 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentRowAxisProvidersHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SaveCurrentRowAxisProvidersHandler.java
@@ -1,82 +1,82 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-
-/**
- * Concrete handler to save the current axis provider, in this case for rows.
- *
- */
-public class SaveCurrentRowAxisProvidersHandler extends AbstractSaveCurrentAxisProvidersHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractSaveCurrentAxisProvidersHandler#getAxisProviderHistoryEReference()
- *
- * @return
- */
- @Override
- public EReference getAxisProviderHistoryEReference() {
- return NattablePackage.eINSTANCE.getTable_RowAxisProvidersHistory();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractSaveCurrentAxisProvidersHandler#getAxisProviderHistory()
- *
- * @return
- */
- @Override
- public EList<AbstractAxisProvider> getAxisProviderHistory() {
- return this.getCurrentNattableModelManager().getTable().getRowAxisProvidersHistory();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractSaveCurrentAxisProvidersHandler#getAxisProvider()
- *
- * @return
- */
- @Override
- public AbstractAxisProvider getAxisProvider() {
- return this.getCurrentNattableModelManager().getHorizontalAxisProvider();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- INattableModelManager manager = this.getCurrentNattableModelManager();
- if (manager == null) {
- setBaseEnabled(false);
- return;
- }
-
- IAxisManager rowAxisManager = manager.getRowAxisManager();
- if (rowAxisManager == null) {
- setBaseEnabled(false);
- return;
- }
- setBaseEnabled(rowAxisManager.canBeSavedAsConfig());
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+
+/**
+ * Concrete handler to save the current axis provider, in this case for rows.
+ *
+ */
+public class SaveCurrentRowAxisProvidersHandler extends AbstractSaveCurrentAxisProvidersHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractSaveCurrentAxisProvidersHandler#getAxisProviderHistoryEReference()
+ *
+ * @return
+ */
+ @Override
+ public EReference getAxisProviderHistoryEReference() {
+ return NattablePackage.eINSTANCE.getTable_RowAxisProvidersHistory();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractSaveCurrentAxisProvidersHandler#getAxisProviderHistory()
+ *
+ * @return
+ */
+ @Override
+ public EList<AbstractAxisProvider> getAxisProviderHistory() {
+ return this.getCurrentNattableModelManager().getTable().getRowAxisProvidersHistory();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractSaveCurrentAxisProvidersHandler#getAxisProvider()
+ *
+ * @return
+ */
+ @Override
+ public AbstractAxisProvider getAxisProvider() {
+ return this.getCurrentNattableModelManager().getHorizontalAxisProvider();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ INattableModelManager manager = this.getCurrentNattableModelManager();
+ if (manager == null) {
+ setBaseEnabled(false);
+ return;
+ }
+
+ IAxisManager rowAxisManager = manager.getRowAxisManager();
+ if (rowAxisManager == null) {
+ setBaseEnabled(false);
+ return;
+ }
+ setBaseEnabled(rowAxisManager.canBeSavedAsConfig());
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectAllHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectAllHandler.java
index 4ac1b62713f..c5829332308 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectAllHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectAllHandler.java
@@ -1,36 +1,36 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class SelectAllHandler extends AbstractTableHandler {
-
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- final INattableModelManager manager = getCurrentNattableModelManager();
- if (manager != null) {
- manager.selectAll();
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class SelectAllHandler extends AbstractTableHandler {
+
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final INattableModelManager manager = getCurrentNattableModelManager();
+ if (manager != null) {
+ manager.selectAll();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectColumnsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectColumnsHandler.java
index f60084b62f9..2733ad6dcab 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectColumnsHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectColumnsHandler.java
@@ -1,60 +1,60 @@
-/*****************************************************************************
- * Copyright (c) 2013, 2015 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- *
- * Handler for the Create/Destroy columns Papyrus version
- *
- */
-public class SelectColumnsHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- final INattableModelManager currentNattableModelManager = this.getCurrentNattableModelManager();
- currentNattableModelManager.openCreateDestroyColumnsManagerDialog();
- return event;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- final INattableModelManager currentNattableModelManager = getCurrentNattableModelManager();
- boolean enabled = false;
- if (currentNattableModelManager != null) {
- enabled = currentNattableModelManager.canCreateDestroyColumnsAxis();
- }
- setBaseEnabled(enabled);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013, 2015 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ *
+ * Handler for the Create/Destroy columns Papyrus version
+ *
+ */
+public class SelectColumnsHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final INattableModelManager currentNattableModelManager = this.getCurrentNattableModelManager();
+ currentNattableModelManager.openCreateDestroyColumnsManagerDialog();
+ return event;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ final INattableModelManager currentNattableModelManager = getCurrentNattableModelManager();
+ boolean enabled = false;
+ if (currentNattableModelManager != null) {
+ enabled = currentNattableModelManager.canCreateDestroyColumnsAxis();
+ }
+ setBaseEnabled(enabled);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectRowsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectRowsHandler.java
index de63d6866ad..93abe95629a 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectRowsHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SelectRowsHandler.java
@@ -1,60 +1,60 @@
-/*****************************************************************************
- * Copyright (c) 2013, 2015 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- *
- * Handler for the Create/Destroy columns Papyrus version
- *
- */
-public class SelectRowsHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- final INattableModelManager currentNattableModelManager = this.getCurrentNattableModelManager();
- currentNattableModelManager.openCreateDestroyRowsManagerDialog();
- return event;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- final INattableModelManager currentNattableModelManager = getCurrentNattableModelManager();
- boolean enabled = false;
- if (currentNattableModelManager != null) {
- enabled = currentNattableModelManager.canCreateDestroyRowsAxis();
- }
- setBaseEnabled(enabled);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013, 2015 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ *
+ * Handler for the Create/Destroy columns Papyrus version
+ *
+ */
+public class SelectRowsHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final INattableModelManager currentNattableModelManager = this.getCurrentNattableModelManager();
+ currentNattableModelManager.openCreateDestroyRowsManagerDialog();
+ return event;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ final INattableModelManager currentNattableModelManager = getCurrentNattableModelManager();
+ boolean enabled = false;
+ if (currentNattableModelManager != null) {
+ enabled = currentNattableModelManager.canCreateDestroyRowsAxis();
+ }
+ setBaseEnabled(enabled);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortColumnsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortColumnsHandler.java
index 33f567921ed..2299a1dccec 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortColumnsHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortColumnsHandler.java
@@ -1,63 +1,63 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.utils.Constants;
-
-/**
- * Handler used to sort the columns
- *
- * @author Vincent Lorenzo
- *
- */
-public class SortColumnsHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final String directionParameter = event.getParameter(Constants.SORT_COMMAND_PARAMETER);
- INattableModelManager manager = getCurrentNattableModelManager();
- boolean alphabeticOrder = "true".equals(directionParameter);
- manager.sortColumnsByName(alphabeticOrder);
- return null;
- }
-
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- INattableModelManager manager = getCurrentNattableModelManager();
- boolean enabled = false;
- if (manager != null) {
- enabled = manager.canMoveColumns();
- }
- setBaseEnabled(enabled);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.Constants;
+
+/**
+ * Handler used to sort the columns
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class SortColumnsHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final String directionParameter = event.getParameter(Constants.SORT_COMMAND_PARAMETER);
+ INattableModelManager manager = getCurrentNattableModelManager();
+ boolean alphabeticOrder = "true".equals(directionParameter);
+ manager.sortColumnsByName(alphabeticOrder);
+ return null;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ INattableModelManager manager = getCurrentNattableModelManager();
+ boolean enabled = false;
+ if (manager != null) {
+ enabled = manager.canMoveColumns();
+ }
+ setBaseEnabled(enabled);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortRowsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortRowsHandler.java
index 836618768cd..4e956ab4eeb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortRowsHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SortRowsHandler.java
@@ -1,62 +1,62 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.utils.Constants;
-
-/**
- * The handler for the sort rows action
- *
- * @author Vincent Lorenzo
- *
- */
-public class SortRowsHandler extends AbstractTableHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final String directionParameter = event.getParameter(Constants.SORT_COMMAND_PARAMETER);
- INattableModelManager manager = getCurrentNattableModelManager();
- boolean alphabeticOrder = Boolean.TRUE.toString().equals(directionParameter);
- manager.sortRowsByName(alphabeticOrder);
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- INattableModelManager manager = getCurrentNattableModelManager();
- boolean enabled = false;
- if (manager != null) {
- enabled = manager.canMoveColumns();
- }
- setBaseEnabled(enabled);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.Constants;
+
+/**
+ * The handler for the sort rows action
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class SortRowsHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final String directionParameter = event.getParameter(Constants.SORT_COMMAND_PARAMETER);
+ INattableModelManager manager = getCurrentNattableModelManager();
+ boolean alphabeticOrder = Boolean.TRUE.toString().equals(directionParameter);
+ manager.sortRowsByName(alphabeticOrder);
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ INattableModelManager manager = getCurrentNattableModelManager();
+ boolean enabled = false;
+ if (manager != null) {
+ enabled = manager.canMoveColumns();
+ }
+ setBaseEnabled(enabled);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesCommandHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesCommandHandler.java
index f5f38437e46..77be36fcfcc 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesCommandHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesCommandHandler.java
@@ -1,84 +1,84 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-
-
-
-public class TreeRowHideAllCategoriesCommandHandler extends AbstractTreeRowHideShowCategoryHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(getTable());
-
- Table table = getTable();
- IntListValueStyle values = (IntListValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getIntListValueStyle(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
- CompoundCommand cc = new CompoundCommand("Hide All categories Command"); //$NON-NLS-1$
- if (values == null) {
- values = NattablestyleFactory.eINSTANCE.createIntListValueStyle();
- cc.append(AddCommand.create(getTableEditingDomain(), table, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), Collections.singleton(values)));
- cc.append(SetCommand.create(getTableEditingDomain(), values, NattablestylePackage.eINSTANCE.getNamedStyle_Name(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH));
- }
- final List<Integer> toHide = new ArrayList<Integer>();
- int start = 0;
- if (!FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), 0)) {
- start = 1;
- }
- for (int i = start; i <= maxDepth; i++) {
- toHide.add(Integer.valueOf(i));
- }
-
- cc.append(SetCommand.create(getTableEditingDomain(), values, NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), toHide));
- getTableEditingDomain().getCommandStack().execute(cc);
- return null;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- if (isEnabled()) {
- if (allCategoriesAreCurrentlyHidden()) {
- setBaseEnabled(false);
- }
- }
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+
+
+
+public class TreeRowHideAllCategoriesCommandHandler extends AbstractTreeRowHideShowCategoryHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(getTable());
+
+ Table table = getTable();
+ IntListValueStyle values = (IntListValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getIntListValueStyle(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
+ CompoundCommand cc = new CompoundCommand("Hide All categories Command"); //$NON-NLS-1$
+ if (values == null) {
+ values = NattablestyleFactory.eINSTANCE.createIntListValueStyle();
+ cc.append(AddCommand.create(getTableEditingDomain(), table, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), Collections.singleton(values)));
+ cc.append(SetCommand.create(getTableEditingDomain(), values, NattablestylePackage.eINSTANCE.getNamedStyle_Name(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH));
+ }
+ final List<Integer> toHide = new ArrayList<Integer>();
+ int start = 0;
+ if (!FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), 0)) {
+ start = 1;
+ }
+ for (int i = start; i <= maxDepth; i++) {
+ toHide.add(Integer.valueOf(i));
+ }
+
+ cc.append(SetCommand.create(getTableEditingDomain(), values, NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), toHide));
+ getTableEditingDomain().getCommandStack().execute(cc);
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ if (isEnabled()) {
+ if (allCategoriesAreCurrentlyHidden()) {
+ setBaseEnabled(false);
+ }
+ }
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesHandler.java
index 8690edb2d9f..9d9c01c53a6 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideAllCategoriesHandler.java
@@ -1,99 +1,99 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
-
-
-/**
- *
- * The handler used to hide all categories
- *
- */
-public class TreeRowHideAllCategoriesHandler extends AbstractTreeRowHideShowCategoryHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(getTable());
- Table table = getTable();
-
- // 1. obtain the list of feature to hide
- final List<Integer> toHide = new ArrayList<Integer>();
- int start = 0;
- if (!FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), 0)) {
- start = 1;
- }
- for (int i = start; i <= maxDepth; i++) {
- toHide.add(Integer.valueOf(i));
- }
-
- IntListValueStyle values = StyleUtils.getHiddenDepthsValueStyle(table);
- Command cmd;
- if (values == null) {
- values = NattablestyleFactory.eINSTANCE.createIntListValueStyle();
- values.setName(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
- values.eSet(NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), toHide);
- cmd = AddCommand.create(getTableEditingDomain(), table, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), Collections.singleton(values));
-
- // cc.append(SetCommand.create(getTableEditingDomain(), values, NattablestylePackage.eINSTANCE.getNamedStyle_Name(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH));
- } else {
- toHide.removeAll(values.getIntListValue());
- if (toHide.isEmpty()) {
- return null;
- }
-
- // here we don't manage the order of the hidden category, because it is not important + to manage it we will receive more than 1 notification in UpdateTableContentListener AND we don't want that
- cmd = AddCommand.create(getTableEditingDomain(), values, NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), toHide);
- }
- getTableEditingDomain().getCommandStack().execute(cmd);
- return null;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- if (isEnabled()) {
- if (allCategoriesAreCurrentlyHidden()) {
- setBaseEnabled(false);
- }
- }
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
+
+
+/**
+ *
+ * The handler used to hide all categories
+ *
+ */
+public class TreeRowHideAllCategoriesHandler extends AbstractTreeRowHideShowCategoryHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ int maxDepth = FillingConfigurationUtils.getMaxDepthForTree(getTable());
+ Table table = getTable();
+
+ // 1. obtain the list of feature to hide
+ final List<Integer> toHide = new ArrayList<Integer>();
+ int start = 0;
+ if (!FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), 0)) {
+ start = 1;
+ }
+ for (int i = start; i <= maxDepth; i++) {
+ toHide.add(Integer.valueOf(i));
+ }
+
+ IntListValueStyle values = StyleUtils.getHiddenDepthsValueStyle(table);
+ Command cmd;
+ if (values == null) {
+ values = NattablestyleFactory.eINSTANCE.createIntListValueStyle();
+ values.setName(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
+ values.eSet(NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), toHide);
+ cmd = AddCommand.create(getTableEditingDomain(), table, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), Collections.singleton(values));
+
+ // cc.append(SetCommand.create(getTableEditingDomain(), values, NattablestylePackage.eINSTANCE.getNamedStyle_Name(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH));
+ } else {
+ toHide.removeAll(values.getIntListValue());
+ if (toHide.isEmpty()) {
+ return null;
+ }
+
+ // here we don't manage the order of the hidden category, because it is not important + to manage it we will receive more than 1 notification in UpdateTableContentListener AND we don't want that
+ cmd = AddCommand.create(getTableEditingDomain(), values, NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), toHide);
+ }
+ getTableEditingDomain().getCommandStack().execute(cmd);
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ if (isEnabled()) {
+ if (allCategoriesAreCurrentlyHidden()) {
+ setBaseEnabled(false);
+ }
+ }
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideShowCategoryHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideShowCategoryHandler.java
index c2a385be41a..5b3c3ce26c2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideShowCategoryHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowHideShowCategoryHandler.java
@@ -1,137 +1,137 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.RemoveCommand;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class TreeRowHideShowCategoryHandler extends AbstractTreeRowHideShowCategoryHandler {
-
- /**
- * Boolean parameter : <code>true</code> to hide and <code>false</code> to show
- */
- public static final String HIDE_CATEGORY_PARAMETER_KEY = "hideCategory"; //$NON-NLS-1$
-
- /**
- * the depth on which we are working
- */
- public static final String DEPTH_PARAMETER_KEY = "depth"; //$NON-NLS-1$
-
- /**
- * the id of the command managed by this handler
- */
- public static final String COMMAND_ID = "org.eclipse.papyrus.infra.nattable.row.show.hide.category.command"; //$NON-NLS-1$
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param arg0
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- Boolean hide = (Boolean) arg0.getParameters().get(HIDE_CATEGORY_PARAMETER_KEY);
- Integer depth = (Integer) arg0.getParameters().get(DEPTH_PARAMETER_KEY);
- if (hide) {
- hideCategory(depth);
- } else {
- showCategory(depth);
- }
- return null;
- }
-
- /**
- *
- * @param depth
- * the depth to hide
- */
- protected void hideCategory(Integer depth) {
- IntListValueStyle style = StyleUtils.getHiddenDepthsValueStyle(getTable());
- if (style != null && style.getIntListValue().contains(depth)) {
- return;
- }
- if (depth == 0 && !FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), 0)) {
- return;
- }
-
-
- if (style == null) {
- style = NattablestyleFactory.eINSTANCE.createIntListValueStyle();
- style.setName(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
- style.eSet(NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), Collections.singleton(depth));
- Command cmd = AddCommand.create(getTableEditingDomain(), getTable(), NattablestylePackage.eINSTANCE.getStyledElement_Styles(), Collections.singleton(style));
- getTableEditingDomain().getCommandStack().execute(cmd);
- return;
- }
-
- List<Integer> allValues = new ArrayList<Integer>();
- if (style != null) {
- allValues.addAll(style.getIntListValue());
- }
-
- if (allValues.contains(depth)) {
- // nothing to do
- return;
- }
- allValues.add(depth);
- Collections.sort(allValues);
- int index = allValues.indexOf(depth);
- Command cmd = AddCommand.create(getTableEditingDomain(), style, NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), depth, index);
- getTableEditingDomain().getCommandStack().execute(cmd);
-
-
- }
-
- /**
- *
- * @param depth
- * the depth to show
- */
- protected void showCategory(Integer depth) {
- IntListValueStyle style = StyleUtils.getHiddenDepthsValueStyle(getTable());
- if (style == null) {
- return;
- }
- List<Integer> newValues = new ArrayList<Integer>(new HashSet<Integer>(style.getIntListValue()));
- newValues.remove(depth);
- Command cmd;
- if (newValues.isEmpty()) {
- cmd = RemoveCommand.create(getTableEditingDomain(), getTable(), NattablestylePackage.eINSTANCE.getStyledElement_Styles(), style);
- } else {
- cmd = RemoveCommand.create(getTableEditingDomain(), style, NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), depth);
- }
- getTableEditingDomain().getCommandStack().execute(cmd);
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class TreeRowHideShowCategoryHandler extends AbstractTreeRowHideShowCategoryHandler {
+
+ /**
+ * Boolean parameter : <code>true</code> to hide and <code>false</code> to show
+ */
+ public static final String HIDE_CATEGORY_PARAMETER_KEY = "hideCategory"; //$NON-NLS-1$
+
+ /**
+ * the depth on which we are working
+ */
+ public static final String DEPTH_PARAMETER_KEY = "depth"; //$NON-NLS-1$
+
+ /**
+ * the id of the command managed by this handler
+ */
+ public static final String COMMAND_ID = "org.eclipse.papyrus.infra.nattable.row.show.hide.category.command"; //$NON-NLS-1$
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param arg0
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ Boolean hide = (Boolean) arg0.getParameters().get(HIDE_CATEGORY_PARAMETER_KEY);
+ Integer depth = (Integer) arg0.getParameters().get(DEPTH_PARAMETER_KEY);
+ if (hide) {
+ hideCategory(depth);
+ } else {
+ showCategory(depth);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param depth
+ * the depth to hide
+ */
+ protected void hideCategory(Integer depth) {
+ IntListValueStyle style = StyleUtils.getHiddenDepthsValueStyle(getTable());
+ if (style != null && style.getIntListValue().contains(depth)) {
+ return;
+ }
+ if (depth == 0 && !FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), 0)) {
+ return;
+ }
+
+
+ if (style == null) {
+ style = NattablestyleFactory.eINSTANCE.createIntListValueStyle();
+ style.setName(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
+ style.eSet(NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), Collections.singleton(depth));
+ Command cmd = AddCommand.create(getTableEditingDomain(), getTable(), NattablestylePackage.eINSTANCE.getStyledElement_Styles(), Collections.singleton(style));
+ getTableEditingDomain().getCommandStack().execute(cmd);
+ return;
+ }
+
+ List<Integer> allValues = new ArrayList<Integer>();
+ if (style != null) {
+ allValues.addAll(style.getIntListValue());
+ }
+
+ if (allValues.contains(depth)) {
+ // nothing to do
+ return;
+ }
+ allValues.add(depth);
+ Collections.sort(allValues);
+ int index = allValues.indexOf(depth);
+ Command cmd = AddCommand.create(getTableEditingDomain(), style, NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), depth, index);
+ getTableEditingDomain().getCommandStack().execute(cmd);
+
+
+ }
+
+ /**
+ *
+ * @param depth
+ * the depth to show
+ */
+ protected void showCategory(Integer depth) {
+ IntListValueStyle style = StyleUtils.getHiddenDepthsValueStyle(getTable());
+ if (style == null) {
+ return;
+ }
+ List<Integer> newValues = new ArrayList<Integer>(new HashSet<Integer>(style.getIntListValue()));
+ newValues.remove(depth);
+ Command cmd;
+ if (newValues.isEmpty()) {
+ cmd = RemoveCommand.create(getTableEditingDomain(), getTable(), NattablestylePackage.eINSTANCE.getStyledElement_Styles(), style);
+ } else {
+ cmd = RemoveCommand.create(getTableEditingDomain(), style, NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue(), depth);
+ }
+ getTableEditingDomain().getCommandStack().execute(cmd);
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowAllCategoriesHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowAllCategoriesHandler.java
index a173a73e71b..e79d391c09e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowAllCategoriesHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowAllCategoriesHandler.java
@@ -1,63 +1,63 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.edit.command.RemoveCommand;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class TreeRowShowAllCategoriesHandler extends AbstractTreeRowHideShowCategoryHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IntListValueStyle values = (IntListValueStyle) getTable().getNamedStyle(NattablestylePackage.eINSTANCE.getIntListValueStyle(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
- if (values != null) {
- Command c = RemoveCommand.create(getTableEditingDomain(), getTable(), NattablestylePackage.eINSTANCE.getStyledElement_Styles(), values);
- getTableEditingDomain().getCommandStack().execute(c);
- }
- return null;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- super.setEnabled(evaluationContext);
- if (isEnabled()) {
- if (allCategoriesAreCurrentlyVisible()) {
- setBaseEnabled(false);
- }
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class TreeRowShowAllCategoriesHandler extends AbstractTreeRowHideShowCategoryHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IntListValueStyle values = (IntListValueStyle) getTable().getNamedStyle(NattablestylePackage.eINSTANCE.getIntListValueStyle(), NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
+ if (values != null) {
+ Command c = RemoveCommand.create(getTableEditingDomain(), getTable(), NattablestylePackage.eINSTANCE.getStyledElement_Styles(), values);
+ getTableEditingDomain().getCommandStack().execute(c);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ if (isEnabled()) {
+ if (allCategoriesAreCurrentlyVisible()) {
+ setBaseEnabled(false);
+ }
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowHideCategoryCommandHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowHideCategoryCommandHandler.java
index a983004a948..78f230db8bd 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowHideCategoryCommandHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TreeRowShowHideCategoryCommandHandler.java
@@ -1,40 +1,40 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class TreeRowShowHideCategoryCommandHandler extends AbstractTreeRowHideShowCategoryHandler {
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param arg0
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
-
-
- // TODO not yet used
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class TreeRowShowHideCategoryCommandHandler extends AbstractTreeRowHideShowCategoryHandler {
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param arg0
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+
+
+ // TODO not yet used
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/DestroyTableAdviceHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/DestroyTableAdviceHelper.java
index 176dbc79002..0740a6f5635 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/DestroyTableAdviceHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/DestroyTableAdviceHelper.java
@@ -1,22 +1,22 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.helper.advice;
-
-
-public class DestroyTableAdviceHelper {
-
- public DestroyTableAdviceHelper() {
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.helper.advice;
+
+
+public class DestroyTableAdviceHelper {
+
+ public DestroyTableAdviceHelper() {
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/TableContentsAdviceHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/TableContentsAdviceHelper.java
index ab0b519a71c..352f92d1684 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/TableContentsAdviceHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/helper/advice/TableContentsAdviceHelper.java
@@ -1,116 +1,116 @@
-/*****************************************************************************
- * Copyright (c) 2012, 2017 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Thanh Liem PHAn (ALL4TEC) thanhliem.phan@all4tec.net - Bug 525245
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.helper.advice;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisPackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.ICellAxisWrapper;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.NattablecellPackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.NattablewrapperPackage;
-
-/**
- *
- * This helper allows to destroy table elements when a destroy element is referenced by a table
- *
- */
-public class TableContentsAdviceHelper extends AbstractEditHelperAdvice {
-
- /**
- *
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeDestroyDependentsCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) {
- final EObject destroyedElement = request.getElementToDestroy();
- return request.getDestroyDependentsCommand(getAssociatedElementToDestroy(destroyedElement));
- // return null;
- }
-
- @Override
- protected ICommand getAfterDestroyDependentsCommand(DestroyDependentsRequest request) {
- // final EObject destroyedElement = request.getElementToDestroy();
- // return request.getDestroyDependentsCommand(getAssociatedElementToDestroy(destroyedElement));
- return null;
- }
-
- /**
- *
- * @param eobject
- * the destroyed element
- * @return
- * the associated element to destroy in the same time than the eobject
- */
- protected List<EObject> getAssociatedElementToDestroy(final EObject eobject) {
- final CrossReferenceAdapter adapter = getCrossReferenceAdapter(eobject);
- if (adapter != null) {
- Set<EObject> elementsToDestroy = adapter.getInverseReferencers(eobject, NattableaxisPackage.eINSTANCE.getEObjectAxis_Element(), NattableaxisPackage.eINSTANCE.getEObjectAxis());
- elementsToDestroy.addAll(adapter.getInverseReferencers(eobject, NattablecellPackage.eINSTANCE.getEObjectAxisWrapper_Element(), NattablecellPackage.eINSTANCE.getEObjectAxisWrapper()));
- // Bug 525245: EObjectWrapper, which wraps destroyed element such as row source or column source, need to be also deleted
- elementsToDestroy.addAll(adapter.getInverseReferencers(eobject, NattablewrapperPackage.eINSTANCE.getEObjectWrapper_Element(), NattablewrapperPackage.eINSTANCE.getEObjectWrapper()));
-
- if (eobject instanceof ICellAxisWrapper) {
- elementsToDestroy.addAll(adapter.getInverseReferencers(eobject, NattablecellPackage.eINSTANCE.getCell_RowWrapper(), NattablecellPackage.eINSTANCE.getCell()));
- elementsToDestroy.addAll(adapter.getInverseReferencers(eobject, NattablecellPackage.eINSTANCE.getCell_ColumnWrapper(), NattablecellPackage.eINSTANCE.getCell()));
- }
- // for(final EObject current : cellWrapper) {
- // if(current instanceof ICellAxisWrapper) {
- // elementsToDestroy.add(current.eContainer());
- // }
- // }
- return new ArrayList<EObject>(elementsToDestroy);
- }
- return Collections.emptyList();
- }
-
- // Duplicated code from UML Diagram common
- /**
- * Returns the {@link CrossReferenceAdapter} corresponding to an {@link EObject}
- *
- * @param element
- * the {@link EObject} element
- * @return the {@link CrossReferenceAdapter} corresponding to element
- */
- public static CrossReferenceAdapter getCrossReferenceAdapter(final EObject element) {
- CrossReferenceAdapter crossReferenceAdapter = CrossReferenceAdapter.getExistingCrossReferenceAdapter(element);
- if (crossReferenceAdapter == null) {
-
- TransactionalEditingDomain domain = null;
- try {
- domain = ServiceUtilsForEObject.getInstance().getService(TransactionalEditingDomain.class, element);
- } catch (ServiceException e) {
- // Activator.log.error(e); //it is not an error, it is possible to not have service registry
- }
- if (domain != null) {
- crossReferenceAdapter = CrossReferenceAdapter.getCrossReferenceAdapter(domain.getResourceSet());
- }
- }
-
- return crossReferenceAdapter;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012, 2017 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAn (ALL4TEC) thanhliem.phan@all4tec.net - Bug 525245
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.helper.advice;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.ICellAxisWrapper;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.NattablecellPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.NattablewrapperPackage;
+
+/**
+ *
+ * This helper allows to destroy table elements when a destroy element is referenced by a table
+ *
+ */
+public class TableContentsAdviceHelper extends AbstractEditHelperAdvice {
+
+ /**
+ *
+ * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeDestroyDependentsCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest)
+ *
+ * @param request
+ * @return
+ */
+ @Override
+ protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) {
+ final EObject destroyedElement = request.getElementToDestroy();
+ return request.getDestroyDependentsCommand(getAssociatedElementToDestroy(destroyedElement));
+ // return null;
+ }
+
+ @Override
+ protected ICommand getAfterDestroyDependentsCommand(DestroyDependentsRequest request) {
+ // final EObject destroyedElement = request.getElementToDestroy();
+ // return request.getDestroyDependentsCommand(getAssociatedElementToDestroy(destroyedElement));
+ return null;
+ }
+
+ /**
+ *
+ * @param eobject
+ * the destroyed element
+ * @return
+ * the associated element to destroy in the same time than the eobject
+ */
+ protected List<EObject> getAssociatedElementToDestroy(final EObject eobject) {
+ final CrossReferenceAdapter adapter = getCrossReferenceAdapter(eobject);
+ if (adapter != null) {
+ Set<EObject> elementsToDestroy = adapter.getInverseReferencers(eobject, NattableaxisPackage.eINSTANCE.getEObjectAxis_Element(), NattableaxisPackage.eINSTANCE.getEObjectAxis());
+ elementsToDestroy.addAll(adapter.getInverseReferencers(eobject, NattablecellPackage.eINSTANCE.getEObjectAxisWrapper_Element(), NattablecellPackage.eINSTANCE.getEObjectAxisWrapper()));
+ // Bug 525245: EObjectWrapper, which wraps destroyed element such as row source or column source, need to be also deleted
+ elementsToDestroy.addAll(adapter.getInverseReferencers(eobject, NattablewrapperPackage.eINSTANCE.getEObjectWrapper_Element(), NattablewrapperPackage.eINSTANCE.getEObjectWrapper()));
+
+ if (eobject instanceof ICellAxisWrapper) {
+ elementsToDestroy.addAll(adapter.getInverseReferencers(eobject, NattablecellPackage.eINSTANCE.getCell_RowWrapper(), NattablecellPackage.eINSTANCE.getCell()));
+ elementsToDestroy.addAll(adapter.getInverseReferencers(eobject, NattablecellPackage.eINSTANCE.getCell_ColumnWrapper(), NattablecellPackage.eINSTANCE.getCell()));
+ }
+ // for(final EObject current : cellWrapper) {
+ // if(current instanceof ICellAxisWrapper) {
+ // elementsToDestroy.add(current.eContainer());
+ // }
+ // }
+ return new ArrayList<EObject>(elementsToDestroy);
+ }
+ return Collections.emptyList();
+ }
+
+ // Duplicated code from UML Diagram common
+ /**
+ * Returns the {@link CrossReferenceAdapter} corresponding to an {@link EObject}
+ *
+ * @param element
+ * the {@link EObject} element
+ * @return the {@link CrossReferenceAdapter} corresponding to element
+ */
+ public static CrossReferenceAdapter getCrossReferenceAdapter(final EObject element) {
+ CrossReferenceAdapter crossReferenceAdapter = CrossReferenceAdapter.getExistingCrossReferenceAdapter(element);
+ if (crossReferenceAdapter == null) {
+
+ TransactionalEditingDomain domain = null;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getService(TransactionalEditingDomain.class, element);
+ } catch (ServiceException e) {
+ // Activator.log.error(e); //it is not an error, it is possible to not have service registry
+ }
+ if (domain != null) {
+ crossReferenceAdapter = CrossReferenceAdapter.getCrossReferenceAdapter(domain.getResourceSet());
+ }
+ }
+
+ return crossReferenceAdapter;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/BodyLayerStack.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/BodyLayerStack.java
index a18dad62f8c..d4c84bc9dfc 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/BodyLayerStack.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/BodyLayerStack.java
@@ -1,150 +1,150 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.layerstack;
-
-import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.data.AutomaticSpanningDataProvider;
-import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
-import org.eclipse.nebula.widgets.nattable.edit.action.KeyEditAction;
-import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
-import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer;
-import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer;
-import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform;
-import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
-import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer;
-import org.eclipse.nebula.widgets.nattable.selection.ITraversalStrategy;
-import org.eclipse.nebula.widgets.nattable.selection.MoveCellSelectionCommandHandler;
-import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
-import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher;
-import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
-import org.eclipse.papyrus.infra.nattable.configuration.StyleConfiguration;
-import org.eclipse.papyrus.infra.nattable.layer.PapyrusSelectionLayer;
-import org.eclipse.papyrus.infra.nattable.layer.PapyrusSpanningDataLayer;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.reorder.CustomDefaultColumnReorderBindings;
-import org.eclipse.papyrus.infra.nattable.utils.DefaultSizeUtils;
-import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils;
-import org.eclipse.swt.SWT;
-
-
-/**
- * The BodyLayer stack used in Papyrus TableF
- *
- * @author Vincent Lorenzo
- *
- */
-public class BodyLayerStack extends AbstractLayerTransform {
-
- private final SelectionLayer selectionLayer;
-
- private final DataLayer bodyDataLayer;
-
- private final ViewportLayer viewportLayer;
-
- private final ColumnHideShowLayer columnHideShowLayer;
-
- private final ColumnReorderLayer columnReorderLayer;
-
- private final RowHideShowLayer rowHideShowLayer;
-
- // private final RowReorderLayer rowReoderLayer;
-
- private AutomaticSpanningDataProvider spanProvider;
-
- public BodyLayerStack(final IDataProvider dataProvider, final INattableModelManager manager) {
- // this.bodyDataLayer = new DataLayer(dataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
-
- // this method is used to merge the cells of same value inside a table
- spanProvider = new AutomaticSpanningDataProvider(dataProvider, false, false) {
-
- @Override
- protected boolean valuesNotEqual(Object value1, Object value2) {
- if (value1 == value2) { // works for both null and not
- return false;
- }
- if ((value1 == null && value2 != null) || (value1 != null && value2 == null)) {
- return true;
- }
- return !value1.equals(value2);
- }
- };
-
- this.bodyDataLayer = new PapyrusSpanningDataLayer(TableEditingDomainUtils.getTableContextEditingDomain(manager.getTable()), manager, spanProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
-
- this.bodyDataLayer.addConfiguration(new StyleConfiguration());
-
- this.columnReorderLayer = new ColumnReorderLayer(this.bodyDataLayer, false);
-
- // we register a custom configuration to manage the case where the reorder is forbidden
- this.columnReorderLayer.addConfiguration(new CustomDefaultColumnReorderBindings(manager));
-
-
- // to allow the reorder on the lines
- // this.rowReoderLayer = null;
- // this.rowReoderLayer = new RowReorderLayer(columnReorderLayer);
- // this.columnHideShowLayer = new ColumnHideShowLayer(this.rowReoderLayer);
-
- this.columnHideShowLayer = new ColumnHideShowLayer(this.columnReorderLayer);
-
- this.rowHideShowLayer = new RowHideShowLayer(columnHideShowLayer);
- this.selectionLayer = new PapyrusSelectionLayer(rowHideShowLayer);
- this.viewportLayer = new ViewportLayer(this.selectionLayer);
- setUnderlyingLayer(this.viewportLayer);
- setRegionName(GridRegion.BODY);
-
- //bug 476658
- viewportLayer.registerCommandHandler( new MoveCellSelectionCommandHandler( selectionLayer, ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY));
- }
-
- public SelectionLayer getSelectionLayer() {
- return this.selectionLayer;
- }
-
- public DataLayer getBodyDataLayer() {
- return this.bodyDataLayer;
- }
-
- public ViewportLayer getViewportLayer() {
- return this.viewportLayer;
- }
-
- public ColumnHideShowLayer getColumnHideShowLayer() {
- return this.columnHideShowLayer;
- }
-
- public ColumnReorderLayer getColumnReorderLayer() {
- return this.columnReorderLayer;
- }
-
- public RowHideShowLayer getRowHideShowLayer() {
- return this.rowHideShowLayer;
- }
-
- @Override
- public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) {
- super.configure(configRegistry, uiBindingRegistry);
- uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.F2), new KeyEditAction());
- // configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE);
- // uiBindingRegistry.registerKeyBinding(new Mouse, new KeyEditAction());
- // uiBindingRegistry.
- // configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CustomizedCellPainter(), DisplayMode.NORMAL, GridRegion.BODY);
- }
-
-
- public AutomaticSpanningDataProvider getBodyLayerSpanProvider() {
- return this.spanProvider;
-
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.layerstack;
+
+import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.data.AutomaticSpanningDataProvider;
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.edit.action.KeyEditAction;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer;
+import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer;
+import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform;
+import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
+import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer;
+import org.eclipse.nebula.widgets.nattable.selection.ITraversalStrategy;
+import org.eclipse.nebula.widgets.nattable.selection.MoveCellSelectionCommandHandler;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher;
+import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
+import org.eclipse.papyrus.infra.nattable.configuration.StyleConfiguration;
+import org.eclipse.papyrus.infra.nattable.layer.PapyrusSelectionLayer;
+import org.eclipse.papyrus.infra.nattable.layer.PapyrusSpanningDataLayer;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.reorder.CustomDefaultColumnReorderBindings;
+import org.eclipse.papyrus.infra.nattable.utils.DefaultSizeUtils;
+import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils;
+import org.eclipse.swt.SWT;
+
+
+/**
+ * The BodyLayer stack used in Papyrus TableF
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class BodyLayerStack extends AbstractLayerTransform {
+
+ private final SelectionLayer selectionLayer;
+
+ private final DataLayer bodyDataLayer;
+
+ private final ViewportLayer viewportLayer;
+
+ private final ColumnHideShowLayer columnHideShowLayer;
+
+ private final ColumnReorderLayer columnReorderLayer;
+
+ private final RowHideShowLayer rowHideShowLayer;
+
+ // private final RowReorderLayer rowReoderLayer;
+
+ private AutomaticSpanningDataProvider spanProvider;
+
+ public BodyLayerStack(final IDataProvider dataProvider, final INattableModelManager manager) {
+ // this.bodyDataLayer = new DataLayer(dataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
+
+ // this method is used to merge the cells of same value inside a table
+ spanProvider = new AutomaticSpanningDataProvider(dataProvider, false, false) {
+
+ @Override
+ protected boolean valuesNotEqual(Object value1, Object value2) {
+ if (value1 == value2) { // works for both null and not
+ return false;
+ }
+ if ((value1 == null && value2 != null) || (value1 != null && value2 == null)) {
+ return true;
+ }
+ return !value1.equals(value2);
+ }
+ };
+
+ this.bodyDataLayer = new PapyrusSpanningDataLayer(TableEditingDomainUtils.getTableContextEditingDomain(manager.getTable()), manager, spanProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
+
+ this.bodyDataLayer.addConfiguration(new StyleConfiguration());
+
+ this.columnReorderLayer = new ColumnReorderLayer(this.bodyDataLayer, false);
+
+ // we register a custom configuration to manage the case where the reorder is forbidden
+ this.columnReorderLayer.addConfiguration(new CustomDefaultColumnReorderBindings(manager));
+
+
+ // to allow the reorder on the lines
+ // this.rowReoderLayer = null;
+ // this.rowReoderLayer = new RowReorderLayer(columnReorderLayer);
+ // this.columnHideShowLayer = new ColumnHideShowLayer(this.rowReoderLayer);
+
+ this.columnHideShowLayer = new ColumnHideShowLayer(this.columnReorderLayer);
+
+ this.rowHideShowLayer = new RowHideShowLayer(columnHideShowLayer);
+ this.selectionLayer = new PapyrusSelectionLayer(rowHideShowLayer);
+ this.viewportLayer = new ViewportLayer(this.selectionLayer);
+ setUnderlyingLayer(this.viewportLayer);
+ setRegionName(GridRegion.BODY);
+
+ //bug 476658
+ viewportLayer.registerCommandHandler( new MoveCellSelectionCommandHandler( selectionLayer, ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY));
+ }
+
+ public SelectionLayer getSelectionLayer() {
+ return this.selectionLayer;
+ }
+
+ public DataLayer getBodyDataLayer() {
+ return this.bodyDataLayer;
+ }
+
+ public ViewportLayer getViewportLayer() {
+ return this.viewportLayer;
+ }
+
+ public ColumnHideShowLayer getColumnHideShowLayer() {
+ return this.columnHideShowLayer;
+ }
+
+ public ColumnReorderLayer getColumnReorderLayer() {
+ return this.columnReorderLayer;
+ }
+
+ public RowHideShowLayer getRowHideShowLayer() {
+ return this.rowHideShowLayer;
+ }
+
+ @Override
+ public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) {
+ super.configure(configRegistry, uiBindingRegistry);
+ uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.F2), new KeyEditAction());
+ // configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE);
+ // uiBindingRegistry.registerKeyBinding(new Mouse, new KeyEditAction());
+ // uiBindingRegistry.
+ // configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CustomizedCellPainter(), DisplayMode.NORMAL, GridRegion.BODY);
+ }
+
+
+ public AutomaticSpanningDataProvider getBodyLayerSpanProvider() {
+ return this.spanProvider;
+
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
index aae076b6701..bad9cf6f574 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
@@ -1,346 +1,346 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.layerstack;
-
-import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
-import org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction;
-import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
-import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer;
-import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer;
-import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform;
-import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer;
-import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
-import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
-import org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionBindings;
-import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
-import org.eclipse.papyrus.infra.nattable.configuration.PapyrusRowHeaderStyleConfiguration;
-import org.eclipse.papyrus.infra.nattable.configuration.PapyrusRowResizeBindingsConfiguration;
-import org.eclipse.papyrus.infra.nattable.dataprovider.RowIndexHeaderDataProvider;
-import org.eclipse.papyrus.infra.nattable.dataprovider.RowLabelHeaderDataProvider;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.utils.DefaultSizeUtils;
-import org.eclipse.swt.SWT;
-
-/**
- *
- * @author Vincent Lorenzo
- * Layer stack used for row header
- */
-public class RowHeaderLayerStack extends AbstractLayerTransform {
-
- /**
- * Default columns width
- */
- public static final int DEFAULT_COLUMN_WIDTH = 150;
-
- /**
- * default rows height
- */
- public static final int DEFAULT_ROW_HEIGHT = DefaultSizeUtils.getDefaultCellWidth();
-
- /**
- * the table manager
- */
- protected final INattableModelManager tableManager;
- /**
- * the composite layer
- */
- protected final CompositeLayer compositeLayer;
-
- /**
- * the index data layer
- */
- protected final DataLayer indexDataLayer;
-
- /**
- * the label data layer
- */
- protected final DataLayer labelDataLayer;
-
- /**
- * the row header layer index
- */
- private final AbstractLayer indexRowHeaderLayer;
-
- /**
- * the row header layer label
- */
- protected final AbstractLayer labelRowHeaderLayer;
- /**
- * the label data provider
- */
- protected final IDataProvider indexDataProvider;
-
- /**
- * the index data provider
- */
- protected final IDataProvider labelDataProvider;
-
-
- /**
- *
- * Constructor.
- *
- * @param dataProvider
- * @param bodyLayer
- * @deprecated use the other constructor
- */
- @Deprecated
- public RowHeaderLayerStack(final IDataProvider dataProvider, final BodyLayerStack bodyLayer) {
- final DataLayer dataLayer = new DataLayer(dataProvider, RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
- // I know that selection layer is probably false
- final RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(dataLayer, bodyLayer, /* bodyLayer.getSelectionLayer() */new SelectionLayer(dataLayer), false);
- rowHeaderLayer.addConfiguration(new PapyrusRowResizeBindingsConfiguration());
- // Did not work ! Needed : Have the same type of cell in row and column headers
- rowHeaderLayer.addConfiguration(new PapyrusRowHeaderStyleConfiguration());
- // final IConfiguration configuration = new CustomConfig();
- // setUnderlyingLayer(sortHeaderLayer);
- // rowHeaderLayer.addConfiguration(configuration);
- // rowHeaderLayer.addConfiguration(new RowOnlySelectionBindings());
- setUnderlyingLayer(rowHeaderLayer);
- setRegionName(GridRegion.ROW_HEADER);
- this.labelRowHeaderLayer = null;
- this.indexRowHeaderLayer = null;
- this.tableManager = null;
- this.labelDataProvider = null;
- this.indexDataProvider = null;
- this.indexDataLayer = null;
- this.labelDataLayer = null;
- this.compositeLayer = null;
- }
-
-
- /**
- *
- * Constructor.
- *
- * @param bodyLayerStack
- * the body layer
- */
- public RowHeaderLayerStack(final BodyLayerStack bodyLayerStack, final INattableModelManager tableManager) {
- this.tableManager = tableManager;
- // 1. create the data provider
- this.indexDataProvider = createIndexDataProvider();
- this.labelDataProvider = createLabelDataProvider();
-
- // 2. create the data layer
- this.indexDataLayer = createIndexDataLayer();
- this.labelDataLayer = createLabelDataLayer();
-
- // 3. create the row header layer
- this.indexRowHeaderLayer = createIndexRowHeaderLayer(bodyLayerStack, tableManager);
- this.labelRowHeaderLayer = createLabelRowHeaderLayer(bodyLayerStack, tableManager);
-
- // 3.1 configure layer
- this.indexRowHeaderLayer.addConfiguration(new PapyrusRowHeaderStyleConfiguration());
- this.indexRowHeaderLayer.setRegionName(GridRegion.ROW_HEADER);
- this.labelRowHeaderLayer.setRegionName(GridRegion.ROW_HEADER);
-
- // 4. create the composite layer
- this.compositeLayer = new CompositeLayer(2, 1);
- this.compositeLayer.setChildLayer(GridRegion.ROW_HEADER, indexRowHeaderLayer, 0, 0);
- this.compositeLayer.setChildLayer(GridRegion.ROW_HEADER, labelRowHeaderLayer, 1, 0);
-
- // 3. configure the layer
- this.indexRowHeaderLayer.addConfiguration(new PapyrusRowResizeBindingsConfiguration());
- this.compositeLayer.addConfiguration(new PapyrusRowResizeBindingsConfiguration());
- this.compositeLayer.setRegionName(GridRegion.ROW_HEADER);
- setUnderlyingLayer(compositeLayer);
- setRegionName(GridRegion.ROW_HEADER);
- }
-
- /**
- *
- * @return
- * the label data provider to use
- */
- protected IDataProvider createLabelDataProvider() {
- return new RowLabelHeaderDataProvider(this.tableManager);
- }
-
- /**
- *
- * @return
- * the index data provider to use
- */
- protected IDataProvider createIndexDataProvider() {
- return new RowIndexHeaderDataProvider(this.tableManager);
- }
-
- /**
- *
- * @return
- * the label data provider to use
- */
- public IDataProvider getLabelDataProvider() {
- return this.labelDataProvider;
- }
-
- /**
- *
- * @return
- * the index data provider to use
- */
- public IDataProvider getIndexDataProvider() {
- return this.indexDataProvider;
- }
-
- /**
- *
- * @param bodyLayerStack
- * @param tableManager
- * @return
- */
- protected AbstractLayer createIndexRowHeaderLayer(final BodyLayerStack bodyLayerStack, final INattableModelManager tableManager) {
- RowHeaderLayer layer = new RowHeaderLayer(getIndexDataLayer(), bodyLayerStack, bodyLayerStack.getSelectionLayer(), false);
- return layer;
- }
-
- /**
- *
- * @param bodyLayerStack
- * @param tableManager
- * @return
- */
- protected AbstractLayer createLabelRowHeaderLayer(final BodyLayerStack bodyLayerStack, final INattableModelManager tableManager) {
- return new RowHeaderLayer(getLabelDataLayer(), bodyLayerStack.getViewportLayer(), bodyLayerStack.getSelectionLayer(), false);
- }
-
- /**
- *
- * @return
- * the index row layer to use
- */
- public final AbstractLayer getIndexRowHeaderLayer() {
- return this.indexRowHeaderLayer;
- }
-
- /**
- *
- * @return
- * the label row layer to use
- */
- public final AbstractLayer getLabelRowHeaderLayer() {
- return this.labelRowHeaderLayer;
- }
-
- /**
- * @param createLabelDataProvider
- * @return
- */
- protected DataLayer createLabelDataLayer() {
- return new DataLayer(getLabelDataProvider(), RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
- }
-
- /**
- * @param createLabelDataProvider
- * @return
- */
- public final DataLayer getLabelDataLayer() {
- return this.labelDataLayer;
- }
-
-
- /**
- * @param createIndexDataProvider
- * @return
- */
- protected DataLayer createIndexDataLayer() {
- return new DataLayer(getIndexDataProvider(), RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
- }
-
- /**
- * @param createIndexDataProvider
- * @return
- */
- public final DataLayer getIndexDataLayer() {
- return this.indexDataLayer;
- }
-
-
- /**
- *
- * @author Vincent Lorenzo
- * Configuration providing the selection binding
- */
- public static class CustomConfig extends DefaultSelectionBindings {
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionBindings#configureRowHeaderMouseClickBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
- *
- * @param uiBindingRegistry
- */
- @Override
- protected void configureRowHeaderMouseClickBindings(final UiBindingRegistry uiBindingRegistry) {
- uiBindingRegistry.registerDoubleClickBinding(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new MouseEditAction());
- }
- }
-
-
- // public static class ReoderRowConfid extends AbstractUiBindingConfiguration {// This configuration should be added by the same kind of layer that DefaultColumnReorderLayerConfiguration but for row!
- //
- // @Override
- // public void configureUiBindings(final UiBindingRegistry uiBindingRegistry) {
- // uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.rowHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new RowReorderDragMode()));
- // }
- // }
-
- /**
- *
- * @return
- * the index data layer
- */
- public DataLayer getRowIndexDataLayer() {
- return indexDataLayer;
- }
-
- /**
- *
- * @return
- * the label data layer
- */
- public DataLayer getRowLabelDataLayer() {
- return labelDataLayer;
- }
-
- /**
- *
- * @return
- * the row header layer index
- */
- public AbstractLayer getRowHeaderLayerIndex() {
- return this.indexRowHeaderLayer;
- }
-
- /**
- *
- * @return
- * the row header layer label
- */
- public AbstractLayer getRowHeaderLayerLabel() {
- return this.labelRowHeaderLayer;
- }
-
- /**
- *
- * @return
- * the composite layer
- */
- public CompositeLayer getCompositeLayer() {
- return this.compositeLayer;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.layerstack;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer;
+import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer;
+import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform;
+import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer;
+import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
+import org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionBindings;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.papyrus.infra.nattable.configuration.PapyrusRowHeaderStyleConfiguration;
+import org.eclipse.papyrus.infra.nattable.configuration.PapyrusRowResizeBindingsConfiguration;
+import org.eclipse.papyrus.infra.nattable.dataprovider.RowIndexHeaderDataProvider;
+import org.eclipse.papyrus.infra.nattable.dataprovider.RowLabelHeaderDataProvider;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.DefaultSizeUtils;
+import org.eclipse.swt.SWT;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ * Layer stack used for row header
+ */
+public class RowHeaderLayerStack extends AbstractLayerTransform {
+
+ /**
+ * Default columns width
+ */
+ public static final int DEFAULT_COLUMN_WIDTH = 150;
+
+ /**
+ * default rows height
+ */
+ public static final int DEFAULT_ROW_HEIGHT = DefaultSizeUtils.getDefaultCellWidth();
+
+ /**
+ * the table manager
+ */
+ protected final INattableModelManager tableManager;
+ /**
+ * the composite layer
+ */
+ protected final CompositeLayer compositeLayer;
+
+ /**
+ * the index data layer
+ */
+ protected final DataLayer indexDataLayer;
+
+ /**
+ * the label data layer
+ */
+ protected final DataLayer labelDataLayer;
+
+ /**
+ * the row header layer index
+ */
+ private final AbstractLayer indexRowHeaderLayer;
+
+ /**
+ * the row header layer label
+ */
+ protected final AbstractLayer labelRowHeaderLayer;
+ /**
+ * the label data provider
+ */
+ protected final IDataProvider indexDataProvider;
+
+ /**
+ * the index data provider
+ */
+ protected final IDataProvider labelDataProvider;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param dataProvider
+ * @param bodyLayer
+ * @deprecated use the other constructor
+ */
+ @Deprecated
+ public RowHeaderLayerStack(final IDataProvider dataProvider, final BodyLayerStack bodyLayer) {
+ final DataLayer dataLayer = new DataLayer(dataProvider, RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
+ // I know that selection layer is probably false
+ final RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(dataLayer, bodyLayer, /* bodyLayer.getSelectionLayer() */new SelectionLayer(dataLayer), false);
+ rowHeaderLayer.addConfiguration(new PapyrusRowResizeBindingsConfiguration());
+ // Did not work ! Needed : Have the same type of cell in row and column headers
+ rowHeaderLayer.addConfiguration(new PapyrusRowHeaderStyleConfiguration());
+ // final IConfiguration configuration = new CustomConfig();
+ // setUnderlyingLayer(sortHeaderLayer);
+ // rowHeaderLayer.addConfiguration(configuration);
+ // rowHeaderLayer.addConfiguration(new RowOnlySelectionBindings());
+ setUnderlyingLayer(rowHeaderLayer);
+ setRegionName(GridRegion.ROW_HEADER);
+ this.labelRowHeaderLayer = null;
+ this.indexRowHeaderLayer = null;
+ this.tableManager = null;
+ this.labelDataProvider = null;
+ this.indexDataProvider = null;
+ this.indexDataLayer = null;
+ this.labelDataLayer = null;
+ this.compositeLayer = null;
+ }
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param bodyLayerStack
+ * the body layer
+ */
+ public RowHeaderLayerStack(final BodyLayerStack bodyLayerStack, final INattableModelManager tableManager) {
+ this.tableManager = tableManager;
+ // 1. create the data provider
+ this.indexDataProvider = createIndexDataProvider();
+ this.labelDataProvider = createLabelDataProvider();
+
+ // 2. create the data layer
+ this.indexDataLayer = createIndexDataLayer();
+ this.labelDataLayer = createLabelDataLayer();
+
+ // 3. create the row header layer
+ this.indexRowHeaderLayer = createIndexRowHeaderLayer(bodyLayerStack, tableManager);
+ this.labelRowHeaderLayer = createLabelRowHeaderLayer(bodyLayerStack, tableManager);
+
+ // 3.1 configure layer
+ this.indexRowHeaderLayer.addConfiguration(new PapyrusRowHeaderStyleConfiguration());
+ this.indexRowHeaderLayer.setRegionName(GridRegion.ROW_HEADER);
+ this.labelRowHeaderLayer.setRegionName(GridRegion.ROW_HEADER);
+
+ // 4. create the composite layer
+ this.compositeLayer = new CompositeLayer(2, 1);
+ this.compositeLayer.setChildLayer(GridRegion.ROW_HEADER, indexRowHeaderLayer, 0, 0);
+ this.compositeLayer.setChildLayer(GridRegion.ROW_HEADER, labelRowHeaderLayer, 1, 0);
+
+ // 3. configure the layer
+ this.indexRowHeaderLayer.addConfiguration(new PapyrusRowResizeBindingsConfiguration());
+ this.compositeLayer.addConfiguration(new PapyrusRowResizeBindingsConfiguration());
+ this.compositeLayer.setRegionName(GridRegion.ROW_HEADER);
+ setUnderlyingLayer(compositeLayer);
+ setRegionName(GridRegion.ROW_HEADER);
+ }
+
+ /**
+ *
+ * @return
+ * the label data provider to use
+ */
+ protected IDataProvider createLabelDataProvider() {
+ return new RowLabelHeaderDataProvider(this.tableManager);
+ }
+
+ /**
+ *
+ * @return
+ * the index data provider to use
+ */
+ protected IDataProvider createIndexDataProvider() {
+ return new RowIndexHeaderDataProvider(this.tableManager);
+ }
+
+ /**
+ *
+ * @return
+ * the label data provider to use
+ */
+ public IDataProvider getLabelDataProvider() {
+ return this.labelDataProvider;
+ }
+
+ /**
+ *
+ * @return
+ * the index data provider to use
+ */
+ public IDataProvider getIndexDataProvider() {
+ return this.indexDataProvider;
+ }
+
+ /**
+ *
+ * @param bodyLayerStack
+ * @param tableManager
+ * @return
+ */
+ protected AbstractLayer createIndexRowHeaderLayer(final BodyLayerStack bodyLayerStack, final INattableModelManager tableManager) {
+ RowHeaderLayer layer = new RowHeaderLayer(getIndexDataLayer(), bodyLayerStack, bodyLayerStack.getSelectionLayer(), false);
+ return layer;
+ }
+
+ /**
+ *
+ * @param bodyLayerStack
+ * @param tableManager
+ * @return
+ */
+ protected AbstractLayer createLabelRowHeaderLayer(final BodyLayerStack bodyLayerStack, final INattableModelManager tableManager) {
+ return new RowHeaderLayer(getLabelDataLayer(), bodyLayerStack.getViewportLayer(), bodyLayerStack.getSelectionLayer(), false);
+ }
+
+ /**
+ *
+ * @return
+ * the index row layer to use
+ */
+ public final AbstractLayer getIndexRowHeaderLayer() {
+ return this.indexRowHeaderLayer;
+ }
+
+ /**
+ *
+ * @return
+ * the label row layer to use
+ */
+ public final AbstractLayer getLabelRowHeaderLayer() {
+ return this.labelRowHeaderLayer;
+ }
+
+ /**
+ * @param createLabelDataProvider
+ * @return
+ */
+ protected DataLayer createLabelDataLayer() {
+ return new DataLayer(getLabelDataProvider(), RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
+ }
+
+ /**
+ * @param createLabelDataProvider
+ * @return
+ */
+ public final DataLayer getLabelDataLayer() {
+ return this.labelDataLayer;
+ }
+
+
+ /**
+ * @param createIndexDataProvider
+ * @return
+ */
+ protected DataLayer createIndexDataLayer() {
+ return new DataLayer(getIndexDataProvider(), RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
+ }
+
+ /**
+ * @param createIndexDataProvider
+ * @return
+ */
+ public final DataLayer getIndexDataLayer() {
+ return this.indexDataLayer;
+ }
+
+
+ /**
+ *
+ * @author Vincent Lorenzo
+ * Configuration providing the selection binding
+ */
+ public static class CustomConfig extends DefaultSelectionBindings {
+
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionBindings#configureRowHeaderMouseClickBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ protected void configureRowHeaderMouseClickBindings(final UiBindingRegistry uiBindingRegistry) {
+ uiBindingRegistry.registerDoubleClickBinding(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new MouseEditAction());
+ }
+ }
+
+
+ // public static class ReoderRowConfid extends AbstractUiBindingConfiguration {// This configuration should be added by the same kind of layer that DefaultColumnReorderLayerConfiguration but for row!
+ //
+ // @Override
+ // public void configureUiBindings(final UiBindingRegistry uiBindingRegistry) {
+ // uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.rowHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new RowReorderDragMode()));
+ // }
+ // }
+
+ /**
+ *
+ * @return
+ * the index data layer
+ */
+ public DataLayer getRowIndexDataLayer() {
+ return indexDataLayer;
+ }
+
+ /**
+ *
+ * @return
+ * the label data layer
+ */
+ public DataLayer getRowLabelDataLayer() {
+ return labelDataLayer;
+ }
+
+ /**
+ *
+ * @return
+ * the row header layer index
+ */
+ public AbstractLayer getRowHeaderLayerIndex() {
+ return this.indexRowHeaderLayer;
+ }
+
+ /**
+ *
+ * @return
+ * the row header layer label
+ */
+ public AbstractLayer getRowHeaderLayerLabel() {
+ return this.labelRowHeaderLayer;
+ }
+
+ /**
+ *
+ * @return
+ * the composite layer
+ */
+ public CompositeLayer getCompositeLayer() {
+ return this.compositeLayer;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/HideShowCategoriesTableListener.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/HideShowCategoriesTableListener.java
index 306153f1576..37c59f77d0e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/HideShowCategoriesTableListener.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/HideShowCategoriesTableListener.java
@@ -1,318 +1,318 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.listener;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.NotificationFilter;
-import org.eclipse.emf.transaction.ResourceSetChangeEvent;
-import org.eclipse.emf.transaction.ResourceSetListener;
-import org.eclipse.emf.transaction.RollbackException;
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.TableDisplayStyle;
-import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
-import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
-import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
-
-/**
- * This class listen the changes in the table model which require nattable update
- *
- * @author Vincent Lorenzo
- *
- */
-public class HideShowCategoriesTableListener implements ResourceSetListener {
-
- private INattableModelManager tableManager;
-
- /**
- * Constructor.
- *
- */
- public HideShowCategoriesTableListener(INattableModelManager tableManager) {
- this.tableManager = tableManager;
- }
-
- /**
- *
- * @param notification
- * a notification
- */
- protected void manageHideShowCategories(Notification notification) {
- int eventType = notification.getEventType();
- Object notifier = notification.getNotifier();
- List<Integer> toShow = null;
- List<Integer> toHide = null;
- if (notifier instanceof Table) {
- if (eventType == Notification.REMOVE) {
- Object oldValue = notification.getOldValue();
- // we are showing categories
- Assert.isTrue(notification.getNewValue() == null);
- toShow = ((IntListValueStyle) oldValue).getIntListValue();
- } else if (eventType == Notification.ADD) {
- Object newValue = notification.getNewValue();
- // we are hiding all categories
- Assert.isTrue(notification.getOldValue() == null);
- toHide = ((IntListValueStyle) newValue).getIntListValue();
- }
- }
- if (notifier instanceof IntListValueStyle) {// && ((IntListValueStyle) notifier).getName().equals(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH) && feature == NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue()) {
- if (Notification.REMOVE == eventType) {
- Object oldValue = notification.getOldValue();
- Assert.isTrue(oldValue instanceof Integer);
- toShow = Collections.singletonList((Integer) oldValue);
- }
- if (Notification.ADD == eventType) {
- Object newValue = notification.getNewValue();
- Assert.isTrue(newValue instanceof Integer);
- toHide = Collections.singletonList((Integer) newValue);
- }
- if (Notification.ADD_MANY == eventType) {
- Object newValue = notification.getNewValue();
- Assert.isTrue(newValue instanceof Collection<?>);
- toHide = new ArrayList<Integer>();
- for (Object tmp : (Collection<?>) newValue) {
- Assert.isTrue(tmp instanceof Integer);
- toHide.add((Integer) tmp);
- }
- }
- if (Notification.REMOVE_MANY == eventType) {
- Object oldValue = notification.getOldValue();
- Assert.isTrue(oldValue instanceof Collection<?>);
- toShow = new ArrayList<Integer>();
- for (Object tmp : (Collection<?>) oldValue) {
- Assert.isTrue(tmp instanceof Integer);
- toShow.add((Integer) tmp);
- }
- }
- }
-
- if (toShow != null || toHide != null) {
- ((ITreeNattableModelManager) this.tableManager).hideShowCategories(toHide, toShow);
- }
- }
-
- /**
- *
- * @param notification
- * a notification about changing the appearance of the tree in the table (single to multi/multi to single column in row header)
- */
- protected void manageChangeOnDisplayStyle(Notification notification) {
- boolean multiToSingle = false;
- Object notifier = notification.getNotifier();
- Object feature = notification.getFeature();
- if (notifier instanceof TableDisplayStyle && feature == NattablestylePackage.eINSTANCE.getTableDisplayStyle_DisplayStyle()) {
- Object newValue = notification.getNewValue();
- if (newValue == DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN) {
- multiToSingle = false;
- } else if (newValue == DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN) {
- multiToSingle = true;
- } else {
- return;
- }
- }
- if (notifier instanceof Table && feature == NattablestylePackage.eINSTANCE.getStyledElement_Styles()) {
- Object tmp = notification.getNewValue();
- if (!(tmp instanceof TableDisplayStyle)) {
- return;
- }
- TableDisplayStyle newValue = (TableDisplayStyle) tmp;
- if (newValue.getDisplayStyle() == DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN) {
- multiToSingle = false;
- } else if (newValue.getDisplayStyle() == DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN) {
- multiToSingle = true;
- } else {
- return;
- }
-
- }
-
- if (multiToSingle) {
- NatTable natTable = (NatTable) ((IAdaptable) this.tableManager).getAdapter(NatTable.class);
- natTable.refresh();
- ((ITreeNattableModelManager) this.tableManager).hideShowColumnCategoriesInRowHeader(null, null);
- } else {
- NatTable natTable = (NatTable) ((IAdaptable) this.tableManager).getAdapter(NatTable.class);
- natTable.refresh();
- ((ITreeNattableModelManager) this.tableManager).hideShowColumnCategoriesInRowHeader(StyleUtils.getHiddenDepths(tableManager), null);
- }
-
- }
-
-
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)
- *
- * @param arg0
- */
- @Override
- public void resourceSetChanged(ResourceSetChangeEvent arg0) {
- if (null == this.tableManager || null == this.tableManager.getTable() || null == this.tableManager.getTable().getTableConfiguration()) {
- // we are deleting the table
- return;
- }
- for (Notification current : arg0.getNotifications()) {
- if (isNotificationOnHideShowCategories(current)) {
- manageHideShowCategories(current);
- }
- if (isNotificationOnSingleOrMultiColumnInRowHeader(current)) {
- manageChangeOnDisplayStyle(current);
- }
- }
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent)
- *
- * @param arg0
- * @return
- * @throws RollbackException
- */
- @Override
- public Command transactionAboutToCommit(ResourceSetChangeEvent arg0) throws RollbackException {
- // nothing to do
- return null;
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#getFilter()
- *
- * @return
- */
- @Override
- public NotificationFilter getFilter() {
- return new NotificationFilter.Custom() {
-
- @Override
- public boolean matches(Notification notification) {
- if (notification.isTouch() || notification.getNotifier() == null || notification.getFeature() == null) {
- return false;
- }
- Object notifier = notification.getNotifier();
- if (notifier instanceof EObject) {
- if (EcoreUtil.getRootContainer(((EObject) notifier).eClass()) == NattablePackage.eINSTANCE) {
- // we must verify than the notification concern the current managed table
- try {
- if (TableHelper.findTable((EObject) notifier) != tableManager.getTable()) {
- return false;
- }
- } catch (Exception e) {
- Activator.log.error(e);
- }
-
- return isNotificationOnHideShowCategories(notification) || isNotificationOnSingleOrMultiColumnInRowHeader(notification);
- }
- }
-
- return false;
- }
- };
- }
-
- /**
- *
- * @param notification
- * a notification
- * @return
- * <code>true</code> if the notification concerns the display style of the table
- */
- private static final boolean isNotificationOnSingleOrMultiColumnInRowHeader(Notification notification) {
- Object feature = notification.getFeature();
- Object notifier = notification.getNotifier();
- if (notifier instanceof TableDisplayStyle && feature == NattablestylePackage.eINSTANCE.getTableDisplayStyle_DisplayStyle()) {
- return true;
- }
- if (notifier instanceof Table && feature == NattablestylePackage.eINSTANCE.getStyledElement_Styles()) {
- Object value = null;
- if (Notification.ADD == notification.getEventType()) {
- value = notification.getNewValue();
- }
- if (value instanceof TableDisplayStyle) {
- return true;
- }
- }
- return false;
- }
-
- /**
- *
- * @param notification
- * a notification
- * @return
- * <code>true</code> if the notification concerns the hide/show of the categoriesF
- */
- private static final boolean isNotificationOnHideShowCategories(Notification notification) {
- Object notifier = notification.getNotifier();
- Object feature = notification.getFeature();
- if (notifier instanceof Table && feature == NattablestylePackage.eINSTANCE.getStyledElement_Styles()) {
- Object style = notification.getOldValue();
- if (style == null) {
- style = notification.getNewValue();
- }
- return style instanceof IntListValueStyle && ((IntListValueStyle) style).getName().equals(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
- }
- return notifier instanceof IntListValueStyle && ((IntListValueStyle) notifier).getName().equals(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH) && feature == NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue();
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#isAggregatePrecommitListener()
- *
- * @return
- */
- @Override
- public boolean isAggregatePrecommitListener() {
- // nothing to do
- return false;
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#isPostcommitOnly()
- *
- * @return
- */
- @Override
- public boolean isPostcommitOnly() {
- // nothing to do
- return false;
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#isPrecommitOnly()
- *
- * @return
- */
- @Override
- public boolean isPrecommitOnly() {
- // nothing to do
- return false;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.listener;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.ResourceSetChangeEvent;
+import org.eclipse.emf.transaction.ResourceSetListener;
+import org.eclipse.emf.transaction.RollbackException;
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.TableDisplayStyle;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
+import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
+
+/**
+ * This class listen the changes in the table model which require nattable update
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class HideShowCategoriesTableListener implements ResourceSetListener {
+
+ private INattableModelManager tableManager;
+
+ /**
+ * Constructor.
+ *
+ */
+ public HideShowCategoriesTableListener(INattableModelManager tableManager) {
+ this.tableManager = tableManager;
+ }
+
+ /**
+ *
+ * @param notification
+ * a notification
+ */
+ protected void manageHideShowCategories(Notification notification) {
+ int eventType = notification.getEventType();
+ Object notifier = notification.getNotifier();
+ List<Integer> toShow = null;
+ List<Integer> toHide = null;
+ if (notifier instanceof Table) {
+ if (eventType == Notification.REMOVE) {
+ Object oldValue = notification.getOldValue();
+ // we are showing categories
+ Assert.isTrue(notification.getNewValue() == null);
+ toShow = ((IntListValueStyle) oldValue).getIntListValue();
+ } else if (eventType == Notification.ADD) {
+ Object newValue = notification.getNewValue();
+ // we are hiding all categories
+ Assert.isTrue(notification.getOldValue() == null);
+ toHide = ((IntListValueStyle) newValue).getIntListValue();
+ }
+ }
+ if (notifier instanceof IntListValueStyle) {// && ((IntListValueStyle) notifier).getName().equals(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH) && feature == NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue()) {
+ if (Notification.REMOVE == eventType) {
+ Object oldValue = notification.getOldValue();
+ Assert.isTrue(oldValue instanceof Integer);
+ toShow = Collections.singletonList((Integer) oldValue);
+ }
+ if (Notification.ADD == eventType) {
+ Object newValue = notification.getNewValue();
+ Assert.isTrue(newValue instanceof Integer);
+ toHide = Collections.singletonList((Integer) newValue);
+ }
+ if (Notification.ADD_MANY == eventType) {
+ Object newValue = notification.getNewValue();
+ Assert.isTrue(newValue instanceof Collection<?>);
+ toHide = new ArrayList<Integer>();
+ for (Object tmp : (Collection<?>) newValue) {
+ Assert.isTrue(tmp instanceof Integer);
+ toHide.add((Integer) tmp);
+ }
+ }
+ if (Notification.REMOVE_MANY == eventType) {
+ Object oldValue = notification.getOldValue();
+ Assert.isTrue(oldValue instanceof Collection<?>);
+ toShow = new ArrayList<Integer>();
+ for (Object tmp : (Collection<?>) oldValue) {
+ Assert.isTrue(tmp instanceof Integer);
+ toShow.add((Integer) tmp);
+ }
+ }
+ }
+
+ if (toShow != null || toHide != null) {
+ ((ITreeNattableModelManager) this.tableManager).hideShowCategories(toHide, toShow);
+ }
+ }
+
+ /**
+ *
+ * @param notification
+ * a notification about changing the appearance of the tree in the table (single to multi/multi to single column in row header)
+ */
+ protected void manageChangeOnDisplayStyle(Notification notification) {
+ boolean multiToSingle = false;
+ Object notifier = notification.getNotifier();
+ Object feature = notification.getFeature();
+ if (notifier instanceof TableDisplayStyle && feature == NattablestylePackage.eINSTANCE.getTableDisplayStyle_DisplayStyle()) {
+ Object newValue = notification.getNewValue();
+ if (newValue == DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN) {
+ multiToSingle = false;
+ } else if (newValue == DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN) {
+ multiToSingle = true;
+ } else {
+ return;
+ }
+ }
+ if (notifier instanceof Table && feature == NattablestylePackage.eINSTANCE.getStyledElement_Styles()) {
+ Object tmp = notification.getNewValue();
+ if (!(tmp instanceof TableDisplayStyle)) {
+ return;
+ }
+ TableDisplayStyle newValue = (TableDisplayStyle) tmp;
+ if (newValue.getDisplayStyle() == DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN) {
+ multiToSingle = false;
+ } else if (newValue.getDisplayStyle() == DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN) {
+ multiToSingle = true;
+ } else {
+ return;
+ }
+
+ }
+
+ if (multiToSingle) {
+ NatTable natTable = (NatTable) ((IAdaptable) this.tableManager).getAdapter(NatTable.class);
+ natTable.refresh();
+ ((ITreeNattableModelManager) this.tableManager).hideShowColumnCategoriesInRowHeader(null, null);
+ } else {
+ NatTable natTable = (NatTable) ((IAdaptable) this.tableManager).getAdapter(NatTable.class);
+ natTable.refresh();
+ ((ITreeNattableModelManager) this.tableManager).hideShowColumnCategoriesInRowHeader(StyleUtils.getHiddenDepths(tableManager), null);
+ }
+
+ }
+
+
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)
+ *
+ * @param arg0
+ */
+ @Override
+ public void resourceSetChanged(ResourceSetChangeEvent arg0) {
+ if (null == this.tableManager || null == this.tableManager.getTable() || null == this.tableManager.getTable().getTableConfiguration()) {
+ // we are deleting the table
+ return;
+ }
+ for (Notification current : arg0.getNotifications()) {
+ if (isNotificationOnHideShowCategories(current)) {
+ manageHideShowCategories(current);
+ }
+ if (isNotificationOnSingleOrMultiColumnInRowHeader(current)) {
+ manageChangeOnDisplayStyle(current);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent)
+ *
+ * @param arg0
+ * @return
+ * @throws RollbackException
+ */
+ @Override
+ public Command transactionAboutToCommit(ResourceSetChangeEvent arg0) throws RollbackException {
+ // nothing to do
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#getFilter()
+ *
+ * @return
+ */
+ @Override
+ public NotificationFilter getFilter() {
+ return new NotificationFilter.Custom() {
+
+ @Override
+ public boolean matches(Notification notification) {
+ if (notification.isTouch() || notification.getNotifier() == null || notification.getFeature() == null) {
+ return false;
+ }
+ Object notifier = notification.getNotifier();
+ if (notifier instanceof EObject) {
+ if (EcoreUtil.getRootContainer(((EObject) notifier).eClass()) == NattablePackage.eINSTANCE) {
+ // we must verify than the notification concern the current managed table
+ try {
+ if (TableHelper.findTable((EObject) notifier) != tableManager.getTable()) {
+ return false;
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+
+ return isNotificationOnHideShowCategories(notification) || isNotificationOnSingleOrMultiColumnInRowHeader(notification);
+ }
+ }
+
+ return false;
+ }
+ };
+ }
+
+ /**
+ *
+ * @param notification
+ * a notification
+ * @return
+ * <code>true</code> if the notification concerns the display style of the table
+ */
+ private static final boolean isNotificationOnSingleOrMultiColumnInRowHeader(Notification notification) {
+ Object feature = notification.getFeature();
+ Object notifier = notification.getNotifier();
+ if (notifier instanceof TableDisplayStyle && feature == NattablestylePackage.eINSTANCE.getTableDisplayStyle_DisplayStyle()) {
+ return true;
+ }
+ if (notifier instanceof Table && feature == NattablestylePackage.eINSTANCE.getStyledElement_Styles()) {
+ Object value = null;
+ if (Notification.ADD == notification.getEventType()) {
+ value = notification.getNewValue();
+ }
+ if (value instanceof TableDisplayStyle) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param notification
+ * a notification
+ * @return
+ * <code>true</code> if the notification concerns the hide/show of the categoriesF
+ */
+ private static final boolean isNotificationOnHideShowCategories(Notification notification) {
+ Object notifier = notification.getNotifier();
+ Object feature = notification.getFeature();
+ if (notifier instanceof Table && feature == NattablestylePackage.eINSTANCE.getStyledElement_Styles()) {
+ Object style = notification.getOldValue();
+ if (style == null) {
+ style = notification.getNewValue();
+ }
+ return style instanceof IntListValueStyle && ((IntListValueStyle) style).getName().equals(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH);
+ }
+ return notifier instanceof IntListValueStyle && ((IntListValueStyle) notifier).getName().equals(NamedStyleConstants.HIDDEN_CATEGORY_FOR_DEPTH) && feature == NattablestylePackage.eINSTANCE.getIntListValueStyle_IntListValue();
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#isAggregatePrecommitListener()
+ *
+ * @return
+ */
+ @Override
+ public boolean isAggregatePrecommitListener() {
+ // nothing to do
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#isPostcommitOnly()
+ *
+ * @return
+ */
+ @Override
+ public boolean isPostcommitOnly() {
+ // nothing to do
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#isPrecommitOnly()
+ *
+ * @return
+ */
+ @Override
+ public boolean isPrecommitOnly() {
+ // nothing to do
+ return false;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/NatTableDropListener.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/NatTableDropListener.java
index 36ef614415f..48957db9550 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/NatTableDropListener.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/NatTableDropListener.java
@@ -1,301 +1,301 @@
-/*****************************************************************************
- * Copyright (c) 2012, 2014 CEA LIST and others.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Christian W. Damus (CEA) - bug 430880
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.listener;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.UnexecutableCommand;
-import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.selection.ISelectionExtractor;
-import org.eclipse.papyrus.infra.nattable.utils.LocationValue;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.DropTargetListener;
-import org.eclipse.swt.graphics.Point;
-
-/**
- *
- * This listener allow to manage the drop inside the table
- *
- */
-public class NatTableDropListener implements DropTargetListener {
-
- /**
- * the table manager
- */
- private final INattableModelManager manager;
-
- private final ISelectionExtractor selectionExtractor;
- /**
- * the location value to use to drop the elements
- */
- private LocationValue dropKindValue;
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the table manager
- * @param selectionExtractor
- */
- public NatTableDropListener(final INattableModelManager manager, ISelectionExtractor selectionExtractor) {
- this.manager = manager;
- this.selectionExtractor = selectionExtractor;
- }
-
- /**
- *
- * @see org.eclipse.swt.dnd.DropTargetListener#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
- *
- * @param event
- */
- @Override
- public void dragEnter(final DropTargetEvent event) {
- validateDropEvent(event);
- }
-
- protected void validateDropEvent(final DropTargetEvent event) {
- event.operations = DND.DROP_COPY | DND.DROP_MOVE;
-
- // Move and Link semantics don't make sense for tables which, like diagrams, are visualizations
- // of objects also visualized in other places (such as the Model Explorer)
- event.detail = DND.DROP_COPY;
- }
-
- /**
- *
- * @see org.eclipse.swt.dnd.DropTargetListener#dragLeave(org.eclipse.swt.dnd.DropTargetEvent)
- *
- * @param event
- */
- @Override
- public void dragLeave(final DropTargetEvent event) {
- // nothing to do
- }
-
- /**
- *
- * @see org.eclipse.swt.dnd.DropTargetListener#dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent)
- *
- * @param event
- */
- @Override
- public void dragOperationChanged(final DropTargetEvent event) {
- validateDropEvent(event);
- }
-
- /**
- *
- * @see org.eclipse.swt.dnd.DropTargetListener#dragOver(org.eclipse.swt.dnd.DropTargetEvent)
- *
- * @param event
- */
- @Override
- public void dragOver(final DropTargetEvent event) {
- validateDropEvent(event);
- this.dropKindValue = null;
- final List<Object> droppedElements = getDroppedObjects(event);
- if (droppedElements.isEmpty()) {
- return; // Nothing to do
- }
- this.dropKindValue = this.manager.getLocationInTheTable(new Point(event.x, event.y));
- int drop = DND.DROP_NONE;
- switch (this.dropKindValue.getKind()) {
- case AFTER_COLUMN_HEADER:
- if (this.manager.canDropColumnsElement(droppedElements)) {
- drop = event.detail;
- }
- break;
- case AFTER_ROW_HEADER:
- if (this.manager.canDropRowElement(droppedElements)) {
- drop = event.detail;
- }
- break;
- case COLUMN_HEADER:
- if (this.manager.canInsertColumns(droppedElements, this.dropKindValue.getColumnIndex())) {
- drop = event.detail;
- }
- break;
- case ROW_HEADER:
- if (this.manager.canInsertRow(droppedElements, this.dropKindValue.getRowIndex())) {
- drop = event.detail;
- }
- break;
- case CELL:
- int rowIndex = this.dropKindValue.getRowIndex();
- int columnIndex = this.dropKindValue.getColumnIndex();
- final Object rowElement = this.manager.getRowElement(rowIndex);
- final Object columnElement = this.manager.getColumnElement(columnIndex);
- if (CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement, this.manager)) {
- final TransactionalEditingDomain domain = getEditingDomain();
- final Command cmd = getDropSetValueCommand(domain, droppedElements);
- if (cmd!=null && cmd.canExecute()) {
- drop = event.detail;
- }
- }
- break;
- case UNKNOWN:
- drop = DND.DROP_NONE;
- break;
- default:
- drop = DND.DROP_NONE;
- break;
- }
- event.detail = drop;
- }
-
- protected List<Object> getDroppedObjects(DropTargetEvent event) {
- final LocalTransfer localTransfer = LocalTransfer.getInstance();
- final Object data = localTransfer.nativeToJava(event.currentDataType);
- IStructuredSelection structuredSelection = null;
- if (data instanceof IStructuredSelection) {
- structuredSelection = (IStructuredSelection) data;
- } else if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) {
- // Try the local selection transfer
- ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
- if (selection instanceof IStructuredSelection) {
- structuredSelection = (IStructuredSelection) selection;
- }
- }
- if (structuredSelection == null) {
- return Collections.emptyList();
- }
- return new ArrayList<Object>(extractSelectedObjects(structuredSelection));
- }
-
- protected Collection<?> extractSelectedObjects(IStructuredSelection structuredSelection) {
- return this.selectionExtractor.extractSelectedObjects(structuredSelection);
- }
-
- /**
- *
- * @param droppedElements
- * the dropped elements
- * @return
- * the command to set the value in the selected cell
- */
- private Command getDropSetValueCommand(final TransactionalEditingDomain domain, final List<Object> droppedElements) {
- int rowIndex = this.dropKindValue.getRowIndex();
- int columnIndex = this.dropKindValue.getColumnIndex();
- final Object rowElement = this.manager.getRowElement(rowIndex);
- final Object columnElement = this.manager.getColumnElement(columnIndex);
- if (CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement, this.manager)) {
- Object newValue = null;
- final Object currentValue = CellManagerFactory.INSTANCE.getCrossValueIgnoringProblems(columnElement, rowElement, this.manager);
- if (currentValue instanceof Collection<?>) {
- // the dropped elements will be added to the current Value in case of multivalued cell
- final Collection<Object> tmpNewValue = new ArrayList<Object>();
- tmpNewValue.addAll((Collection<?>) currentValue);
- tmpNewValue.addAll(droppedElements);
- newValue = tmpNewValue;
- } else if (droppedElements.size() == 1) {
- newValue = droppedElements.get(0);
- } else {
- newValue = droppedElements;
- }
- final Command cmd = CellManagerFactory.INSTANCE.getSetCellValueCommand(domain, columnElement, rowElement, newValue, manager);
- return cmd;
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- *
- * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
- *
- * @param event
- */
- @Override
- public void drop(final DropTargetEvent event) {
- // we drop the elements into the table
- final List<Object> droppedElements = getDroppedObjects(event);
- if (!droppedElements.isEmpty()) {
- if (this.dropKindValue != null) {
- switch (this.dropKindValue.getKind()) {
- case AFTER_COLUMN_HEADER:
- this.manager.addColumns(droppedElements);
- break;
- case AFTER_ROW_HEADER:
- this.manager.addRows(droppedElements);
- break;
- case COLUMN_HEADER:
- this.manager.insertColumns(droppedElements, this.dropKindValue.getColumnIndex());
- break;
- case ROW_HEADER:
- this.manager.insertRows(droppedElements, this.dropKindValue.getRowIndex());
- break;
- case CELL:
- final TransactionalEditingDomain domain = getEditingDomain();
- final Command cmd = getDropSetValueCommand(domain, droppedElements);
- if (cmd!=null && cmd.canExecute()) {
- domain.getCommandStack().execute(cmd);
- }
- break;
- case UNKNOWN:
- break;
- default:
- break;
- }
- }
- }
- this.dropKindValue = null;
- }
-
-
- @Override
- public void dropAccept(final DropTargetEvent event) {
- // nothing to do
- }
-
- /**
- *
- * @return
- * the Transactional Editing Domain to use to edit the model
- */
- private TransactionalEditingDomain getEditingDomain() {
- TransactionalEditingDomain domain = null;
- ServicesRegistry registry = null;
- try {
- registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(this.manager.getTable().getContext());
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
-
- if (registry != null) {
- try {
- domain = registry.getService(TransactionalEditingDomain.class);
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
- }
- return domain;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012, 2014 CEA LIST and others.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 430880
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.listener;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.selection.ISelectionExtractor;
+import org.eclipse.papyrus.infra.nattable.utils.LocationValue;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.DropTargetListener;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ *
+ * This listener allow to manage the drop inside the table
+ *
+ */
+public class NatTableDropListener implements DropTargetListener {
+
+ /**
+ * the table manager
+ */
+ private final INattableModelManager manager;
+
+ private final ISelectionExtractor selectionExtractor;
+ /**
+ * the location value to use to drop the elements
+ */
+ private LocationValue dropKindValue;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the table manager
+ * @param selectionExtractor
+ */
+ public NatTableDropListener(final INattableModelManager manager, ISelectionExtractor selectionExtractor) {
+ this.manager = manager;
+ this.selectionExtractor = selectionExtractor;
+ }
+
+ /**
+ *
+ * @see org.eclipse.swt.dnd.DropTargetListener#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
+ *
+ * @param event
+ */
+ @Override
+ public void dragEnter(final DropTargetEvent event) {
+ validateDropEvent(event);
+ }
+
+ protected void validateDropEvent(final DropTargetEvent event) {
+ event.operations = DND.DROP_COPY | DND.DROP_MOVE;
+
+ // Move and Link semantics don't make sense for tables which, like diagrams, are visualizations
+ // of objects also visualized in other places (such as the Model Explorer)
+ event.detail = DND.DROP_COPY;
+ }
+
+ /**
+ *
+ * @see org.eclipse.swt.dnd.DropTargetListener#dragLeave(org.eclipse.swt.dnd.DropTargetEvent)
+ *
+ * @param event
+ */
+ @Override
+ public void dragLeave(final DropTargetEvent event) {
+ // nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.swt.dnd.DropTargetListener#dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent)
+ *
+ * @param event
+ */
+ @Override
+ public void dragOperationChanged(final DropTargetEvent event) {
+ validateDropEvent(event);
+ }
+
+ /**
+ *
+ * @see org.eclipse.swt.dnd.DropTargetListener#dragOver(org.eclipse.swt.dnd.DropTargetEvent)
+ *
+ * @param event
+ */
+ @Override
+ public void dragOver(final DropTargetEvent event) {
+ validateDropEvent(event);
+ this.dropKindValue = null;
+ final List<Object> droppedElements = getDroppedObjects(event);
+ if (droppedElements.isEmpty()) {
+ return; // Nothing to do
+ }
+ this.dropKindValue = this.manager.getLocationInTheTable(new Point(event.x, event.y));
+ int drop = DND.DROP_NONE;
+ switch (this.dropKindValue.getKind()) {
+ case AFTER_COLUMN_HEADER:
+ if (this.manager.canDropColumnsElement(droppedElements)) {
+ drop = event.detail;
+ }
+ break;
+ case AFTER_ROW_HEADER:
+ if (this.manager.canDropRowElement(droppedElements)) {
+ drop = event.detail;
+ }
+ break;
+ case COLUMN_HEADER:
+ if (this.manager.canInsertColumns(droppedElements, this.dropKindValue.getColumnIndex())) {
+ drop = event.detail;
+ }
+ break;
+ case ROW_HEADER:
+ if (this.manager.canInsertRow(droppedElements, this.dropKindValue.getRowIndex())) {
+ drop = event.detail;
+ }
+ break;
+ case CELL:
+ int rowIndex = this.dropKindValue.getRowIndex();
+ int columnIndex = this.dropKindValue.getColumnIndex();
+ final Object rowElement = this.manager.getRowElement(rowIndex);
+ final Object columnElement = this.manager.getColumnElement(columnIndex);
+ if (CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement, this.manager)) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final Command cmd = getDropSetValueCommand(domain, droppedElements);
+ if (cmd!=null && cmd.canExecute()) {
+ drop = event.detail;
+ }
+ }
+ break;
+ case UNKNOWN:
+ drop = DND.DROP_NONE;
+ break;
+ default:
+ drop = DND.DROP_NONE;
+ break;
+ }
+ event.detail = drop;
+ }
+
+ protected List<Object> getDroppedObjects(DropTargetEvent event) {
+ final LocalTransfer localTransfer = LocalTransfer.getInstance();
+ final Object data = localTransfer.nativeToJava(event.currentDataType);
+ IStructuredSelection structuredSelection = null;
+ if (data instanceof IStructuredSelection) {
+ structuredSelection = (IStructuredSelection) data;
+ } else if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) {
+ // Try the local selection transfer
+ ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ structuredSelection = (IStructuredSelection) selection;
+ }
+ }
+ if (structuredSelection == null) {
+ return Collections.emptyList();
+ }
+ return new ArrayList<Object>(extractSelectedObjects(structuredSelection));
+ }
+
+ protected Collection<?> extractSelectedObjects(IStructuredSelection structuredSelection) {
+ return this.selectionExtractor.extractSelectedObjects(structuredSelection);
+ }
+
+ /**
+ *
+ * @param droppedElements
+ * the dropped elements
+ * @return
+ * the command to set the value in the selected cell
+ */
+ private Command getDropSetValueCommand(final TransactionalEditingDomain domain, final List<Object> droppedElements) {
+ int rowIndex = this.dropKindValue.getRowIndex();
+ int columnIndex = this.dropKindValue.getColumnIndex();
+ final Object rowElement = this.manager.getRowElement(rowIndex);
+ final Object columnElement = this.manager.getColumnElement(columnIndex);
+ if (CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement, this.manager)) {
+ Object newValue = null;
+ final Object currentValue = CellManagerFactory.INSTANCE.getCrossValueIgnoringProblems(columnElement, rowElement, this.manager);
+ if (currentValue instanceof Collection<?>) {
+ // the dropped elements will be added to the current Value in case of multivalued cell
+ final Collection<Object> tmpNewValue = new ArrayList<Object>();
+ tmpNewValue.addAll((Collection<?>) currentValue);
+ tmpNewValue.addAll(droppedElements);
+ newValue = tmpNewValue;
+ } else if (droppedElements.size() == 1) {
+ newValue = droppedElements.get(0);
+ } else {
+ newValue = droppedElements;
+ }
+ final Command cmd = CellManagerFactory.INSTANCE.getSetCellValueCommand(domain, columnElement, rowElement, newValue, manager);
+ return cmd;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ *
+ * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
+ *
+ * @param event
+ */
+ @Override
+ public void drop(final DropTargetEvent event) {
+ // we drop the elements into the table
+ final List<Object> droppedElements = getDroppedObjects(event);
+ if (!droppedElements.isEmpty()) {
+ if (this.dropKindValue != null) {
+ switch (this.dropKindValue.getKind()) {
+ case AFTER_COLUMN_HEADER:
+ this.manager.addColumns(droppedElements);
+ break;
+ case AFTER_ROW_HEADER:
+ this.manager.addRows(droppedElements);
+ break;
+ case COLUMN_HEADER:
+ this.manager.insertColumns(droppedElements, this.dropKindValue.getColumnIndex());
+ break;
+ case ROW_HEADER:
+ this.manager.insertRows(droppedElements, this.dropKindValue.getRowIndex());
+ break;
+ case CELL:
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final Command cmd = getDropSetValueCommand(domain, droppedElements);
+ if (cmd!=null && cmd.canExecute()) {
+ domain.getCommandStack().execute(cmd);
+ }
+ break;
+ case UNKNOWN:
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ this.dropKindValue = null;
+ }
+
+
+ @Override
+ public void dropAccept(final DropTargetEvent event) {
+ // nothing to do
+ }
+
+ /**
+ *
+ * @return
+ * the Transactional Editing Domain to use to edit the model
+ */
+ private TransactionalEditingDomain getEditingDomain() {
+ TransactionalEditingDomain domain = null;
+ ServicesRegistry registry = null;
+ try {
+ registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(this.manager.getTable().getContext());
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ if (registry != null) {
+ try {
+ domain = registry.getService(TransactionalEditingDomain.class);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+ }
+ return domain;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/UpdateTableContentListener.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/UpdateTableContentListener.java
index 720cf11976c..fafd6600a4e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/UpdateTableContentListener.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/listener/UpdateTableContentListener.java
@@ -1,305 +1,305 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug #471903
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.listener;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.NotificationFilter;
-import org.eclipse.emf.transaction.ResourceSetChangeEvent;
-import org.eclipse.emf.transaction.ResourceSetListener;
-import org.eclipse.emf.transaction.RollbackException;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.manager.axis.CompositeAxisManagerForEventList;
-import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList;
-import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisPackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
-
-
-/**
- * @author Vincent Lorenzo
- *
- * This listener is used to notify {@link CompositeAxisManagerForEventList} when an event comes
- *
- */
-public class UpdateTableContentListener implements ResourceSetListener {
-
- /**
- * the current table for which we want notify its axis manager
- */
- protected NattableModelManager tableManager;
-
- /**
- * the axis manager to notify
- */
- protected IAxisManagerForEventList axisManager;
-
- /**
- * Constructor.
- *
- */
- public UpdateTableContentListener(final NattableModelManager tableManager, final IAxisManagerForEventList axisManager) {
- this.tableManager = tableManager;
- this.axisManager = axisManager;
- }
-
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#getFilter()
- *
- * @return
- */
- @Override
- public NotificationFilter getFilter() {
- return new NotificationFilter.Custom() {
-
- @Override
- public boolean matches(Notification notification) {
- if (notification.isTouch() || notification.getNotifier() == null || notification.getFeature() == null) {
- return false;
- }
- Object notifier = notification.getNotifier();
- if (notifier instanceof EObject) {
- if (EcoreUtil.getRootContainer(((EObject) notifier).eClass()) == NattablePackage.eINSTANCE) {
- // we must verify than the notification concern the current managed table
- try {
- if (TableHelper.findTable((EObject) notifier) != tableManager.getTable()) {
- return false;
- }
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- }
-
- return true;
- }
- };
- }
-
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent)
- *
- * @param event
- * @return
- * @throws RollbackException
- */
- @Override
- public final Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException {
- // nothing to do
- return null;
- }
-
-
- /**
- * @return <code>true</code> if there are changes on TreeFillingConfiguration
- */
- protected boolean containsTreeFillingConfigurationChange(ResourceSetChangeEvent event) {
- List<Notification> notifications = event.getNotifications();
- for (Notification current : notifications) {
- Object feature = current.getFeature();
- if (feature == NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_OwnedAxisConfigurations()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)
- *
- * @param event
- */
- @Override
- public void resourceSetChanged(final ResourceSetChangeEvent event) {
- if (containsTreeFillingConfigurationChange(event)) {
- this.axisManager.fillingConfigurationsHaveChanged();
- return;
- }
- // The initial notifications
- final List<Notification> initialNotifications = event.getNotifications();
- // Create a copy of notifications to keep only the managed one
- final List<Notification> managedNotifications = new ArrayList<Notification>(initialNotifications);
- final Iterator<Notification> notificationsIterator = initialNotifications.iterator();
- int index = 0;
-
- // Loop on initial notifications
- while (notificationsIterator.hasNext()) {
- Notification current = notificationsIterator.next();
-
- if (managedNotifications.contains(current)) {
- int currentEvent = current.getEventType();
-
- // filtering notification concerning creation of ITreeItemAxis created as children
- if (Notification.ADD == currentEvent) {
- current = getAddNotification(current, managedNotifications, index);
- // check if the remove event is a move action
- }else if (Notification.REMOVE_MANY == currentEvent || Notification.REMOVE == currentEvent && notificationsIterator.hasNext()) {
- current = getMoveNotification(current, managedNotifications, index);
- }
-
- if (null != this.axisManager && null != current) {
- this.axisManager.manageEvent(current);
- }
- }
-
- index++;
- }
- tableManager.refreshNatTable();
-
- }
-
- /**
- * This allow to get the notification from the initial add notification.
- *
- * @param initialNotification
- * The initial add notification.
- * @param managedNotifications
- * The already managed notifications.
- * @param index
- * The index of the notification in the list of initial notifications.
- * @return The notification to manage.
- */
- protected Notification getAddNotification(final Notification initialNotification, final List<Notification> managedNotifications, final int index){
- Notification currentNotification = initialNotification;
-
- if (NattableaxisPackage.eINSTANCE.getITreeItemAxis_Children() == currentNotification.getFeature()) {
- if (currentNotification.getNotifier() instanceof ITreeItemAxis && (null == ((EObject) currentNotification.getNotifier()).eContainer() || (((EObject) currentNotification.getNotifier()).eContainer()) instanceof AbstractAxisProvider)) {
- currentNotification = null;
- }
- }
-
- return currentNotification;
- }
-
- /**
- * This allow to get the move notification from the initial remove notification. This one will be managed as a move (because the move does not exist in GMD command (replaced by add and remove)).
- *
- * @param initialNotification
- * The initial remove notification.
- * @param managedNotifications
- * The already managed notifications.
- * @param index
- * The index of the notification in the list of initial notifications.
- * @return The notification to manage.
- */
- @SuppressWarnings("unchecked")
- protected Notification getMoveNotification(final Notification initialNotification, final List<Notification> managedNotifications, final int index) {
- Notification currentNotification = initialNotification;
-
- // Create a list of remaining notifications to check if a
- final List<Notification> remainingNotifications = managedNotifications.subList(index + 1, managedNotifications.size());
- Iterator<Notification> remainingIterator = remainingNotifications.iterator();
-
- // we need to verify that a remove_many is not followed by an add_many. in this case it is probably a move inside a list
- boolean isAMove = false;
-
- while (!isAMove && remainingIterator.hasNext()) {
- Notification nextNotification = remainingIterator.next();
- int nextEventType = nextNotification.getEventType();
- // Check that the next notification manage a move action with the current one
- if (Notification.ADD_MANY == nextEventType && currentNotification.getNotifier().equals(nextNotification.getNotifier()) && currentNotification.getFeature().equals(nextNotification.getFeature())) {
- // Get the old value(s)
- Collection<Object> oldValue = null;
- if (Notification.REMOVE == currentNotification.getEventType()) {
- oldValue = new ArrayList<Object>(1);
- oldValue.add((Object) currentNotification.getOldValue());
- } else {
- oldValue = (Collection<Object>) currentNotification.getOldValue();
- }
- // Get the new values
- Collection<?> newValue = (Collection<?>) nextNotification.getNewValue();
-
- // Check that all the new values contains the old one (else it's not a move, don't continue
- isAMove = newValue.containsAll(oldValue);
- if (isAMove) {
- if (oldValue.size() == newValue.size()) {
- // The old and new values are just reorganized, the notification no need to be executed (only refresh on the nattable is necessary)
- currentNotification = null;
- } else {
- // The move is done from a parent to another one, recreate a added notification with only the new added objects at the good position
- int position = 0;
-
- // Get the position to add it
- Iterator<?> newValueIterator = newValue.iterator();
- while (newValueIterator.hasNext() && oldValue.contains(newValueIterator.next())) {
- position++;
- }
-
- // Get the objects to add
- final List<Object> addedObject = new ArrayList<Object>(newValue);
- addedObject.removeAll(oldValue);
-
- // Create the add notifications
- currentNotification = new ENotificationImpl((InternalEObject) currentNotification.getNotifier(), Notification.ADD_MANY, (EStructuralFeature) currentNotification.getFeature(), null, addedObject, position);
- }
-
- // The move manage the delete and the add notification so skip the next one
- managedNotifications.remove(nextNotification);
- }
- }
- }
-
- return currentNotification;
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#isAggregatePrecommitListener()
- *
- * @return
- */
- @Override
- public final boolean isAggregatePrecommitListener() {
- // nothing to do
- return false;
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#isPrecommitOnly()
- *
- * @return
- */
- @Override
- public final boolean isPrecommitOnly() {
- // nothing to do
- return false;
- }
-
- /**
- * @see org.eclipse.emf.transaction.ResourceSetListener#isPostcommitOnly()
- *
- * @return
- */
- @Override
- public final boolean isPostcommitOnly() {
- // nothing to do
- return false;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug #471903
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.listener;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.ResourceSetChangeEvent;
+import org.eclipse.emf.transaction.ResourceSetListener;
+import org.eclipse.emf.transaction.RollbackException;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.manager.axis.CompositeAxisManagerForEventList;
+import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList;
+import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
+
+
+/**
+ * @author Vincent Lorenzo
+ *
+ * This listener is used to notify {@link CompositeAxisManagerForEventList} when an event comes
+ *
+ */
+public class UpdateTableContentListener implements ResourceSetListener {
+
+ /**
+ * the current table for which we want notify its axis manager
+ */
+ protected NattableModelManager tableManager;
+
+ /**
+ * the axis manager to notify
+ */
+ protected IAxisManagerForEventList axisManager;
+
+ /**
+ * Constructor.
+ *
+ */
+ public UpdateTableContentListener(final NattableModelManager tableManager, final IAxisManagerForEventList axisManager) {
+ this.tableManager = tableManager;
+ this.axisManager = axisManager;
+ }
+
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#getFilter()
+ *
+ * @return
+ */
+ @Override
+ public NotificationFilter getFilter() {
+ return new NotificationFilter.Custom() {
+
+ @Override
+ public boolean matches(Notification notification) {
+ if (notification.isTouch() || notification.getNotifier() == null || notification.getFeature() == null) {
+ return false;
+ }
+ Object notifier = notification.getNotifier();
+ if (notifier instanceof EObject) {
+ if (EcoreUtil.getRootContainer(((EObject) notifier).eClass()) == NattablePackage.eINSTANCE) {
+ // we must verify than the notification concern the current managed table
+ try {
+ if (TableHelper.findTable((EObject) notifier) != tableManager.getTable()) {
+ return false;
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ return true;
+ }
+ };
+ }
+
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent)
+ *
+ * @param event
+ * @return
+ * @throws RollbackException
+ */
+ @Override
+ public final Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException {
+ // nothing to do
+ return null;
+ }
+
+
+ /**
+ * @return <code>true</code> if there are changes on TreeFillingConfiguration
+ */
+ protected boolean containsTreeFillingConfigurationChange(ResourceSetChangeEvent event) {
+ List<Notification> notifications = event.getNotifications();
+ for (Notification current : notifications) {
+ Object feature = current.getFeature();
+ if (feature == NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_OwnedAxisConfigurations()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)
+ *
+ * @param event
+ */
+ @Override
+ public void resourceSetChanged(final ResourceSetChangeEvent event) {
+ if (containsTreeFillingConfigurationChange(event)) {
+ this.axisManager.fillingConfigurationsHaveChanged();
+ return;
+ }
+ // The initial notifications
+ final List<Notification> initialNotifications = event.getNotifications();
+ // Create a copy of notifications to keep only the managed one
+ final List<Notification> managedNotifications = new ArrayList<Notification>(initialNotifications);
+ final Iterator<Notification> notificationsIterator = initialNotifications.iterator();
+ int index = 0;
+
+ // Loop on initial notifications
+ while (notificationsIterator.hasNext()) {
+ Notification current = notificationsIterator.next();
+
+ if (managedNotifications.contains(current)) {
+ int currentEvent = current.getEventType();
+
+ // filtering notification concerning creation of ITreeItemAxis created as children
+ if (Notification.ADD == currentEvent) {
+ current = getAddNotification(current, managedNotifications, index);
+ // check if the remove event is a move action
+ }else if (Notification.REMOVE_MANY == currentEvent || Notification.REMOVE == currentEvent && notificationsIterator.hasNext()) {
+ current = getMoveNotification(current, managedNotifications, index);
+ }
+
+ if (null != this.axisManager && null != current) {
+ this.axisManager.manageEvent(current);
+ }
+ }
+
+ index++;
+ }
+ tableManager.refreshNatTable();
+
+ }
+
+ /**
+ * This allow to get the notification from the initial add notification.
+ *
+ * @param initialNotification
+ * The initial add notification.
+ * @param managedNotifications
+ * The already managed notifications.
+ * @param index
+ * The index of the notification in the list of initial notifications.
+ * @return The notification to manage.
+ */
+ protected Notification getAddNotification(final Notification initialNotification, final List<Notification> managedNotifications, final int index){
+ Notification currentNotification = initialNotification;
+
+ if (NattableaxisPackage.eINSTANCE.getITreeItemAxis_Children() == currentNotification.getFeature()) {
+ if (currentNotification.getNotifier() instanceof ITreeItemAxis && (null == ((EObject) currentNotification.getNotifier()).eContainer() || (((EObject) currentNotification.getNotifier()).eContainer()) instanceof AbstractAxisProvider)) {
+ currentNotification = null;
+ }
+ }
+
+ return currentNotification;
+ }
+
+ /**
+ * This allow to get the move notification from the initial remove notification. This one will be managed as a move (because the move does not exist in GMD command (replaced by add and remove)).
+ *
+ * @param initialNotification
+ * The initial remove notification.
+ * @param managedNotifications
+ * The already managed notifications.
+ * @param index
+ * The index of the notification in the list of initial notifications.
+ * @return The notification to manage.
+ */
+ @SuppressWarnings("unchecked")
+ protected Notification getMoveNotification(final Notification initialNotification, final List<Notification> managedNotifications, final int index) {
+ Notification currentNotification = initialNotification;
+
+ // Create a list of remaining notifications to check if a
+ final List<Notification> remainingNotifications = managedNotifications.subList(index + 1, managedNotifications.size());
+ Iterator<Notification> remainingIterator = remainingNotifications.iterator();
+
+ // we need to verify that a remove_many is not followed by an add_many. in this case it is probably a move inside a list
+ boolean isAMove = false;
+
+ while (!isAMove && remainingIterator.hasNext()) {
+ Notification nextNotification = remainingIterator.next();
+ int nextEventType = nextNotification.getEventType();
+ // Check that the next notification manage a move action with the current one
+ if (Notification.ADD_MANY == nextEventType && currentNotification.getNotifier().equals(nextNotification.getNotifier()) && currentNotification.getFeature().equals(nextNotification.getFeature())) {
+ // Get the old value(s)
+ Collection<Object> oldValue = null;
+ if (Notification.REMOVE == currentNotification.getEventType()) {
+ oldValue = new ArrayList<Object>(1);
+ oldValue.add((Object) currentNotification.getOldValue());
+ } else {
+ oldValue = (Collection<Object>) currentNotification.getOldValue();
+ }
+ // Get the new values
+ Collection<?> newValue = (Collection<?>) nextNotification.getNewValue();
+
+ // Check that all the new values contains the old one (else it's not a move, don't continue
+ isAMove = newValue.containsAll(oldValue);
+ if (isAMove) {
+ if (oldValue.size() == newValue.size()) {
+ // The old and new values are just reorganized, the notification no need to be executed (only refresh on the nattable is necessary)
+ currentNotification = null;
+ } else {
+ // The move is done from a parent to another one, recreate a added notification with only the new added objects at the good position
+ int position = 0;
+
+ // Get the position to add it
+ Iterator<?> newValueIterator = newValue.iterator();
+ while (newValueIterator.hasNext() && oldValue.contains(newValueIterator.next())) {
+ position++;
+ }
+
+ // Get the objects to add
+ final List<Object> addedObject = new ArrayList<Object>(newValue);
+ addedObject.removeAll(oldValue);
+
+ // Create the add notifications
+ currentNotification = new ENotificationImpl((InternalEObject) currentNotification.getNotifier(), Notification.ADD_MANY, (EStructuralFeature) currentNotification.getFeature(), null, addedObject, position);
+ }
+
+ // The move manage the delete and the add notification so skip the next one
+ managedNotifications.remove(nextNotification);
+ }
+ }
+ }
+
+ return currentNotification;
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#isAggregatePrecommitListener()
+ *
+ * @return
+ */
+ @Override
+ public final boolean isAggregatePrecommitListener() {
+ // nothing to do
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#isPrecommitOnly()
+ *
+ * @return
+ */
+ @Override
+ public final boolean isPrecommitOnly() {
+ // nothing to do
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.emf.transaction.ResourceSetListener#isPostcommitOnly()
+ *
+ * @return
+ */
+ @Override
+ public final boolean isPostcommitOnly() {
+ // nothing to do
+ return false;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManagerForEventList.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManagerForEventList.java
index 2e0b18cc69f..0c442b0901f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManagerForEventList.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManagerForEventList.java
@@ -1,233 +1,233 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.manager.axis;
-
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notification;
-
-import ca.odell.glazedlists.EventList;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractAxisManagerForEventList extends AbstractAxisManager implements IAxisManagerForEventList {
-
- /**
- * the event list used for the managed axis
- */
- protected EventList<Object> eventList;
-
- /** the message displayed by an exception when we call an inherited method from IAxisManager, forbidden for IAxisManagerForEventList */
- protected static final String EXCEPTION_MESSAGE = "This method cant be call for IAxisManagerForEventList";////$NON-NLS-1$
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList#setEventList(ca.odell.glazedlists.EventList)
- *
- * @param list
- */
- @Override
- public final void setEventList(EventList<Object> list) {
- this.eventList = list;
- }
-
-
- /**
- * @param notification
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList#manageEvent(Notification)
- */
- @Override
- public void manageEvent(Notification notification) {
- if (ignoreEvent(notification)) {
- return;
- }
- final int eventType = notification.getEventType();
- switch (eventType) {
- case Notification.SET:
- manageSetNotification(notification);
- break;
- case Notification.UNSET:
- manageUnsetNotification(notification);
- break;
- case Notification.ADD:
- manageAddNotification(notification);
- break;
- case Notification.ADD_MANY:
- manageAddManyNotification(notification);
- break;
- case Notification.MOVE:
- manageMoveNotification(notification);
- break;
- case Notification.REMOVE:
- manageRemoveNotification(notification);
- break;
- case Notification.REMOVE_MANY:
- manageRemoveManyNotification(notification);
- break;
- default:
- return;
- }
- }
-
- /**
- *
- * @param notification
- * a notification
- * @return
- * <code>true</code> if the notification must be ignored
- */
- protected boolean ignoreEvent(final Notification notification) {
- if (notification.isTouch()) {
- return true;
- }
- return false;
- }
-
- /**
- * @param notification
- */
- protected abstract void manageRemoveManyNotification(Notification notification);
-
- /**
- * @param notification
- */
- protected abstract void manageRemoveNotification(Notification notification);
-
- /**
- * @param notification
- */
- protected abstract void manageMoveNotification(Notification notification);
-
- /**
- * @param notification
- */
- protected abstract void manageAddManyNotification(Notification notification);
-
- /**
- * @param notification
- */
- protected abstract void manageAddNotification(Notification notification);
-
- /**
- *
- * @param notification
- */
- protected abstract void manageSetNotification(Notification notification);
-
- /**
- *
- * @param notification
- */
- protected abstract void manageUnsetNotification(Notification notification);
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canEditAxisHeader()
- *
- * @return
- */
- @Override
- public boolean canEditAxisHeader() {
- return false;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#createManagedObjectList()
- *
- * @return
- */
- @Override
- protected final List<Object> createManagedObjectList() {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#addListeners()
- *
- */
- @Override
- protected void addListeners() {
- // nothing to do
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#axisManagerHasChanged(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- */
- @Override
- protected final void axisManagerHasChanged(Notification notification) {
- throw new UnsupportedOperationException(EXCEPTION_MESSAGE);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#initializeManagedObjectList()
- *
- */
- @Override
- protected void initializeManagedObjectList() {
- throw new UnsupportedOperationException(EXCEPTION_MESSAGE);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#dispose()
- *
- */
- @Override
- public void dispose() {
- super.dispose();
- this.eventList = null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#isAlreadyManaged(java.lang.Object)
- *
- * @param object
- * @return
- */
- @Override
- public boolean isAlreadyManaged(Object object) {
- return this.eventList.contains(object);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getAllManagedAxis()
- *
- * @return
- */
- @Override
- public final List<Object> getAllManagedAxis() {
- throw new UnsupportedOperationException(EXCEPTION_MESSAGE);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getElements(java.util.List)
- *
- * @param axisPositions
- * @return
- */
- @Override
- protected final List<Object> getElements(List<Integer> axisPositions) {
- throw new UnsupportedOperationException(EXCEPTION_MESSAGE);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.axis;
+
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import ca.odell.glazedlists.EventList;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractAxisManagerForEventList extends AbstractAxisManager implements IAxisManagerForEventList {
+
+ /**
+ * the event list used for the managed axis
+ */
+ protected EventList<Object> eventList;
+
+ /** the message displayed by an exception when we call an inherited method from IAxisManager, forbidden for IAxisManagerForEventList */
+ protected static final String EXCEPTION_MESSAGE = "This method cant be call for IAxisManagerForEventList";////$NON-NLS-1$
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList#setEventList(ca.odell.glazedlists.EventList)
+ *
+ * @param list
+ */
+ @Override
+ public final void setEventList(EventList<Object> list) {
+ this.eventList = list;
+ }
+
+
+ /**
+ * @param notification
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList#manageEvent(Notification)
+ */
+ @Override
+ public void manageEvent(Notification notification) {
+ if (ignoreEvent(notification)) {
+ return;
+ }
+ final int eventType = notification.getEventType();
+ switch (eventType) {
+ case Notification.SET:
+ manageSetNotification(notification);
+ break;
+ case Notification.UNSET:
+ manageUnsetNotification(notification);
+ break;
+ case Notification.ADD:
+ manageAddNotification(notification);
+ break;
+ case Notification.ADD_MANY:
+ manageAddManyNotification(notification);
+ break;
+ case Notification.MOVE:
+ manageMoveNotification(notification);
+ break;
+ case Notification.REMOVE:
+ manageRemoveNotification(notification);
+ break;
+ case Notification.REMOVE_MANY:
+ manageRemoveManyNotification(notification);
+ break;
+ default:
+ return;
+ }
+ }
+
+ /**
+ *
+ * @param notification
+ * a notification
+ * @return
+ * <code>true</code> if the notification must be ignored
+ */
+ protected boolean ignoreEvent(final Notification notification) {
+ if (notification.isTouch()) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @param notification
+ */
+ protected abstract void manageRemoveManyNotification(Notification notification);
+
+ /**
+ * @param notification
+ */
+ protected abstract void manageRemoveNotification(Notification notification);
+
+ /**
+ * @param notification
+ */
+ protected abstract void manageMoveNotification(Notification notification);
+
+ /**
+ * @param notification
+ */
+ protected abstract void manageAddManyNotification(Notification notification);
+
+ /**
+ * @param notification
+ */
+ protected abstract void manageAddNotification(Notification notification);
+
+ /**
+ *
+ * @param notification
+ */
+ protected abstract void manageSetNotification(Notification notification);
+
+ /**
+ *
+ * @param notification
+ */
+ protected abstract void manageUnsetNotification(Notification notification);
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canEditAxisHeader()
+ *
+ * @return
+ */
+ @Override
+ public boolean canEditAxisHeader() {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#createManagedObjectList()
+ *
+ * @return
+ */
+ @Override
+ protected final List<Object> createManagedObjectList() {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#addListeners()
+ *
+ */
+ @Override
+ protected void addListeners() {
+ // nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#axisManagerHasChanged(org.eclipse.emf.common.notify.Notification)
+ *
+ * @param notification
+ */
+ @Override
+ protected final void axisManagerHasChanged(Notification notification) {
+ throw new UnsupportedOperationException(EXCEPTION_MESSAGE);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#initializeManagedObjectList()
+ *
+ */
+ @Override
+ protected void initializeManagedObjectList() {
+ throw new UnsupportedOperationException(EXCEPTION_MESSAGE);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ this.eventList = null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#isAlreadyManaged(java.lang.Object)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ public boolean isAlreadyManaged(Object object) {
+ return this.eventList.contains(object);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getAllManagedAxis()
+ *
+ * @return
+ */
+ @Override
+ public final List<Object> getAllManagedAxis() {
+ throw new UnsupportedOperationException(EXCEPTION_MESSAGE);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getElements(java.util.List)
+ *
+ * @param axisPositions
+ * @return
+ */
+ @Override
+ protected final List<Object> getElements(List<Integer> axisPositions) {
+ throw new UnsupportedOperationException(EXCEPTION_MESSAGE);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IAxisManagerForEventList.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IAxisManagerForEventList.java
index 4b337f003e3..d2cf537cff7 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IAxisManagerForEventList.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IAxisManagerForEventList.java
@@ -1,44 +1,44 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.manager.axis;
-
-
-import org.eclipse.emf.common.notify.Notification;
-
-import ca.odell.glazedlists.EventList;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public interface IAxisManagerForEventList extends IAxisManager {
-
- /**
- *
- * @param notification
- */
- public void manageEvent(final Notification notification);
-
- /**
- *
- * @param list
- * the event list owning axis element
- */
- public void setEventList(final EventList<Object> list);
-
- /**
- * This method allows to notify the axis manager than the filling configuration has changed
- */
- public void fillingConfigurationsHaveChanged();
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.axis;
+
+
+import org.eclipse.emf.common.notify.Notification;
+
+import ca.odell.glazedlists.EventList;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public interface IAxisManagerForEventList extends IAxisManager {
+
+ /**
+ *
+ * @param notification
+ */
+ public void manageEvent(final Notification notification);
+
+ /**
+ *
+ * @param list
+ * the event list owning axis element
+ */
+ public void setEventList(final EventList<Object> list);
+
+ /**
+ * This method allows to notify the axis manager than the filling configuration has changed
+ */
+ public void fillingConfigurationsHaveChanged();
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ICompositeAxisManagerForEventList.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ICompositeAxisManagerForEventList.java
index f5c07c0d3e2..2e496e6cb75 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ICompositeAxisManagerForEventList.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ICompositeAxisManagerForEventList.java
@@ -1,31 +1,31 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.manager.axis;
-
-import java.util.List;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public interface ICompositeAxisManagerForEventList extends ICompositeAxisManager, IAxisManagerForEventList {
-
- /**
- *
- * @param subAxisManager
- * the managed axis manager
- */
- public void setSubAxisManagers(final List<IAxisManagerForEventList> subAxisManager);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.axis;
+
+import java.util.List;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public interface ICompositeAxisManagerForEventList extends ICompositeAxisManager, IAxisManagerForEventList {
+
+ /**
+ *
+ * @param subAxisManager
+ * the managed axis manager
+ */
+ public void setSubAxisManagers(final List<IAxisManagerForEventList> subAxisManager);
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IIdAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IIdAxisManager.java
index c15523b7a64..ec39d032c0e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IIdAxisManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/IIdAxisManager.java
@@ -1,31 +1,31 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.manager.axis;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public interface IIdAxisManager {
-
- /**
- *
- * @param path
- * a path
- * @return
- * the resolved object or <code>null</code> if it is not possible
- */
- public Object resolvedPath(final String path);
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.manager.axis;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface IIdAxisManager {
+
+ /**
+ *
+ * @param path
+ * a path
+ * @return
+ * the resolved object or <code>null</code> if it is not possible
+ */
+ public Object resolvedPath(final String path);
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisManagerForEventList.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisManagerForEventList.java
index 56658b01799..0dc2eaf5b2e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisManagerForEventList.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisManagerForEventList.java
@@ -1,99 +1,99 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.manager.axis;
-
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.nebula.widgets.nattable.sort.ISortModel;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public interface ITreeItemAxisManagerForEventList extends IAxisManagerForEventList {
-
- /**
- *
- * @param objectToTest
- * an object
- * @param semanticParent
- * the semantic parent of the object to test
- * @param conf
- * the configuration which provides the object to test
- * @param depth
- * the depth on which we want to apply this object
- * @return
- * <code>true</code> if the object is accepted and false if not
- */
- public boolean isAllowedContents(Object objectToTest, Object semanticParent, TreeFillingConfiguration conf, int depth);
-
- /**
- *
- * @param sortModel
- * the sort model to use
- * @param depth
- * the depth for which we want sort the elements
- * @param axis1
- * the first axis
- * @param axis2
- * the second axis
- * @return
- * @see Comparator#compare(Object, Object)
- */
- public int compare(final ISortModel sortModel, final int depth, final ITreeItemAxis axis1, final ITreeItemAxis axis2);
-
- /**
- * @param element
- * the expanded/collapsed element
- * @param path
- * the path of the element
- * @param expanded
- * if <code>true</code> the axis is expanded, if <code>false</code> the axis is collapsed
- */
- public void setExpanded(ITreeItemAxis element, List<ITreeItemAxis> path, boolean expanded);
-
- /**
- * This method must fill the event list with
- * <ul>
- * <li>root element</li>
- * <li>child of the roots elements</li>
- * <li>child of child of the roots elements, for expanded roots</li>
- * </ul>
- *
- * the others child of child of ... will be added by {@link #fillListWithChildren(ITreeItemAxis)}
- */
- public void fillListWithRoots();
-
- /**
- *
- * This method fill the list with the children of the axis
- *
- * @param axis
- * a tree item axis
- */
- public void fillListWithChildren(final ITreeItemAxis axis);
-
- /**
- *
- * @param toHide
- * the list of the depths for which we want hide the categories, can be <code>null</code>
- * @param toShow
- * the list of the depths for which we want display the categories, can be <code>null</code>
- */
- public void managedHideShowCategoriesForDepth(List<Integer> toHide, List<Integer> toShow);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.axis;
+
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.nebula.widgets.nattable.sort.ISortModel;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public interface ITreeItemAxisManagerForEventList extends IAxisManagerForEventList {
+
+ /**
+ *
+ * @param objectToTest
+ * an object
+ * @param semanticParent
+ * the semantic parent of the object to test
+ * @param conf
+ * the configuration which provides the object to test
+ * @param depth
+ * the depth on which we want to apply this object
+ * @return
+ * <code>true</code> if the object is accepted and false if not
+ */
+ public boolean isAllowedContents(Object objectToTest, Object semanticParent, TreeFillingConfiguration conf, int depth);
+
+ /**
+ *
+ * @param sortModel
+ * the sort model to use
+ * @param depth
+ * the depth for which we want sort the elements
+ * @param axis1
+ * the first axis
+ * @param axis2
+ * the second axis
+ * @return
+ * @see Comparator#compare(Object, Object)
+ */
+ public int compare(final ISortModel sortModel, final int depth, final ITreeItemAxis axis1, final ITreeItemAxis axis2);
+
+ /**
+ * @param element
+ * the expanded/collapsed element
+ * @param path
+ * the path of the element
+ * @param expanded
+ * if <code>true</code> the axis is expanded, if <code>false</code> the axis is collapsed
+ */
+ public void setExpanded(ITreeItemAxis element, List<ITreeItemAxis> path, boolean expanded);
+
+ /**
+ * This method must fill the event list with
+ * <ul>
+ * <li>root element</li>
+ * <li>child of the roots elements</li>
+ * <li>child of child of the roots elements, for expanded roots</li>
+ * </ul>
+ *
+ * the others child of child of ... will be added by {@link #fillListWithChildren(ITreeItemAxis)}
+ */
+ public void fillListWithRoots();
+
+ /**
+ *
+ * This method fill the list with the children of the axis
+ *
+ * @param axis
+ * a tree item axis
+ */
+ public void fillListWithChildren(final ITreeItemAxis axis);
+
+ /**
+ *
+ * @param toHide
+ * the list of the depths for which we want hide the categories, can be <code>null</code>
+ * @param toShow
+ * the list of the depths for which we want display the categories, can be <code>null</code>
+ */
+ public void managedHideShowCategoriesForDepth(List<Integer> toHide, List<Integer> toShow);
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/TreeFillingConfigurationCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/TreeFillingConfigurationCellManager.java
index ec44faf7129..bac1fb05775 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/TreeFillingConfigurationCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/TreeFillingConfigurationCellManager.java
@@ -1,65 +1,65 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.manager.cell;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
-
-/**
- * This cell manager allows to display empty string in body cells when the row element is {@link TreeFillingConfiguration}
- *
- * @author Vincent Lorenzo
- *
- */
-public class TreeFillingConfigurationCellManager extends AbstractCellManager implements ICellManager {
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#handles(java.lang.Object, java.lang.Object, INattableModelManager)
- *
- * @param columnElement
- * @param rowElement
- * @return
- */
- @Override
- public boolean handles(Object columnElement, Object rowElement, INattableModelManager tableManager) {
- return rowElement instanceof ITreeItemAxis && ((ITreeItemAxis) rowElement).getElement() instanceof TreeFillingConfiguration;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#isCellEditable(java.lang.Object, java.lang.Object, INattableModelManager)
- *
- * @param columnElement
- * @param rowElement
- * @return
- */
- @Override
- public boolean isCellEditable(Object columnElement, Object rowElement, INattableModelManager tableManager) {
- return false;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#doGetValue(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
- *
- * @param columnElement
- * @param rowElement
- * @param tableManager
- * @return
- */
- @Override
- protected Object doGetValue(Object columnElement, Object rowElement, INattableModelManager tableManager) {
- return EMPTY_STRING;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.manager.cell;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+
+/**
+ * This cell manager allows to display empty string in body cells when the row element is {@link TreeFillingConfiguration}
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class TreeFillingConfigurationCellManager extends AbstractCellManager implements ICellManager {
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#handles(java.lang.Object, java.lang.Object, INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @return
+ */
+ @Override
+ public boolean handles(Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ return rowElement instanceof ITreeItemAxis && ((ITreeItemAxis) rowElement).getElement() instanceof TreeFillingConfiguration;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#isCellEditable(java.lang.Object, java.lang.Object, INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @return
+ */
+ @Override
+ public boolean isCellEditable(Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#doGetValue(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ * @return
+ */
+ @Override
+ protected Object doGetValue(Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ return EMPTY_STRING;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITableAxisElementProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITableAxisElementProvider.java
index d1c067e831d..8b6174c39ff 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITableAxisElementProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITableAxisElementProvider.java
@@ -1,72 +1,72 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.manager.table;
-
-import java.util.List;
-
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.Cell;
-
-
-/**
- * This interface is used to get the elements on the axis
- *
- * @author Vincent Lorenzo
- *
- */
-public interface ITableAxisElementProvider {
-
- /**
- *
- * @return
- * the list of the elements displayed on columns
- */
- public List<Object> getColumnElementsList();
-
- /**
- *
- * @return
- * the list of the elements displayed on rows
- */
- public List<Object> getRowElementsList();
-
- /**
- *
- * @param index
- * the index of the wanted element
- * @return
- * the column element for this index or <code>null</code>
- */
- public Object getColumnElement(int index);
-
- /**
- *
- * @param index
- * the index of the wanted element
- * @return
- * the row element for this index or <code>null</code>
- */
- public Object getRowElement(int index);
-
- /**
- *
- * @param columnElement
- * the column element
- * @param rowElement
- * the row element
- * @return
- * the cell for this couple if existing on the model or <code>null</code>
- */
- public Cell getCell(final Object columnElement, final Object rowElement);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.manager.table;
+
+import java.util.List;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.Cell;
+
+
+/**
+ * This interface is used to get the elements on the axis
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface ITableAxisElementProvider {
+
+ /**
+ *
+ * @return
+ * the list of the elements displayed on columns
+ */
+ public List<Object> getColumnElementsList();
+
+ /**
+ *
+ * @return
+ * the list of the elements displayed on rows
+ */
+ public List<Object> getRowElementsList();
+
+ /**
+ *
+ * @param index
+ * the index of the wanted element
+ * @return
+ * the column element for this index or <code>null</code>
+ */
+ public Object getColumnElement(int index);
+
+ /**
+ *
+ * @param index
+ * the index of the wanted element
+ * @return
+ * the row element for this index or <code>null</code>
+ */
+ public Object getRowElement(int index);
+
+ /**
+ *
+ * @param columnElement
+ * the column element
+ * @param rowElement
+ * the row element
+ * @return
+ * the cell for this couple if existing on the model or <code>null</code>
+ */
+ public Cell getCell(final Object columnElement, final Object rowElement);
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java
index fcac6fb200e..f4dec331fb4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java
@@ -1,113 +1,113 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.manager.table;
-
-
-
-import java.util.List;
-
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
-import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum;
-import org.eclipse.papyrus.infra.nattable.tree.DatumTreeFormat;
-
-import ca.odell.glazedlists.TreeList;
-
-/**
- * This interface provides methods for Tree Table table manager
- *
- * @author Vincent Lorenzo
- *
- */
-public interface ITreeNattableModelManager extends INattableModelManager {
-
- /**
- *
- * @return
- * the tree format used for the table
- */
- public DatumTreeFormat getTreeFormat();
-
-
- /**
- * @param axis
- * an axis
- * @return
- * the depth of a ITreeItemAxis, that is to says, the number of {@link ITreeItemAxis} to cross to get the root {@link ITreeItemAxis}, included itself
- */
- public int getTreeItemDepth(ITreeItemAxis axis);
-
- /**
- *
- * @param axis
- * an axis
- * @return
- * the semantic depth, that is to say the number of semantic element before to cross to get the root {@link ITreeItemAxis}, included itself.
- * if the {@link ITreeItemAxis} represents a {@link TreeFillingConfiguration}, we return the depth of the configruation
- */
- public int getSemanticDepth(ITreeItemAxis axis);
-
- /**
- * This method allows to show/hide categories in the row header. It calls {@link #hideShowCategories(List, List)} and {@link #hideShowColumnCategoriesInRowHeader(List, List)}.
- *
- * @param depthToHide
- * the list of the depth for which we want to hide the categories
- * @param depthToShow
- * the list of the depth for which we want to show the categories
- */
- public void hideShowCategories(List<Integer> depthToHide, List<Integer> depthToShow);
-
- /**
- * This methods allows to hide the rows representing categories (TreeFillingConfiguration)
- *
- * @param depthToHide
- * the depth to hide
- * @param depthToShow
- * the depth to show
- */
- public void hideShowRowCategories(List<Integer> depthToHide, List<Integer> depthToShow);
-
-
- /**
- * This methods allows to hide the column, in the row header representing categories (TreeFillingConfiguration)
- *
- * @param depthToHide
- * the depth to hide
- * @param depthToShow
- * the depth to show
- */
- public void hideShowColumnCategoriesInRowHeader(List<Integer> depthToHide, List<Integer> depthToShow);
-
-
- /**
- * The action to use to expand or collapse node in the table.
- * See {@link CollapseAndExpandActionsEnum}
- *
- * @param actionId
- * the id of the action to do
- * @param selectedAxis
- * the list of axis to manage
- * <ul>
- * <li>this argument must be <code>null</code> for {@link CollapseAndExpandActionsEnum#COLLAPSE_ALL} and {@link CollapseAndExpandActionsEnum#EXPAND_ALL}</li>
- * <li>for others values of {@link CollapseAndExpandActionsEnum}, if selectedAxis
- * <ul>
- * <li>is <code>null</code> we use the current selection of the table (fully selected rows)</li>
- * <li>is not <code>null</code>, empty or with valid values, we use these axis instead of the current selection of the table</li>
- * </ul>
- * </ul>
- */
- public void doCollapseExpandAction(CollapseAndExpandActionsEnum actionId, List<ITreeItemAxis> selectedAxis);
-
- public TreeList getTreeList();
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.table;
+
+
+
+import java.util.List;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum;
+import org.eclipse.papyrus.infra.nattable.tree.DatumTreeFormat;
+
+import ca.odell.glazedlists.TreeList;
+
+/**
+ * This interface provides methods for Tree Table table manager
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface ITreeNattableModelManager extends INattableModelManager {
+
+ /**
+ *
+ * @return
+ * the tree format used for the table
+ */
+ public DatumTreeFormat getTreeFormat();
+
+
+ /**
+ * @param axis
+ * an axis
+ * @return
+ * the depth of a ITreeItemAxis, that is to says, the number of {@link ITreeItemAxis} to cross to get the root {@link ITreeItemAxis}, included itself
+ */
+ public int getTreeItemDepth(ITreeItemAxis axis);
+
+ /**
+ *
+ * @param axis
+ * an axis
+ * @return
+ * the semantic depth, that is to say the number of semantic element before to cross to get the root {@link ITreeItemAxis}, included itself.
+ * if the {@link ITreeItemAxis} represents a {@link TreeFillingConfiguration}, we return the depth of the configruation
+ */
+ public int getSemanticDepth(ITreeItemAxis axis);
+
+ /**
+ * This method allows to show/hide categories in the row header. It calls {@link #hideShowCategories(List, List)} and {@link #hideShowColumnCategoriesInRowHeader(List, List)}.
+ *
+ * @param depthToHide
+ * the list of the depth for which we want to hide the categories
+ * @param depthToShow
+ * the list of the depth for which we want to show the categories
+ */
+ public void hideShowCategories(List<Integer> depthToHide, List<Integer> depthToShow);
+
+ /**
+ * This methods allows to hide the rows representing categories (TreeFillingConfiguration)
+ *
+ * @param depthToHide
+ * the depth to hide
+ * @param depthToShow
+ * the depth to show
+ */
+ public void hideShowRowCategories(List<Integer> depthToHide, List<Integer> depthToShow);
+
+
+ /**
+ * This methods allows to hide the column, in the row header representing categories (TreeFillingConfiguration)
+ *
+ * @param depthToHide
+ * the depth to hide
+ * @param depthToShow
+ * the depth to show
+ */
+ public void hideShowColumnCategoriesInRowHeader(List<Integer> depthToHide, List<Integer> depthToShow);
+
+
+ /**
+ * The action to use to expand or collapse node in the table.
+ * See {@link CollapseAndExpandActionsEnum}
+ *
+ * @param actionId
+ * the id of the action to do
+ * @param selectedAxis
+ * the list of axis to manage
+ * <ul>
+ * <li>this argument must be <code>null</code> for {@link CollapseAndExpandActionsEnum#COLLAPSE_ALL} and {@link CollapseAndExpandActionsEnum#EXPAND_ALL}</li>
+ * <li>for others values of {@link CollapseAndExpandActionsEnum}, if selectedAxis
+ * <ul>
+ * <li>is <code>null</code> we use the current selection of the table (fully selected rows)</li>
+ * <li>is not <code>null</code>, empty or with valid values, we use these axis instead of the current selection of the table</li>
+ * </ul>
+ * </ul>
+ */
+ public void doCollapseExpandAction(CollapseAndExpandActionsEnum actionId, List<ITreeItemAxis> selectedAxis);
+
+ public TreeList getTreeList();
} \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java
index b982c3efdcc..c094bc8f225 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java
@@ -1,118 +1,118 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.painter;
-
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter;
-import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-
-/**
- * This checkbox painter allows to display text into the cell
- *
- * @author Vincent Lorenzo
- *
- */
-public class CustomCheckBoxPainter extends CheckBoxPainter {
-
- /**
- * the text painter used to paint N/A
- */
- private TextPainter textPainter = new CustomizedCellPainter();
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getCellPainterAt(int, int, org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
- * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param x
- * @param y
- * @param cell
- * @param gc
- * @param bounds
- * @param configRegistry
- * @return
- */
- @Override
- public ICellPainter getCellPainterAt(int x, int y, ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
- try {
- isChecked(cell, configRegistry);
- } catch (Exception e) {
- return this;
- }
- return super.getCellPainterAt(x, y, cell, gc, bounds, configRegistry);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#paintCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
- * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param cell
- * @param gc
- * @param bounds
- * @param configRegistry
- */
- @Override
- public void paintCell(ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
- try {
- isChecked(cell, configRegistry);
- } catch (Exception e) {
- this.textPainter.paintCell(cell, gc, bounds, configRegistry);
- return;
- }
- super.paintCell(cell, gc, bounds, configRegistry);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getPreferredWidth(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param cell
- * @param gc
- * @param configRegistry
- * @return
- */
- @Override
- public int getPreferredWidth(ILayerCell cell, GC gc, IConfigRegistry configRegistry) {
- try {
- isChecked(cell, configRegistry);
- } catch (Exception e) {
- return textPainter.getPreferredWidth(cell, gc, configRegistry);
- }
- return super.getPreferredWidth(cell, gc, configRegistry);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getPreferredHeight(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param cell
- * @param gc
- * @param configRegistry
- * @return
- */
- @Override
- public int getPreferredHeight(ILayerCell cell, GC gc, IConfigRegistry configRegistry) {
- try {
- isChecked(cell, configRegistry);
- } catch (Exception e) {
- return textPainter.getPreferredHeight(cell, gc, configRegistry);
- }
- return super.getPreferredHeight(cell, gc, configRegistry);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.painter;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * This checkbox painter allows to display text into the cell
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class CustomCheckBoxPainter extends CheckBoxPainter {
+
+ /**
+ * the text painter used to paint N/A
+ */
+ private TextPainter textPainter = new CustomizedCellPainter();
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getCellPainterAt(int, int, org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
+ * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param x
+ * @param y
+ * @param cell
+ * @param gc
+ * @param bounds
+ * @param configRegistry
+ * @return
+ */
+ @Override
+ public ICellPainter getCellPainterAt(int x, int y, ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
+ try {
+ isChecked(cell, configRegistry);
+ } catch (Exception e) {
+ return this;
+ }
+ return super.getCellPainterAt(x, y, cell, gc, bounds, configRegistry);
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#paintCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
+ * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param cell
+ * @param gc
+ * @param bounds
+ * @param configRegistry
+ */
+ @Override
+ public void paintCell(ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
+ try {
+ isChecked(cell, configRegistry);
+ } catch (Exception e) {
+ this.textPainter.paintCell(cell, gc, bounds, configRegistry);
+ return;
+ }
+ super.paintCell(cell, gc, bounds, configRegistry);
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getPreferredWidth(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param cell
+ * @param gc
+ * @param configRegistry
+ * @return
+ */
+ @Override
+ public int getPreferredWidth(ILayerCell cell, GC gc, IConfigRegistry configRegistry) {
+ try {
+ isChecked(cell, configRegistry);
+ } catch (Exception e) {
+ return textPainter.getPreferredWidth(cell, gc, configRegistry);
+ }
+ return super.getPreferredWidth(cell, gc, configRegistry);
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getPreferredHeight(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param cell
+ * @param gc
+ * @param configRegistry
+ * @return
+ */
+ @Override
+ public int getPreferredHeight(ILayerCell cell, GC gc, IConfigRegistry configRegistry) {
+ try {
+ isChecked(cell, configRegistry);
+ } catch (Exception e) {
+ return textPainter.getPreferredHeight(cell, gc, configRegistry);
+ }
+ return super.getPreferredHeight(cell, gc, configRegistry);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomImagePainter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomImagePainter.java
index 6a3343030a4..d821f4fa47c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomImagePainter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomImagePainter.java
@@ -1,52 +1,52 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.painter;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.nattable.utils.Constants;
-import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
-import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.swt.graphics.Image;
-
-/**
- *
- * Custom Image painter for the header of the table
- *
- */
-public class CustomImagePainter extends ImagePainter {
-
- private LabelProviderCellContextElementWrapper contextElement = new LabelProviderCellContextElementWrapper();
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getImage(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param cell
- * @param configRegistry
- * @return
- */
- @Override
- protected Image getImage(ILayerCell cell, IConfigRegistry configRegistry) {
- contextElement.setConfigRegistry(configRegistry);
- contextElement.setCell(cell);
- contextElement.setObject(cell.getDataValue());
- final LabelProviderService serv = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- final ILabelProvider provider = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT, contextElement);
- return provider.getImage(contextElement);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.painter;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.nattable.utils.Constants;
+import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
+import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ * Custom Image painter for the header of the table
+ *
+ */
+public class CustomImagePainter extends ImagePainter {
+
+ private LabelProviderCellContextElementWrapper contextElement = new LabelProviderCellContextElementWrapper();
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getImage(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param cell
+ * @param configRegistry
+ * @return
+ */
+ @Override
+ protected Image getImage(ILayerCell cell, IConfigRegistry configRegistry) {
+ contextElement.setConfigRegistry(configRegistry);
+ contextElement.setCell(cell);
+ contextElement.setObject(cell.getDataValue());
+ final LabelProviderService serv = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ final ILabelProvider provider = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT, contextElement);
+ return provider.getImage(contextElement);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusBeveledBorderDecorator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusBeveledBorderDecorator.java
index da866c421a4..cd6a434e185 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusBeveledBorderDecorator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusBeveledBorderDecorator.java
@@ -1,78 +1,78 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.painter;
-
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.nebula.widgets.nattable.layer.cell.TranslatedLayerCell;
-import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
-import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator;
-import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class PapyrusBeveledBorderDecorator extends BeveledBorderDecorator {
-
- /**
- * Constructor.
- *
- * @param interiorPainter
- */
- public PapyrusBeveledBorderDecorator(ICellPainter interiorPainter) {
- super(interiorPainter);
- }
-
- /**
- * Constructor.
- *
- * @param interiorPainter
- * @param uplift
- */
- public PapyrusBeveledBorderDecorator(ICellPainter interiorPainter, boolean uplift) {
- super(interiorPainter, uplift);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator#paintCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
- * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param cell
- * @param gc
- * @param adjustedCellBounds
- * @param configRegistry
- */
- @Override
- public void paintCell(ILayerCell cell, GC gc, Rectangle adjustedCellBounds, IConfigRegistry configRegistry) {
- LabelStack labels = null;
- if (cell instanceof TranslatedLayerCell) {
- labels = cell.getConfigLabels();
- }
- if (labels != null) {
- if (!labels.hasLabel(TreeLayer.TREE_COLUMN_CELL)) {
- super.paintCell(cell, gc, adjustedCellBounds, configRegistry);
- return;
- } else {
- if (getWrappedPainter() != null) {
- getWrappedPainter().paintCell(cell, gc, adjustedCellBounds, configRegistry);
- }
- }
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.painter;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.layer.cell.TranslatedLayerCell;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator;
+import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class PapyrusBeveledBorderDecorator extends BeveledBorderDecorator {
+
+ /**
+ * Constructor.
+ *
+ * @param interiorPainter
+ */
+ public PapyrusBeveledBorderDecorator(ICellPainter interiorPainter) {
+ super(interiorPainter);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param interiorPainter
+ * @param uplift
+ */
+ public PapyrusBeveledBorderDecorator(ICellPainter interiorPainter, boolean uplift) {
+ super(interiorPainter, uplift);
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator#paintCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
+ * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param cell
+ * @param gc
+ * @param adjustedCellBounds
+ * @param configRegistry
+ */
+ @Override
+ public void paintCell(ILayerCell cell, GC gc, Rectangle adjustedCellBounds, IConfigRegistry configRegistry) {
+ LabelStack labels = null;
+ if (cell instanceof TranslatedLayerCell) {
+ labels = cell.getConfigLabels();
+ }
+ if (labels != null) {
+ if (!labels.hasLabel(TreeLayer.TREE_COLUMN_CELL)) {
+ super.paintCell(cell, gc, adjustedCellBounds, configRegistry);
+ return;
+ } else {
+ if (getWrappedPainter() != null) {
+ getWrappedPainter().paintCell(cell, gc, adjustedCellBounds, configRegistry);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/AddToResource.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/AddToResource.java
index 88e4d0404b1..72925c8a911 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/AddToResource.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/AddToResource.java
@@ -1,73 +1,73 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.paste;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class AddToResource implements IValueSetter {
-
- /**
- * the managed resource
- */
- private final Resource resource;
-
- /**
- * the object to add to the resource
- */
- private final EObject toAdd;
-
- /**
- *
- * Constructor.
- *
- * @param resource
- * @param feature
- * @param toAdd
- */
- public AddToResource(final Resource resource, final EObject toAdd) {
- this.resource = resource;
- this.toAdd = toAdd;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.paste.IValueSetter#doSetValue(org.eclipse.emf.edit.domain.EditingDomain)
- *
- * @param domain
- */
- @Override
- public void doSetValue(EditingDomain domain) {
- if (resource != null && toAdd != null) {
- final Command cmd = new RecordingCommand((TransactionalEditingDomain) domain) {
-
- @Override
- protected void doExecute() {
- resource.getContents().add(toAdd);
- }
- };
- cmd.execute();
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.paste;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class AddToResource implements IValueSetter {
+
+ /**
+ * the managed resource
+ */
+ private final Resource resource;
+
+ /**
+ * the object to add to the resource
+ */
+ private final EObject toAdd;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param resource
+ * @param feature
+ * @param toAdd
+ */
+ public AddToResource(final Resource resource, final EObject toAdd) {
+ this.resource = resource;
+ this.toAdd = toAdd;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.paste.IValueSetter#doSetValue(org.eclipse.emf.edit.domain.EditingDomain)
+ *
+ * @param domain
+ */
+ @Override
+ public void doSetValue(EditingDomain domain) {
+ if (resource != null && toAdd != null) {
+ final Command cmd = new RecordingCommand((TransactionalEditingDomain) domain) {
+
+ @Override
+ protected void doExecute() {
+ resource.getContents().add(toAdd);
+ }
+ };
+ cmd.execute();
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IPastePostAction.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IPastePostAction.java
index 8194cb14eac..ee8ff13813d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IPastePostAction.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IPastePostAction.java
@@ -1,80 +1,80 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.paste;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- * Common interface for paste post actions
- *
- * @author Vincent Lorenzo
- *
- */
-
-public interface IPastePostAction {
-
- /**
- *
- * @param postActionId
- * the id of the post action
- * @return
- * <code>true</code> if this id is managed by the PostAction
- */
- public boolean accept(final String postActionId);
-
- /**
- * This method will be called one time by new pasted axis
- *
- * @param tableManager
- * the table manager
- * @param postActionId
- * the post action id
- * @param editedElement
- * the edited element
- * @param sharedMap
- * the map where the class managing the paste and the set value can store interesting information
- *
- *
- *
- */
- public void doPostAction(final INattableModelManager tableManager, final String postActionId, final Object editedElement, final Map<Object, Object> sharedMap);
-
-
- /**
- * This method will be called one time, at the end of the paste action
- *
- * @param tableManager
- * the table manager
- * @param postActionId
- * the post action id
- * @param sharedMap
- * the map where the class managing the paste and the set value can store interesting information
- */
- public void concludePostAction(final INattableModelManager tableManager, final String postActionId, final Map<Object, Object> sharedMap);
-
- /**
- *
- * @param tableManager
- * the table manager
- * @param object
- * the object
- * @return
- * the possible post actions for this object
- */
- public Collection<String> getAvailablePostActionIds(final INattableModelManager tableManager, final Object object);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.paste;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ * Common interface for paste post actions
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+
+public interface IPastePostAction {
+
+ /**
+ *
+ * @param postActionId
+ * the id of the post action
+ * @return
+ * <code>true</code> if this id is managed by the PostAction
+ */
+ public boolean accept(final String postActionId);
+
+ /**
+ * This method will be called one time by new pasted axis
+ *
+ * @param tableManager
+ * the table manager
+ * @param postActionId
+ * the post action id
+ * @param editedElement
+ * the edited element
+ * @param sharedMap
+ * the map where the class managing the paste and the set value can store interesting information
+ *
+ *
+ *
+ */
+ public void doPostAction(final INattableModelManager tableManager, final String postActionId, final Object editedElement, final Map<Object, Object> sharedMap);
+
+
+ /**
+ * This method will be called one time, at the end of the paste action
+ *
+ * @param tableManager
+ * the table manager
+ * @param postActionId
+ * the post action id
+ * @param sharedMap
+ * the map where the class managing the paste and the set value can store interesting information
+ */
+ public void concludePostAction(final INattableModelManager tableManager, final String postActionId, final Map<Object, Object> sharedMap);
+
+ /**
+ *
+ * @param tableManager
+ * the table manager
+ * @param object
+ * the object
+ * @return
+ * the possible post actions for this object
+ */
+ public Collection<String> getAvailablePostActionIds(final INattableModelManager tableManager, final Object object);
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IValueSetter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IValueSetter.java
index cdd9bbf3316..16bf17c18c1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IValueSetter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/IValueSetter.java
@@ -1,36 +1,36 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.paste;
-
-import org.eclipse.emf.edit.domain.EditingDomain;
-
-/**
- * Common interface used by the paste framework when we are not in the service edit.
- *
- *
- *
- * @author Vincent Lorenzo
- *
- */
-public interface IValueSetter {
-
- /**
- *
- * This method will be used to set references, without using the service edit
- *
- * @param domain
- * the editing domain
- */
- public void doSetValue(final EditingDomain domain);
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.paste;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+
+/**
+ * Common interface used by the paste framework when we are not in the service edit.
+ *
+ *
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface IValueSetter {
+
+ /**
+ *
+ * This method will be used to set references, without using the service edit
+ *
+ * @param domain
+ * the editing domain
+ */
+ public void doSetValue(final EditingDomain domain);
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PastePostActionRegistry.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PastePostActionRegistry.java
index fe8851e48fb..390e9db4482 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PastePostActionRegistry.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PastePostActionRegistry.java
@@ -1,144 +1,144 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.paste;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-/**
- * The Paste Post Action registry
- *
- * @author Vincent Lorenzo
- *
- */
-public final class PastePostActionRegistry {
-
-
- private static final String CLASS_MANAGER = "postActionClass"; //$NON-NLS-1$
-
- private static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.paste.postactions"; //$NON-NLS-1$
-
-
- private final Collection<IPastePostAction> postActions;
-
- /**
- * The cell manager factory
- */
- public static final PastePostActionRegistry INSTANCE = new PastePostActionRegistry();
-
- /**
- *
- * Constructor.
- * Initialize the field of the class
- */
- private PastePostActionRegistry() {
- this.postActions = new ArrayList<IPastePostAction>();
- final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
-
- for (final IConfigurationElement iConfigurationElement : configElements) {
- try {
- final IPastePostAction solver = (IPastePostAction) iConfigurationElement.createExecutableExtension(CLASS_MANAGER);
- this.postActions.add(solver);
- } catch (final CoreException e) {
- Activator.log.error(e);
- }
- }
- }
-
- /**
- *
- * @param tableManager
- * the table manager
- * @param postActionId
- * the post action id
- * @param tableContext
- * @param objectToEdit
- * the object to edit
- * @param sharedMap
- * the map where the class managing the paste and the set value can store interesting information
- * @param axisAsString
- *
- */
- public void doPostAction(final INattableModelManager tableManager, final String postActionId, final EObject tableContext, final Object objectToEdit, final Map<Object, Object> sharedMap, final String axisAsString) {
- final IPastePostAction postAction = getPostAction(postActionId);
- if (postAction != null) {
- postAction.doPostAction(tableManager, postActionId, objectToEdit, sharedMap);
- } else {
- Activator.log.warn(NLS.bind("No Manager were found to manage {0}", postActionId)); //$NON-NLS-1$
- }
- }
-
- /**
- *
- * @param tableManager
- * the table manager
- * @param postActionId
- * the id of the post action
- * @param sharedMap
- * the map where the class managing the paste and the set value can store interesting information
- */
- public void concludePostAction(final INattableModelManager tableManager, final String postActionId, final Map<Object, Object> sharedMap) {
- final IPastePostAction postAction = getPostAction(postActionId);
- if (postAction != null) {
- postAction.concludePostAction(tableManager, postActionId, sharedMap);
- } else {
- Activator.log.warn(NLS.bind("No Manager were found to manage {0}", postActionId)); //$NON-NLS-1$
- }
-
- }
-
- /**
- *
- * @param postActionId
- * @return
- * the post action managing this id
- */
- private IPastePostAction getPostAction(final String postActionId) {
- for (final IPastePostAction current : this.postActions) {
- if (current.accept(postActionId)) {
- return current;
- }
- }
- return null;
- }
-
- /**
- *
- * @param tableManager
- * the current table manager
- * @param object
- * an object
- * @return
- * the possible post actions for this objects
- */
- public Collection<String> getAvailablePostActionIds(final INattableModelManager tableManager, final Object object) {
- final List<String> postActions = new ArrayList<String>();
- for (final IPastePostAction current : this.postActions) {
- postActions.addAll(current.getAvailablePostActionIds(tableManager, object));
- }
- Collections.sort(postActions);
- return postActions;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.paste;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ * The Paste Post Action registry
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public final class PastePostActionRegistry {
+
+
+ private static final String CLASS_MANAGER = "postActionClass"; //$NON-NLS-1$
+
+ private static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.paste.postactions"; //$NON-NLS-1$
+
+
+ private final Collection<IPastePostAction> postActions;
+
+ /**
+ * The cell manager factory
+ */
+ public static final PastePostActionRegistry INSTANCE = new PastePostActionRegistry();
+
+ /**
+ *
+ * Constructor.
+ * Initialize the field of the class
+ */
+ private PastePostActionRegistry() {
+ this.postActions = new ArrayList<IPastePostAction>();
+ final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+
+ for (final IConfigurationElement iConfigurationElement : configElements) {
+ try {
+ final IPastePostAction solver = (IPastePostAction) iConfigurationElement.createExecutableExtension(CLASS_MANAGER);
+ this.postActions.add(solver);
+ } catch (final CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param tableManager
+ * the table manager
+ * @param postActionId
+ * the post action id
+ * @param tableContext
+ * @param objectToEdit
+ * the object to edit
+ * @param sharedMap
+ * the map where the class managing the paste and the set value can store interesting information
+ * @param axisAsString
+ *
+ */
+ public void doPostAction(final INattableModelManager tableManager, final String postActionId, final EObject tableContext, final Object objectToEdit, final Map<Object, Object> sharedMap, final String axisAsString) {
+ final IPastePostAction postAction = getPostAction(postActionId);
+ if (postAction != null) {
+ postAction.doPostAction(tableManager, postActionId, objectToEdit, sharedMap);
+ } else {
+ Activator.log.warn(NLS.bind("No Manager were found to manage {0}", postActionId)); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ * @param tableManager
+ * the table manager
+ * @param postActionId
+ * the id of the post action
+ * @param sharedMap
+ * the map where the class managing the paste and the set value can store interesting information
+ */
+ public void concludePostAction(final INattableModelManager tableManager, final String postActionId, final Map<Object, Object> sharedMap) {
+ final IPastePostAction postAction = getPostAction(postActionId);
+ if (postAction != null) {
+ postAction.concludePostAction(tableManager, postActionId, sharedMap);
+ } else {
+ Activator.log.warn(NLS.bind("No Manager were found to manage {0}", postActionId)); //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ *
+ * @param postActionId
+ * @return
+ * the post action managing this id
+ */
+ private IPastePostAction getPostAction(final String postActionId) {
+ for (final IPastePostAction current : this.postActions) {
+ if (current.accept(postActionId)) {
+ return current;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param tableManager
+ * the current table manager
+ * @param object
+ * an object
+ * @return
+ * the possible post actions for this objects
+ */
+ public Collection<String> getAvailablePostActionIds(final INattableModelManager tableManager, final Object object) {
+ final List<String> postActions = new ArrayList<String>();
+ for (final IPastePostAction current : this.postActions) {
+ postActions.addAll(current.getAvailablePostActionIds(tableManager, object));
+ }
+ Collections.sort(postActions);
+ return postActions;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PasteSeparator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PasteSeparator.java
index 5907a7efd49..7cd70bf7ad9 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PasteSeparator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/PasteSeparator.java
@@ -1,101 +1,101 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.paste;
-
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-
-
-/**
- *
- * Enumeration for cell delimiters in CSV files
- *
- */
-public enum PasteSeparator {
- /**
- * tabulation value
- */
- TABULATION('\t', Messages.PasteSeparator_Tabulation),
-
- /**
- * semicolon value
- */
- SEMICOLON(';', Messages.PasteSeparator_Semicolon),
-
- /**
- * Comma value
- */
- COMMA(',', Messages.PasteSeparator_Comma),
- /**
- * space value
- */
- SPACE(' ', Messages.PasteSeparator_Space),
-
- /**
- * other value
- */
- OTHER(Messages.PasteSeparator_Other);
-
- /**
- * the separator itself
- */
- private final char separator;
-
- /**
- * the name of the separator
- */
- private final String name;
-
- /**
- *
- * Constructor.
- *
- * @param name
- */
- private PasteSeparator(final String name) {
- this(Character.MIN_VALUE, name);// MIN_VALUE is a value as other one!
- }
-
- /**
- *
- * Constructor.
- *
- * @param separator
- * @param name
- */
- private PasteSeparator(char separator, String name) {
- this.separator = separator;
- this.name = name;
- }
-
- /**
- *
- * @return
- * the separator to use
- */
- public char getSeparator() {
- if (this == OTHER) {
- throw new UnsupportedOperationException();
- }
- return separator;
- }
-
- /**
- *
- * @return
- * the name of the separator
- */
- public String getName() {
- return name;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.paste;
+
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+
+
+/**
+ *
+ * Enumeration for cell delimiters in CSV files
+ *
+ */
+public enum PasteSeparator {
+ /**
+ * tabulation value
+ */
+ TABULATION('\t', Messages.PasteSeparator_Tabulation),
+
+ /**
+ * semicolon value
+ */
+ SEMICOLON(';', Messages.PasteSeparator_Semicolon),
+
+ /**
+ * Comma value
+ */
+ COMMA(',', Messages.PasteSeparator_Comma),
+ /**
+ * space value
+ */
+ SPACE(' ', Messages.PasteSeparator_Space),
+
+ /**
+ * other value
+ */
+ OTHER(Messages.PasteSeparator_Other);
+
+ /**
+ * the separator itself
+ */
+ private final char separator;
+
+ /**
+ * the name of the separator
+ */
+ private final String name;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param name
+ */
+ private PasteSeparator(final String name) {
+ this(Character.MIN_VALUE, name);// MIN_VALUE is a value as other one!
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param separator
+ * @param name
+ */
+ private PasteSeparator(char separator, String name) {
+ this.separator = separator;
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ * the separator to use
+ */
+ public char getSeparator() {
+ if (this == OTHER) {
+ throw new UnsupportedOperationException();
+ }
+ return separator;
+ }
+
+ /**
+ *
+ * @return
+ * the name of the separator
+ */
+ public String getName() {
+ return name;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/ReferenceValueSetter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/ReferenceValueSetter.java
index 8f69af0ea70..465102d958f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/ReferenceValueSetter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/ReferenceValueSetter.java
@@ -1,110 +1,110 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.paste;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.emf.edit.domain.EditingDomain;
-
-/**
- * A structure which is used to store values to set for a given feature and a given object
- *
- * @author Vincent Lorenzo
- *
- */
-public class ReferenceValueSetter implements IValueSetter {
-
- /**
- * the feature to edit
- */
- private final EReference eReference;
-
- /**
- * the edited object
- */
- private final EObject editedObject;
-
- /**
- * the new value
- */
- protected final Object value;
-
- /**
- * if true, the current value will be erased
- */
- private final boolean eraseExistingMultiValueValue;
-
- /**
- *
- * Constructor.
- *
- * @param editedObject
- * the edited object
- * @param feature
- * the edited feature
- * @param value
- * the value for this feature. If the feature is multivalued, the newValue will be added to the existing value
- */
- public ReferenceValueSetter(final EObject editedObject, final EReference feature, final Object value) {
- this(editedObject, feature, value, false);
- }
-
- /**
- *
- * Constructor.
- *
- * @param editedObject
- * the edited object
- * @param feature
- * the edited feature
- * @param value
- * the value for this feature.
- * @param eraseExistingMultiValueValue
- * if <code>true</code>, in case of multivalued references, the current value will be replaced by {@code tutu} , if <code>false</code> we
- * will add {@code tutu} to the current value
- * , will be added to the current value
- */
- public ReferenceValueSetter(final EObject editedObject, final EReference feature, final Object value, final boolean eraseExistingMultiValueValue) {
- this.eReference = feature;
- this.editedObject = editedObject;
- this.value = value;
- this.eraseExistingMultiValueValue = eraseExistingMultiValueValue;
- }
-
- /**
- * set the value of the reference
- *
- * @param domain
- * the editing domain used to do the action
- */
- @Deprecated
- // deprecated since october 2013. use doSetValue instead of this method
- public void setReferenceValue(final EditingDomain domain) {
- doSetValue(domain);
- }
-
- @Override
- public void doSetValue(final EditingDomain domain) {
- if (this.eReference.isMany() && !this.eraseExistingMultiValueValue && this.value instanceof Collection<?>) {
- Collection<?> collection = (Collection<?>) value;
- AddCommand.create(domain, editedObject, eReference, collection).execute();
- } else {
- SetCommand.create(domain, editedObject, eReference, value).execute();
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.paste;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+
+/**
+ * A structure which is used to store values to set for a given feature and a given object
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ReferenceValueSetter implements IValueSetter {
+
+ /**
+ * the feature to edit
+ */
+ private final EReference eReference;
+
+ /**
+ * the edited object
+ */
+ private final EObject editedObject;
+
+ /**
+ * the new value
+ */
+ protected final Object value;
+
+ /**
+ * if true, the current value will be erased
+ */
+ private final boolean eraseExistingMultiValueValue;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param editedObject
+ * the edited object
+ * @param feature
+ * the edited feature
+ * @param value
+ * the value for this feature. If the feature is multivalued, the newValue will be added to the existing value
+ */
+ public ReferenceValueSetter(final EObject editedObject, final EReference feature, final Object value) {
+ this(editedObject, feature, value, false);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param editedObject
+ * the edited object
+ * @param feature
+ * the edited feature
+ * @param value
+ * the value for this feature.
+ * @param eraseExistingMultiValueValue
+ * if <code>true</code>, in case of multivalued references, the current value will be replaced by {@code tutu} , if <code>false</code> we
+ * will add {@code tutu} to the current value
+ * , will be added to the current value
+ */
+ public ReferenceValueSetter(final EObject editedObject, final EReference feature, final Object value, final boolean eraseExistingMultiValueValue) {
+ this.eReference = feature;
+ this.editedObject = editedObject;
+ this.value = value;
+ this.eraseExistingMultiValueValue = eraseExistingMultiValueValue;
+ }
+
+ /**
+ * set the value of the reference
+ *
+ * @param domain
+ * the editing domain used to do the action
+ */
+ @Deprecated
+ // deprecated since october 2013. use doSetValue instead of this method
+ public void setReferenceValue(final EditingDomain domain) {
+ doSetValue(domain);
+ }
+
+ @Override
+ public void doSetValue(final EditingDomain domain) {
+ if (this.eReference.isMany() && !this.eraseExistingMultiValueValue && this.value instanceof Collection<?>) {
+ Collection<?> collection = (Collection<?>) value;
+ AddCommand.create(domain, editedObject, eReference, collection).execute();
+ } else {
+ SetCommand.create(domain, editedObject, eReference, value).execute();
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/TextDelimiter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/TextDelimiter.java
index c7b6eb6df4c..7b0d24c769e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/TextDelimiter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/paste/TextDelimiter.java
@@ -1,74 +1,74 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.paste;
-
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-
-/**
- *
- * Enumeration for text delimiters
- *
- */
-public enum TextDelimiter {
-
- /**
- * the single quote
- */
- SINGLE_QUOTE('\'', Messages.TextDelimiter_Quote),
-
- /**
- * the double quote
- */
- DOUBLE_QUOTE('"', Messages.TextDelimiter_DoubleQuote);
-
- /**
- * the delimiter itself
- */
- private final char delimiter;
-
- /**
- * the name of the delimiter
- */
- private final String name;
-
- /**
- *
- * Constructor.
- *
- * @param delimiter
- * @param name
- */
- private TextDelimiter(char delimiter, String name) {
- this.delimiter = delimiter;
- this.name = name;
- }
-
- /**
- *
- * @return
- * the separator to use
- */
- public char getDelimiter() {
- return delimiter;
- }
-
- /**
- *
- * @return
- * the name of the separator
- */
- public String getName() {
- return name;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.paste;
+
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+
+/**
+ *
+ * Enumeration for text delimiters
+ *
+ */
+public enum TextDelimiter {
+
+ /**
+ * the single quote
+ */
+ SINGLE_QUOTE('\'', Messages.TextDelimiter_Quote),
+
+ /**
+ * the double quote
+ */
+ DOUBLE_QUOTE('"', Messages.TextDelimiter_DoubleQuote);
+
+ /**
+ * the delimiter itself
+ */
+ private final char delimiter;
+
+ /**
+ * the name of the delimiter
+ */
+ private final String name;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param delimiter
+ * @param name
+ */
+ private TextDelimiter(char delimiter, String name) {
+ this.delimiter = delimiter;
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ * the separator to use
+ */
+ public char getDelimiter() {
+ return delimiter;
+ }
+
+ /**
+ *
+ * @return
+ * the name of the separator
+ */
+ public String getName() {
+ return name;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/PapyrusTablePreferenceStore.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/PapyrusTablePreferenceStore.java
index 8d490798977..7f13de2db35 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/PapyrusTablePreferenceStore.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/PapyrusTablePreferenceStore.java
@@ -1,68 +1,68 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.preferences;
-
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferenceStore;
-import org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractApplyValueOnPreferenceKeyDialog;
-
-/**
- * this class is a specific store that is used to look for value of element
- * by taking account the structure of preferences : papyrus editor-> Diagram -> Elements of Diagram
- *
- */
-public class PapyrusTablePreferenceStore extends AbstractPapyrusPreferenceStore {
-
- /**
- *
- * Constructor.
- *
- * @param context
- * @param qualifier
- * @param defaultQualifierPath
- */
- public PapyrusTablePreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) {
- super(context, qualifier, defaultQualifierPath, TablePreferencesConstantsHelper.PAPYRUS_TABLE_EDITOR_PREFERENCE_PREFIX, TablePreferencesConstantsHelper.TABLE_PREFERENCE_PREFIX, TablePreferencesConstantsHelper.TABLE_ELEMENT);
- }
-
-
- /**
- *
- * Constructor.
- *
- * @param context
- * @param qualifier
- */
- public PapyrusTablePreferenceStore(IScopeContext context, String qualifier) {
- super(context, qualifier, TablePreferencesConstantsHelper.PAPYRUS_TABLE_EDITOR_PREFERENCE_PREFIX, TablePreferencesConstantsHelper.TABLE_PREFERENCE_PREFIX, TablePreferencesConstantsHelper.TABLE_ELEMENT);
- }
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferenceStore#createPreferenceKeyDialog(java.lang.String[])
- *
- * @param keys
- * @return
- */
- @Override
- protected AbstractApplyValueOnPreferenceKeyDialog createPreferenceKeyDialog(String[] keys) {
- throw new UnsupportedOperationException("not yet implemented"); //$NON-NLS-1$
- }
-
-
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.preferences;
+
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferenceStore;
+import org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractApplyValueOnPreferenceKeyDialog;
+
+/**
+ * this class is a specific store that is used to look for value of element
+ * by taking account the structure of preferences : papyrus editor-> Diagram -> Elements of Diagram
+ *
+ */
+public class PapyrusTablePreferenceStore extends AbstractPapyrusPreferenceStore {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param context
+ * @param qualifier
+ * @param defaultQualifierPath
+ */
+ public PapyrusTablePreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) {
+ super(context, qualifier, defaultQualifierPath, TablePreferencesConstantsHelper.PAPYRUS_TABLE_EDITOR_PREFERENCE_PREFIX, TablePreferencesConstantsHelper.TABLE_PREFERENCE_PREFIX, TablePreferencesConstantsHelper.TABLE_ELEMENT);
+ }
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param context
+ * @param qualifier
+ */
+ public PapyrusTablePreferenceStore(IScopeContext context, String qualifier) {
+ super(context, qualifier, TablePreferencesConstantsHelper.PAPYRUS_TABLE_EDITOR_PREFERENCE_PREFIX, TablePreferencesConstantsHelper.TABLE_PREFERENCE_PREFIX, TablePreferencesConstantsHelper.TABLE_ELEMENT);
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferenceStore#createPreferenceKeyDialog(java.lang.String[])
+ *
+ * @param keys
+ * @return
+ */
+ @Override
+ protected AbstractApplyValueOnPreferenceKeyDialog createPreferenceKeyDialog(String[] keys) {
+ throw new UnsupportedOperationException("not yet implemented"); //$NON-NLS-1$
+ }
+
+
+
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/TablePreferencesConstantsHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/TablePreferencesConstantsHelper.java
index 72be0357b29..c2b136d31d1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/TablePreferencesConstantsHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/TablePreferencesConstantsHelper.java
@@ -1,86 +1,86 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.preferences;
-
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class TablePreferencesConstantsHelper {
-
- private TablePreferencesConstantsHelper() {
- // to prevent instanciation
- }
-
- /**
- * Prefix for preference for Papyrus nattable Level editor
- */
- public final static String PAPYRUS_TABLE_EDITOR_PREFERENCE_PREFIX = "PAPYRUS_TABLE_EDITOR"; //$NON-NLS-1$
-
- /**
- * Prefix for preference for Diagram Level
- */
- public final static String TABLE_PREFERENCE_PREFIX = "NATTABLE_"; //$NON-NLS-1$
-
- /**
- * Prefix for preference for element Level
- */
- public final static String TABLE_ELEMENT = "TABLE_ELEMENT_"; //$NON-NLS-1$
-
- /**
- * Get the preference constant used to store the preference of an element.
- *
- * @param elementName
- * the name of the element
- * @param preferenceType
- * the type of preference to store. It must be a value defined in {@link TablePreferencesConstantsHelper}
- * @return the constant used.
- */
- public static String getConstant(String elementName, int preferenceType) {
- throw new UnsupportedOperationException("Not yet implemented");//$NON-NLS-1$
- // StringBuffer sb = new StringBuffer();
- // sb.append(elementName);
- // sb.append("."); //$NON-NLS-1$
- // switch(preferenceType) {
- //
- // default:
- // break;
- // }
- // return sb.toString();
- }
-
- /**
- *
- * @param preferenceType
- * the type of preference to store. It must be a value defined in {@link TablePreferencesConstantsHelper}
- * @return get the preference key at the papyrus editor level
- */
- public static String getPapyrusEditorConstant(int preferenceType) {
- return getConstant(PAPYRUS_TABLE_EDITOR_PREFERENCE_PREFIX, preferenceType);
- }
-
- /**
- *
- * @param diagramKind
- * the kind of diagram.
- * @param preferenceType
- * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
- * @return the preference key at the diagram level
- */
- public static String getNatTableConstant(String tableKind, int preferenceType) {
- return TABLE_PREFERENCE_PREFIX + getConstant(tableKind, preferenceType);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.preferences;
+
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class TablePreferencesConstantsHelper {
+
+ private TablePreferencesConstantsHelper() {
+ // to prevent instanciation
+ }
+
+ /**
+ * Prefix for preference for Papyrus nattable Level editor
+ */
+ public final static String PAPYRUS_TABLE_EDITOR_PREFERENCE_PREFIX = "PAPYRUS_TABLE_EDITOR"; //$NON-NLS-1$
+
+ /**
+ * Prefix for preference for Diagram Level
+ */
+ public final static String TABLE_PREFERENCE_PREFIX = "NATTABLE_"; //$NON-NLS-1$
+
+ /**
+ * Prefix for preference for element Level
+ */
+ public final static String TABLE_ELEMENT = "TABLE_ELEMENT_"; //$NON-NLS-1$
+
+ /**
+ * Get the preference constant used to store the preference of an element.
+ *
+ * @param elementName
+ * the name of the element
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link TablePreferencesConstantsHelper}
+ * @return the constant used.
+ */
+ public static String getConstant(String elementName, int preferenceType) {
+ throw new UnsupportedOperationException("Not yet implemented");//$NON-NLS-1$
+ // StringBuffer sb = new StringBuffer();
+ // sb.append(elementName);
+ // sb.append("."); //$NON-NLS-1$
+ // switch(preferenceType) {
+ //
+ // default:
+ // break;
+ // }
+ // return sb.toString();
+ }
+
+ /**
+ *
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link TablePreferencesConstantsHelper}
+ * @return get the preference key at the papyrus editor level
+ */
+ public static String getPapyrusEditorConstant(int preferenceType) {
+ return getConstant(PAPYRUS_TABLE_EDITOR_PREFERENCE_PREFIX, preferenceType);
+ }
+
+ /**
+ *
+ * @param diagramKind
+ * the kind of diagram.
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
+ * @return the preference key at the diagram level
+ */
+ public static String getNatTableConstant(String tableKind, int preferenceType) {
+ return TABLE_PREFERENCE_PREFIX + getConstant(tableKind, preferenceType);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/IndexHeaderLabelProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/IndexHeaderLabelProvider.java
index efe1713a9b1..bdd7352d77e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/IndexHeaderLabelProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/IndexHeaderLabelProvider.java
@@ -1,53 +1,53 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.provider;
-
-import org.eclipse.papyrus.infra.nattable.utils.ILabelProviderContextElementWrapper;
-
-/**
- * The label provider used for the index of the header
- *
- * @author Vincent Lorenzo
- *
- */
-public class IndexHeaderLabelProvider extends AbstractNattableCellLabelProvider {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#accept(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public boolean accept(Object element) {
- if (element instanceof ILabelProviderContextElementWrapper) {
- Object object = ((ILabelProviderContextElementWrapper) element).getObject();
- return object instanceof String || object instanceof Integer;
- }
- return false;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#getText(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public String getText(Object element) {
- return ((ILabelProviderContextElementWrapper) element).getObject().toString();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.provider;
+
+import org.eclipse.papyrus.infra.nattable.utils.ILabelProviderContextElementWrapper;
+
+/**
+ * The label provider used for the index of the header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class IndexHeaderLabelProvider extends AbstractNattableCellLabelProvider {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#accept(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public boolean accept(Object element) {
+ if (element instanceof ILabelProviderContextElementWrapper) {
+ Object object = ((ILabelProviderContextElementWrapper) element).getObject();
+ return object instanceof String || object instanceof Integer;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(Object element) {
+ return ((ILabelProviderContextElementWrapper) element).getObject().toString();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/ProblemLabelProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/ProblemLabelProvider.java
index b580fda46ba..77c4ed8604f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/ProblemLabelProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/ProblemLabelProvider.java
@@ -1,96 +1,96 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.provider;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.Problem;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.StringResolutionProblem;
-import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
-import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider;
-
-/**
- * Label Provider for problem
- *
- * @author Vincent Lorenzo
- *
- */
-public class ProblemLabelProvider extends EMFLabelProvider implements IFilteredLabelProvider {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider#accept(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public boolean accept(Object element) {
- return element instanceof Problem;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider#getText(org.eclipse.emf.ecore.EObject)
- *
- * @param element
- * @return
- */
- @Override
- protected String getText(final EObject element) {
- final Problem pb = (Problem) element;
- if (pb instanceof StringResolutionProblem) {
- return ((StringResolutionProblem) pb).getValueAsString();
- }
- return pb.getDescription();
- }
-
- /**
- *
- * @param element
- * a problem
- * @return
- * the text to display for a problem in a tooltip
- */
- // TODO : should be obtained using a service or a specific wrapper to get tooltip
- public String getTooltipText(final EObject element) {
- if (element instanceof Problem) {
- final Problem problem = (Problem) element;
- final StringBuilder builder = new StringBuilder();
- if (problem instanceof StringResolutionProblem) {
- final List<String> unresolvedStrings = ((StringResolutionProblem) problem).getUnresolvedString();
- builder.append(NLS.bind(Messages.ProblemLabelProvider_StringsValuesCanBeResolved, unresolvedStrings.size()));
- if (unresolvedStrings.size() == 1) {
- builder.append(" "); //$NON-NLS-1$
- builder.append(unresolvedStrings.get(0));
- } else {
- final Iterator<String> iterOnString = ((StringResolutionProblem) problem).getUnresolvedString().iterator();
- while (iterOnString.hasNext()) {
- builder.append("\n\t- "); //$NON-NLS-1$
- builder.append(iterOnString.next());
- }
- }
- } else {
- builder.append(problem.getDescription());
- }
- return builder.toString();
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.provider;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.Problem;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.StringResolutionProblem;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider;
+
+/**
+ * Label Provider for problem
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ProblemLabelProvider extends EMFLabelProvider implements IFilteredLabelProvider {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider#accept(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public boolean accept(Object element) {
+ return element instanceof Problem;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider#getText(org.eclipse.emf.ecore.EObject)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ protected String getText(final EObject element) {
+ final Problem pb = (Problem) element;
+ if (pb instanceof StringResolutionProblem) {
+ return ((StringResolutionProblem) pb).getValueAsString();
+ }
+ return pb.getDescription();
+ }
+
+ /**
+ *
+ * @param element
+ * a problem
+ * @return
+ * the text to display for a problem in a tooltip
+ */
+ // TODO : should be obtained using a service or a specific wrapper to get tooltip
+ public String getTooltipText(final EObject element) {
+ if (element instanceof Problem) {
+ final Problem problem = (Problem) element;
+ final StringBuilder builder = new StringBuilder();
+ if (problem instanceof StringResolutionProblem) {
+ final List<String> unresolvedStrings = ((StringResolutionProblem) problem).getUnresolvedString();
+ builder.append(NLS.bind(Messages.ProblemLabelProvider_StringsValuesCanBeResolved, unresolvedStrings.size()));
+ if (unresolvedStrings.size() == 1) {
+ builder.append(" "); //$NON-NLS-1$
+ builder.append(unresolvedStrings.get(0));
+ } else {
+ final Iterator<String> iterOnString = ((StringResolutionProblem) problem).getUnresolvedString().iterator();
+ while (iterOnString.hasNext()) {
+ builder.append("\n\t- "); //$NON-NLS-1$
+ builder.append(iterOnString.next());
+ }
+ }
+ } else {
+ builder.append(problem.getDescription());
+ }
+ return builder.toString();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomCellDragModeForColumn.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomCellDragModeForColumn.java
index f155cdd0d1c..6ffe13fd900 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomCellDragModeForColumn.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomCellDragModeForColumn.java
@@ -1,89 +1,89 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.reorder;
-
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.swt.events.MouseEvent;
-
-/**
- *
- * This custom Cell Drag Mode allows to hide the phantom of the header when the drag of column is forbidden
- *
- */
-public class CustomCellDragModeForColumn extends CellDragMode {
-
- /**
- * The manager of the table
- */
- private final INattableModelManager manager;
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the manager of the table
- */
- public CustomCellDragModeForColumn(final INattableModelManager manager) {
- this.manager = manager;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode#mouseDown(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
- *
- * @param natTable
- * @param event
- */
- @Override
- public void mouseDown(NatTable natTable, MouseEvent event) {
- if (this.manager.canMoveColumns()) {
- super.mouseDown(natTable, event);
- }
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode#mouseMove(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
- *
- * @param natTable
- * @param event
- */
- @Override
- public void mouseMove(NatTable natTable, MouseEvent event) {
- if (this.manager.canMoveColumns()) {
- super.mouseMove(natTable, event);
- }
-
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode#mouseUp(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
- *
- * @param natTable
- * @param event
- */
- @Override
- public void mouseUp(NatTable natTable, MouseEvent event) {
- if (this.manager.canMoveColumns()) {
- super.mouseUp(natTable, event);
- }
-
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.reorder;
+
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.swt.events.MouseEvent;
+
+/**
+ *
+ * This custom Cell Drag Mode allows to hide the phantom of the header when the drag of column is forbidden
+ *
+ */
+public class CustomCellDragModeForColumn extends CellDragMode {
+
+ /**
+ * The manager of the table
+ */
+ private final INattableModelManager manager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the manager of the table
+ */
+ public CustomCellDragModeForColumn(final INattableModelManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode#mouseDown(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
+ *
+ * @param natTable
+ * @param event
+ */
+ @Override
+ public void mouseDown(NatTable natTable, MouseEvent event) {
+ if (this.manager.canMoveColumns()) {
+ super.mouseDown(natTable, event);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode#mouseMove(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
+ *
+ * @param natTable
+ * @param event
+ */
+ @Override
+ public void mouseMove(NatTable natTable, MouseEvent event) {
+ if (this.manager.canMoveColumns()) {
+ super.mouseMove(natTable, event);
+ }
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode#mouseUp(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
+ *
+ * @param natTable
+ * @param event
+ */
+ @Override
+ public void mouseUp(NatTable natTable, MouseEvent event) {
+ if (this.manager.canMoveColumns()) {
+ super.mouseUp(natTable, event);
+ }
+
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomColumnReorderDragMode.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomColumnReorderDragMode.java
index 34a37f3574b..e3891ee8467 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomColumnReorderDragMode.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomColumnReorderDragMode.java
@@ -1,85 +1,85 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.reorder;
-
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.swt.events.MouseEvent;
-
-/**
- *
- * This custom Drag Mode for columns allows to restrict the Drag of the Column
- *
- */
-public class CustomColumnReorderDragMode extends ColumnReorderDragMode {
-
- /**
- * the table manager
- */
- private INattableModelManager manager;
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the table manager
- */
- public CustomColumnReorderDragMode(final INattableModelManager manager) {
- this.manager = manager;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode#mouseDown(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
- *
- * @param natTable
- * @param event
- */
- @Override
- public void mouseDown(NatTable natTable, MouseEvent event) {
- if (this.manager.canMoveColumns()) {
- super.mouseDown(natTable, event);
- }
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode#mouseMove(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
- *
- * @param natTable
- * @param event
- */
- @Override
- public void mouseMove(NatTable natTable, MouseEvent event) {
- if (this.manager.canMoveColumns()) {
- super.mouseMove(natTable, event);
- }
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode#mouseUp(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
- *
- * @param natTable
- * @param event
- */
- @Override
- public void mouseUp(NatTable natTable, MouseEvent event) {
- if (this.manager.canMoveColumns()) {
- super.mouseUp(natTable, event);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.reorder;
+
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.swt.events.MouseEvent;
+
+/**
+ *
+ * This custom Drag Mode for columns allows to restrict the Drag of the Column
+ *
+ */
+public class CustomColumnReorderDragMode extends ColumnReorderDragMode {
+
+ /**
+ * the table manager
+ */
+ private INattableModelManager manager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the table manager
+ */
+ public CustomColumnReorderDragMode(final INattableModelManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode#mouseDown(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
+ *
+ * @param natTable
+ * @param event
+ */
+ @Override
+ public void mouseDown(NatTable natTable, MouseEvent event) {
+ if (this.manager.canMoveColumns()) {
+ super.mouseDown(natTable, event);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode#mouseMove(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
+ *
+ * @param natTable
+ * @param event
+ */
+ @Override
+ public void mouseMove(NatTable natTable, MouseEvent event) {
+ if (this.manager.canMoveColumns()) {
+ super.mouseMove(natTable, event);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode#mouseUp(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent)
+ *
+ * @param natTable
+ * @param event
+ */
+ @Override
+ public void mouseUp(NatTable natTable, MouseEvent event) {
+ if (this.manager.canMoveColumns()) {
+ super.mouseUp(natTable, event);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java
index d8d86094ca2..5bf18998d2b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java
@@ -1,58 +1,58 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.reorder;
-
-import org.eclipse.nebula.widgets.nattable.reorder.config.DefaultColumnReorderBindings;
-import org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode;
-import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
-import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.swt.SWT;
-
-/**
- *
- * This bindings allows to move the columns, only when the manager allows it.
- *
- */
-public class CustomDefaultColumnReorderBindings extends DefaultColumnReorderBindings {
-
- /**
- * the table manager
- */
- private final INattableModelManager manager;
-
- /**
- *
- * Constructor.
- *
- * @param manager
- * the table manager
- */
- public CustomDefaultColumnReorderBindings(final INattableModelManager manager) {
- this.manager = manager;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.reorder.config.DefaultReorderBindings#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
- *
- * @param uiBindingRegistry
- */
- @Override
- public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
- assert manager != null;
- uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CustomCellDragModeForColumn(this.manager), new CustomColumnReorderDragMode(this.manager)));
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.reorder;
+
+import org.eclipse.nebula.widgets.nattable.reorder.config.DefaultColumnReorderBindings;
+import org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.swt.SWT;
+
+/**
+ *
+ * This bindings allows to move the columns, only when the manager allows it.
+ *
+ */
+public class CustomDefaultColumnReorderBindings extends DefaultColumnReorderBindings {
+
+ /**
+ * the table manager
+ */
+ private final INattableModelManager manager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the table manager
+ */
+ public CustomDefaultColumnReorderBindings(final INattableModelManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.reorder.config.DefaultReorderBindings#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ assert manager != null;
+ uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CustomCellDragModeForColumn(this.manager), new CustomColumnReorderDragMode(this.manager)));
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ISelectionExtractor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ISelectionExtractor.java
index 5e1dfd38dc2..fe621758b2d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ISelectionExtractor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ISelectionExtractor.java
@@ -1,36 +1,36 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.selection;
-
-import java.util.Collection;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-/**
- * @author Vincent Lorenzo
- * This interface is used to obtain real object provided by a structured selection.
- * It allows to remove emf dependencies during the manipulation of the contents of the table
- */
-public interface ISelectionExtractor {
-
- /**
- *
- * @param structuredSelection
- * a structured selection
- * @return
- * a collection representing the object encapsulated in the selection
- */
- public Collection<?> extractSelectedObjects(IStructuredSelection structuredSelection);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.selection;
+
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * @author Vincent Lorenzo
+ * This interface is used to obtain real object provided by a structured selection.
+ * It allows to remove emf dependencies during the manipulation of the contents of the table
+ */
+public interface ISelectionExtractor {
+
+ /**
+ *
+ * @param structuredSelection
+ * a structured selection
+ * @return
+ * a collection representing the object encapsulated in the selection
+ */
+ public Collection<?> extractSelectedObjects(IStructuredSelection structuredSelection);
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ObjectsSelectionExtractor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ObjectsSelectionExtractor.java
index d4a8ba7d872..11369ff84cb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ObjectsSelectionExtractor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/selection/ObjectsSelectionExtractor.java
@@ -1,60 +1,60 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.selection;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-/**
- * @author Vincent Lorenzo
- * This class has been created to avoid dependencies on EMF manipulating eobject referenced by the table
- */
-public class ObjectsSelectionExtractor implements ISelectionExtractor {
-
-
- /**
- *
- * @param structuredSelection
- * a structured selection
- * @return
- * the object owned by the selected
- */
- public final Collection<?> extractSelectedObjects(IStructuredSelection structuredSelection) {
- List<Object> result = new ArrayList<Object>(structuredSelection.size());
-
- for (Iterator<?> iter = structuredSelection.iterator(); iter.hasNext();) {
- Object realObject = getRealObject(iter.next());
- if (realObject != null) {
- result.add(realObject);
- }
- }
-
- return result;
- }
-
- /**
- *
- * @param object
- * an object
- * @return
- * the real object
- */
- protected Object getRealObject(final Object object) {
- return object;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.selection;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * @author Vincent Lorenzo
+ * This class has been created to avoid dependencies on EMF manipulating eobject referenced by the table
+ */
+public class ObjectsSelectionExtractor implements ISelectionExtractor {
+
+
+ /**
+ *
+ * @param structuredSelection
+ * a structured selection
+ * @return
+ * the object owned by the selected
+ */
+ public final Collection<?> extractSelectedObjects(IStructuredSelection structuredSelection) {
+ List<Object> result = new ArrayList<Object>(structuredSelection.size());
+
+ for (Iterator<?> iter = structuredSelection.iterator(); iter.hasNext();) {
+ Object realObject = getRealObject(iter.next());
+ if (realObject != null) {
+ result.add(realObject);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param object
+ * an object
+ * @return
+ * the real object
+ */
+ protected Object getRealObject(final Object object) {
+ return object;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/ColumnSortModel.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/ColumnSortModel.java
index 46a83d1523d..f8371996db4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/ColumnSortModel.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/ColumnSortModel.java
@@ -1,267 +1,267 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.sort;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
-import org.eclipse.papyrus.infra.nattable.comparator.RowComparator;
-import org.eclipse.papyrus.infra.nattable.manager.axis.ICompositeAxisManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.tools.comparator.CompositeComparator;
-
-
-/**
- * @Deprecated since Eclipse Mars
- * @author Vincent Lorenzo
- *
- */
-@Deprecated
-public class ColumnSortModel implements IPapyrusSortModel {
-
-
- /**
- * the list of the sorted columns, in the order of the sort
- */
- private final List<Object> sortedColumns = new ArrayList<Object>();
-
- /**
- * the sorted columns associated to their direction
- */
- private final Map<Object, SortDirectionEnum> sortedColumnsAndDirection = new HashMap<Object, SortDirectionEnum>();
-
- /**
- * the table manager
- */
- private INattableModelManager tableManager;
-
- /**
- *
- * Constructor.
- *
- * @param tableManager
- * the table manager to use
- */
- public ColumnSortModel(final INattableModelManager tableManager) {
- this.tableManager = tableManager;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getSortedColumnIndexes()
- *
- * @return
- */
- @Override
- public List<Integer> getSortedColumnIndexes() {
- final List<Integer> sortedColumnsIndex = new ArrayList<Integer>();
- for (final Object current : sortedColumns) {
- sortedColumnsIndex.add(getColumnIndex(current));
- }
- return sortedColumnsIndex;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#isColumnIndexSorted(int)
- *
- * @param columnIndex
- * @return
- */
- @Override
- public boolean isColumnIndexSorted(int columnIndex) {
- return sortedColumns.contains(getObject(columnIndex));
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getSortDirection(int)
- *
- * @param columnIndex
- * @return
- */
- @Override
- public SortDirectionEnum getSortDirection(int columnIndex) {
- Object object = getObject(columnIndex);
- SortDirectionEnum direction = sortedColumnsAndDirection.get(object);
- if (direction == null) {
- direction = SortDirectionEnum.NONE;
- }
- return direction;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getSortOrder(int)
- *
- * @param columnIndex
- * @return
- */
- @Override
- public int getSortOrder(int columnIndex) {
- final Object obj = getObject(columnIndex);
- return this.sortedColumns.indexOf(obj);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getComparatorsForColumnIndex(int)
- *
- * @param columnIndex
- * @return
- */
- @SuppressWarnings("rawtypes")
- @Override
- public List<Comparator> getComparatorsForColumnIndex(int columnIndex) {
- Comparator comp = new RowComparator(getObject(columnIndex), sortedColumnsAndDirection.get(getObject(columnIndex)), tableManager);
- return Collections.singletonList(comp);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#sort(int, org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum, boolean)
- *
- * @param columnIndex
- * @param sortDirection
- * @param accumulate
- */
- @Override
- public void sort(int columnIndex, SortDirectionEnum sortDirection, boolean accumulate) {
- final Object columnElement = getObject(columnIndex);
-
- if (!accumulate) {
- clear();
- }
-
- this.sortedColumns.remove(columnElement);
- this.sortedColumnsAndDirection.remove(columnElement);
- if (sortDirection != SortDirectionEnum.NONE) {
- this.sortedColumnsAndDirection.put(columnElement, sortDirection);
- this.sortedColumns.add(0, columnElement);
- }
- List<Comparator<Object>> comparators = new ArrayList<Comparator<Object>>();
- for (final Object current : sortedColumns) {
- Comparator<Object> newOne = new RowComparator(current, this.sortedColumnsAndDirection.get(current), tableManager);
- comparators.add(newOne);
- }
- setAxisComparator();
- }
-
- /**
- * set the axis comparator (the sort is done by the manager when we change its comparator)
- */
- protected void setAxisComparator() {
- final Comparator<Object> comp = createComparator();
- final ICompositeAxisManager manager = (ICompositeAxisManager) tableManager.getRowAxisManager();
- manager.setAxisComparator(comp);// the sort is done by the manager when we change its comparator
- }
-
- /**
- *
- * @return
- * the created axis comparator to use or <code>null</code>
- */
- protected final Comparator<Object> createComparator() {
- List<Comparator<Object>> comparators = new ArrayList<Comparator<Object>>();
- for (final Object current : sortedColumns) {
- Comparator<Object> newOne = new RowComparator(current, this.sortedColumnsAndDirection.get(current), tableManager);
- comparators.add(newOne);
- }
-
- final Comparator<Object> comp;
- if (comparators.isEmpty()) {
- comp = null;
- } else {
- comp = new CompositeComparator<Object>(comparators);
- }
- return comp;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#clear()
- *
- */
- @Override
- public void clear() {
- sortedColumns.clear();
- sortedColumnsAndDirection.clear();
- }
-
- /**
- *
- * @param columnIndex
- * @return
- */
- private Object getObject(int columnIndex) {
- return tableManager.getColumnElement(columnIndex);
- }
-
- /**
- *
- * @param object
- * @return
- */
- private int getColumnIndex(final Object object) {
- return tableManager.getColumnElementsList().indexOf(object);
- }
-
- /**
- * clear the comparator list, according to the removed columns
- */
- @Override
- public void updateSort() {
- final ListIterator<Object> iterator = this.sortedColumns.listIterator();
- while (iterator.hasNext()) {
- final Object current = iterator.next();
- if (-1 == tableManager.getColumnElementsList().indexOf(current)) {
- iterator.remove();
- this.sortedColumnsAndDirection.remove(current);
- this.sortedColumns.remove(current);
- }
- }
- setAxisComparator();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getColumnComparator(int)
- *
- * @param columnIndex
- * @return
- */
- @Override
- public Comparator<?> getColumnComparator(int columnIndex) {
-
- //TODO : new method coming from nattable 1.2.0
- return null;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.sort.IPapyrusSortModel#setTableInverted(boolean)
- *
- * @param isInverted
- */
- @Override
- public void setTableInverted(boolean isInverted) {
-
-
- }
-}
-
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.sort;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
+import org.eclipse.papyrus.infra.nattable.comparator.RowComparator;
+import org.eclipse.papyrus.infra.nattable.manager.axis.ICompositeAxisManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.tools.comparator.CompositeComparator;
+
+
+/**
+ * @Deprecated since Eclipse Mars
+ * @author Vincent Lorenzo
+ *
+ */
+@Deprecated
+public class ColumnSortModel implements IPapyrusSortModel {
+
+
+ /**
+ * the list of the sorted columns, in the order of the sort
+ */
+ private final List<Object> sortedColumns = new ArrayList<Object>();
+
+ /**
+ * the sorted columns associated to their direction
+ */
+ private final Map<Object, SortDirectionEnum> sortedColumnsAndDirection = new HashMap<Object, SortDirectionEnum>();
+
+ /**
+ * the table manager
+ */
+ private INattableModelManager tableManager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableManager
+ * the table manager to use
+ */
+ public ColumnSortModel(final INattableModelManager tableManager) {
+ this.tableManager = tableManager;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getSortedColumnIndexes()
+ *
+ * @return
+ */
+ @Override
+ public List<Integer> getSortedColumnIndexes() {
+ final List<Integer> sortedColumnsIndex = new ArrayList<Integer>();
+ for (final Object current : sortedColumns) {
+ sortedColumnsIndex.add(getColumnIndex(current));
+ }
+ return sortedColumnsIndex;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#isColumnIndexSorted(int)
+ *
+ * @param columnIndex
+ * @return
+ */
+ @Override
+ public boolean isColumnIndexSorted(int columnIndex) {
+ return sortedColumns.contains(getObject(columnIndex));
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getSortDirection(int)
+ *
+ * @param columnIndex
+ * @return
+ */
+ @Override
+ public SortDirectionEnum getSortDirection(int columnIndex) {
+ Object object = getObject(columnIndex);
+ SortDirectionEnum direction = sortedColumnsAndDirection.get(object);
+ if (direction == null) {
+ direction = SortDirectionEnum.NONE;
+ }
+ return direction;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getSortOrder(int)
+ *
+ * @param columnIndex
+ * @return
+ */
+ @Override
+ public int getSortOrder(int columnIndex) {
+ final Object obj = getObject(columnIndex);
+ return this.sortedColumns.indexOf(obj);
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getComparatorsForColumnIndex(int)
+ *
+ * @param columnIndex
+ * @return
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public List<Comparator> getComparatorsForColumnIndex(int columnIndex) {
+ Comparator comp = new RowComparator(getObject(columnIndex), sortedColumnsAndDirection.get(getObject(columnIndex)), tableManager);
+ return Collections.singletonList(comp);
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#sort(int, org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum, boolean)
+ *
+ * @param columnIndex
+ * @param sortDirection
+ * @param accumulate
+ */
+ @Override
+ public void sort(int columnIndex, SortDirectionEnum sortDirection, boolean accumulate) {
+ final Object columnElement = getObject(columnIndex);
+
+ if (!accumulate) {
+ clear();
+ }
+
+ this.sortedColumns.remove(columnElement);
+ this.sortedColumnsAndDirection.remove(columnElement);
+ if (sortDirection != SortDirectionEnum.NONE) {
+ this.sortedColumnsAndDirection.put(columnElement, sortDirection);
+ this.sortedColumns.add(0, columnElement);
+ }
+ List<Comparator<Object>> comparators = new ArrayList<Comparator<Object>>();
+ for (final Object current : sortedColumns) {
+ Comparator<Object> newOne = new RowComparator(current, this.sortedColumnsAndDirection.get(current), tableManager);
+ comparators.add(newOne);
+ }
+ setAxisComparator();
+ }
+
+ /**
+ * set the axis comparator (the sort is done by the manager when we change its comparator)
+ */
+ protected void setAxisComparator() {
+ final Comparator<Object> comp = createComparator();
+ final ICompositeAxisManager manager = (ICompositeAxisManager) tableManager.getRowAxisManager();
+ manager.setAxisComparator(comp);// the sort is done by the manager when we change its comparator
+ }
+
+ /**
+ *
+ * @return
+ * the created axis comparator to use or <code>null</code>
+ */
+ protected final Comparator<Object> createComparator() {
+ List<Comparator<Object>> comparators = new ArrayList<Comparator<Object>>();
+ for (final Object current : sortedColumns) {
+ Comparator<Object> newOne = new RowComparator(current, this.sortedColumnsAndDirection.get(current), tableManager);
+ comparators.add(newOne);
+ }
+
+ final Comparator<Object> comp;
+ if (comparators.isEmpty()) {
+ comp = null;
+ } else {
+ comp = new CompositeComparator<Object>(comparators);
+ }
+ return comp;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#clear()
+ *
+ */
+ @Override
+ public void clear() {
+ sortedColumns.clear();
+ sortedColumnsAndDirection.clear();
+ }
+
+ /**
+ *
+ * @param columnIndex
+ * @return
+ */
+ private Object getObject(int columnIndex) {
+ return tableManager.getColumnElement(columnIndex);
+ }
+
+ /**
+ *
+ * @param object
+ * @return
+ */
+ private int getColumnIndex(final Object object) {
+ return tableManager.getColumnElementsList().indexOf(object);
+ }
+
+ /**
+ * clear the comparator list, according to the removed columns
+ */
+ @Override
+ public void updateSort() {
+ final ListIterator<Object> iterator = this.sortedColumns.listIterator();
+ while (iterator.hasNext()) {
+ final Object current = iterator.next();
+ if (-1 == tableManager.getColumnElementsList().indexOf(current)) {
+ iterator.remove();
+ this.sortedColumnsAndDirection.remove(current);
+ this.sortedColumns.remove(current);
+ }
+ }
+ setAxisComparator();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.sort.ISortModel#getColumnComparator(int)
+ *
+ * @param columnIndex
+ * @return
+ */
+ @Override
+ public Comparator<?> getColumnComparator(int columnIndex) {
+
+ //TODO : new method coming from nattable 1.2.0
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.sort.IPapyrusSortModel#setTableInverted(boolean)
+ *
+ * @param isInverted
+ */
+ @Override
+ public void setTableInverted(boolean isInverted) {
+
+
+ }
+}
+
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/IPapyrusSortModel.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/IPapyrusSortModel.java
index bc4d65a703d..8e393651191 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/IPapyrusSortModel.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/IPapyrusSortModel.java
@@ -1,37 +1,37 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.sort;
-
-import org.eclipse.nebula.widgets.nattable.sort.ISortModel;
-
-/**
- * Common interface to use for sort model
- *
- * @author Vincent Lorenzo
- *
- */
-public interface IPapyrusSortModel extends ISortModel {
-
- /**
- * remove axis which have been destroyed from the comparison
- */
- public void updateSort();
-
- /**
- *
- * @param isInverted
- * <code>true</code> when the table isInverted
- */
- public void setTableInverted(boolean isInverted);
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.sort;
+
+import org.eclipse.nebula.widgets.nattable.sort.ISortModel;
+
+/**
+ * Common interface to use for sort model
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface IPapyrusSortModel extends ISortModel {
+
+ /**
+ * remove axis which have been destroyed from the comparison
+ */
+ public void updateSort();
+
+ /**
+ *
+ * @param isInverted
+ * <code>true</code> when the table isInverted
+ */
+ public void setTableInverted(boolean isInverted);
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/ITableTester.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/ITableTester.java
index 5172b329ef5..f67209bc899 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/ITableTester.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/ITableTester.java
@@ -1,34 +1,34 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.tester;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * The interface to implements for the table creation tester
- *
- * @author Vincent Lorenzo
- *
- */
-public interface ITableTester {
-
- /**
- *
- * @param context
- * @return
- * a status indicating if the table can be created
- */
- public IStatus isAllowed(final Object context);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.tester;
+
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * The interface to implements for the table creation tester
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface ITableTester {
+
+ /**
+ *
+ * @param context
+ * @return
+ * a status indicating if the table can be created
+ */
+ public IStatus isAllowed(final Object context);
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/TableTesterRegistry.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/TableTesterRegistry.java
index 7eb4148a5e5..3b3121fa390 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/TableTesterRegistry.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tester/TableTesterRegistry.java
@@ -1,72 +1,72 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.tester;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-
-
-public class TableTesterRegistry {
-
-
- private static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.tester"; //$NON-NLS-1$
-
- private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
-
- private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
-
- private Map<String, ITableTester> testers;
-
- public static final TableTesterRegistry INSTANCE = new TableTesterRegistry();
-
- private TableTesterRegistry() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param tableType
- * the type of the table
- * @return
- * the URI of the configuration to use for this table or <code>null</code> if not found
- */
- public ITableTester getTableTester(final String testerId) {
- if (this.testers == null) {
- this.testers = new HashMap<String, ITableTester>();
- final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
- for (final IConfigurationElement iConfigurationElement : configElements) {
- String id = iConfigurationElement.getAttribute(ID_ATTRIBUTE);
- if (this.testers.containsKey(id)) {
- Activator.log.warn(String.format(Messages.TableTesterRegistry_SeveralTesterAreRegisteredWithTheSameId, id));
- } else {
- ITableTester tester = null;
- try {
- tester = (ITableTester) iConfigurationElement.createExecutableExtension(CLASS_ATTRIBUTE);
- this.testers.put(id, tester);
- } catch (CoreException e) {
- Activator.log.error(String.format(Messages.TableTesterRegistry_TheClassCantBeLoaded, id), e);
- }
-
- }
- }
- }
- return this.testers.get(testerId);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.tester;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+
+
+public class TableTesterRegistry {
+
+
+ private static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.tester"; //$NON-NLS-1$
+
+ private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
+ private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+
+ private Map<String, ITableTester> testers;
+
+ public static final TableTesterRegistry INSTANCE = new TableTesterRegistry();
+
+ private TableTesterRegistry() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param tableType
+ * the type of the table
+ * @return
+ * the URI of the configuration to use for this table or <code>null</code> if not found
+ */
+ public ITableTester getTableTester(final String testerId) {
+ if (this.testers == null) {
+ this.testers = new HashMap<String, ITableTester>();
+ final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+ for (final IConfigurationElement iConfigurationElement : configElements) {
+ String id = iConfigurationElement.getAttribute(ID_ATTRIBUTE);
+ if (this.testers.containsKey(id)) {
+ Activator.log.warn(String.format(Messages.TableTesterRegistry_SeveralTesterAreRegisteredWithTheSameId, id));
+ } else {
+ ITableTester tester = null;
+ try {
+ tester = (ITableTester) iConfigurationElement.createExecutableExtension(CLASS_ATTRIBUTE);
+ this.testers.put(id, tester);
+ } catch (CoreException e) {
+ Activator.log.error(String.format(Messages.TableTesterRegistry_TheClassCantBeLoaded, id), e);
+ }
+
+ }
+ }
+ }
+ return this.testers.get(testerId);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/CollapseAndExpandActionsEnum.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/CollapseAndExpandActionsEnum.java
index 97079304c0b..088eb8aec61 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/CollapseAndExpandActionsEnum.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/CollapseAndExpandActionsEnum.java
@@ -1,63 +1,63 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.tree;
-
-/**
- * This enumeration provides all possible actions for Tree (Collapse/Expand)
- *
- */
-public enum CollapseAndExpandActionsEnum {
- /**
- * expand all the tree
- */
- EXPAND_ALL,
-
- /**
- * expand one level from the selected elements
- */
- EXPAND_ONE_LEVEL,
-
- /**
- * expand 2 levels from the selected elements
- */
- EXPAND_TWO_LEVEL,
-
- /**
- * expand all from the selected element
- */
- EXPAND_ALL_FROM_SELECTION,
-
- /**
- * expand tree to find the wanted node
- */
- EXPAND_TO_NODE,
-
- /**
- * collapse all the tree
- */
- COLLAPSE_ALL,
-
- /**
- * collapse all from the selection
- */
- COLLAPSE_ALL_FROM_SELECTION,
-
- /**
- * collapse one level from selected elements
- */
- COLLAPSE_ONE_LEVEL;
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.tree;
+
+/**
+ * This enumeration provides all possible actions for Tree (Collapse/Expand)
+ *
+ */
+public enum CollapseAndExpandActionsEnum {
+ /**
+ * expand all the tree
+ */
+ EXPAND_ALL,
+
+ /**
+ * expand one level from the selected elements
+ */
+ EXPAND_ONE_LEVEL,
+
+ /**
+ * expand 2 levels from the selected elements
+ */
+ EXPAND_TWO_LEVEL,
+
+ /**
+ * expand all from the selected element
+ */
+ EXPAND_ALL_FROM_SELECTION,
+
+ /**
+ * expand tree to find the wanted node
+ */
+ EXPAND_TO_NODE,
+
+ /**
+ * collapse all the tree
+ */
+ COLLAPSE_ALL,
+
+ /**
+ * collapse all from the selection
+ */
+ COLLAPSE_ALL_FROM_SELECTION,
+
+ /**
+ * collapse one level from selected elements
+ */
+ COLLAPSE_ONE_LEVEL;
+
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/DatumExpansionModel.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/DatumExpansionModel.java
index 0e6b58661d9..2a675d143c4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/DatumExpansionModel.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/tree/DatumExpansionModel.java
@@ -1,71 +1,71 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.tree;
-
-
-import java.util.List;
-
-import org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-
-import ca.odell.glazedlists.TreeList;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class DatumExpansionModel implements TreeList.ExpansionModel<ITreeItemAxis> {
-
- /**
- * the editing domain used in the table
- */
- private ITreeItemAxisManagerForEventList axisManager;
-
- /**
- *
- * @see ca.odell.glazedlists.TreeList.ExpansionModel#isExpanded(java.lang.Object, java.util.List)
- *
- * @param element
- * @param path
- * @return
- */
- @Override
- public boolean isExpanded(ITreeItemAxis element, List<ITreeItemAxis> path) {
- return element.isExpanded();
- }
-
- /**
- *
- * @param axisManager
- * the axis manager
- */
- public void setAxisManager(ITreeItemAxisManagerForEventList axisManager) {
- this.axisManager = axisManager;
- }
-
- /**
- *
- * @see ca.odell.glazedlists.TreeList.ExpansionModel#setExpanded(java.lang.Object, java.util.List, boolean)
- *
- * @param element
- * @param path
- * @param expanded
- */
- @Override
- public void setExpanded(ITreeItemAxis element, List<ITreeItemAxis> path, boolean expanded) {
- if (this.axisManager != null) {
- this.axisManager.setExpanded(element, path, expanded);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.tree;
+
+
+import java.util.List;
+
+import org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+
+import ca.odell.glazedlists.TreeList;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class DatumExpansionModel implements TreeList.ExpansionModel<ITreeItemAxis> {
+
+ /**
+ * the editing domain used in the table
+ */
+ private ITreeItemAxisManagerForEventList axisManager;
+
+ /**
+ *
+ * @see ca.odell.glazedlists.TreeList.ExpansionModel#isExpanded(java.lang.Object, java.util.List)
+ *
+ * @param element
+ * @param path
+ * @return
+ */
+ @Override
+ public boolean isExpanded(ITreeItemAxis element, List<ITreeItemAxis> path) {
+ return element.isExpanded();
+ }
+
+ /**
+ *
+ * @param axisManager
+ * the axis manager
+ */
+ public void setAxisManager(ITreeItemAxisManagerForEventList axisManager) {
+ this.axisManager = axisManager;
+ }
+
+ /**
+ *
+ * @see ca.odell.glazedlists.TreeList.ExpansionModel#setExpanded(java.lang.Object, java.util.List, boolean)
+ *
+ * @param element
+ * @param path
+ * @param expanded
+ */
+ @Override
+ public void setExpanded(ITreeItemAxis element, List<ITreeItemAxis> path, boolean expanded) {
+ if (this.axisManager != null) {
+ this.axisManager.setExpanded(element, path, expanded);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisComparator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisComparator.java
index f649842b931..b283e671444 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisComparator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisComparator.java
@@ -1,108 +1,108 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import java.util.Comparator;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-
-
-/**
- * The comparator used to sort IAxis
- *
- * @author Vincent Lorenzo
- *
- */
-public class AxisComparator implements Comparator<IAxis> {
-
- /**
- * indicates the direction of the sort
- */
- private boolean alphabeticOrder;
-
- /**
- * the config registry is used to find the label provider service
- */
- private IConfigRegistry configRegistry;
-
- private LabelProviderContextElementWrapper wrapper1;
-
- private LabelProviderContextElementWrapper wrapper2;
-
- /**
- *
- * Constructor.
- *
- * @param alphabeticOrder
- * indicates the direction of the sort
- * @param configRegistry
- * the config registry used by the table
- */
- public AxisComparator(boolean alphabticOrder, final IConfigRegistry configRegistry) {
- this.alphabeticOrder = alphabticOrder;
- this.configRegistry = configRegistry;
- wrapper1 = new LabelProviderContextElementWrapper();
- wrapper2 = new LabelProviderContextElementWrapper();
- wrapper1.setConfigRegistry(configRegistry);
- wrapper2.setConfigRegistry(configRegistry);
- }
-
- /**
- * Compare 2 {@link IAxis}
- *
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- *
- * @param arg0
- * @param arg1
- * @return
- */
- @Override
- public int compare(IAxis arg0, IAxis arg1) {
- final LabelProviderService serv = this.configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- wrapper1.setObject(arg0);
- wrapper2.setObject(arg1);
- final ILabelProvider provider = serv.getLabelProvider(Constants.HEADER_LABEL_PROVIDER_CONTEXT);
-
- final String str1 = provider.getText(wrapper1).replaceAll(AxisUtils.REGEX, "");// we keep only words characters (letters + numbers) + whitespace //$NON-NLS-1$
- final String str2 = provider.getText(wrapper2).replaceAll(AxisUtils.REGEX, ""); //$NON-NLS-1$
- if (this.alphabeticOrder) {
- return str1.compareToIgnoreCase(str2);
- }
- return str2.compareToIgnoreCase(str1);
-
- }
-
- /**
- *
- * @param serv
- * the label provider service
- * @param obj
- * the object for which we want the displayed text
- * @return
- *
- * @Deprecated since Eclipse Mars
- */
- @Deprecated
- protected String getText(final LabelProviderService serv, final Object obj) {
- final ILabelProvider provider = serv.getLabelProvider(Constants.HEADER_LABEL_PROVIDER_CONTEXT);
- LabelProviderContextElementWrapper wrapper = new LabelProviderContextElementWrapper();
- wrapper.setConfigRegistry(this.configRegistry);
- wrapper.setObject(obj);
- return provider.getText(wrapper);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.Comparator;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+
+
+/**
+ * The comparator used to sort IAxis
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class AxisComparator implements Comparator<IAxis> {
+
+ /**
+ * indicates the direction of the sort
+ */
+ private boolean alphabeticOrder;
+
+ /**
+ * the config registry is used to find the label provider service
+ */
+ private IConfigRegistry configRegistry;
+
+ private LabelProviderContextElementWrapper wrapper1;
+
+ private LabelProviderContextElementWrapper wrapper2;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param alphabeticOrder
+ * indicates the direction of the sort
+ * @param configRegistry
+ * the config registry used by the table
+ */
+ public AxisComparator(boolean alphabticOrder, final IConfigRegistry configRegistry) {
+ this.alphabeticOrder = alphabticOrder;
+ this.configRegistry = configRegistry;
+ wrapper1 = new LabelProviderContextElementWrapper();
+ wrapper2 = new LabelProviderContextElementWrapper();
+ wrapper1.setConfigRegistry(configRegistry);
+ wrapper2.setConfigRegistry(configRegistry);
+ }
+
+ /**
+ * Compare 2 {@link IAxis}
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param arg0
+ * @param arg1
+ * @return
+ */
+ @Override
+ public int compare(IAxis arg0, IAxis arg1) {
+ final LabelProviderService serv = this.configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ wrapper1.setObject(arg0);
+ wrapper2.setObject(arg1);
+ final ILabelProvider provider = serv.getLabelProvider(Constants.HEADER_LABEL_PROVIDER_CONTEXT);
+
+ final String str1 = provider.getText(wrapper1).replaceAll(AxisUtils.REGEX, "");// we keep only words characters (letters + numbers) + whitespace //$NON-NLS-1$
+ final String str2 = provider.getText(wrapper2).replaceAll(AxisUtils.REGEX, ""); //$NON-NLS-1$
+ if (this.alphabeticOrder) {
+ return str1.compareToIgnoreCase(str2);
+ }
+ return str2.compareToIgnoreCase(str1);
+
+ }
+
+ /**
+ *
+ * @param serv
+ * the label provider service
+ * @param obj
+ * the object for which we want the displayed text
+ * @return
+ *
+ * @Deprecated since Eclipse Mars
+ */
+ @Deprecated
+ protected String getText(final LabelProviderService serv, final Object obj) {
+ final ILabelProvider provider = serv.getLabelProvider(Constants.HEADER_LABEL_PROVIDER_CONTEXT);
+ LabelProviderContextElementWrapper wrapper = new LabelProviderContextElementWrapper();
+ wrapper.setConfigRegistry(this.configRegistry);
+ wrapper.setObject(obj);
+ return provider.getText(wrapper);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisConfigurationUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisConfigurationUtils.java
index 379788cfd4d..0026158865e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisConfigurationUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisConfigurationUtils.java
@@ -1,80 +1,80 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class AxisConfigurationUtils {
-
- private AxisConfigurationUtils() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param table
- * the table
- * @param eClass
- * the eclass of the wanted configuration
- * @param onColumn
- * <code>true</code> if we want a column configuration and false if we want a row configuration
- * @return
- */
- public static IAxisConfiguration getIAxisConfigurationUsedInTable(final Table table, final EClass eClass, final boolean onColumn) {
- IAxisConfiguration iAxisConfiguration = null;
- final Collection<AbstractHeaderAxisConfiguration> headerConfigurations = new ArrayList<AbstractHeaderAxisConfiguration>();
- if (onColumn) {
- AbstractHeaderAxisConfiguration localConf = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTable(table);
- if (localConf != null) {
- headerConfigurations.add(localConf);
- }
- localConf = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(table);
- if (localConf != null) {
- headerConfigurations.add(localConf);
- }
- } else {
- AbstractHeaderAxisConfiguration localConf = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTable(table);
- if (localConf != null) {
- headerConfigurations.add(localConf);
- }
- localConf = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
- if (localConf != null) {
- headerConfigurations.add(localConf);
- }
- }
- final Iterator<AbstractHeaderAxisConfiguration> iter = headerConfigurations.iterator();
- while (iter.hasNext() && iAxisConfiguration == null) {
- final Iterator<IAxisConfiguration> confIter = iter.next().getOwnedAxisConfigurations().iterator();
- while (confIter.hasNext() && iAxisConfiguration == null) {
- final IAxisConfiguration current = confIter.next();
- if (current.eClass() == eClass) {
- iAxisConfiguration = current;
- }
- }
- }
- return iAxisConfiguration;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class AxisConfigurationUtils {
+
+ private AxisConfigurationUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param eClass
+ * the eclass of the wanted configuration
+ * @param onColumn
+ * <code>true</code> if we want a column configuration and false if we want a row configuration
+ * @return
+ */
+ public static IAxisConfiguration getIAxisConfigurationUsedInTable(final Table table, final EClass eClass, final boolean onColumn) {
+ IAxisConfiguration iAxisConfiguration = null;
+ final Collection<AbstractHeaderAxisConfiguration> headerConfigurations = new ArrayList<AbstractHeaderAxisConfiguration>();
+ if (onColumn) {
+ AbstractHeaderAxisConfiguration localConf = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTable(table);
+ if (localConf != null) {
+ headerConfigurations.add(localConf);
+ }
+ localConf = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(table);
+ if (localConf != null) {
+ headerConfigurations.add(localConf);
+ }
+ } else {
+ AbstractHeaderAxisConfiguration localConf = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTable(table);
+ if (localConf != null) {
+ headerConfigurations.add(localConf);
+ }
+ localConf = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
+ if (localConf != null) {
+ headerConfigurations.add(localConf);
+ }
+ }
+ final Iterator<AbstractHeaderAxisConfiguration> iter = headerConfigurations.iterator();
+ while (iter.hasNext() && iAxisConfiguration == null) {
+ final Iterator<IAxisConfiguration> confIter = iter.next().getOwnedAxisConfigurations().iterator();
+ while (confIter.hasNext() && iAxisConfiguration == null) {
+ final IAxisConfiguration current = confIter.next();
+ if (current.eClass() == eClass) {
+ iAxisConfiguration = current;
+ }
+ }
+ }
+ return iAxisConfiguration;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellMapKey.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellMapKey.java
index e4bf912ffb7..3ffa6eea6a5 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellMapKey.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellMapKey.java
@@ -1,87 +1,87 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.ICellAxisWrapper;
-
-
-/**
- * This class is used as key to find easily the cell for a row and a column in the table metamodel
- *
- * @author Vincent Lorenzo
- *
- */
-public class CellMapKey {
-
-
-
- /**
- * the column element
- */
- private final Object columnElement;
-
- /**
- * the row element
- */
- private final Object rowElement;
-
- /**
- *
- * Constructor.
- *
- * @param columnElement
- * the columnElement
- * @param rowElement
- * the rowElement
- */
- public CellMapKey(final Object columnElement, final Object rowElement) {
- if (columnElement instanceof ICellAxisWrapper) {
- this.columnElement = AxisUtils.getRepresentedElement(((ICellAxisWrapper) columnElement).getElement());
- } else {
- this.columnElement = AxisUtils.getRepresentedElement(columnElement);
- }
- if (rowElement instanceof ICellAxisWrapper) {
- this.rowElement = AxisUtils.getRepresentedElement(((ICellAxisWrapper) rowElement).getElement());
- } else {
- this.rowElement = AxisUtils.getRepresentedElement(rowElement);
- }
- }
-
- /**
- *
- * @see java.lang.Object#hashCode()
- *
- * @return
- */
- @Override
- public int hashCode() {
- int hashCode = this.columnElement.hashCode() + 10 * this.rowElement.hashCode();
- return hashCode;
- }
-
- /**
- *
- * @see java.lang.Object#equals(java.lang.Object)
- *
- * @param obj
- * @return
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof CellMapKey) {
- return obj.hashCode() == hashCode();
- }
- return false;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.ICellAxisWrapper;
+
+
+/**
+ * This class is used as key to find easily the cell for a row and a column in the table metamodel
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class CellMapKey {
+
+
+
+ /**
+ * the column element
+ */
+ private final Object columnElement;
+
+ /**
+ * the row element
+ */
+ private final Object rowElement;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param columnElement
+ * the columnElement
+ * @param rowElement
+ * the rowElement
+ */
+ public CellMapKey(final Object columnElement, final Object rowElement) {
+ if (columnElement instanceof ICellAxisWrapper) {
+ this.columnElement = AxisUtils.getRepresentedElement(((ICellAxisWrapper) columnElement).getElement());
+ } else {
+ this.columnElement = AxisUtils.getRepresentedElement(columnElement);
+ }
+ if (rowElement instanceof ICellAxisWrapper) {
+ this.rowElement = AxisUtils.getRepresentedElement(((ICellAxisWrapper) rowElement).getElement());
+ } else {
+ this.rowElement = AxisUtils.getRepresentedElement(rowElement);
+ }
+ }
+
+ /**
+ *
+ * @see java.lang.Object#hashCode()
+ *
+ * @return
+ */
+ @Override
+ public int hashCode() {
+ int hashCode = this.columnElement.hashCode() + 10 * this.rowElement.hashCode();
+ return hashCode;
+ }
+
+ /**
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ *
+ * @param obj
+ * @return
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof CellMapKey) {
+ return obj.hashCode() == hashCode();
+ }
+ return false;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CollapseExpandActionHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CollapseExpandActionHelper.java
index fc09a521a1a..85bbf36ce8e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CollapseExpandActionHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CollapseExpandActionHelper.java
@@ -1,454 +1,454 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.nebula.widgets.nattable.tree.command.TreeCollapseAllCommand;
-import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandAllCommand;
-import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.provider.TableStructuredSelection;
-import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum;
-import org.eclipse.papyrus.infra.ui.util.SelectionHelper;
-
-/**
- * This class is not in API.
- */
-public class CollapseExpandActionHelper {
-
- /**
- *
- * Constructor.
- *
- */
- private CollapseExpandActionHelper() {
- // to prevent instanciation
- }
-
- /**
- * This method is not in the API.
- *
- * @param actionId
- * the id of the action to do
- * @param axisProvider
- * the table axis provider
- * @param natTable
- * the natTable widget
- */
- public static final void doCollapseExpandAction(CollapseAndExpandActionsEnum actionId, List<ITreeItemAxis> selectedAxis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- switch (actionId) {
- case EXPAND_ALL:
- natTable.doCommand(new TreeExpandAllCommand());
- return;
- case COLLAPSE_ALL:
- doCollapseAll(axisProvider, natTable);
- return;
- default:
- break;
- }
-
- if (selectedAxis == null) {
- doCollapseExpandActionOnSelection(actionId, axisProvider, natTable);
- } else {
- doCollapseExpandActionOnChoosenRows(actionId, selectedAxis, axisProvider, natTable);
- }
- }
-
- /**
- * Do the collapse all action
- *
- * @param axisProvider
- * the axis provider
- * @param natTable
- * the nattable widget
- */
- private static final void doCollapseAll(ITableAxisElementProvider axisProvider, NatTable natTable) {
- natTable.doCommand(new TreeCollapseAllCommand());
-
- // with collapse all, we must check than the root category is not hidden. If the root is hidden, the table will be displayed as empty
- //added thanks to the bug 463312
- if (axisProvider instanceof INattableModelManager && StyleUtils.isHiddenDepth((INattableModelManager) axisProvider, 0)) {
- List<Object> rows = axisProvider.getRowElementsList();
- List<ITreeItemAxis> axis = new ArrayList<ITreeItemAxis>();
- for (Object current : rows) {
- Assert.isTrue(current instanceof ITreeItemAxis);
- Assert.isTrue(((ITreeItemAxis) current).getParent() == null);
- axis.add((ITreeItemAxis) current);
- }
- doCollapseExpandActionOnChoosenRows(CollapseAndExpandActionsEnum.EXPAND_ONE_LEVEL, axis, axisProvider, natTable);
- }
- }
-
- /**
- *
- * This method does the wanted action according to the current selection of the table
- *
- * @param actionId
- * the id of the action to do
- * @param axisProvider
- * the table axis provider
- * @param natTable
- * the natTable widget
- */
- private static final void doCollapseExpandActionOnSelection(CollapseAndExpandActionsEnum actionId, ITableAxisElementProvider axisProvider, NatTable natTable) {
- switch (actionId) {
- case COLLAPSE_ALL_FROM_SELECTION:
- collapseAllFromSelectedRows(axisProvider, natTable);
- return;
- case COLLAPSE_ONE_LEVEL:
- collapseSelectedRows(axisProvider, natTable);
- return;
- case EXPAND_TWO_LEVEL:
- expandOn2LevelsSelectedRows(axisProvider, natTable);
- return;
- case EXPAND_ALL_FROM_SELECTION:
- expandAllFromSelectedRows(axisProvider, natTable);
- return;
- case EXPAND_ONE_LEVEL:
- expandFromSelectedRows(axisProvider, natTable);
- return;
- case EXPAND_TO_NODE:
- // nothing to do
- return;
- default:
- return;
- }
- }
-
- /**
- *
- * This method does the wanted action according to the @param selectedRows
- *
- * @param actionId
- * the id of the action to do
- * @param selectedRows
- * the rows on which the action must be done
- * @param axisProvider
- * the table axis provider
- * @param natTable
- * the natTable widget
- */
- private static final void doCollapseExpandActionOnChoosenRows(CollapseAndExpandActionsEnum actionId, List<ITreeItemAxis> selectedRows, ITableAxisElementProvider axisProvider, NatTable natTable) {
- switch (actionId) {
- case COLLAPSE_ALL_FROM_SELECTION:
- collapseAllRows(selectedRows, axisProvider, natTable);
- break;
- case COLLAPSE_ONE_LEVEL:
- collapseRows(selectedRows, axisProvider, natTable);
- break;
- case EXPAND_ALL_FROM_SELECTION:
- expandAllRows(selectedRows, axisProvider, natTable);
- break;
- case EXPAND_ONE_LEVEL:
- expandRows(selectedRows, axisProvider, natTable);
- break;
- case EXPAND_TO_NODE:
- expandToRows(selectedRows, axisProvider, natTable);
- break;
- case EXPAND_TWO_LEVEL:
- expandOn2LevelsRows(selectedRows, axisProvider, natTable);
- break;
- default:
- break;
- }
- }
-
- /**
- * This method allows to expand the selected rows on 2 levels
- *
- * @param natTable
- *
- */
- private static final void expandOn2LevelsRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- List<ITreeItemAxis> toExpand = new ArrayList<ITreeItemAxis>();
- for (ITreeItemAxis current : axis) {
-
- toExpand.add(current);
- if (!current.isExpanded() && current.getChildren().size() > 0) {
- int index = axisProvider.getRowElementsList().indexOf(current);
- if (index != -1) {
- natTable.doCommand(new TreeExpandCollapseCommand(index));
- }
- }
- }
- for (ITreeItemAxis current : toExpand) {
- for (ITreeItemAxis child : current.getChildren()) {
- if (!child.isExpanded() && child.getChildren().size() > 0) {
- int index = axisProvider.getRowElementsList().indexOf(child);
- if (index != -1) {
- natTable.doCommand(new TreeExpandCollapseCommand(index));
- }
- }
- }
- }
- }
-
- /**
- *
- * @param axis
- * @param axisProvider
- * @param natTable
- */
- private static final void expandRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (ITreeItemAxis current : axis) {
- if (!current.isExpanded()) {
- int index = axisProvider.getRowElementsList().indexOf(current);
- if (index != -1) {
- natTable.doCommand(new TreeExpandCollapseCommand(index));
- }
- }
- }
- }
-
- /**
- *
- * @param axis
- * @param axisProvider
- * @param natTable
- */
- private static final void expandAllRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (ITreeItemAxis current : axis) {
- expandFullBranch(current, axisProvider, natTable);
- }
- }
-
- /**
- *
- * @param axis
- * @param axisProvider
- * @param natTable
- */
- private static final void collapseAllRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (ITreeItemAxis current : axis) {
- if (current.isExpanded()) {
- collapseFullBranch((ITreeItemAxis) axis, axisProvider, natTable);
- }
- }
- }
-
- /**
- * @param axis
- * the list of axis to collapse
- * @param natTable
- *
- */
- private static final void collapseRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (ITreeItemAxis current : axis) {
- int index = axisProvider.getRowElementsList().indexOf(axis);
- if (index != -1 && current.isExpanded()) {
- natTable.doCommand(new TreeExpandCollapseCommand(index));
- }
- }
- }
-
- /**
- *
- * This method expands parents of nodes to display these nodes in the table
- *
- * @param axis
- * a list of axis to show in the table
- * @param axisProvider
- * an axis provider
- * @param natTable
- * the natTable widget
- */
- private static final void expandToRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (ITreeItemAxis current : axis) {
- expandToNode(current, axisProvider, natTable);
- }
- }
-
- /**
- * This action expands the parents axis of the axis, in order to display it
- *
- * @param axis
- * an axis
- * @param axisProvider
- * the axis provider of the table
- * @param natTable
- * the natTable widget
- */
- private static final void expandToNode(ITreeItemAxis axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- List<ITreeItemAxis> axisToExpand = new ArrayList<ITreeItemAxis>();
- ITreeItemAxis parent = axis.getParent();
- while (parent != null) {
- if (!parent.isExpanded()) {
- axisToExpand.add(parent);
- }
- parent = parent.getParent();
- }
- for (ITreeItemAxis current : axisToExpand) {
- int index = axisProvider.getRowElementsList().indexOf(current);
- natTable.doCommand(new TreeExpandCollapseCommand(index));
- }
- }
-
- /**
- * this method allows to collapse the selection
- *
- * @param natTable
- *
- */
- private static final void collapseSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
- Object value = current.getValue();
- if (value instanceof ITreeItemAxis) {
- ITreeItemAxis axis = (ITreeItemAxis) value;
- if (axis.isExpanded()) {
- natTable.doCommand(new TreeExpandCollapseCommand(current.getKey()));
- }
- }
- }
- }
-
- /**
- * this method allows to expand the selection
- *
- * @param natTable
- *
- */
- private static final void expandFromSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
- Object value = current.getValue();
- if (value instanceof ITreeItemAxis) {
- ITreeItemAxis axis = (ITreeItemAxis) value;
- if (!axis.isExpanded()) {
- natTable.doCommand(new TreeExpandCollapseCommand(current.getKey()));
- }
- }
- }
- }
-
- /**
- * this method allows to collapse all nodes for the selection
- *
- * @param natTable
- *
- */
- private static final void collapseAllFromSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
- Object value = current.getValue();
- if (value instanceof ITreeItemAxis) {
- ITreeItemAxis axis = (ITreeItemAxis) value;
- if (axis.isExpanded()) {
- collapseFullBranch((ITreeItemAxis) axis, axisProvider, natTable);
- }
- }
- }
- }
-
- /**
- *
- * @param axis
- * an axis
- * this method collapse all ITreeItemAxis of the branch
- * @param natTable
- *
- */
- private static final void collapseFullBranch(ITreeItemAxis axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- // NatTable nattable = this.eventData.getNatTable();
- if (axis.isExpanded() && axis.getChildren().size() > 0) {
- int index = axisProvider.getRowElementsList().indexOf(axis);
- for (ITreeItemAxis child : axis.getChildren()) {
- collapseFullBranch(child, axisProvider, natTable);
- }
- natTable.doCommand(new TreeExpandCollapseCommand(index));
- }
- }
-
- /**
- * This method allows to expand the selected rows on 2 levels
- *
- * @param natTable
- *
- */
- private static final void expandOn2LevelsSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
- List<ITreeItemAxis> toExpand = new ArrayList<ITreeItemAxis>();
- for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
- Object value = current.getValue();
- if (value instanceof ITreeItemAxis) {
- ITreeItemAxis axis = (ITreeItemAxis) value;
- toExpand.add(axis);
- if (!axis.isExpanded() && axis.getChildren().size() > 0) {
- natTable.doCommand(new TreeExpandCollapseCommand(current.getKey()));
- }
- }
- }
- for (ITreeItemAxis current : toExpand) {
- for (ITreeItemAxis child : current.getChildren()) {
- if (!child.isExpanded() && child.getChildren().size() > 0) {
- int index = axisProvider.getRowElementsList().indexOf(child);
- natTable.doCommand(new TreeExpandCollapseCommand(index));
-
- }
- }
- }
- }
-
- /**
- * @return
- * a map with the selected rows
- */
- private static Map<Integer, Object> getFullySelectedRows() {
- IStructuredSelection selection = SelectionHelper.getCurrentStructuredSelection();
- if (selection instanceof TableStructuredSelection) {
- TableStructuredSelection tableSelection = (TableStructuredSelection) selection;
- TableSelectionWrapper wrapper = (TableSelectionWrapper) tableSelection.getAdapter(TableSelectionWrapper.class);
- return wrapper.getFullySelectedRows();
- }
- return Collections.emptyMap();
- }
-
- /**
- * This method allows to expand all the sub-item of the selected items
- *
- * @param natTable
- *
- */
- private static final void expandAllFromSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
- for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
- Object value = current.getValue();
- if (value instanceof ITreeItemAxis) {
- expandFullBranch((ITreeItemAxis) value, axisProvider, natTable);
- }
- }
- }
-
- /**
- *
- * @param axis
- * the axis for which we want to expand the whole branch
- * @param natTable
- *
- */
- private static final void expandFullBranch(ITreeItemAxis axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
- if (!axis.isExpanded() && axis.getChildren().size() > 0) {
- int index = axisProvider.getRowElementsList().indexOf(axis);
- natTable.doCommand(new TreeExpandCollapseCommand(index));
- for (ITreeItemAxis child : axis.getChildren()) {
- expandFullBranch(child, axisProvider, natTable);
- }
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.tree.command.TreeCollapseAllCommand;
+import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandAllCommand;
+import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.provider.TableStructuredSelection;
+import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum;
+import org.eclipse.papyrus.infra.ui.util.SelectionHelper;
+
+/**
+ * This class is not in API.
+ */
+public class CollapseExpandActionHelper {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ private CollapseExpandActionHelper() {
+ // to prevent instanciation
+ }
+
+ /**
+ * This method is not in the API.
+ *
+ * @param actionId
+ * the id of the action to do
+ * @param axisProvider
+ * the table axis provider
+ * @param natTable
+ * the natTable widget
+ */
+ public static final void doCollapseExpandAction(CollapseAndExpandActionsEnum actionId, List<ITreeItemAxis> selectedAxis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ switch (actionId) {
+ case EXPAND_ALL:
+ natTable.doCommand(new TreeExpandAllCommand());
+ return;
+ case COLLAPSE_ALL:
+ doCollapseAll(axisProvider, natTable);
+ return;
+ default:
+ break;
+ }
+
+ if (selectedAxis == null) {
+ doCollapseExpandActionOnSelection(actionId, axisProvider, natTable);
+ } else {
+ doCollapseExpandActionOnChoosenRows(actionId, selectedAxis, axisProvider, natTable);
+ }
+ }
+
+ /**
+ * Do the collapse all action
+ *
+ * @param axisProvider
+ * the axis provider
+ * @param natTable
+ * the nattable widget
+ */
+ private static final void doCollapseAll(ITableAxisElementProvider axisProvider, NatTable natTable) {
+ natTable.doCommand(new TreeCollapseAllCommand());
+
+ // with collapse all, we must check than the root category is not hidden. If the root is hidden, the table will be displayed as empty
+ //added thanks to the bug 463312
+ if (axisProvider instanceof INattableModelManager && StyleUtils.isHiddenDepth((INattableModelManager) axisProvider, 0)) {
+ List<Object> rows = axisProvider.getRowElementsList();
+ List<ITreeItemAxis> axis = new ArrayList<ITreeItemAxis>();
+ for (Object current : rows) {
+ Assert.isTrue(current instanceof ITreeItemAxis);
+ Assert.isTrue(((ITreeItemAxis) current).getParent() == null);
+ axis.add((ITreeItemAxis) current);
+ }
+ doCollapseExpandActionOnChoosenRows(CollapseAndExpandActionsEnum.EXPAND_ONE_LEVEL, axis, axisProvider, natTable);
+ }
+ }
+
+ /**
+ *
+ * This method does the wanted action according to the current selection of the table
+ *
+ * @param actionId
+ * the id of the action to do
+ * @param axisProvider
+ * the table axis provider
+ * @param natTable
+ * the natTable widget
+ */
+ private static final void doCollapseExpandActionOnSelection(CollapseAndExpandActionsEnum actionId, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ switch (actionId) {
+ case COLLAPSE_ALL_FROM_SELECTION:
+ collapseAllFromSelectedRows(axisProvider, natTable);
+ return;
+ case COLLAPSE_ONE_LEVEL:
+ collapseSelectedRows(axisProvider, natTable);
+ return;
+ case EXPAND_TWO_LEVEL:
+ expandOn2LevelsSelectedRows(axisProvider, natTable);
+ return;
+ case EXPAND_ALL_FROM_SELECTION:
+ expandAllFromSelectedRows(axisProvider, natTable);
+ return;
+ case EXPAND_ONE_LEVEL:
+ expandFromSelectedRows(axisProvider, natTable);
+ return;
+ case EXPAND_TO_NODE:
+ // nothing to do
+ return;
+ default:
+ return;
+ }
+ }
+
+ /**
+ *
+ * This method does the wanted action according to the @param selectedRows
+ *
+ * @param actionId
+ * the id of the action to do
+ * @param selectedRows
+ * the rows on which the action must be done
+ * @param axisProvider
+ * the table axis provider
+ * @param natTable
+ * the natTable widget
+ */
+ private static final void doCollapseExpandActionOnChoosenRows(CollapseAndExpandActionsEnum actionId, List<ITreeItemAxis> selectedRows, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ switch (actionId) {
+ case COLLAPSE_ALL_FROM_SELECTION:
+ collapseAllRows(selectedRows, axisProvider, natTable);
+ break;
+ case COLLAPSE_ONE_LEVEL:
+ collapseRows(selectedRows, axisProvider, natTable);
+ break;
+ case EXPAND_ALL_FROM_SELECTION:
+ expandAllRows(selectedRows, axisProvider, natTable);
+ break;
+ case EXPAND_ONE_LEVEL:
+ expandRows(selectedRows, axisProvider, natTable);
+ break;
+ case EXPAND_TO_NODE:
+ expandToRows(selectedRows, axisProvider, natTable);
+ break;
+ case EXPAND_TWO_LEVEL:
+ expandOn2LevelsRows(selectedRows, axisProvider, natTable);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * This method allows to expand the selected rows on 2 levels
+ *
+ * @param natTable
+ *
+ */
+ private static final void expandOn2LevelsRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ List<ITreeItemAxis> toExpand = new ArrayList<ITreeItemAxis>();
+ for (ITreeItemAxis current : axis) {
+
+ toExpand.add(current);
+ if (!current.isExpanded() && current.getChildren().size() > 0) {
+ int index = axisProvider.getRowElementsList().indexOf(current);
+ if (index != -1) {
+ natTable.doCommand(new TreeExpandCollapseCommand(index));
+ }
+ }
+ }
+ for (ITreeItemAxis current : toExpand) {
+ for (ITreeItemAxis child : current.getChildren()) {
+ if (!child.isExpanded() && child.getChildren().size() > 0) {
+ int index = axisProvider.getRowElementsList().indexOf(child);
+ if (index != -1) {
+ natTable.doCommand(new TreeExpandCollapseCommand(index));
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param axis
+ * @param axisProvider
+ * @param natTable
+ */
+ private static final void expandRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (ITreeItemAxis current : axis) {
+ if (!current.isExpanded()) {
+ int index = axisProvider.getRowElementsList().indexOf(current);
+ if (index != -1) {
+ natTable.doCommand(new TreeExpandCollapseCommand(index));
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param axis
+ * @param axisProvider
+ * @param natTable
+ */
+ private static final void expandAllRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (ITreeItemAxis current : axis) {
+ expandFullBranch(current, axisProvider, natTable);
+ }
+ }
+
+ /**
+ *
+ * @param axis
+ * @param axisProvider
+ * @param natTable
+ */
+ private static final void collapseAllRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (ITreeItemAxis current : axis) {
+ if (current.isExpanded()) {
+ collapseFullBranch((ITreeItemAxis) axis, axisProvider, natTable);
+ }
+ }
+ }
+
+ /**
+ * @param axis
+ * the list of axis to collapse
+ * @param natTable
+ *
+ */
+ private static final void collapseRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (ITreeItemAxis current : axis) {
+ int index = axisProvider.getRowElementsList().indexOf(axis);
+ if (index != -1 && current.isExpanded()) {
+ natTable.doCommand(new TreeExpandCollapseCommand(index));
+ }
+ }
+ }
+
+ /**
+ *
+ * This method expands parents of nodes to display these nodes in the table
+ *
+ * @param axis
+ * a list of axis to show in the table
+ * @param axisProvider
+ * an axis provider
+ * @param natTable
+ * the natTable widget
+ */
+ private static final void expandToRows(List<ITreeItemAxis> axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (ITreeItemAxis current : axis) {
+ expandToNode(current, axisProvider, natTable);
+ }
+ }
+
+ /**
+ * This action expands the parents axis of the axis, in order to display it
+ *
+ * @param axis
+ * an axis
+ * @param axisProvider
+ * the axis provider of the table
+ * @param natTable
+ * the natTable widget
+ */
+ private static final void expandToNode(ITreeItemAxis axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ List<ITreeItemAxis> axisToExpand = new ArrayList<ITreeItemAxis>();
+ ITreeItemAxis parent = axis.getParent();
+ while (parent != null) {
+ if (!parent.isExpanded()) {
+ axisToExpand.add(parent);
+ }
+ parent = parent.getParent();
+ }
+ for (ITreeItemAxis current : axisToExpand) {
+ int index = axisProvider.getRowElementsList().indexOf(current);
+ natTable.doCommand(new TreeExpandCollapseCommand(index));
+ }
+ }
+
+ /**
+ * this method allows to collapse the selection
+ *
+ * @param natTable
+ *
+ */
+ private static final void collapseSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
+ Object value = current.getValue();
+ if (value instanceof ITreeItemAxis) {
+ ITreeItemAxis axis = (ITreeItemAxis) value;
+ if (axis.isExpanded()) {
+ natTable.doCommand(new TreeExpandCollapseCommand(current.getKey()));
+ }
+ }
+ }
+ }
+
+ /**
+ * this method allows to expand the selection
+ *
+ * @param natTable
+ *
+ */
+ private static final void expandFromSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
+ Object value = current.getValue();
+ if (value instanceof ITreeItemAxis) {
+ ITreeItemAxis axis = (ITreeItemAxis) value;
+ if (!axis.isExpanded()) {
+ natTable.doCommand(new TreeExpandCollapseCommand(current.getKey()));
+ }
+ }
+ }
+ }
+
+ /**
+ * this method allows to collapse all nodes for the selection
+ *
+ * @param natTable
+ *
+ */
+ private static final void collapseAllFromSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
+ Object value = current.getValue();
+ if (value instanceof ITreeItemAxis) {
+ ITreeItemAxis axis = (ITreeItemAxis) value;
+ if (axis.isExpanded()) {
+ collapseFullBranch((ITreeItemAxis) axis, axisProvider, natTable);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param axis
+ * an axis
+ * this method collapse all ITreeItemAxis of the branch
+ * @param natTable
+ *
+ */
+ private static final void collapseFullBranch(ITreeItemAxis axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ // NatTable nattable = this.eventData.getNatTable();
+ if (axis.isExpanded() && axis.getChildren().size() > 0) {
+ int index = axisProvider.getRowElementsList().indexOf(axis);
+ for (ITreeItemAxis child : axis.getChildren()) {
+ collapseFullBranch(child, axisProvider, natTable);
+ }
+ natTable.doCommand(new TreeExpandCollapseCommand(index));
+ }
+ }
+
+ /**
+ * This method allows to expand the selected rows on 2 levels
+ *
+ * @param natTable
+ *
+ */
+ private static final void expandOn2LevelsSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
+ List<ITreeItemAxis> toExpand = new ArrayList<ITreeItemAxis>();
+ for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
+ Object value = current.getValue();
+ if (value instanceof ITreeItemAxis) {
+ ITreeItemAxis axis = (ITreeItemAxis) value;
+ toExpand.add(axis);
+ if (!axis.isExpanded() && axis.getChildren().size() > 0) {
+ natTable.doCommand(new TreeExpandCollapseCommand(current.getKey()));
+ }
+ }
+ }
+ for (ITreeItemAxis current : toExpand) {
+ for (ITreeItemAxis child : current.getChildren()) {
+ if (!child.isExpanded() && child.getChildren().size() > 0) {
+ int index = axisProvider.getRowElementsList().indexOf(child);
+ natTable.doCommand(new TreeExpandCollapseCommand(index));
+
+ }
+ }
+ }
+ }
+
+ /**
+ * @return
+ * a map with the selected rows
+ */
+ private static Map<Integer, Object> getFullySelectedRows() {
+ IStructuredSelection selection = SelectionHelper.getCurrentStructuredSelection();
+ if (selection instanceof TableStructuredSelection) {
+ TableStructuredSelection tableSelection = (TableStructuredSelection) selection;
+ TableSelectionWrapper wrapper = (TableSelectionWrapper) tableSelection.getAdapter(TableSelectionWrapper.class);
+ return wrapper.getFullySelectedRows();
+ }
+ return Collections.emptyMap();
+ }
+
+ /**
+ * This method allows to expand all the sub-item of the selected items
+ *
+ * @param natTable
+ *
+ */
+ private static final void expandAllFromSelectedRows(ITableAxisElementProvider axisProvider, NatTable natTable) {
+ for (Entry<Integer, Object> current : getFullySelectedRows().entrySet()) {
+ Object value = current.getValue();
+ if (value instanceof ITreeItemAxis) {
+ expandFullBranch((ITreeItemAxis) value, axisProvider, natTable);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param axis
+ * the axis for which we want to expand the whole branch
+ * @param natTable
+ *
+ */
+ private static final void expandFullBranch(ITreeItemAxis axis, ITableAxisElementProvider axisProvider, NatTable natTable) {
+ if (!axis.isExpanded() && axis.getChildren().size() > 0) {
+ int index = axisProvider.getRowElementsList().indexOf(axis);
+ natTable.doCommand(new TreeExpandCollapseCommand(index));
+ for (ITreeItemAxis child : axis.getChildren()) {
+ expandFullBranch(child, axisProvider, natTable);
+ }
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/DefaultSizeUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/DefaultSizeUtils.java
index 4a98199bcea..3aa8933bff4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/DefaultSizeUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/DefaultSizeUtils.java
@@ -1,91 +1,91 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Adapted code from EMF-Facet Nattable integration
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Display;
-
-public final class DefaultSizeUtils {
-
- private static final float MARGINE = 4;
-
- private static final float FONT_CELL_RATIO = 2;
-
- private static final float WIDTH_HEIGHT_RATIO = 8;
-
- private static final float ROW_HEADER_RATIO = 6; // Row header width height ratio
-
- private static final float DEFAULT_DPI = 96;
-
- private DefaultSizeUtils() {
- // Must not be used.
- }
-
- /**
- * windows : 150%
- * dipX=dpiY = 150
- * fontName = Segoe UI
- * fontHeight = 9
- * value = 33
- *
- * windows 125% :
- * dipX = dpiY = 120
- * fontName = Segoe UI
- * fontHeight = 9
- * value = 27,5
- *
- * windows 100%
- * dipX = dpiY = 96
- * fontName = Segoe UI
- * fontHeight = 9
- * value = 22
- *
- * @return
- * the default cell height to use, according to the dpi used by the system
- */
- public static int getDefaultCellHeight() {
- float dpiY = Display.getDefault().getDPI().y;
- FontData[] fd = Display.getDefault().getSystemFont().getFontData();
- // fd[0].getName();
- float height = (fd[0].getHeight() * DefaultSizeUtils.FONT_CELL_RATIO) + DefaultSizeUtils.MARGINE;
- float value = height * (dpiY / DEFAULT_DPI);
- return (int) Math.ceil(value);
- }
-
- /**
- *
- * @return
- * the default cell width to use, according to the dpi used by the system
- */
- public static int getDefaultCellWidth() {
- float width = DefaultSizeUtils.getDefaultCellHeight() * DefaultSizeUtils.WIDTH_HEIGHT_RATIO;
- return (int) Math.ceil(width);
- }
-
- // not used
- public static int getDefaultRowHeaderWidth() {
- float width = DefaultSizeUtils.getDefaultCellHeight() * DefaultSizeUtils.ROW_HEADER_RATIO;
- return (int) Math.ceil(width);
- }
-
- // not used
- public static Font getHeaderFont() {
- FontData[] fd = Display.getDefault().getSystemFont().getFontData().clone();
- fd[0].setStyle(SWT.BOLD);
- Font headerFont = new Font(Display.getDefault(), fd);
- return headerFont;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Adapted code from EMF-Facet Nattable integration
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+
+public final class DefaultSizeUtils {
+
+ private static final float MARGINE = 4;
+
+ private static final float FONT_CELL_RATIO = 2;
+
+ private static final float WIDTH_HEIGHT_RATIO = 8;
+
+ private static final float ROW_HEADER_RATIO = 6; // Row header width height ratio
+
+ private static final float DEFAULT_DPI = 96;
+
+ private DefaultSizeUtils() {
+ // Must not be used.
+ }
+
+ /**
+ * windows : 150%
+ * dipX=dpiY = 150
+ * fontName = Segoe UI
+ * fontHeight = 9
+ * value = 33
+ *
+ * windows 125% :
+ * dipX = dpiY = 120
+ * fontName = Segoe UI
+ * fontHeight = 9
+ * value = 27,5
+ *
+ * windows 100%
+ * dipX = dpiY = 96
+ * fontName = Segoe UI
+ * fontHeight = 9
+ * value = 22
+ *
+ * @return
+ * the default cell height to use, according to the dpi used by the system
+ */
+ public static int getDefaultCellHeight() {
+ float dpiY = Display.getDefault().getDPI().y;
+ FontData[] fd = Display.getDefault().getSystemFont().getFontData();
+ // fd[0].getName();
+ float height = (fd[0].getHeight() * DefaultSizeUtils.FONT_CELL_RATIO) + DefaultSizeUtils.MARGINE;
+ float value = height * (dpiY / DEFAULT_DPI);
+ return (int) Math.ceil(value);
+ }
+
+ /**
+ *
+ * @return
+ * the default cell width to use, according to the dpi used by the system
+ */
+ public static int getDefaultCellWidth() {
+ float width = DefaultSizeUtils.getDefaultCellHeight() * DefaultSizeUtils.WIDTH_HEIGHT_RATIO;
+ return (int) Math.ceil(width);
+ }
+
+ // not used
+ public static int getDefaultRowHeaderWidth() {
+ float width = DefaultSizeUtils.getDefaultCellHeight() * DefaultSizeUtils.ROW_HEADER_RATIO;
+ return (int) Math.ceil(width);
+ }
+
+ // not used
+ public static Font getHeaderFont() {
+ FontData[] fd = Display.getDefault().getSystemFont().getFontData().clone();
+ fd[0].setStyle(SWT.BOLD);
+ Font headerFont = new Font(Display.getDefault(), fd);
+ return headerFont;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/EventListHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/EventListHelper.java
index 860ff80b5f7..894ab65ef4e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/EventListHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/EventListHelper.java
@@ -1,114 +1,114 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-
-import ca.odell.glazedlists.EventList;
-
-/**
- * @author Vincent Lorenzo
- * This class provides methods to manipulate properly EventList calling appropriate lock and unlock methods
- */
-public class EventListHelper {
-
- private EventListHelper() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param list
- * an event list to edit
- * @param object
- * an object to add to the event list
- */
- public static final void addToEventList(final EventList<Object> list, final Object object) {
- list.getReadWriteLock().readLock().lock();
- try {
- if (list.contains(object)) {
- return;
- }
- } catch (Exception e1) {
- Activator.log.error(e1);
- } finally {
- list.getReadWriteLock().readLock().unlock();
- }
- int parentIndex = -1;
- // 1. get the index to add the element
- if (object instanceof ITreeItemAxis) {
- IAxis parent = ((ITreeItemAxis) object).getParent();
- if (parent != null) {
- try {
- list.getReadWriteLock().readLock().lock();
- parentIndex = list.indexOf(parent);
- } catch (Exception e) {
- Activator.log.error(e);
- } finally {
- list.getReadWriteLock().readLock().unlock();
- }
- }
- }
-
-
- list.getReadWriteLock().writeLock().lock();
- try {
- if (parentIndex != -1) {
- list.add(parentIndex + 1, object);
- } else {
- list.add(object);
- }
- } catch (Exception e) {
- Activator.log.error(e);
- } finally {
- list.getReadWriteLock().writeLock().unlock();
- }
- }
-
- /**
- *
- * @param list
- * an event list to edit
- * @param object
- * an object to remove from the list
- */
- public static final void removeFromEventList(final EventList<Object> list, final Object object) {
- list.getReadWriteLock().readLock().lock();
- try {
- if (!list.contains(object)) {
- return;
- }
- } catch (Exception e1) {
- Activator.log.error(e1);
- } finally {
- list.getReadWriteLock().readLock().unlock();
- }
-
- list.getReadWriteLock().writeLock().lock();
- try {
-
- if (object instanceof ITreeItemAxis) {
- list.remove(object);
- } else {
- list.remove(object);
- }
- } catch (Exception e) {
- Activator.log.error(e);
- } finally {
- list.getReadWriteLock().writeLock().unlock();
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+
+import ca.odell.glazedlists.EventList;
+
+/**
+ * @author Vincent Lorenzo
+ * This class provides methods to manipulate properly EventList calling appropriate lock and unlock methods
+ */
+public class EventListHelper {
+
+ private EventListHelper() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param list
+ * an event list to edit
+ * @param object
+ * an object to add to the event list
+ */
+ public static final void addToEventList(final EventList<Object> list, final Object object) {
+ list.getReadWriteLock().readLock().lock();
+ try {
+ if (list.contains(object)) {
+ return;
+ }
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ } finally {
+ list.getReadWriteLock().readLock().unlock();
+ }
+ int parentIndex = -1;
+ // 1. get the index to add the element
+ if (object instanceof ITreeItemAxis) {
+ IAxis parent = ((ITreeItemAxis) object).getParent();
+ if (parent != null) {
+ try {
+ list.getReadWriteLock().readLock().lock();
+ parentIndex = list.indexOf(parent);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ } finally {
+ list.getReadWriteLock().readLock().unlock();
+ }
+ }
+ }
+
+
+ list.getReadWriteLock().writeLock().lock();
+ try {
+ if (parentIndex != -1) {
+ list.add(parentIndex + 1, object);
+ } else {
+ list.add(object);
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ } finally {
+ list.getReadWriteLock().writeLock().unlock();
+ }
+ }
+
+ /**
+ *
+ * @param list
+ * an event list to edit
+ * @param object
+ * an object to remove from the list
+ */
+ public static final void removeFromEventList(final EventList<Object> list, final Object object) {
+ list.getReadWriteLock().readLock().lock();
+ try {
+ if (!list.contains(object)) {
+ return;
+ }
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ } finally {
+ list.getReadWriteLock().readLock().unlock();
+ }
+
+ list.getReadWriteLock().writeLock().lock();
+ try {
+
+ if (object instanceof ITreeItemAxis) {
+ list.remove(object);
+ } else {
+ list.remove(object);
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ } finally {
+ list.getReadWriteLock().writeLock().unlock();
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/FillingConfigurationUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/FillingConfigurationUtils.java
index 23d089f118d..409e796aca6 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/FillingConfigurationUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/FillingConfigurationUtils.java
@@ -1,435 +1,435 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IFillingConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
-
-/**
- *
- * Util class used to get FillingConfigruation for the table
- *
- */
-public class FillingConfigurationUtils {
-
-
- private FillingConfigurationUtils() {
- // to prevent instanciation
- }
-
- /**
- * error message for developper
- */
- private static final String INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE = "Invert axis not yet managed -> probably impossible with tree table"; //$NON-NLS-1$
-
- /**
- *
- * @param table
- * a table
- * @param rep
- * an axis manager representation
- * @param onColumn
- * a boolean indicating than we are on column
- * @return
- * the list of {@link TreeFillingConfiguration} to use for the representedAxisManager
- */
- public static final List<TreeFillingConfiguration> getTreeFillingConfiguration(final Table table, final AxisManagerRepresentation representedAxisManager) {
- Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
- List<TreeFillingConfiguration> confs = new ArrayList<TreeFillingConfiguration>();
- LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
- if (local != null && local.getAxisManagerConfigurations().size() > 0) {
- for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
- if (currentRep.getAxisManager() == representedAxisManager) {
- for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- confs.add((TreeFillingConfiguration) current);
- }
- }
- return confs;
- }
- }
- } else {
- for (final IAxisConfiguration current : representedAxisManager.getSpecificAxisConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- confs.add((TreeFillingConfiguration) current);
- }
- }
- }
- return confs;
- }
-
- /**
- *
- * @param table
- * a table
- * @param rep
- * an axis manager representation
- * @return
- * the list of {@link TreeFillingConfiguration} to use for the representedAxisManager defined as column axis manager
- * @since 4.0
- */
- public static final List<TreeFillingConfiguration> getTreeFillingConfigurationForColumn(final Table table, final AxisManagerRepresentation representedAxisManager) {
- Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
- List<TreeFillingConfiguration> confs = new ArrayList<TreeFillingConfiguration>();
- LocalTableHeaderAxisConfiguration local = table.getLocalColumnHeaderAxisConfiguration();
- if (local != null && local.getAxisManagerConfigurations().size() > 0) {
- for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
- if (currentRep.getAxisManager() == representedAxisManager) {
- for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- confs.add((TreeFillingConfiguration) current);
- }
- }
- return confs;
- }
- }
- } else {
- for (final IAxisConfiguration current : representedAxisManager.getSpecificAxisConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- confs.add((TreeFillingConfiguration) current);
- }
- }
- }
- return confs;
- }
- /**
- *
- * @param table
- * a table
- * @param wantedDepth
- * the depth for which we want all TreeFillingConfiguration
- * @return
- * the list of {@link TreeFillingConfiguration} to use for the representedAxisManager
- */
- public static final List<TreeFillingConfiguration> getAllTreeFillingConfigurationForDepth(final Table table, final int wantedDepth) {
- Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
- List<TreeFillingConfiguration> confs = new ArrayList<TreeFillingConfiguration>();
- LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
- if (local != null && local.getAxisManagerConfigurations().size() > 0) {
- for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
- for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- if (((TreeFillingConfiguration) current).getDepth() == wantedDepth) {
- confs.add((TreeFillingConfiguration) current);
- }
- }
- }
- return confs;
- }
-
- }
-
- TableHeaderAxisConfiguration rowConfig = table.getTableConfiguration().getRowHeaderAxisConfiguration();
- List<AxisManagerRepresentation> axisManagers = rowConfig.getAxisManagers();
- for (AxisManagerRepresentation axisManagerRepresentation : axisManagers) {
- for (IAxisConfiguration current : axisManagerRepresentation.getSpecificAxisConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- if (((TreeFillingConfiguration) current).getDepth() == wantedDepth) {
- confs.add((TreeFillingConfiguration) current);
- }
- }
- }
- }
- return confs;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * all {@link TreeFillingConfiguration} used in the table
- */
- public static final List<TreeFillingConfiguration> getAllTreeFillingConfiguration(final Table table) {
- Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
- List<TreeFillingConfiguration> confs = new ArrayList<TreeFillingConfiguration>();
- LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
- if (local != null && !local.getAxisManagerConfigurations().isEmpty()) { //bug 467968: [Tree Table] Show Hide categories menu is not displayed after changing categories
- for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
- for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- confs.add((TreeFillingConfiguration) current);
- }
- }
- }
- } else {
- for (AxisManagerRepresentation axisManager : table.getTableConfiguration().getRowHeaderAxisConfiguration().getAxisManagers()) {
- for (IAxisConfiguration axisConf : axisManager.getSpecificAxisConfigurations()) {
- if (axisConf instanceof TreeFillingConfiguration) {
- confs.add((TreeFillingConfiguration) axisConf);
- }
- }
- }
- }
- return confs;
- }
-
-
- /**
- *
- * @param table
- * a table
- * @param representedAxisManager
- * the represented axis manager for which we want TreeFillingConfiguration
- * @param depth
- * the depth for which we want tree filling configuration
- * @return
- * <code>true</code> is the representedAxisManager has TreeFillingConfiguration
- *
- */
- public static final boolean hasTreeFillingConfiguration(final Table table, final AxisManagerRepresentation representedAxisManager) {
- Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
- LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
- if (local != null) {
- for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
- if (currentRep.getAxisManager() == representedAxisManager) {
- for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- return true;
- }
- }
- }
- }
- } else {
- for (final IAxisConfiguration current : representedAxisManager.getSpecificAxisConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- *
- * @param table
- * a table
- * @param representedAxisManager
- * the represented axis manager for which we want TreeFillingConfiguration
- * @param depth
- * the depth for which we want tree filling configuration
- * @return
- * a list of @link TreeFillingConfiguration} for the wanted depth
- *
- */
- public static final List<TreeFillingConfiguration> getTreeFillingConfigurationForDepth(final Table table, final AxisManagerRepresentation representedAxisManager, final int depth) {
- // duplicate code getTreeFillingConfiguration to avoid to iterate twice on the same list
- List<TreeFillingConfiguration> confs = getTreeFillingConfiguration(table, representedAxisManager);
- Iterator<TreeFillingConfiguration> iter = confs.listIterator();
- while (iter.hasNext()) {
- if (iter.next().getDepth() != depth) {
- iter.remove();
- }
- }
- return confs;
- }
-
- /**
- *
- * @param table
- * a table
- * @param representedAxisManager
- * the represented axis manager for which we want TreeFillingConfiguration
- * @param depth
- * the depth for which we want tree filling configuration
- * @return
- * <code>true</code> if we found {@link TreeFillingConfiguration} for the wanted depth
- *
- */
- public static final boolean hasTreeFillingConfigurationForDepth(final Table table, final AxisManagerRepresentation representedAxisManager, final int depth) {
- Iterator<TreeFillingConfiguration> iter = getTreeFillingConfigurationForDepth(table, representedAxisManager, depth).iterator();
- while (iter.hasNext()) {
- if (iter.next().getDepth() == depth) {
- return true;
- }
- }
- return false;
- }
-
- /**
- *
- * @param table
- * the table
- * @param onColumn
- * <code>true</code> if the user is working on column and false if not
- * @return
- * the list of the filling configuration used by the table
- */
- // TODO : doesn't yet manage the local filling configuration
- public static final Collection<IFillingConfiguration> getFillingConfigurationUsedInTable(final Table table, final boolean onColumn) {
- final Collection<IFillingConfiguration> confs = new ArrayList<IFillingConfiguration>();
-
-
- AbstractHeaderAxisConfiguration tableHeaderAxisConfiguration;
- if (onColumn) {
- tableHeaderAxisConfiguration = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(table);
- } else {
- tableHeaderAxisConfiguration = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
- }
-
- for (final IAxisConfiguration currentConfiguration : tableHeaderAxisConfiguration.getOwnedAxisConfigurations()) {
- if (currentConfiguration instanceof IFillingConfiguration) {
- confs.add((IFillingConfiguration) currentConfiguration);
- }
- }
-
- return confs;
- }
-
- /**
- *
- * @param table
- * the table
- * @param onColumn
- * true if we are working on column
- * @return
- * the element type id to create or <code>null</code> if not found
- */
- public static String getElementTypeIdToCreate(final Table table, final boolean onColumn) {
- final Collection<IFillingConfiguration> fillingConfiguration = FillingConfigurationUtils.getFillingConfigurationUsedInTable(table, onColumn);
- for (IFillingConfiguration iFillingConfiguration : fillingConfiguration) {
- if (iFillingConfiguration instanceof PasteEObjectConfiguration) {
- return ((PasteEObjectConfiguration) fillingConfiguration).getPastedElementId();
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * the table
- * @param onColumn
- * true if we are working on column
- * @return
- * the containment feature to use for created element
- */
- public static EStructuralFeature getContainmentFeature(final Table table, final boolean onColumn) {
- final Collection<IFillingConfiguration> fillingConfiguration = FillingConfigurationUtils.getFillingConfigurationUsedInTable(table, onColumn);
- for (IFillingConfiguration iFillingConfiguration : fillingConfiguration) {
- if (iFillingConfiguration instanceof PasteEObjectConfiguration) {
- return ((PasteEObjectConfiguration) fillingConfiguration).getPasteElementContainementFeature();
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @param depth
- * a wanted depth
- * @return
- * <code>true</code> if the table has tree filling configuration declared on the wanted depth
- */
- public static boolean hasTreeFillingConfigurationForDepth(final Table table, final int depth) {
- Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
- LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
- if (local != null) {
- List<AxisManagerConfiguration> localReps = local.getAxisManagerConfigurations();
- if (!localReps.isEmpty()) {
- for (AxisManagerConfiguration currentRep : localReps) {
- for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
- if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == depth) {
- return true;
- }
- }
- }
- return false;
- }
- }
- final List<AxisManagerRepresentation> representation = table.getTableConfiguration().getRowHeaderAxisConfiguration().getAxisManagers();
- for (final AxisManagerRepresentation currentRep : representation) {
- for (final IAxisConfiguration current : currentRep.getSpecificAxisConfigurations()) {
- if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == depth) {
- return true;
- }
- }
-
- }
- return false;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the maximum depth displayed in the table. This method check than all hidden depth are consecutive and start to 0 (or 1)
- */
- public static int getMaxDepthForTree(final Table table) {
- Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
- TreeSet<Integer> hiddenLevels = new TreeSet<Integer>();
- LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
- if (local != null && !local.getAxisManagerConfigurations().isEmpty()) {
- for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
- for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- int depth = ((TreeFillingConfiguration) current).getDepth();
- if (depth >= 0) {
- hiddenLevels.add(Integer.valueOf(depth));
- }
- }
- }
- }
- } else {
- final List<AxisManagerRepresentation> representation = table.getTableConfiguration().getRowHeaderAxisConfiguration().getAxisManagers();
- for (final AxisManagerRepresentation currentRep : representation) {
- for (final IAxisConfiguration current : currentRep.getSpecificAxisConfigurations()) {
- if (current instanceof TreeFillingConfiguration) {
- int depth = ((TreeFillingConfiguration) current).getDepth();
- if (depth >= 0) {
- hiddenLevels.add(Integer.valueOf(depth));
- }
- }
- }
- }
- }
- if (hiddenLevels.size() > 0) {
- Iterator<Integer> iter = hiddenLevels.iterator();
- int previousValue = iter.next().intValue();
- if (previousValue == 0 || previousValue == 1) {
- while (iter.hasNext()) {
- int nextValue = iter.next();
- if (nextValue == previousValue + 1) {
- previousValue = nextValue;
- } else {
- return previousValue;
- }
- }
- return previousValue;
- }
-
- }
- return 0;
-
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+
+/**
+ *
+ * Util class used to get FillingConfigruation for the table
+ *
+ */
+public class FillingConfigurationUtils {
+
+
+ private FillingConfigurationUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ * error message for developper
+ */
+ private static final String INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE = "Invert axis not yet managed -> probably impossible with tree table"; //$NON-NLS-1$
+
+ /**
+ *
+ * @param table
+ * a table
+ * @param rep
+ * an axis manager representation
+ * @param onColumn
+ * a boolean indicating than we are on column
+ * @return
+ * the list of {@link TreeFillingConfiguration} to use for the representedAxisManager
+ */
+ public static final List<TreeFillingConfiguration> getTreeFillingConfiguration(final Table table, final AxisManagerRepresentation representedAxisManager) {
+ Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
+ List<TreeFillingConfiguration> confs = new ArrayList<TreeFillingConfiguration>();
+ LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
+ if (local != null && local.getAxisManagerConfigurations().size() > 0) {
+ for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
+ if (currentRep.getAxisManager() == representedAxisManager) {
+ for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ confs.add((TreeFillingConfiguration) current);
+ }
+ }
+ return confs;
+ }
+ }
+ } else {
+ for (final IAxisConfiguration current : representedAxisManager.getSpecificAxisConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ confs.add((TreeFillingConfiguration) current);
+ }
+ }
+ }
+ return confs;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @param rep
+ * an axis manager representation
+ * @return
+ * the list of {@link TreeFillingConfiguration} to use for the representedAxisManager defined as column axis manager
+ * @since 4.0
+ */
+ public static final List<TreeFillingConfiguration> getTreeFillingConfigurationForColumn(final Table table, final AxisManagerRepresentation representedAxisManager) {
+ Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
+ List<TreeFillingConfiguration> confs = new ArrayList<TreeFillingConfiguration>();
+ LocalTableHeaderAxisConfiguration local = table.getLocalColumnHeaderAxisConfiguration();
+ if (local != null && local.getAxisManagerConfigurations().size() > 0) {
+ for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
+ if (currentRep.getAxisManager() == representedAxisManager) {
+ for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ confs.add((TreeFillingConfiguration) current);
+ }
+ }
+ return confs;
+ }
+ }
+ } else {
+ for (final IAxisConfiguration current : representedAxisManager.getSpecificAxisConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ confs.add((TreeFillingConfiguration) current);
+ }
+ }
+ }
+ return confs;
+ }
+ /**
+ *
+ * @param table
+ * a table
+ * @param wantedDepth
+ * the depth for which we want all TreeFillingConfiguration
+ * @return
+ * the list of {@link TreeFillingConfiguration} to use for the representedAxisManager
+ */
+ public static final List<TreeFillingConfiguration> getAllTreeFillingConfigurationForDepth(final Table table, final int wantedDepth) {
+ Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
+ List<TreeFillingConfiguration> confs = new ArrayList<TreeFillingConfiguration>();
+ LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
+ if (local != null && local.getAxisManagerConfigurations().size() > 0) {
+ for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
+ for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ if (((TreeFillingConfiguration) current).getDepth() == wantedDepth) {
+ confs.add((TreeFillingConfiguration) current);
+ }
+ }
+ }
+ return confs;
+ }
+
+ }
+
+ TableHeaderAxisConfiguration rowConfig = table.getTableConfiguration().getRowHeaderAxisConfiguration();
+ List<AxisManagerRepresentation> axisManagers = rowConfig.getAxisManagers();
+ for (AxisManagerRepresentation axisManagerRepresentation : axisManagers) {
+ for (IAxisConfiguration current : axisManagerRepresentation.getSpecificAxisConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ if (((TreeFillingConfiguration) current).getDepth() == wantedDepth) {
+ confs.add((TreeFillingConfiguration) current);
+ }
+ }
+ }
+ }
+ return confs;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * all {@link TreeFillingConfiguration} used in the table
+ */
+ public static final List<TreeFillingConfiguration> getAllTreeFillingConfiguration(final Table table) {
+ Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
+ List<TreeFillingConfiguration> confs = new ArrayList<TreeFillingConfiguration>();
+ LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
+ if (local != null && !local.getAxisManagerConfigurations().isEmpty()) { //bug 467968: [Tree Table] Show Hide categories menu is not displayed after changing categories
+ for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
+ for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ confs.add((TreeFillingConfiguration) current);
+ }
+ }
+ }
+ } else {
+ for (AxisManagerRepresentation axisManager : table.getTableConfiguration().getRowHeaderAxisConfiguration().getAxisManagers()) {
+ for (IAxisConfiguration axisConf : axisManager.getSpecificAxisConfigurations()) {
+ if (axisConf instanceof TreeFillingConfiguration) {
+ confs.add((TreeFillingConfiguration) axisConf);
+ }
+ }
+ }
+ }
+ return confs;
+ }
+
+
+ /**
+ *
+ * @param table
+ * a table
+ * @param representedAxisManager
+ * the represented axis manager for which we want TreeFillingConfiguration
+ * @param depth
+ * the depth for which we want tree filling configuration
+ * @return
+ * <code>true</code> is the representedAxisManager has TreeFillingConfiguration
+ *
+ */
+ public static final boolean hasTreeFillingConfiguration(final Table table, final AxisManagerRepresentation representedAxisManager) {
+ Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
+ LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
+ if (local != null) {
+ for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
+ if (currentRep.getAxisManager() == representedAxisManager) {
+ for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ return true;
+ }
+ }
+ }
+ }
+ } else {
+ for (final IAxisConfiguration current : representedAxisManager.getSpecificAxisConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @param representedAxisManager
+ * the represented axis manager for which we want TreeFillingConfiguration
+ * @param depth
+ * the depth for which we want tree filling configuration
+ * @return
+ * a list of @link TreeFillingConfiguration} for the wanted depth
+ *
+ */
+ public static final List<TreeFillingConfiguration> getTreeFillingConfigurationForDepth(final Table table, final AxisManagerRepresentation representedAxisManager, final int depth) {
+ // duplicate code getTreeFillingConfiguration to avoid to iterate twice on the same list
+ List<TreeFillingConfiguration> confs = getTreeFillingConfiguration(table, representedAxisManager);
+ Iterator<TreeFillingConfiguration> iter = confs.listIterator();
+ while (iter.hasNext()) {
+ if (iter.next().getDepth() != depth) {
+ iter.remove();
+ }
+ }
+ return confs;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @param representedAxisManager
+ * the represented axis manager for which we want TreeFillingConfiguration
+ * @param depth
+ * the depth for which we want tree filling configuration
+ * @return
+ * <code>true</code> if we found {@link TreeFillingConfiguration} for the wanted depth
+ *
+ */
+ public static final boolean hasTreeFillingConfigurationForDepth(final Table table, final AxisManagerRepresentation representedAxisManager, final int depth) {
+ Iterator<TreeFillingConfiguration> iter = getTreeFillingConfigurationForDepth(table, representedAxisManager, depth).iterator();
+ while (iter.hasNext()) {
+ if (iter.next().getDepth() == depth) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param onColumn
+ * <code>true</code> if the user is working on column and false if not
+ * @return
+ * the list of the filling configuration used by the table
+ */
+ // TODO : doesn't yet manage the local filling configuration
+ public static final Collection<IFillingConfiguration> getFillingConfigurationUsedInTable(final Table table, final boolean onColumn) {
+ final Collection<IFillingConfiguration> confs = new ArrayList<IFillingConfiguration>();
+
+
+ AbstractHeaderAxisConfiguration tableHeaderAxisConfiguration;
+ if (onColumn) {
+ tableHeaderAxisConfiguration = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisInTableConfiguration(table);
+ } else {
+ tableHeaderAxisConfiguration = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
+ }
+
+ for (final IAxisConfiguration currentConfiguration : tableHeaderAxisConfiguration.getOwnedAxisConfigurations()) {
+ if (currentConfiguration instanceof IFillingConfiguration) {
+ confs.add((IFillingConfiguration) currentConfiguration);
+ }
+ }
+
+ return confs;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param onColumn
+ * true if we are working on column
+ * @return
+ * the element type id to create or <code>null</code> if not found
+ */
+ public static String getElementTypeIdToCreate(final Table table, final boolean onColumn) {
+ final Collection<IFillingConfiguration> fillingConfiguration = FillingConfigurationUtils.getFillingConfigurationUsedInTable(table, onColumn);
+ for (IFillingConfiguration iFillingConfiguration : fillingConfiguration) {
+ if (iFillingConfiguration instanceof PasteEObjectConfiguration) {
+ return ((PasteEObjectConfiguration) fillingConfiguration).getPastedElementId();
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param onColumn
+ * true if we are working on column
+ * @return
+ * the containment feature to use for created element
+ */
+ public static EStructuralFeature getContainmentFeature(final Table table, final boolean onColumn) {
+ final Collection<IFillingConfiguration> fillingConfiguration = FillingConfigurationUtils.getFillingConfigurationUsedInTable(table, onColumn);
+ for (IFillingConfiguration iFillingConfiguration : fillingConfiguration) {
+ if (iFillingConfiguration instanceof PasteEObjectConfiguration) {
+ return ((PasteEObjectConfiguration) fillingConfiguration).getPasteElementContainementFeature();
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @param depth
+ * a wanted depth
+ * @return
+ * <code>true</code> if the table has tree filling configuration declared on the wanted depth
+ */
+ public static boolean hasTreeFillingConfigurationForDepth(final Table table, final int depth) {
+ Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
+ LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
+ if (local != null) {
+ List<AxisManagerConfiguration> localReps = local.getAxisManagerConfigurations();
+ if (!localReps.isEmpty()) {
+ for (AxisManagerConfiguration currentRep : localReps) {
+ for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
+ if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == depth) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ }
+ final List<AxisManagerRepresentation> representation = table.getTableConfiguration().getRowHeaderAxisConfiguration().getAxisManagers();
+ for (final AxisManagerRepresentation currentRep : representation) {
+ for (final IAxisConfiguration current : currentRep.getSpecificAxisConfigurations()) {
+ if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == depth) {
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the maximum depth displayed in the table. This method check than all hidden depth are consecutive and start to 0 (or 1)
+ */
+ public static int getMaxDepthForTree(final Table table) {
+ Assert.isTrue(!table.isInvertAxis(), INVERT_AXIS_CASE_NOT_YET_MANAGED_FOR_TREE_TABLE);
+ TreeSet<Integer> hiddenLevels = new TreeSet<Integer>();
+ LocalTableHeaderAxisConfiguration local = table.getLocalRowHeaderAxisConfiguration();
+ if (local != null && !local.getAxisManagerConfigurations().isEmpty()) {
+ for (AxisManagerConfiguration currentRep : local.getAxisManagerConfigurations()) {
+ for (final IAxisConfiguration current : currentRep.getLocalSpecificConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ int depth = ((TreeFillingConfiguration) current).getDepth();
+ if (depth >= 0) {
+ hiddenLevels.add(Integer.valueOf(depth));
+ }
+ }
+ }
+ }
+ } else {
+ final List<AxisManagerRepresentation> representation = table.getTableConfiguration().getRowHeaderAxisConfiguration().getAxisManagers();
+ for (final AxisManagerRepresentation currentRep : representation) {
+ for (final IAxisConfiguration current : currentRep.getSpecificAxisConfigurations()) {
+ if (current instanceof TreeFillingConfiguration) {
+ int depth = ((TreeFillingConfiguration) current).getDepth();
+ if (depth >= 0) {
+ hiddenLevels.add(Integer.valueOf(depth));
+ }
+ }
+ }
+ }
+ }
+ if (hiddenLevels.size() > 0) {
+ Iterator<Integer> iter = hiddenLevels.iterator();
+ int previousValue = iter.next().intValue();
+ if (previousValue == 0 || previousValue == 1) {
+ while (iter.hasNext()) {
+ int nextValue = iter.next();
+ if (nextValue == previousValue + 1) {
+ previousValue = nextValue;
+ } else {
+ return previousValue;
+ }
+ }
+ return previousValue;
+ }
+
+ }
+ return 0;
+
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java
index 7b47f84626b..d38de45903d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java
@@ -1,206 +1,206 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.Style;
-
-/**
- * Utils class for AxisConfiguration
- *
- * @author Vincent Lorenzo
- *
- */
-public class HeaderAxisConfigurationManagementUtils {
-
- private HeaderAxisConfigurationManagementUtils() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the header configuration defined in the table and used for rows, managing the inversion of the axis or <code>null</code> if we aer
- * using the
- * configuration defined in the table configuration
- */
- public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- config = table.getLocalColumnHeaderAxisConfiguration();
- }
- return config;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the header configuration defined in the tableconfiguration for rows, managing the inversion of the axis. The result can't be <code>null</code>
- */
- public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisInTableConfiguration(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
- }
- assert config != null;
- return config;
- }
-
- /**
- *
- * @param table
- * the table
- * @return
- * the header configuration used for rows in the table. The result can't be <code>null</code>
- */
- public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisConfigurationUsedInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = getRowAbstractHeaderAxisInTable(table);
- if (config == null) {
- config = getRowAbstractHeaderAxisInTableConfiguration(table);
- }
- assert config != null;
- return config;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the header configuration defined in the table and used for columns, managing the inversion of the axis or <code>null</code> if we are
- * using the configuration defined in the table configuration
- */
- public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getLocalColumnHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- config = table.getLocalRowHeaderAxisConfiguration();
- }
- return config;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the header configuration defined in the tableconfiguration for columns, mananing the inversion of the axis. The result can't be <code>null</code>
- */
- public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisInTableConfiguration(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
- }
- assert config != null;
- return config;
- }
-
- /**
- *
- * @param table
- * the table
- * @return
- * the header configuration used for columns in the table. The result can't be <code>null</code>
- */
- public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisConfigurationUsedInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = getColumnAbstractHeaderAxisInTable(table);
- if (config == null) {
- config = getColumnAbstractHeaderAxisInTableConfiguration(table);
- }
- Assert.isNotNull(config);
- return config;
- }
-
- /**
- *
- * @param table
- * the table
- * @return
- * the header configuration used for row in the table. The result can't be <code>null</code>
- */
- public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisUsedInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = getRowAbstractHeaderAxisInTable(table);
- if (config == null) {
- config = getRowAbstractHeaderAxisInTableConfiguration(table);
- }
- Assert.isNotNull(config);
- return config;
- }
-
- /**
- *
- * @param configuration
- * the configuration to duplicate
- * @return
- * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
- */
- public static LocalTableHeaderAxisConfiguration transformToLocalHeaderConfiguration(final TableHeaderAxisConfiguration configuration) {
- LocalTableHeaderAxisConfiguration conf = NattableaxisconfigurationFactory.eINSTANCE.createLocalTableHeaderAxisConfiguration();
- conf.setDisplayFilter(configuration.isDisplayFilter());
- conf.setDisplayIndex(configuration.isDisplayIndex());
- conf.setDisplayLabel(configuration.isDisplayLabel());
- conf.setIndexStyle(configuration.getIndexStyle());
- for (Style current : configuration.getStyles()) {
- Style copy = EcoreUtil.copy(current);
- conf.getStyles().add(copy);
- }
- return conf;
- }
-
- /**
- *
- * @param configuration
- * the configuration to duplicate, with all its configuration
- * @return
- * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
- * @since 3.0
- */
- public static LocalTableHeaderAxisConfiguration transformToLocalHeaderConfigurationIncludingAllConfigurations(final TableHeaderAxisConfiguration configuration) {
- final LocalTableHeaderAxisConfiguration conf = transformToLocalHeaderConfiguration(configuration);
- for (final AxisManagerRepresentation axisManagers : configuration.getAxisManagers()) {
- final AxisManagerConfiguration currentConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createAxisManagerConfiguration();
- currentConfiguration.setAxisManager(axisManagers);
- for (final Style current : axisManagers.getStyles()) {
- Style copy = EcoreUtil.copy(current);
- axisManagers.getStyles().add(copy);
- }
-
- for (final IAxisConfiguration axisConf : axisManagers.getSpecificAxisConfigurations()) {
- final IAxisConfiguration tmp = EcoreUtil.copy(axisConf);
- conf.getOwnedAxisConfigurations().add(tmp);
- currentConfiguration.getLocalSpecificConfigurations().add(tmp);
- }
- final ILabelProviderConfiguration labelProviderConfiguration = EcoreUtil.copy(axisManagers.getHeaderLabelConfiguration());
- currentConfiguration.setLocalHeaderLabelConfiguration(labelProviderConfiguration);
- conf.getOwnedLabelConfigurations().add(labelProviderConfiguration);
- conf.getAxisManagerConfigurations().add(currentConfiguration);
-
- }
- return conf;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.Style;
+
+/**
+ * Utils class for AxisConfiguration
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class HeaderAxisConfigurationManagementUtils {
+
+ private HeaderAxisConfigurationManagementUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the header configuration defined in the table and used for rows, managing the inversion of the axis or <code>null</code> if we aer
+ * using the
+ * configuration defined in the table configuration
+ */
+ public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ config = table.getLocalColumnHeaderAxisConfiguration();
+ }
+ return config;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the header configuration defined in the tableconfiguration for rows, managing the inversion of the axis. The result can't be <code>null</code>
+ */
+ public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisInTableConfiguration(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
+ }
+ assert config != null;
+ return config;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @return
+ * the header configuration used for rows in the table. The result can't be <code>null</code>
+ */
+ public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisConfigurationUsedInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = getRowAbstractHeaderAxisInTable(table);
+ if (config == null) {
+ config = getRowAbstractHeaderAxisInTableConfiguration(table);
+ }
+ assert config != null;
+ return config;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the header configuration defined in the table and used for columns, managing the inversion of the axis or <code>null</code> if we are
+ * using the configuration defined in the table configuration
+ */
+ public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getLocalColumnHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ config = table.getLocalRowHeaderAxisConfiguration();
+ }
+ return config;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the header configuration defined in the tableconfiguration for columns, mananing the inversion of the axis. The result can't be <code>null</code>
+ */
+ public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisInTableConfiguration(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
+ }
+ assert config != null;
+ return config;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @return
+ * the header configuration used for columns in the table. The result can't be <code>null</code>
+ */
+ public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisConfigurationUsedInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = getColumnAbstractHeaderAxisInTable(table);
+ if (config == null) {
+ config = getColumnAbstractHeaderAxisInTableConfiguration(table);
+ }
+ Assert.isNotNull(config);
+ return config;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @return
+ * the header configuration used for row in the table. The result can't be <code>null</code>
+ */
+ public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisUsedInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = getRowAbstractHeaderAxisInTable(table);
+ if (config == null) {
+ config = getRowAbstractHeaderAxisInTableConfiguration(table);
+ }
+ Assert.isNotNull(config);
+ return config;
+ }
+
+ /**
+ *
+ * @param configuration
+ * the configuration to duplicate
+ * @return
+ * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
+ */
+ public static LocalTableHeaderAxisConfiguration transformToLocalHeaderConfiguration(final TableHeaderAxisConfiguration configuration) {
+ LocalTableHeaderAxisConfiguration conf = NattableaxisconfigurationFactory.eINSTANCE.createLocalTableHeaderAxisConfiguration();
+ conf.setDisplayFilter(configuration.isDisplayFilter());
+ conf.setDisplayIndex(configuration.isDisplayIndex());
+ conf.setDisplayLabel(configuration.isDisplayLabel());
+ conf.setIndexStyle(configuration.getIndexStyle());
+ for (Style current : configuration.getStyles()) {
+ Style copy = EcoreUtil.copy(current);
+ conf.getStyles().add(copy);
+ }
+ return conf;
+ }
+
+ /**
+ *
+ * @param configuration
+ * the configuration to duplicate, with all its configuration
+ * @return
+ * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
+ * @since 3.0
+ */
+ public static LocalTableHeaderAxisConfiguration transformToLocalHeaderConfigurationIncludingAllConfigurations(final TableHeaderAxisConfiguration configuration) {
+ final LocalTableHeaderAxisConfiguration conf = transformToLocalHeaderConfiguration(configuration);
+ for (final AxisManagerRepresentation axisManagers : configuration.getAxisManagers()) {
+ final AxisManagerConfiguration currentConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createAxisManagerConfiguration();
+ currentConfiguration.setAxisManager(axisManagers);
+ for (final Style current : axisManagers.getStyles()) {
+ Style copy = EcoreUtil.copy(current);
+ axisManagers.getStyles().add(copy);
+ }
+
+ for (final IAxisConfiguration axisConf : axisManagers.getSpecificAxisConfigurations()) {
+ final IAxisConfiguration tmp = EcoreUtil.copy(axisConf);
+ conf.getOwnedAxisConfigurations().add(tmp);
+ currentConfiguration.getLocalSpecificConfigurations().add(tmp);
+ }
+ final ILabelProviderConfiguration labelProviderConfiguration = EcoreUtil.copy(axisManagers.getHeaderLabelConfiguration());
+ currentConfiguration.setLocalHeaderLabelConfiguration(labelProviderConfiguration);
+ conf.getOwnedLabelConfigurations().add(labelProviderConfiguration);
+ conf.getAxisManagerConfigurations().add(currentConfiguration);
+
+ }
+ return conf;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderCellContextElementWrapper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderCellContextElementWrapper.java
index 1f7f91c9311..43c4e88c15b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderCellContextElementWrapper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderCellContextElementWrapper.java
@@ -1,28 +1,28 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-
-
-/**
- * This interface provides specific methods to allows to get a label with its context (object and edited feature)
- *
- * @author Vincent Lorenzo
- *
- */
-public interface ILabelProviderCellContextElementWrapper extends ILabelProviderContextElementWrapper, ILayerCell {
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+
+
+/**
+ * This interface provides specific methods to allows to get a label with its context (object and edited feature)
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface ILabelProviderCellContextElementWrapper extends ILabelProviderContextElementWrapper, ILayerCell {
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderContextElementWrapper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderContextElementWrapper.java
index de58ea076cf..f7811a5c667 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderContextElementWrapper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/ILabelProviderContextElementWrapper.java
@@ -1,41 +1,41 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-
-
-/**
- * This interface provides specific methods to allows to get a label with its context (object and edited feature)
- *
- * @author Vincent Lorenzo
- *
- */
-public interface ILabelProviderContextElementWrapper {
-
- /**
- *
- * @return
- * the config registry which can provide useful information
- */
- public IConfigRegistry getConfigRegistry();
-
- /**
- *
- * @return
- * the object for which we want the label
- */
- public Object getObject();
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+
+
+/**
+ * This interface provides specific methods to allows to get a label with its context (object and edited feature)
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface ILabelProviderContextElementWrapper {
+
+ /**
+ *
+ * @return
+ * the config registry which can provide useful information
+ */
+ public IConfigRegistry getConfigRegistry();
+
+ /**
+ *
+ * @return
+ * the object for which we want the label
+ */
+ public Object getObject();
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/INattableModelManagerUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/INattableModelManagerUtils.java
index 6d5994ac411..8c9815bda11 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/INattableModelManagerUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/INattableModelManagerUtils.java
@@ -1,47 +1,47 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Utilities for INattableModelManager
- *
- * @author Vincent Lorenzo
- *
- */
-public class INattableModelManagerUtils {
-
-
- private INattableModelManagerUtils() {
- // to prevent instanciation
- }
-
- /**
- *
- *
- * @param activeWorkbenchPart
- * @return
- * the table manager from the workbench part
- */
- public static INattableModelManager getTableManagerFromWorkbenchPart(final IWorkbenchPart activeWorkbenchPart) {
- if (activeWorkbenchPart != null) {
- return (INattableModelManager) activeWorkbenchPart.getAdapter(INattableModelManager.class);
- }
- return null;
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Utilities for INattableModelManager
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class INattableModelManagerUtils {
+
+
+ private INattableModelManagerUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ *
+ * @param activeWorkbenchPart
+ * @return
+ * the table manager from the workbench part
+ */
+ public static INattableModelManager getTableManagerFromWorkbenchPart(final IWorkbenchPart activeWorkbenchPart) {
+ if (activeWorkbenchPart != null) {
+ return (INattableModelManager) activeWorkbenchPart.getAdapter(INattableModelManager.class);
+ }
+ return null;
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelConfigurationManagementUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelConfigurationManagementUtils.java
index 8be4f01142e..2d945a8032e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelConfigurationManagementUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelConfigurationManagementUtils.java
@@ -1,310 +1,310 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.FeatureLabelProviderConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ObjectLabelProviderConfiguration;
-
-/**
- * Utils class for LabelConfiguration management
- *
- * @author Vincent Lorenzo
- *
- */
-public class LabelConfigurationManagementUtils {
-
- private LabelConfigurationManagementUtils() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the FeatureLabelProviderConfiguration for rows defined in the table, managing the inversion of the axis or <code>null</code>
- */
- public static final FeatureLabelProviderConfiguration getRowFeatureLabelConfigurationInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- config = table.getLocalColumnHeaderAxisConfiguration();
- }
- if (config != null) {
- for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
- if (current instanceof FeatureLabelProviderConfiguration) {
- return (FeatureLabelProviderConfiguration) current;
- }
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the FeatureLabelProviderConfiguration for rows defined in the configuration, managing the inversion of the axis or <code>null</code>
- */
- public static final FeatureLabelProviderConfiguration getRowFeatureLabelConfigurationInTableConfiguration(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
- }
- // can be null according to the metamodel
- for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
- if (current instanceof FeatureLabelProviderConfiguration) {
- return (FeatureLabelProviderConfiguration) current;
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * <code>true</code> if a FeatureLabelProviderConfiguration is defined for rows for the table, managing the inversion of the axis
- */
- public static final boolean hasRowFeatureLabelConfiguration(final Table table) {
- return getRowFeatureLabelConfigurationInTable(table) != null || getRowFeatureLabelConfigurationInTableConfiguration(table) != null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the FeatureLabelProviderConfiguration for columns defined in the table, managing the inversion of the axis or <code>null</code>
- */
- public static final FeatureLabelProviderConfiguration getColumnFeatureLabelConfigurationInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
- if (!table.isInvertAxis()) {
- config = table.getLocalColumnHeaderAxisConfiguration();
- }
- if (config != null) {
- for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
- if (current instanceof FeatureLabelProviderConfiguration) {
- return (FeatureLabelProviderConfiguration) current;
- }
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the FeatureLabelProviderConfiguration for columns defined in the configuration, managing the inversion of the axis or <code>null</code>
- */
- public static final FeatureLabelProviderConfiguration getColumnFeatureLabelConfigurationInTableConfiguration(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
- if (!table.isInvertAxis()) {
- config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
- }
- // can be null according to the metamodel
- for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
- if (current instanceof FeatureLabelProviderConfiguration) {
- return (FeatureLabelProviderConfiguration) current;
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * <code>true</code> if a FeatureLabelProviderConfiguration is defined for columns for the table, managing the inversion of the axis
- */
- public static final boolean hasColumnFeatureLabelConfiguration(final Table table) {
- return getColumnFeatureLabelConfigurationInTable(table) != null || getColumnFeatureLabelConfigurationInTableConfiguration(table) != null;
- }
-
-
- /**
- *
- * @param table
- * a table
- * @return
- * the ObjectLabelProviderConfiguration for rows defined in the table, managing the inversion of the axis or <code>null</code>
- */
- public static final ObjectLabelProviderConfiguration getRowObjectLabelConfigurationInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- config = table.getLocalColumnHeaderAxisConfiguration();
- }
- if (config != null) {
- for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
- if (current instanceof ObjectLabelProviderConfiguration) {
- return (ObjectLabelProviderConfiguration) current;
- }
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the ObjectLabelProviderConfiguration for rows defined in the configuration, managing the inversion of the axis or <code>null</code>
- */
- public static final ObjectLabelProviderConfiguration getRowObjectLabelConfigurationInTableConfiguration(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
- if (table.isInvertAxis()) {
- config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
- }
- // can be null according to the metamodel
- for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
- if (current instanceof ObjectLabelProviderConfiguration) {
- return (ObjectLabelProviderConfiguration) current;
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * <code>true</code> if a ObjectLabelProviderConfiguration is defined for rows for the table, managing the inversion of the axis
- */
- public static final boolean hasRowObjectLabelConfiguration(final Table table) {
- return getRowObjectLabelConfigurationInTable(table) != null || getRowObjectLabelConfigurationInTableConfiguration(table) != null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the ObjectLabelProviderConfiguration for columns defined in the table, managing the inversion of the axis or <code>null</code>
- */
- public static final ObjectLabelProviderConfiguration getColumnObjectLabelConfigurationInTable(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
- if (!table.isInvertAxis()) {
- config = table.getLocalColumnHeaderAxisConfiguration();
- }
- if (config != null) {
- for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
- if (current instanceof ObjectLabelProviderConfiguration) {
- return (ObjectLabelProviderConfiguration) current;
- }
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the ObjectLabelProviderConfiguration for columns defined in the configuration, managing the inversion of the axis or <code>null</code>
- */
- public static final ObjectLabelProviderConfiguration getColumnObjectLabelConfigurationInTableConfiguration(final Table table) {
- AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
- if (!table.isInvertAxis()) {
- config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
- }
- // can be null according to the metamodel
- for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
- if (current instanceof ObjectLabelProviderConfiguration) {
- return (ObjectLabelProviderConfiguration) current;
- }
- }
- return null;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * <code>true</code> if a ObjectLabelProviderConfiguration is defined for columns for the table, managing the inversion of the axis
- */
- public static final boolean hasColumnObjectLabelConfiguration(final Table table) {
- return getColumnObjectLabelConfigurationInTable(table) != null || getColumnObjectLabelConfigurationInTableConfiguration(table) != null;
- }
-
- /**
- *
- * @param table
- * the table
- * @return
- * the object label configuration currently used in the table
- */
- public static final FeatureLabelProviderConfiguration getUsedColumnFeatureLabelConfiguration(final Table table) {
- FeatureLabelProviderConfiguration conf = getColumnFeatureLabelConfigurationInTable(table);
- if (conf == null) {
- conf = getColumnFeatureLabelConfigurationInTableConfiguration(table);
- }
- return conf;
- }
-
- /**
- *
- * @param table
- * the table
- * @return
- * the object label configuration currently used in the table
- */
- public static final FeatureLabelProviderConfiguration getUsedRowFeatureLabelConfiguration(final Table table) {
- FeatureLabelProviderConfiguration conf = getRowFeatureLabelConfigurationInTable(table);
- if (conf == null) {
- conf = getRowFeatureLabelConfigurationInTableConfiguration(table);
- }
- return conf;
- }
-
- /**
- *
- * @param table
- * the table
- * @return
- * the object label configuration currently used in the table
- */
- public static final ObjectLabelProviderConfiguration getUsedColumnObjectLabelConfiguration(final Table table) {
- ObjectLabelProviderConfiguration conf = getColumnObjectLabelConfigurationInTable(table);
- if (conf == null) {
- conf = getColumnObjectLabelConfigurationInTableConfiguration(table);
- }
- return conf;
- }
-
- /**
- *
- * @param table
- * the table
- * @return
- * the object label configuration currently used in the table
- */
- public static final ObjectLabelProviderConfiguration getUsedRowObjectLabelConfiguration(final Table table) {
- ObjectLabelProviderConfiguration conf = getRowObjectLabelConfigurationInTable(table);
- if (conf == null) {
- conf = getRowObjectLabelConfigurationInTableConfiguration(table);
- }
- return conf;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.FeatureLabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ObjectLabelProviderConfiguration;
+
+/**
+ * Utils class for LabelConfiguration management
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class LabelConfigurationManagementUtils {
+
+ private LabelConfigurationManagementUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the FeatureLabelProviderConfiguration for rows defined in the table, managing the inversion of the axis or <code>null</code>
+ */
+ public static final FeatureLabelProviderConfiguration getRowFeatureLabelConfigurationInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ config = table.getLocalColumnHeaderAxisConfiguration();
+ }
+ if (config != null) {
+ for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
+ if (current instanceof FeatureLabelProviderConfiguration) {
+ return (FeatureLabelProviderConfiguration) current;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the FeatureLabelProviderConfiguration for rows defined in the configuration, managing the inversion of the axis or <code>null</code>
+ */
+ public static final FeatureLabelProviderConfiguration getRowFeatureLabelConfigurationInTableConfiguration(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
+ }
+ // can be null according to the metamodel
+ for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
+ if (current instanceof FeatureLabelProviderConfiguration) {
+ return (FeatureLabelProviderConfiguration) current;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * <code>true</code> if a FeatureLabelProviderConfiguration is defined for rows for the table, managing the inversion of the axis
+ */
+ public static final boolean hasRowFeatureLabelConfiguration(final Table table) {
+ return getRowFeatureLabelConfigurationInTable(table) != null || getRowFeatureLabelConfigurationInTableConfiguration(table) != null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the FeatureLabelProviderConfiguration for columns defined in the table, managing the inversion of the axis or <code>null</code>
+ */
+ public static final FeatureLabelProviderConfiguration getColumnFeatureLabelConfigurationInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
+ if (!table.isInvertAxis()) {
+ config = table.getLocalColumnHeaderAxisConfiguration();
+ }
+ if (config != null) {
+ for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
+ if (current instanceof FeatureLabelProviderConfiguration) {
+ return (FeatureLabelProviderConfiguration) current;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the FeatureLabelProviderConfiguration for columns defined in the configuration, managing the inversion of the axis or <code>null</code>
+ */
+ public static final FeatureLabelProviderConfiguration getColumnFeatureLabelConfigurationInTableConfiguration(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
+ if (!table.isInvertAxis()) {
+ config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
+ }
+ // can be null according to the metamodel
+ for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
+ if (current instanceof FeatureLabelProviderConfiguration) {
+ return (FeatureLabelProviderConfiguration) current;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * <code>true</code> if a FeatureLabelProviderConfiguration is defined for columns for the table, managing the inversion of the axis
+ */
+ public static final boolean hasColumnFeatureLabelConfiguration(final Table table) {
+ return getColumnFeatureLabelConfigurationInTable(table) != null || getColumnFeatureLabelConfigurationInTableConfiguration(table) != null;
+ }
+
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the ObjectLabelProviderConfiguration for rows defined in the table, managing the inversion of the axis or <code>null</code>
+ */
+ public static final ObjectLabelProviderConfiguration getRowObjectLabelConfigurationInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ config = table.getLocalColumnHeaderAxisConfiguration();
+ }
+ if (config != null) {
+ for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
+ if (current instanceof ObjectLabelProviderConfiguration) {
+ return (ObjectLabelProviderConfiguration) current;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the ObjectLabelProviderConfiguration for rows defined in the configuration, managing the inversion of the axis or <code>null</code>
+ */
+ public static final ObjectLabelProviderConfiguration getRowObjectLabelConfigurationInTableConfiguration(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
+ if (table.isInvertAxis()) {
+ config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
+ }
+ // can be null according to the metamodel
+ for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
+ if (current instanceof ObjectLabelProviderConfiguration) {
+ return (ObjectLabelProviderConfiguration) current;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * <code>true</code> if a ObjectLabelProviderConfiguration is defined for rows for the table, managing the inversion of the axis
+ */
+ public static final boolean hasRowObjectLabelConfiguration(final Table table) {
+ return getRowObjectLabelConfigurationInTable(table) != null || getRowObjectLabelConfigurationInTableConfiguration(table) != null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the ObjectLabelProviderConfiguration for columns defined in the table, managing the inversion of the axis or <code>null</code>
+ */
+ public static final ObjectLabelProviderConfiguration getColumnObjectLabelConfigurationInTable(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getLocalRowHeaderAxisConfiguration();
+ if (!table.isInvertAxis()) {
+ config = table.getLocalColumnHeaderAxisConfiguration();
+ }
+ if (config != null) {
+ for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
+ if (current instanceof ObjectLabelProviderConfiguration) {
+ return (ObjectLabelProviderConfiguration) current;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the ObjectLabelProviderConfiguration for columns defined in the configuration, managing the inversion of the axis or <code>null</code>
+ */
+ public static final ObjectLabelProviderConfiguration getColumnObjectLabelConfigurationInTableConfiguration(final Table table) {
+ AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
+ if (!table.isInvertAxis()) {
+ config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
+ }
+ // can be null according to the metamodel
+ for (final ILabelProviderConfiguration current : config.getOwnedLabelConfigurations()) {
+ if (current instanceof ObjectLabelProviderConfiguration) {
+ return (ObjectLabelProviderConfiguration) current;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * <code>true</code> if a ObjectLabelProviderConfiguration is defined for columns for the table, managing the inversion of the axis
+ */
+ public static final boolean hasColumnObjectLabelConfiguration(final Table table) {
+ return getColumnObjectLabelConfigurationInTable(table) != null || getColumnObjectLabelConfigurationInTableConfiguration(table) != null;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @return
+ * the object label configuration currently used in the table
+ */
+ public static final FeatureLabelProviderConfiguration getUsedColumnFeatureLabelConfiguration(final Table table) {
+ FeatureLabelProviderConfiguration conf = getColumnFeatureLabelConfigurationInTable(table);
+ if (conf == null) {
+ conf = getColumnFeatureLabelConfigurationInTableConfiguration(table);
+ }
+ return conf;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @return
+ * the object label configuration currently used in the table
+ */
+ public static final FeatureLabelProviderConfiguration getUsedRowFeatureLabelConfiguration(final Table table) {
+ FeatureLabelProviderConfiguration conf = getRowFeatureLabelConfigurationInTable(table);
+ if (conf == null) {
+ conf = getRowFeatureLabelConfigurationInTableConfiguration(table);
+ }
+ return conf;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @return
+ * the object label configuration currently used in the table
+ */
+ public static final ObjectLabelProviderConfiguration getUsedColumnObjectLabelConfiguration(final Table table) {
+ ObjectLabelProviderConfiguration conf = getColumnObjectLabelConfigurationInTable(table);
+ if (conf == null) {
+ conf = getColumnObjectLabelConfigurationInTableConfiguration(table);
+ }
+ return conf;
+ }
+
+ /**
+ *
+ * @param table
+ * the table
+ * @return
+ * the object label configuration currently used in the table
+ */
+ public static final ObjectLabelProviderConfiguration getUsedRowObjectLabelConfiguration(final Table table) {
+ ObjectLabelProviderConfiguration conf = getRowObjectLabelConfigurationInTable(table);
+ if (conf == null) {
+ conf = getRowObjectLabelConfigurationInTableConfiguration(table);
+ }
+ return conf;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderCellContextElementWrapper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderCellContextElementWrapper.java
index aba49032084..bfa4470aa46 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderCellContextElementWrapper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderCellContextElementWrapper.java
@@ -1,243 +1,243 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.layer.ILayer;
-import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.swt.graphics.Rectangle;
-
-/**
- * This object can used as context to find the best label provider and get the text to display.
- * Its allows to have the context of the value to use it in the label provider
- *
- * This objects can be used to get the label of an object which is not the current value of the cell, using the label provider used by the cell.
- * example to get the value of the enumeration literal in the combo box for uml stereotype properties
- *
- * @author Vincent Lorenzo
- *
- */
-
-public class LabelProviderCellContextElementWrapper extends LabelProviderContextElementWrapper implements ILabelProviderCellContextElementWrapper {
-
- /** the cell. */
- private ILayerCell cell;
-
- /**
- * *
- * Constructor.
- *
- * @param cell
- * the cell for which we want the label/icon, ...
- * @param registry
- * the registry used by nattable
- * @deprecated since Eclipse Mars, please use setter method
- */
- @Deprecated
- public LabelProviderCellContextElementWrapper(ILayerCell cell, final IConfigRegistry registry) {
- this(cell, cell.getDataValue(), registry);
- }
-
- /**
- *
- * Constructor.
- *
- */
- public LabelProviderCellContextElementWrapper() {
- super();
- }
-
- /**
- *
- * @param cell
- * the wrapped cell
- */
- public void setCell(ILayerCell cell) {
- this.cell = cell;
- }
-
- /**
- *
- * Constructor.
- *
- * @param cell
- * the cell
- * @param value
- * a value
- * @param registry
- * the registry used by nattable
- * @deprecated use setter instead of this constructor
- */
- @Deprecated
- public LabelProviderCellContextElementWrapper(ILayerCell cell, final Object value, final IConfigRegistry registry) {
- super(value, registry);
- this.cell = cell;
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getConfigLabels()
- *
- * @return
- */
-
- @Override
- public LabelStack getConfigLabels() {
- return this.cell.getConfigLabels();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getOriginColumnPosition()
- *
- * @return
- */
-
- @Override
- public int getOriginColumnPosition() {
- return cell.getOriginColumnPosition();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getOriginRowPosition()
- *
- * @return
- */
-
- @Override
- public int getOriginRowPosition() {
- return cell.getOriginRowPosition();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getLayer()
- *
- * @return
- */
-
- @Override
- public ILayer getLayer() {
- return cell.getLayer();
- }
-
- /**
- * Gets the column position.
- *
- * @return the column position
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getColumnPosition()
- */
-
- @Override
- public int getColumnPosition() {
- return cell.getColumnPosition();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getRowPosition()
- *
- * @return
- */
-
- @Override
- public int getRowPosition() {
- return cell.getRowPosition();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getColumnIndex()
- *
- * @return
- */
-
- @Override
- public int getColumnIndex() {
- return cell.getColumnIndex();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getRowIndex()
- *
- * @return
- */
-
- @Override
- public int getRowIndex() {
- return cell.getRowIndex();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getColumnSpan()
- *
- * @return
- */
-
- @Override
- public int getColumnSpan() {
- return cell.getColumnSpan();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getRowSpan()
- *
- * @return
- */
-
- @Override
- public int getRowSpan() {
- return cell.getRowSpan();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#isSpannedCell()
- *
- * @return
- */
-
- @Override
- public boolean isSpannedCell() {
- return cell.isSpannedCell();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getDisplayMode()
- *
- * @return
- */
-
- @Override
- public String getDisplayMode() {
- return cell.getDisplayMode();
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getDataValue()
- *
- * @return
- */
- @Override
- public final Object getDataValue() {
- throw new UnsupportedOperationException("You must use ILabelProviderCellContextElement#getObject()"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getBounds()
- *
- * @return
- */
-
- @Override
- public Rectangle getBounds() {
- return cell.getBounds();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * This object can used as context to find the best label provider and get the text to display.
+ * Its allows to have the context of the value to use it in the label provider
+ *
+ * This objects can be used to get the label of an object which is not the current value of the cell, using the label provider used by the cell.
+ * example to get the value of the enumeration literal in the combo box for uml stereotype properties
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+
+public class LabelProviderCellContextElementWrapper extends LabelProviderContextElementWrapper implements ILabelProviderCellContextElementWrapper {
+
+ /** the cell. */
+ private ILayerCell cell;
+
+ /**
+ * *
+ * Constructor.
+ *
+ * @param cell
+ * the cell for which we want the label/icon, ...
+ * @param registry
+ * the registry used by nattable
+ * @deprecated since Eclipse Mars, please use setter method
+ */
+ @Deprecated
+ public LabelProviderCellContextElementWrapper(ILayerCell cell, final IConfigRegistry registry) {
+ this(cell, cell.getDataValue(), registry);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public LabelProviderCellContextElementWrapper() {
+ super();
+ }
+
+ /**
+ *
+ * @param cell
+ * the wrapped cell
+ */
+ public void setCell(ILayerCell cell) {
+ this.cell = cell;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param cell
+ * the cell
+ * @param value
+ * a value
+ * @param registry
+ * the registry used by nattable
+ * @deprecated use setter instead of this constructor
+ */
+ @Deprecated
+ public LabelProviderCellContextElementWrapper(ILayerCell cell, final Object value, final IConfigRegistry registry) {
+ super(value, registry);
+ this.cell = cell;
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getConfigLabels()
+ *
+ * @return
+ */
+
+ @Override
+ public LabelStack getConfigLabels() {
+ return this.cell.getConfigLabels();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getOriginColumnPosition()
+ *
+ * @return
+ */
+
+ @Override
+ public int getOriginColumnPosition() {
+ return cell.getOriginColumnPosition();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getOriginRowPosition()
+ *
+ * @return
+ */
+
+ @Override
+ public int getOriginRowPosition() {
+ return cell.getOriginRowPosition();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getLayer()
+ *
+ * @return
+ */
+
+ @Override
+ public ILayer getLayer() {
+ return cell.getLayer();
+ }
+
+ /**
+ * Gets the column position.
+ *
+ * @return the column position
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getColumnPosition()
+ */
+
+ @Override
+ public int getColumnPosition() {
+ return cell.getColumnPosition();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getRowPosition()
+ *
+ * @return
+ */
+
+ @Override
+ public int getRowPosition() {
+ return cell.getRowPosition();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getColumnIndex()
+ *
+ * @return
+ */
+
+ @Override
+ public int getColumnIndex() {
+ return cell.getColumnIndex();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getRowIndex()
+ *
+ * @return
+ */
+
+ @Override
+ public int getRowIndex() {
+ return cell.getRowIndex();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getColumnSpan()
+ *
+ * @return
+ */
+
+ @Override
+ public int getColumnSpan() {
+ return cell.getColumnSpan();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getRowSpan()
+ *
+ * @return
+ */
+
+ @Override
+ public int getRowSpan() {
+ return cell.getRowSpan();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#isSpannedCell()
+ *
+ * @return
+ */
+
+ @Override
+ public boolean isSpannedCell() {
+ return cell.isSpannedCell();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getDisplayMode()
+ *
+ * @return
+ */
+
+ @Override
+ public String getDisplayMode() {
+ return cell.getDisplayMode();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getDataValue()
+ *
+ * @return
+ */
+ @Override
+ public final Object getDataValue() {
+ throw new UnsupportedOperationException("You must use ILabelProviderCellContextElement#getObject()"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell#getBounds()
+ *
+ * @return
+ */
+
+ @Override
+ public Rectangle getBounds() {
+ return cell.getBounds();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderContextElementWrapper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderContextElementWrapper.java
index 57678ee40db..1fbbc8dddfb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderContextElementWrapper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LabelProviderContextElementWrapper.java
@@ -1,103 +1,103 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-
-/**
- * This object can used as context to find the best label provider and get the text to display.
- * Its allows to have the context of the value to use it in the label provider
- *
- * @author Vincent Lorenzo
- *
- */
-public class LabelProviderContextElementWrapper implements ILabelProviderContextElementWrapper {
-
- /**
- * the config registry of the table
- */
- private IConfigRegistry registry;
-
- /**
- * the object for which we want the label
- */
- private Object object;
-
-
-
- /**
- * *
- * Constructor.
- *
- * @param object
- * the cell for which we want the label/icon, ...
- * @param registry
- * the registry used by nattable
- *
- * @deprecated since Eclipse Mars, please use setter method
- */
- @Deprecated
- public LabelProviderContextElementWrapper(final Object object, final IConfigRegistry registry) {
- this.object = object;
- this.registry = registry;
- }
-
- /**
- *
- * Constructor.
- *
- */
- public LabelProviderContextElementWrapper() {
- // nothing to do
- }
-
- /**
- *
- * @param configRegistry
- * the config registry to use
- */
- public void setConfigRegistry(IConfigRegistry configRegistry) {
- this.registry = configRegistry;
- }
-
- /**
- *
- * @param object
- * the object for which we want the label/icon,....
- */
- public void setObject(Object object) {
- this.object = object;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.utils.ILabelProviderContextElementWrapper#getConfigRegistry()
- *
- * @return
- */
- @Override
- public IConfigRegistry getConfigRegistry() {
- return this.registry;
- }
-
- /**
- *
- * @return
- */
- @Override
- public Object getObject() {
- return this.object;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+
+/**
+ * This object can used as context to find the best label provider and get the text to display.
+ * Its allows to have the context of the value to use it in the label provider
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class LabelProviderContextElementWrapper implements ILabelProviderContextElementWrapper {
+
+ /**
+ * the config registry of the table
+ */
+ private IConfigRegistry registry;
+
+ /**
+ * the object for which we want the label
+ */
+ private Object object;
+
+
+
+ /**
+ * *
+ * Constructor.
+ *
+ * @param object
+ * the cell for which we want the label/icon, ...
+ * @param registry
+ * the registry used by nattable
+ *
+ * @deprecated since Eclipse Mars, please use setter method
+ */
+ @Deprecated
+ public LabelProviderContextElementWrapper(final Object object, final IConfigRegistry registry) {
+ this.object = object;
+ this.registry = registry;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public LabelProviderContextElementWrapper() {
+ // nothing to do
+ }
+
+ /**
+ *
+ * @param configRegistry
+ * the config registry to use
+ */
+ public void setConfigRegistry(IConfigRegistry configRegistry) {
+ this.registry = configRegistry;
+ }
+
+ /**
+ *
+ * @param object
+ * the object for which we want the label/icon,....
+ */
+ public void setObject(Object object) {
+ this.object = object;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.utils.ILabelProviderContextElementWrapper#getConfigRegistry()
+ *
+ * @return
+ */
+ @Override
+ public IConfigRegistry getConfigRegistry() {
+ return this.registry;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public Object getObject() {
+ return this.object;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LocationValue.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LocationValue.java
index 7df40885882..948ac094519 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LocationValue.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/LocationValue.java
@@ -1,229 +1,229 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.swt.graphics.Point;
-
-/**
- *
- * This class allows to store information about a location
- *
- */
-public class LocationValue {
-
- /**
- * the initial point (mouse information)
- */
- final private Point absolutePoint;
-
- /**
- * the same point, but in the coordinate of the widget
- */
- final private Point widgetPoint;
-
-
- /**
- * the kind of the location
- */
- final private TableGridRegion kind;
-
- /**
- * the column index
- */
- final private int columnIndex;
-
- /**
- * the row index
- */
- final private int rowIndex;
-
- /**
- * the layerCell if this location
- */
- final private ILayerCell layerCell;
-
- /**
- * the columnObject
- */
- final private Object columnObject;
-
- /**
- * the rowObject
- */
- final private Object rowObject;
-
- /**
- * Constructor.
- *
- * @param kind
- * the kind of location
- * @param cell
- * the cell located as this place
- * @param columnIndex
- * the columnIndex
- * @param rowIndex
- * the rowIndex
- * @param columnObject
- * the column object
- * @param rowObject
- * the row object
- */
- public LocationValue(final TableGridRegion kind, final ILayerCell cell, final int columnIndex, final int rowIndex, final Object columnObject, final Object rowObject) {
- this(null, null, kind, cell, columnIndex, rowIndex, columnObject, rowObject);
- }
-
-
-
-
- /**
- * Constructor.
- *
- * @param absoluteLocation
- * a location in the absolute coordinate
- * @param widgetLocation
- * the same point, but with the widget coordinate
- * @param kind
- * the kind of location
- * @param cell
- * the cell located as this place
- * @param columnIndex
- * the columnIndex
- * @param rowIndex
- * the rowIndex
- * @param columnObject
- * the column object
- * @param rowObject
- * the row object
- */
- public LocationValue(final Point absoluteLocation, final Point widgetLocation, final TableGridRegion kind, final ILayerCell cell, final int columnIndex, final int rowIndex, final Object columnObject, final Object rowObject) {
- this.absolutePoint = absoluteLocation;
- this.widgetPoint = widgetLocation;
- this.kind = kind;
- this.layerCell = cell;
- this.columnIndex = columnIndex;
- this.rowIndex = rowIndex;
- this.columnObject = columnObject;
- this.rowObject = rowObject;
- }
-
- /**
- * Gets the point.
- *
- * @return the point
- */
- public Point getPoint() {
- return absolutePoint;
- }
-
-
- /**
- * Gets the translated point.
- *
- * @return the translated point
- */
- public Point getTranslatedPoint() {
- return widgetPoint;
- }
-
- /**
- * Gets the kind.
- *
- * @return the kind
- */
- public TableGridRegion getKind() {
- return kind;
- }
-
-
- /**
- * Gets the column index.
- *
- * @return the column index
- */
- public int getColumnIndex() {
- return columnIndex;
- }
-
-
- /**
- * Gets the row index.
- *
- * @return the row index
- */
- public int getRowIndex() {
- return rowIndex;
- }
-
-
- /**
- * Gets the layer cell.
- *
- * @return the layer cell
- */
- public ILayerCell getLayerCell() {
- return layerCell;
- }
-
- /**
- * Gets the absolute point.
- *
- * @return the absolute point
- */
- public Point getAbsolutePoint() {
- return absolutePoint;
- }
-
-
- /**
- * Gets the widget point.
- *
- * @return the widget point
- */
- public Point getWidgetPoint() {
- return widgetPoint;
- }
-
-
- /**
- * Gets the column object.
- *
- * @return the column object
- */
- public Object getColumnObject() {
- return columnObject;
- }
-
-
- /**
- * Gets the row object.
- *
- * @return the row object
- */
- public Object getRowObject() {
- return rowObject;
- }
-
- /**
- *
- * @see java.lang.Object#toString()
- *
- * @return
- */
- @Override
- public String toString() {
- String message = "location : " + this.kind + ", columnIndex :" + this.columnIndex + ", rowIndex :" + this.rowIndex + ", columnObject :" + this.columnObject + ", rowObject :" + this.rowObject; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- return message;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ *
+ * This class allows to store information about a location
+ *
+ */
+public class LocationValue {
+
+ /**
+ * the initial point (mouse information)
+ */
+ final private Point absolutePoint;
+
+ /**
+ * the same point, but in the coordinate of the widget
+ */
+ final private Point widgetPoint;
+
+
+ /**
+ * the kind of the location
+ */
+ final private TableGridRegion kind;
+
+ /**
+ * the column index
+ */
+ final private int columnIndex;
+
+ /**
+ * the row index
+ */
+ final private int rowIndex;
+
+ /**
+ * the layerCell if this location
+ */
+ final private ILayerCell layerCell;
+
+ /**
+ * the columnObject
+ */
+ final private Object columnObject;
+
+ /**
+ * the rowObject
+ */
+ final private Object rowObject;
+
+ /**
+ * Constructor.
+ *
+ * @param kind
+ * the kind of location
+ * @param cell
+ * the cell located as this place
+ * @param columnIndex
+ * the columnIndex
+ * @param rowIndex
+ * the rowIndex
+ * @param columnObject
+ * the column object
+ * @param rowObject
+ * the row object
+ */
+ public LocationValue(final TableGridRegion kind, final ILayerCell cell, final int columnIndex, final int rowIndex, final Object columnObject, final Object rowObject) {
+ this(null, null, kind, cell, columnIndex, rowIndex, columnObject, rowObject);
+ }
+
+
+
+
+ /**
+ * Constructor.
+ *
+ * @param absoluteLocation
+ * a location in the absolute coordinate
+ * @param widgetLocation
+ * the same point, but with the widget coordinate
+ * @param kind
+ * the kind of location
+ * @param cell
+ * the cell located as this place
+ * @param columnIndex
+ * the columnIndex
+ * @param rowIndex
+ * the rowIndex
+ * @param columnObject
+ * the column object
+ * @param rowObject
+ * the row object
+ */
+ public LocationValue(final Point absoluteLocation, final Point widgetLocation, final TableGridRegion kind, final ILayerCell cell, final int columnIndex, final int rowIndex, final Object columnObject, final Object rowObject) {
+ this.absolutePoint = absoluteLocation;
+ this.widgetPoint = widgetLocation;
+ this.kind = kind;
+ this.layerCell = cell;
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ this.columnObject = columnObject;
+ this.rowObject = rowObject;
+ }
+
+ /**
+ * Gets the point.
+ *
+ * @return the point
+ */
+ public Point getPoint() {
+ return absolutePoint;
+ }
+
+
+ /**
+ * Gets the translated point.
+ *
+ * @return the translated point
+ */
+ public Point getTranslatedPoint() {
+ return widgetPoint;
+ }
+
+ /**
+ * Gets the kind.
+ *
+ * @return the kind
+ */
+ public TableGridRegion getKind() {
+ return kind;
+ }
+
+
+ /**
+ * Gets the column index.
+ *
+ * @return the column index
+ */
+ public int getColumnIndex() {
+ return columnIndex;
+ }
+
+
+ /**
+ * Gets the row index.
+ *
+ * @return the row index
+ */
+ public int getRowIndex() {
+ return rowIndex;
+ }
+
+
+ /**
+ * Gets the layer cell.
+ *
+ * @return the layer cell
+ */
+ public ILayerCell getLayerCell() {
+ return layerCell;
+ }
+
+ /**
+ * Gets the absolute point.
+ *
+ * @return the absolute point
+ */
+ public Point getAbsolutePoint() {
+ return absolutePoint;
+ }
+
+
+ /**
+ * Gets the widget point.
+ *
+ * @return the widget point
+ */
+ public Point getWidgetPoint() {
+ return widgetPoint;
+ }
+
+
+ /**
+ * Gets the column object.
+ *
+ * @return the column object
+ */
+ public Object getColumnObject() {
+ return columnObject;
+ }
+
+
+ /**
+ * Gets the row object.
+ *
+ * @return the row object
+ */
+ public Object getRowObject() {
+ return rowObject;
+ }
+
+ /**
+ *
+ * @see java.lang.Object#toString()
+ *
+ * @return
+ */
+ @Override
+ public String toString() {
+ String message = "location : " + this.kind + ", columnIndex :" + this.columnIndex + ", rowIndex :" + this.rowIndex + ", columnObject :" + this.columnObject + ", rowObject :" + this.rowObject; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ return message;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableMergePropertyTester.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableMergePropertyTester.java
index 301c3cadbf7..86f78dae0c0 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableMergePropertyTester.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableMergePropertyTester.java
@@ -1,202 +1,202 @@
-/*****************************************************************************
- * Copyright (c) 2014, 2015 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import java.util.HashMap;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * The property tester used to enable or disable the merge options in the merge menu of the table
- *
- * @author Quentin Le Menez
- *
- */
-public class NattableMergePropertyTester extends PropertyTester {
-
- @Override
- public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
- // the map used to quickly identify the merge states of the table
- HashMap<String, Boolean> mergeMap = new HashMap<String, Boolean>();
- // the manager of the table
- INattableModelManager manager = getNattableModelManager();
- if (manager == null) {
- return false;
- }
-
- // the row Headers where the merge booleans concerning the allRows and allColumns merges and their values
- AbstractHeaderAxisConfiguration rowHeader = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(manager.getTable());
- AbstractHeaderAxisConfiguration columnHeader = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(manager.getTable());
- BooleanValueStyle rowsMerge = (BooleanValueStyle) rowHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_ROWS);
- BooleanValueStyle columnsMerge = (BooleanValueStyle) columnHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_COLUMNS);
- // the booleans concerning the merge of selected rows or columns
- boolean selectedRowsMerge = getToMergeRowBoolean();
- boolean selectedColumnsMerge = getToMergeColumnBoolean();
- // BooleanValueStyle tableMerge = (BooleanValueStyle)manager.getTable().getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGETABLE);
-
-
- // fills out the map in order to avoid having to check for the existence/value of the merge boolean
- if (rowsMerge != null) {
- mergeMap.put(NamedStyleConstants.MERGE_ROWS, rowsMerge.isBooleanValue());
- } else {
- mergeMap.put(NamedStyleConstants.MERGE_ROWS, false);
- }
- if (columnsMerge != null) {
- mergeMap.put(NamedStyleConstants.MERGE_COLUMNS, columnsMerge.isBooleanValue());
- } else {
- mergeMap.put(NamedStyleConstants.MERGE_COLUMNS, false);
- }
- if (selectedRowsMerge) {
- mergeMap.put(NamedStyleConstants.MERGE_SELECTED_ROWS, selectedRowsMerge);
- } else {
- mergeMap.put(NamedStyleConstants.MERGE_SELECTED_ROWS, false);
- }
- if (selectedColumnsMerge) {
- mergeMap.put(NamedStyleConstants.MERGE_SELECTED_COLUMNS, selectedColumnsMerge);
- } else {
- mergeMap.put(NamedStyleConstants.MERGE_SELECTED_COLUMNS, false);
- }
- // if(tableMerge != null) {
- // mergeMap.put(NamedStyleConstants.MERGE_TABLE, tableMerge.isBooleanValue());
- // } else {
- // mergeMap.put(NamedStyleConstants.MERGE_TABLE, false);
- // }
-
- // verify the availability of each merge option in order to allow the activation of its associated handler
- if (getNattableModelManager() != null && expectedValue instanceof Boolean) {
- if (NamedStyleConstants.MERGE_ROWS.equals(property)) {
- if (!tableMerged(mergeMap)) {
- return true;
- } else {
- return mergeMap.get(NamedStyleConstants.MERGE_ROWS);
- }
- } else if (NamedStyleConstants.MERGE_COLUMNS.equals(property)) {
- if (!tableMerged(mergeMap)) {
- return true;
- } else {
- return mergeMap.get(NamedStyleConstants.MERGE_COLUMNS);
- }
- } else if (NamedStyleConstants.MERGE_SELECTED_ROWS.equals(property)) {
- if (!tableMerged(mergeMap)) {
- return true;
- } else {
- return mergeMap.get(NamedStyleConstants.MERGE_SELECTED_ROWS);
- }
- } else if (NamedStyleConstants.MERGE_SELECTED_COLUMNS.equals(property)) {
- if (!tableMerged(mergeMap)) {
- return true;
- } else {
- return mergeMap.get(NamedStyleConstants.MERGE_SELECTED_COLUMNS);
- }
- // } else if(NamedStyleConstants.MERGE_TABLE.equals(property)) {
- // if(!tableMerged(mergeMap)) {
- // return true;
- // } else {
- // return mergeMap.get(NamedStyleConstants.MERGE_TABLE);
- // }
- }
- }
- return false;
- }
-
- /**
- *
- * @return
- * the current nattable model manager or <code>null</code> if not found
- */
- protected INattableModelManager getNattableModelManager() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchPart current = null;
- if (workbench != null) {
- final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
- if (activeWorkbench != null) {
- final IWorkbenchPage activePage = activeWorkbench.getActivePage();
- if (activePage != null) {
- current = activePage.getActivePart();
- }
- }
- }
-
- if (current != null) {
- return (INattableModelManager) current.getAdapter(INattableModelManager.class);
- }
- return null;
- }
-
- /**
- *
- * Identifies if the table is already merged or not
- *
- */
- protected boolean tableMerged(HashMap<String, Boolean> mergeMap) {
- // verify if none of the merge options are active, all must then be available (restrictions to false)
- // if(!mergeMap.get(NamedStyleConstants.MERGE_ROWS) && !mergeMap.get(NamedStyleConstants.MERGE_COLUMNS) && !mergeMap.get(NamedStyleConstants.MERGE_SELECTED_ROWS)
- // && !mergeMap.get(NamedStyleConstants.MERGE_SELECTED_COLUMNS) && !mergeMap.get(NamedStyleConstants.MERGE_TABLE)) {
- if (!mergeMap.get(NamedStyleConstants.MERGE_ROWS) && !mergeMap.get(NamedStyleConstants.MERGE_COLUMNS) && !mergeMap.get(NamedStyleConstants.MERGE_SELECTED_ROWS) && !mergeMap.get(NamedStyleConstants.MERGE_SELECTED_COLUMNS)) {
- return false;
- } else {
- return true;
- }
- }
-
- /**
- *
- * @return
- * the boolean indicating that some row axis are to be merged in the selection
- */
- protected boolean getToMergeRowBoolean() {
- // for(IAxis currentAxis : getNattableModelManager().getTable().getCurrentRowAxisProvider().getAxis()) {
- for (Object currentObject : getNattableModelManager().getRowElementsList()) {
- if (currentObject instanceof IAxis) {
- IAxis currentAxis = (IAxis) currentObject;
- BooleanValueStyle axisToMerge = (BooleanValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
- if (axisToMerge != null && axisToMerge.isBooleanValue()) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- *
- * @return
- * the boolean indicating that some column axis are to be merged in the selection
- */
- protected boolean getToMergeColumnBoolean() {
- // for(IAxis currentAxis : getNattableModelManager().getTable().getCurrentColumnAxisProvider().getAxis()) {
- for (Object currentObject : getNattableModelManager().getColumnElementsList()) {
- if (currentObject instanceof IAxis) {
- IAxis currentAxis = (IAxis) currentObject;
- BooleanValueStyle axisToMerge = (BooleanValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
- if (axisToMerge != null && axisToMerge.isBooleanValue()) {
- return true;
- }
- }
- }
- return false;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014, 2015 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.HashMap;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The property tester used to enable or disable the merge options in the merge menu of the table
+ *
+ * @author Quentin Le Menez
+ *
+ */
+public class NattableMergePropertyTester extends PropertyTester {
+
+ @Override
+ public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
+ // the map used to quickly identify the merge states of the table
+ HashMap<String, Boolean> mergeMap = new HashMap<String, Boolean>();
+ // the manager of the table
+ INattableModelManager manager = getNattableModelManager();
+ if (manager == null) {
+ return false;
+ }
+
+ // the row Headers where the merge booleans concerning the allRows and allColumns merges and their values
+ AbstractHeaderAxisConfiguration rowHeader = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(manager.getTable());
+ AbstractHeaderAxisConfiguration columnHeader = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(manager.getTable());
+ BooleanValueStyle rowsMerge = (BooleanValueStyle) rowHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_ROWS);
+ BooleanValueStyle columnsMerge = (BooleanValueStyle) columnHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_COLUMNS);
+ // the booleans concerning the merge of selected rows or columns
+ boolean selectedRowsMerge = getToMergeRowBoolean();
+ boolean selectedColumnsMerge = getToMergeColumnBoolean();
+ // BooleanValueStyle tableMerge = (BooleanValueStyle)manager.getTable().getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGETABLE);
+
+
+ // fills out the map in order to avoid having to check for the existence/value of the merge boolean
+ if (rowsMerge != null) {
+ mergeMap.put(NamedStyleConstants.MERGE_ROWS, rowsMerge.isBooleanValue());
+ } else {
+ mergeMap.put(NamedStyleConstants.MERGE_ROWS, false);
+ }
+ if (columnsMerge != null) {
+ mergeMap.put(NamedStyleConstants.MERGE_COLUMNS, columnsMerge.isBooleanValue());
+ } else {
+ mergeMap.put(NamedStyleConstants.MERGE_COLUMNS, false);
+ }
+ if (selectedRowsMerge) {
+ mergeMap.put(NamedStyleConstants.MERGE_SELECTED_ROWS, selectedRowsMerge);
+ } else {
+ mergeMap.put(NamedStyleConstants.MERGE_SELECTED_ROWS, false);
+ }
+ if (selectedColumnsMerge) {
+ mergeMap.put(NamedStyleConstants.MERGE_SELECTED_COLUMNS, selectedColumnsMerge);
+ } else {
+ mergeMap.put(NamedStyleConstants.MERGE_SELECTED_COLUMNS, false);
+ }
+ // if(tableMerge != null) {
+ // mergeMap.put(NamedStyleConstants.MERGE_TABLE, tableMerge.isBooleanValue());
+ // } else {
+ // mergeMap.put(NamedStyleConstants.MERGE_TABLE, false);
+ // }
+
+ // verify the availability of each merge option in order to allow the activation of its associated handler
+ if (getNattableModelManager() != null && expectedValue instanceof Boolean) {
+ if (NamedStyleConstants.MERGE_ROWS.equals(property)) {
+ if (!tableMerged(mergeMap)) {
+ return true;
+ } else {
+ return mergeMap.get(NamedStyleConstants.MERGE_ROWS);
+ }
+ } else if (NamedStyleConstants.MERGE_COLUMNS.equals(property)) {
+ if (!tableMerged(mergeMap)) {
+ return true;
+ } else {
+ return mergeMap.get(NamedStyleConstants.MERGE_COLUMNS);
+ }
+ } else if (NamedStyleConstants.MERGE_SELECTED_ROWS.equals(property)) {
+ if (!tableMerged(mergeMap)) {
+ return true;
+ } else {
+ return mergeMap.get(NamedStyleConstants.MERGE_SELECTED_ROWS);
+ }
+ } else if (NamedStyleConstants.MERGE_SELECTED_COLUMNS.equals(property)) {
+ if (!tableMerged(mergeMap)) {
+ return true;
+ } else {
+ return mergeMap.get(NamedStyleConstants.MERGE_SELECTED_COLUMNS);
+ }
+ // } else if(NamedStyleConstants.MERGE_TABLE.equals(property)) {
+ // if(!tableMerged(mergeMap)) {
+ // return true;
+ // } else {
+ // return mergeMap.get(NamedStyleConstants.MERGE_TABLE);
+ // }
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @return
+ * the current nattable model manager or <code>null</code> if not found
+ */
+ protected INattableModelManager getNattableModelManager() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchPart current = null;
+ if (workbench != null) {
+ final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
+ if (activeWorkbench != null) {
+ final IWorkbenchPage activePage = activeWorkbench.getActivePage();
+ if (activePage != null) {
+ current = activePage.getActivePart();
+ }
+ }
+ }
+
+ if (current != null) {
+ return (INattableModelManager) current.getAdapter(INattableModelManager.class);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * Identifies if the table is already merged or not
+ *
+ */
+ protected boolean tableMerged(HashMap<String, Boolean> mergeMap) {
+ // verify if none of the merge options are active, all must then be available (restrictions to false)
+ // if(!mergeMap.get(NamedStyleConstants.MERGE_ROWS) && !mergeMap.get(NamedStyleConstants.MERGE_COLUMNS) && !mergeMap.get(NamedStyleConstants.MERGE_SELECTED_ROWS)
+ // && !mergeMap.get(NamedStyleConstants.MERGE_SELECTED_COLUMNS) && !mergeMap.get(NamedStyleConstants.MERGE_TABLE)) {
+ if (!mergeMap.get(NamedStyleConstants.MERGE_ROWS) && !mergeMap.get(NamedStyleConstants.MERGE_COLUMNS) && !mergeMap.get(NamedStyleConstants.MERGE_SELECTED_ROWS) && !mergeMap.get(NamedStyleConstants.MERGE_SELECTED_COLUMNS)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ *
+ * @return
+ * the boolean indicating that some row axis are to be merged in the selection
+ */
+ protected boolean getToMergeRowBoolean() {
+ // for(IAxis currentAxis : getNattableModelManager().getTable().getCurrentRowAxisProvider().getAxis()) {
+ for (Object currentObject : getNattableModelManager().getRowElementsList()) {
+ if (currentObject instanceof IAxis) {
+ IAxis currentAxis = (IAxis) currentObject;
+ BooleanValueStyle axisToMerge = (BooleanValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_ROWS);
+ if (axisToMerge != null && axisToMerge.isBooleanValue()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @return
+ * the boolean indicating that some column axis are to be merged in the selection
+ */
+ protected boolean getToMergeColumnBoolean() {
+ // for(IAxis currentAxis : getNattableModelManager().getTable().getCurrentColumnAxisProvider().getAxis()) {
+ for (Object currentObject : getNattableModelManager().getColumnElementsList()) {
+ if (currentObject instanceof IAxis) {
+ IAxis currentAxis = (IAxis) currentObject;
+ BooleanValueStyle axisToMerge = (BooleanValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.MERGE_IN_SELECTED_COLUMNS);
+ if (axisToMerge != null && axisToMerge.isBooleanValue()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteConfigurationUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteConfigurationUtils.java
index e62a510b491..2ff9e322a4f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteConfigurationUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteConfigurationUtils.java
@@ -1,82 +1,82 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
-
-
-/**
- * Utils class for paste actions
- *
- * @author Vincent Lorenzo
- *
- */
-public class PasteConfigurationUtils {
-
-
- private PasteConfigurationUtils() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param pasteConfiguration
- * a paste configuration
- * @return
- * a status describing the consistence of the paste configuration
- */
- public static IStatus hasConsistentPasteEObjectConfiguration(final PasteEObjectConfiguration pasteConfiguration) {
- Assert.isNotNull(pasteConfiguration);
- final String pluginId = Activator.PLUGIN_ID;
- final EStructuralFeature feature = pasteConfiguration.getPasteElementContainementFeature();
- if (feature == null) {
- return new Status(IStatus.ERROR, pluginId, Messages.PasteConfigurationUtils_ContainmentFeatureIsNull);
- } else if (feature instanceof EReference) {
- if (!((EReference) feature).isContainment()) {
- return new Status(IStatus.ERROR, pluginId, Messages.PasteConfigurationUtils_ContainmentFeatureIsNotAReferenceContainment);
- }
- final String elementId = pasteConfiguration.getPastedElementId();
- if (elementId != null && !elementId.equals("")) { //$NON-NLS-1$
- final IElementType elementType = ElementTypeRegistry.getInstance().getType(elementId);
- if (elementType != null) {
- final EClass elementTypeMetaclass = elementType.getEClass();
- final EClass containmentFeatureEClass = (EClass) feature.getEType();
- boolean knownFeature = elementTypeMetaclass == containmentFeatureEClass || containmentFeatureEClass.isSuperTypeOf(elementTypeMetaclass);
- if (knownFeature) {
- return new Status(IStatus.OK, pluginId, Messages.PasteConfigurationUtils_PasteConfigurationIsConsistent);
- } else {
- return new Status(IStatus.ERROR, pluginId, NLS.bind(Messages.PasteConfigurationUtils_CreatesElementsAreNotCompatibleWithContainmentFeature, elementId, containmentFeatureEClass.getName()));
- }
- } else {
- return new Status(IStatus.ERROR, pluginId, NLS.bind(Messages.PasteConfigurationUtils_ElementTypeCantBeFound, elementId));
- }
- } else {
- return new Status(IStatus.ERROR, pluginId, Messages.PasteConfigurationUtils_ElementIdNotDefined);
- }
- } else {
- return new Status(IStatus.ERROR, pluginId, Messages.PasteConfigurationUtils_ContainementFeatureIsNotAReference);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
+
+
+/**
+ * Utils class for paste actions
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class PasteConfigurationUtils {
+
+
+ private PasteConfigurationUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param pasteConfiguration
+ * a paste configuration
+ * @return
+ * a status describing the consistence of the paste configuration
+ */
+ public static IStatus hasConsistentPasteEObjectConfiguration(final PasteEObjectConfiguration pasteConfiguration) {
+ Assert.isNotNull(pasteConfiguration);
+ final String pluginId = Activator.PLUGIN_ID;
+ final EStructuralFeature feature = pasteConfiguration.getPasteElementContainementFeature();
+ if (feature == null) {
+ return new Status(IStatus.ERROR, pluginId, Messages.PasteConfigurationUtils_ContainmentFeatureIsNull);
+ } else if (feature instanceof EReference) {
+ if (!((EReference) feature).isContainment()) {
+ return new Status(IStatus.ERROR, pluginId, Messages.PasteConfigurationUtils_ContainmentFeatureIsNotAReferenceContainment);
+ }
+ final String elementId = pasteConfiguration.getPastedElementId();
+ if (elementId != null && !elementId.equals("")) { //$NON-NLS-1$
+ final IElementType elementType = ElementTypeRegistry.getInstance().getType(elementId);
+ if (elementType != null) {
+ final EClass elementTypeMetaclass = elementType.getEClass();
+ final EClass containmentFeatureEClass = (EClass) feature.getEType();
+ boolean knownFeature = elementTypeMetaclass == containmentFeatureEClass || containmentFeatureEClass.isSuperTypeOf(elementTypeMetaclass);
+ if (knownFeature) {
+ return new Status(IStatus.OK, pluginId, Messages.PasteConfigurationUtils_PasteConfigurationIsConsistent);
+ } else {
+ return new Status(IStatus.ERROR, pluginId, NLS.bind(Messages.PasteConfigurationUtils_CreatesElementsAreNotCompatibleWithContainmentFeature, elementId, containmentFeatureEClass.getName()));
+ }
+ } else {
+ return new Status(IStatus.ERROR, pluginId, NLS.bind(Messages.PasteConfigurationUtils_ElementTypeCantBeFound, elementId));
+ }
+ } else {
+ return new Status(IStatus.ERROR, pluginId, Messages.PasteConfigurationUtils_ElementIdNotDefined);
+ }
+ } else {
+ return new Status(IStatus.ERROR, pluginId, Messages.PasteConfigurationUtils_ContainementFeatureIsNotAReference);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteEnablementStatus.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteEnablementStatus.java
index 3270e89ab57..f47ca71f4d8 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteEnablementStatus.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteEnablementStatus.java
@@ -1,98 +1,98 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.core.runtime.MultiStatus;
-
-/**
- *
- * This class is used to store the tests about the paste capability of the table
- *
- */
-public class PasteEnablementStatus {
-
- /**
- * the result of the tests to paste rows in the table
- */
- private MultiStatus rowStatus;
-
- /**
- * the result of the test to paste columns in the table
- */
- private MultiStatus columnStatus;
-
-
- /**
- *
- * Constructor.
- *
- * @param columnStatus
- * the paste column status
- * @param rowStatus
- * the paste row status
- */
- public PasteEnablementStatus(final MultiStatus columnStatus, final MultiStatus rowStatus) {
- this.rowStatus = rowStatus;
- this.columnStatus = columnStatus;
- }
-
- /**
- *
- * @return
- * the paste mode according to the row and column status
- */
- public PasteModeEnumeration getPasteMode() {
- if (this.rowStatus == null && this.columnStatus == null) {
- return PasteModeEnumeration.PASTE_NO_CONFIGURATION;
- }
- if (this.rowStatus != null && this.columnStatus != null) {
- if (this.columnStatus.isOK() && this.rowStatus.isOK()) {
- return PasteModeEnumeration.PASTE_EOBJECT_ROW_OR_COLUMN;
- }
- if (this.columnStatus.isOK() && !this.rowStatus.isOK()) {
- return PasteModeEnumeration.PASTE_EOBJECT_COLUMN;
- }
- if (!this.columnStatus.isOK() && this.rowStatus.isOK()) {
- return PasteModeEnumeration.PASTE_EOBJECT_ROW;
- }
- }
- if (this.rowStatus != null && this.rowStatus.isOK() && this.columnStatus == null) {
- return PasteModeEnumeration.PASTE_EOBJECT_ROW;
- }
- if (this.columnStatus != null && this.rowStatus == null && this.columnStatus.isOK()) {
- return PasteModeEnumeration.PASTE_EOBJECT_COLUMN;
- }
- return PasteModeEnumeration.CANT_PASTE;
- }
-
- /**
- *
- * @return
- * the column status
- */
- public MultiStatus getColumnStatus() {
- return this.columnStatus;
- }
-
- /**
- *
- * @return
- * the row status
- */
- public MultiStatus getRowStatus() {
- return this.rowStatus;
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.core.runtime.MultiStatus;
+
+/**
+ *
+ * This class is used to store the tests about the paste capability of the table
+ *
+ */
+public class PasteEnablementStatus {
+
+ /**
+ * the result of the tests to paste rows in the table
+ */
+ private MultiStatus rowStatus;
+
+ /**
+ * the result of the test to paste columns in the table
+ */
+ private MultiStatus columnStatus;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param columnStatus
+ * the paste column status
+ * @param rowStatus
+ * the paste row status
+ */
+ public PasteEnablementStatus(final MultiStatus columnStatus, final MultiStatus rowStatus) {
+ this.rowStatus = rowStatus;
+ this.columnStatus = columnStatus;
+ }
+
+ /**
+ *
+ * @return
+ * the paste mode according to the row and column status
+ */
+ public PasteModeEnumeration getPasteMode() {
+ if (this.rowStatus == null && this.columnStatus == null) {
+ return PasteModeEnumeration.PASTE_NO_CONFIGURATION;
+ }
+ if (this.rowStatus != null && this.columnStatus != null) {
+ if (this.columnStatus.isOK() && this.rowStatus.isOK()) {
+ return PasteModeEnumeration.PASTE_EOBJECT_ROW_OR_COLUMN;
+ }
+ if (this.columnStatus.isOK() && !this.rowStatus.isOK()) {
+ return PasteModeEnumeration.PASTE_EOBJECT_COLUMN;
+ }
+ if (!this.columnStatus.isOK() && this.rowStatus.isOK()) {
+ return PasteModeEnumeration.PASTE_EOBJECT_ROW;
+ }
+ }
+ if (this.rowStatus != null && this.rowStatus.isOK() && this.columnStatus == null) {
+ return PasteModeEnumeration.PASTE_EOBJECT_ROW;
+ }
+ if (this.columnStatus != null && this.rowStatus == null && this.columnStatus.isOK()) {
+ return PasteModeEnumeration.PASTE_EOBJECT_COLUMN;
+ }
+ return PasteModeEnumeration.CANT_PASTE;
+ }
+
+ /**
+ *
+ * @return
+ * the column status
+ */
+ public MultiStatus getColumnStatus() {
+ return this.columnStatus;
+ }
+
+ /**
+ *
+ * @return
+ * the row status
+ */
+ public MultiStatus getRowStatus() {
+ return this.rowStatus;
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteHelper.java
index 1ba3d9749ce..97b57758507 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteHelper.java
@@ -1,154 +1,154 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-/**
- *
- * This class provides utils method to split a string to do a paste in the table
- *
- */
-public class PasteHelper {
-
- /**
- * the default separator used for row
- */
- public static final String DEFAULT_ROW_SEPARATOR = "\n"; //$NON-NLS-1" //$NON-NLS-1$
-
- /**
- * the default separator used for columns
- */
- public static final String DEFAULT_COLUMN_SEPARATOR = "\t";//$NON-NLS-1" //$NON-NLS-1$
-
- /**
- * the default separator used for multivalue
- */
- public static final String DEFAULT_MULTI_VALUE_SEPARATOR = ","; //$NON-NLS-1$
-
-
- private final String rowSeparator;
-
- private final String columnSeparator;
-
- private final String multiValueSeparator;
-
- /**
- *
- * Constructor.
- *
- */
- public PasteHelper() {
- this(DEFAULT_COLUMN_SEPARATOR, DEFAULT_ROW_SEPARATOR, DEFAULT_MULTI_VALUE_SEPARATOR);
- }
-
- /**
- *
- * Constructor.
- *
- * @param columnSeparator
- * the column separator to use
- * @param rowSeparator
- * the row separator to use
- * @param multiValueSeparator
- * the multi value separator to use
- */
- public PasteHelper(final String columnSeparator, final String rowSeparator, final String multiValueSeparator) {
- this.columnSeparator = columnSeparator;
- this.rowSeparator = rowSeparator;
- this.multiValueSeparator = multiValueSeparator;
- }
-
- /**
- *
- * @param axisAsString
- * an full axis represented by a String
- *
- *
- * @return
- * the cells using the specified cell separator
- */
-
- public String[] getCellsAsStringFromAxis(final String axisAsString) {
- return axisAsString.split(this.columnSeparator);
- }
-
- /**
- *
- * @param fullContents
- * the string to split
- *
- * @return
- * the rows
- */
- public final String[] getRows(final String fullContents) {
- final String[] rows = fullContents.split(this.rowSeparator);
- return rows;
- }
-
- /**
- *
- * @param fullContents
- * @param rowSeparator
- * @param columnSeparator
- * @return
- * an array of the pasted columns
- */
- // TODO refactor me the paste in column should be the same as the paste in row!
- public final String[] getColumns(final String fullContents) {
- final String[] rows = fullContents.split(rowSeparator);
- if (rows.length > 0) {
- int nbColumn = rows[0].split(columnSeparator).length;
- String[] columns = new String[nbColumn];
- for (int columnIndex = 0; columnIndex < nbColumn; columnIndex++) {
- columns[columnIndex] = ""; //$NON-NLS-1$
- }
-
- for (int rowIndex = 0; rowIndex < rows.length; rowIndex++) {
- String row = rows[rowIndex];
- String[] currentColumns = row.split(columnSeparator);
- for (int columnIndex = 0; columnIndex < nbColumn; columnIndex++) {
- if (currentColumns.length != 0) {
- columns[columnIndex] += currentColumns[columnIndex];
- } else {
- columns[columnIndex] += ""; //$NON-NLS-1$
- }
- if (rowIndex < rows.length + 1) {
- columns[columnIndex] += columnSeparator;
- } else {
- columns[columnIndex] += rowSeparator;
- }
- }
- }
- return columns;
-
- }
- return null;
- }
-
-
- public String getRowSeparator() {
- return rowSeparator;
- }
-
-
- public String getColumnSeparator() {
- return columnSeparator;
- }
-
-
- public String getMultiValueSeparator() {
- return multiValueSeparator;
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+/**
+ *
+ * This class provides utils method to split a string to do a paste in the table
+ *
+ */
+public class PasteHelper {
+
+ /**
+ * the default separator used for row
+ */
+ public static final String DEFAULT_ROW_SEPARATOR = "\n"; //$NON-NLS-1" //$NON-NLS-1$
+
+ /**
+ * the default separator used for columns
+ */
+ public static final String DEFAULT_COLUMN_SEPARATOR = "\t";//$NON-NLS-1" //$NON-NLS-1$
+
+ /**
+ * the default separator used for multivalue
+ */
+ public static final String DEFAULT_MULTI_VALUE_SEPARATOR = ","; //$NON-NLS-1$
+
+
+ private final String rowSeparator;
+
+ private final String columnSeparator;
+
+ private final String multiValueSeparator;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public PasteHelper() {
+ this(DEFAULT_COLUMN_SEPARATOR, DEFAULT_ROW_SEPARATOR, DEFAULT_MULTI_VALUE_SEPARATOR);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param columnSeparator
+ * the column separator to use
+ * @param rowSeparator
+ * the row separator to use
+ * @param multiValueSeparator
+ * the multi value separator to use
+ */
+ public PasteHelper(final String columnSeparator, final String rowSeparator, final String multiValueSeparator) {
+ this.columnSeparator = columnSeparator;
+ this.rowSeparator = rowSeparator;
+ this.multiValueSeparator = multiValueSeparator;
+ }
+
+ /**
+ *
+ * @param axisAsString
+ * an full axis represented by a String
+ *
+ *
+ * @return
+ * the cells using the specified cell separator
+ */
+
+ public String[] getCellsAsStringFromAxis(final String axisAsString) {
+ return axisAsString.split(this.columnSeparator);
+ }
+
+ /**
+ *
+ * @param fullContents
+ * the string to split
+ *
+ * @return
+ * the rows
+ */
+ public final String[] getRows(final String fullContents) {
+ final String[] rows = fullContents.split(this.rowSeparator);
+ return rows;
+ }
+
+ /**
+ *
+ * @param fullContents
+ * @param rowSeparator
+ * @param columnSeparator
+ * @return
+ * an array of the pasted columns
+ */
+ // TODO refactor me the paste in column should be the same as the paste in row!
+ public final String[] getColumns(final String fullContents) {
+ final String[] rows = fullContents.split(rowSeparator);
+ if (rows.length > 0) {
+ int nbColumn = rows[0].split(columnSeparator).length;
+ String[] columns = new String[nbColumn];
+ for (int columnIndex = 0; columnIndex < nbColumn; columnIndex++) {
+ columns[columnIndex] = ""; //$NON-NLS-1$
+ }
+
+ for (int rowIndex = 0; rowIndex < rows.length; rowIndex++) {
+ String row = rows[rowIndex];
+ String[] currentColumns = row.split(columnSeparator);
+ for (int columnIndex = 0; columnIndex < nbColumn; columnIndex++) {
+ if (currentColumns.length != 0) {
+ columns[columnIndex] += currentColumns[columnIndex];
+ } else {
+ columns[columnIndex] += ""; //$NON-NLS-1$
+ }
+ if (rowIndex < rows.length + 1) {
+ columns[columnIndex] += columnSeparator;
+ } else {
+ columns[columnIndex] += rowSeparator;
+ }
+ }
+ }
+ return columns;
+
+ }
+ return null;
+ }
+
+
+ public String getRowSeparator() {
+ return rowSeparator;
+ }
+
+
+ public String getColumnSeparator() {
+ return columnSeparator;
+ }
+
+
+ public String getMultiValueSeparator() {
+ return multiValueSeparator;
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteModeEnumeration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteModeEnumeration.java
index 83480373fcf..f6bd4068ce1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteModeEnumeration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteModeEnumeration.java
@@ -1,46 +1,46 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-/**
- * Literals used to describe the paste mode
- *
- * @author Vincent Lorenzo
- *
- */
-public enum PasteModeEnumeration {
-
- /**
- * the user want paste rows
- */
- PASTE_EOBJECT_ROW,
- /**
- * the user wants paste columns
- */
- PASTE_EOBJECT_COLUMN,
- /**
- * the system can't decide if the user want paste rows or columns
- */
- PASTE_EOBJECT_ROW_OR_COLUMN,
- /**
- * configuration exist but the configuration is not valid
- */
- CANT_PASTE,
-
- /**
- * the table have any configuration for paste
- */
- PASTE_NO_CONFIGURATION;
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+/**
+ * Literals used to describe the paste mode
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public enum PasteModeEnumeration {
+
+ /**
+ * the user want paste rows
+ */
+ PASTE_EOBJECT_ROW,
+ /**
+ * the user wants paste columns
+ */
+ PASTE_EOBJECT_COLUMN,
+ /**
+ * the system can't decide if the user want paste rows or columns
+ */
+ PASTE_EOBJECT_ROW_OR_COLUMN,
+ /**
+ * configuration exist but the configuration is not valid
+ */
+ CANT_PASTE,
+
+ /**
+ * the table have any configuration for paste
+ */
+ PASTE_NO_CONFIGURATION;
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteSeverityCode.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteSeverityCode.java
index 4edd7453191..b4f5e255dde 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteSeverityCode.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteSeverityCode.java
@@ -1,72 +1,72 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.utils;
-
-/**
- * @author Vincent Lorenzo
- *
- * This class provides code which can be provided by Paste Action in the table
- */
-public class PasteSeverityCode {
-
-
- /**
- * Constructor.
- *
- */
- private PasteSeverityCode() {
- // to prevent instanciation
- }
-
- /**
- * the severity code used when there is no containment feature declared in the configuration
- */
- public static final int PASTE_ERROR__NO_CONTAINMENT_FEATURE = 0;
-
- /**
- * the severity code used when there is no paste configuration found
- */
- public static final int PASTE_ERROR__NO_PASTE_CONFIGURATION = PASTE_ERROR__NO_CONTAINMENT_FEATURE+1;
-
- /**
- * no element type defined for the paste
- */
- public static final int PASTE_ERROR__NO_ELEMENT_TYPE_IN_PASTE_CONFIGURATION = PASTE_ERROR__NO_PASTE_CONFIGURATION + 1;
-
- /**
- * A depth is hidden, but there is more than one category for the depth (we can't know which category choose for the paste)
- */
- public static final int PASTE_ERROR__MORE_THAN_ONE_CATEGORY_FOR_A_HIDDEN_DEPTH = PASTE_ERROR__NO_ELEMENT_TYPE_IN_PASTE_CONFIGURATION + 1;
-
- /**
- * Element type has not be definedS
- */
- public static final int PASTE_ERROR__UNKNOWN_ELEMENT_TYPE = PASTE_ERROR__MORE_THAN_ONE_CATEGORY_FOR_A_HIDDEN_DEPTH + 1;
-
- /**
- * the severity code used when we try to paste columns in a tree table
- */
- public static final int PASTE_ERROR__CANT_PASTE_COLUMNS_IN_TREE_TABLE = PASTE_ERROR__UNKNOWN_ELEMENT_TYPE + 1;
-
- /**
- * the severity code used when more lines is pasted than the number of depth available
- */
- public static final int PASTE_ERROR__MORE_LINES_THAN_DEPTH = PASTE_ERROR__CANT_PASTE_COLUMNS_IN_TREE_TABLE + 1;
-
- /**
- * the severity code used when there are too many cells on a rows
- */
- public static final int PASTE_WARNING__TOO_MANY_CELLS_ON_ROWS = PASTE_ERROR__MORE_LINES_THAN_DEPTH + 1;
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.utils;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ * This class provides code which can be provided by Paste Action in the table
+ */
+public class PasteSeverityCode {
+
+
+ /**
+ * Constructor.
+ *
+ */
+ private PasteSeverityCode() {
+ // to prevent instanciation
+ }
+
+ /**
+ * the severity code used when there is no containment feature declared in the configuration
+ */
+ public static final int PASTE_ERROR__NO_CONTAINMENT_FEATURE = 0;
+
+ /**
+ * the severity code used when there is no paste configuration found
+ */
+ public static final int PASTE_ERROR__NO_PASTE_CONFIGURATION = PASTE_ERROR__NO_CONTAINMENT_FEATURE+1;
+
+ /**
+ * no element type defined for the paste
+ */
+ public static final int PASTE_ERROR__NO_ELEMENT_TYPE_IN_PASTE_CONFIGURATION = PASTE_ERROR__NO_PASTE_CONFIGURATION + 1;
+
+ /**
+ * A depth is hidden, but there is more than one category for the depth (we can't know which category choose for the paste)
+ */
+ public static final int PASTE_ERROR__MORE_THAN_ONE_CATEGORY_FOR_A_HIDDEN_DEPTH = PASTE_ERROR__NO_ELEMENT_TYPE_IN_PASTE_CONFIGURATION + 1;
+
+ /**
+ * Element type has not be definedS
+ */
+ public static final int PASTE_ERROR__UNKNOWN_ELEMENT_TYPE = PASTE_ERROR__MORE_THAN_ONE_CATEGORY_FOR_A_HIDDEN_DEPTH + 1;
+
+ /**
+ * the severity code used when we try to paste columns in a tree table
+ */
+ public static final int PASTE_ERROR__CANT_PASTE_COLUMNS_IN_TREE_TABLE = PASTE_ERROR__UNKNOWN_ELEMENT_TYPE + 1;
+
+ /**
+ * the severity code used when more lines is pasted than the number of depth available
+ */
+ public static final int PASTE_ERROR__MORE_LINES_THAN_DEPTH = PASTE_ERROR__CANT_PASTE_COLUMNS_IN_TREE_TABLE + 1;
+
+ /**
+ * the severity code used when there are too many cells on a rows
+ */
+ public static final int PASTE_WARNING__TOO_MANY_CELLS_ON_ROWS = PASTE_ERROR__MORE_LINES_THAN_DEPTH + 1;
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteTreeUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteTreeUtils.java
index efdd03c5693..fe5dd51557e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteTreeUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/PasteTreeUtils.java
@@ -1,119 +1,119 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- *
- *
- */
-public class PasteTreeUtils {
-
- /**
- * Constructor.
- *
- */
- private PasteTreeUtils() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param nbReadCell
- * the number of read cells (>0)
- * @param maxDepth
- * the max depth of the table, this value start to 0
- * @param hiddenDepth
- * the list of the hidden depth
- * @param hasConfigurationOnDepth0
- * <code>true</code> if the table has a configuration on depth==0
- * @return
- * the depth for the read cell
- */
- public static final int getDepth(int nbReadCell, int maxDepth, List<Integer> hiddenDepth, boolean hasConfigurationOnDepth0) {
- int nbColumn = (maxDepth + 1) * 2;// depth start to 0
- int readColumn = 0;
- int depth = -1;
- for (int i = 0; i < nbColumn; i++) {
- // we cross the column table and we check if the column is visible
- if (i % 2 == 0) {// it is the index of the category columns
- depth++;
- if (!hiddenDepth.contains(Integer.valueOf(i / 2))) {
- readColumn++;
- }
- } else {
- readColumn++;
- }
-
- if (readColumn == nbReadCell) {
- if (!hasConfigurationOnDepth0) {
- readColumn--;
- hasConfigurationOnDepth0 = true;
- continue;
- }
- return depth;
- }
- }
- throw new UnsupportedOperationException("There is an error in this method", null); //$NON-NLS-1$
- }
-
- /**
- *
- * @param nbReadCell
- * the number of read cells (>0)
- * @param maxDepth
- * the max depth of the table, this value start to 0
- * @param hiddenDepth
- * the list of the hidden depth
- * @param hasConfigurationOnDepth0
- * <code>true</code> if the table has a configuration on depth==0
- * @return
- * <code>true</code> if the read cell represents a category
- */
- public static final boolean isCategory(int nbReadCell, int maxDepth, List<Integer> hiddenDepth, boolean hasConfigurationOnDepth0) {
- Assert.isTrue(nbReadCell > 0);
- int nbColumn = (maxDepth + 1) * 2;// depth start to 0
- boolean isCategory;
- int readColumn = 0;
- for (int i = 0; i < nbColumn; i++) {
- // we cross the column table and we check if the column is visible
- if (i % 2 == 0) {// it is the index of the category columns
- if (!hiddenDepth.contains(Integer.valueOf(i / 2))) {
- isCategory = true;
- readColumn++;
- } else {
- isCategory = false;
- }
- } else {
- readColumn++;
- isCategory = false;
- }
-
- if (readColumn == nbReadCell) {
- if (!hasConfigurationOnDepth0) {
- readColumn--;
- hasConfigurationOnDepth0 = true;
- continue;
- }
- return isCategory;
- }
- }
- throw new UnsupportedOperationException("There is an error in this method", null); //$NON-NLS-1$
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ *
+ *
+ */
+public class PasteTreeUtils {
+
+ /**
+ * Constructor.
+ *
+ */
+ private PasteTreeUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param nbReadCell
+ * the number of read cells (>0)
+ * @param maxDepth
+ * the max depth of the table, this value start to 0
+ * @param hiddenDepth
+ * the list of the hidden depth
+ * @param hasConfigurationOnDepth0
+ * <code>true</code> if the table has a configuration on depth==0
+ * @return
+ * the depth for the read cell
+ */
+ public static final int getDepth(int nbReadCell, int maxDepth, List<Integer> hiddenDepth, boolean hasConfigurationOnDepth0) {
+ int nbColumn = (maxDepth + 1) * 2;// depth start to 0
+ int readColumn = 0;
+ int depth = -1;
+ for (int i = 0; i < nbColumn; i++) {
+ // we cross the column table and we check if the column is visible
+ if (i % 2 == 0) {// it is the index of the category columns
+ depth++;
+ if (!hiddenDepth.contains(Integer.valueOf(i / 2))) {
+ readColumn++;
+ }
+ } else {
+ readColumn++;
+ }
+
+ if (readColumn == nbReadCell) {
+ if (!hasConfigurationOnDepth0) {
+ readColumn--;
+ hasConfigurationOnDepth0 = true;
+ continue;
+ }
+ return depth;
+ }
+ }
+ throw new UnsupportedOperationException("There is an error in this method", null); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @param nbReadCell
+ * the number of read cells (>0)
+ * @param maxDepth
+ * the max depth of the table, this value start to 0
+ * @param hiddenDepth
+ * the list of the hidden depth
+ * @param hasConfigurationOnDepth0
+ * <code>true</code> if the table has a configuration on depth==0
+ * @return
+ * <code>true</code> if the read cell represents a category
+ */
+ public static final boolean isCategory(int nbReadCell, int maxDepth, List<Integer> hiddenDepth, boolean hasConfigurationOnDepth0) {
+ Assert.isTrue(nbReadCell > 0);
+ int nbColumn = (maxDepth + 1) * 2;// depth start to 0
+ boolean isCategory;
+ int readColumn = 0;
+ for (int i = 0; i < nbColumn; i++) {
+ // we cross the column table and we check if the column is visible
+ if (i % 2 == 0) {// it is the index of the category columns
+ if (!hiddenDepth.contains(Integer.valueOf(i / 2))) {
+ isCategory = true;
+ readColumn++;
+ } else {
+ isCategory = false;
+ }
+ } else {
+ readColumn++;
+ isCategory = false;
+ }
+
+ if (readColumn == nbReadCell) {
+ if (!hasConfigurationOnDepth0) {
+ readColumn--;
+ hasConfigurationOnDepth0 = true;
+ continue;
+ }
+ return isCategory;
+ }
+ }
+ throw new UnsupportedOperationException("There is an error in this method", null); //$NON-NLS-1$
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StringComparator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StringComparator.java
index 78f62610c22..9453f8bedb2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StringComparator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StringComparator.java
@@ -1,35 +1,35 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import java.util.Comparator;
-
-/**
- *
- * String comparator ignoring all non-words character
- *
- */
-public class StringComparator implements Comparator<String> {
-
- /**
- *
- * @param o1
- * @param o2
- * @return
- */
- @Override
- public int compare(String str1, String str2) {
- str1 = str1.replaceAll(AxisUtils.REGEX, "");//$NON-NLS-1$ //we keep only words characters (letters + numbers) + whitespace
- str2 = str2.replaceAll(AxisUtils.REGEX, ""); //$NON-NLS-1$
- return str1.compareToIgnoreCase(str2);
- };
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.Comparator;
+
+/**
+ *
+ * String comparator ignoring all non-words character
+ *
+ */
+public class StringComparator implements Comparator<String> {
+
+ /**
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ @Override
+ public int compare(String str1, String str2) {
+ str1 = str1.replaceAll(AxisUtils.REGEX, "");//$NON-NLS-1$ //we keep only words characters (letters + numbers) + whitespace
+ str2 = str2.replaceAll(AxisUtils.REGEX, ""); //$NON-NLS-1$
+ return str1.compareToIgnoreCase(str2);
+ };
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableClipboardUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableClipboardUtils.java
index 29fe9f200a3..b2206a97dfa 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableClipboardUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableClipboardUtils.java
@@ -1,188 +1,188 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.widgets.Display;
-
-
-
-/**
- * Util class to manage the clipboard
- *
- * @author Vincent Lorenzo
- *
- */
-public class TableClipboardUtils {
-
- /**
- * row separator in the clipboard contents
- */
- @Deprecated
- // use the value defined in PasteHelpers
- public static final String AXIS_SEPARATOR = "\n"; //$NON-NLS-1$
-
- /**
- * column separator in the clipboard contents
- */
- @Deprecated
- // use the value defined into PasteHelper
- public static final String CELL_SEPARATOR = "\t"; //$NON-NLS-1$
-
- /**
- * the separator used for multivalue
- */
- @Deprecated
- // use the value defined into PasteHelper
- public static final String MULTI_VALUE_SEPARATOR = ","; //$NON-NLS-1$
-
- private TableClipboardUtils() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param fullContents
- * a table represented by a String
- * @return the rows for this table
- */
- @Deprecated
- // use PasteHelper
- public static final String[] getRows(final String fullContents) {
- final String[] rows = fullContents.split(AXIS_SEPARATOR);
- return rows;
- }
-
- /**
- *
- * @return
- * the rows as string extractzed from the clipboard
- */
- @Deprecated
- // use PasteHelper
- public static final String[] getRowsFromClipboard() {
- final String clipboardContent = getClipboardContents();
- if (clipboardContent != null && !clipboardContent.isEmpty()) {
- return getRows(clipboardContent);
- }
- return null;
- }
-
- /**
- *
- * @return
- * the columns as string extractzed from the clipboard
- */
- @Deprecated
- // use PasteHelper
- public static final String[] getColumnsFromClipboard() {
- final String clipboardContent = getClipboardContents();
- if (clipboardContent != null && !clipboardContent.isEmpty()) {
- return getColumns(clipboardContent);
- }
- return null;
- }
-
-
- /**
- *
- * @return
- * the clipboard contents used to build the command
- */
- private static final String getClipboardContents() {
- // examine system clipboard with AWT
-// String bufferSystem = null;
-//
-//
-// java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
-//
-// if (clipboard.isDataFlavorAvailable(DataFlavor.stringFlavor)) {
-// try {
-// bufferSystem = clipboard.getData(DataFlavor.stringFlavor).toString();
-// } catch (UnsupportedFlavorException e) {
-// Activator.log.error(e);
-// } catch (IOException e) {
-// Activator.log.error(e);
-// }
-// }
-//
-// return bufferSystem;
-
-// using SWT
- final Display display = Display.getCurrent();
- final Clipboard cb = new Clipboard(display);
- // we use the text transfert
- final TextTransfer transfer = TextTransfer.getInstance();
-
- // final Clipboard cb = new Clipboard(clipboard);
- final String contents = (String) cb.getContents(transfer);
-
- return contents;
- }
-
- /**
- *
- * @return
- * the contents of the clipboard
- */
- public static final String getClipboardContentsAsString() {
- return getClipboardContents();
- }
-
- /**
- *
- * @param row
- * a row represented by a String
- * @return the cells for this row
- */
- @Deprecated
- // Use PasteHelpers#getCellsAsStringFromAxis
- public static final String[] getCells(final String row) {
- return row.split(CELL_SEPARATOR);
- }
-
-
- public static final String[] getColumns(final String fullContents) {
- final String[] rows = fullContents.split(AXIS_SEPARATOR);
- if (rows.length > 0) {
- int nbColumn = rows[0].split(CELL_SEPARATOR).length;
- String[] columns = new String[nbColumn];
- for (int columnIndex = 0; columnIndex < nbColumn; columnIndex++) {
- columns[columnIndex] = ""; //$NON-NLS-1$
- }
-
- for (int rowIndex = 0; rowIndex < rows.length; rowIndex++) {
- String row = rows[rowIndex];
- String[] currentColumns = row.split(CELL_SEPARATOR);
- for (int columnIndex = 0; columnIndex < nbColumn; columnIndex++) {
- if (currentColumns.length != 0) {
- columns[columnIndex] += currentColumns[columnIndex];
- } else {
- columns[columnIndex] += ""; //$NON-NLS-1$
- }
- if (rowIndex < rows.length + 1) {
- columns[columnIndex] += CELL_SEPARATOR;
- } else {
- columns[columnIndex] += AXIS_SEPARATOR;
- }
- }
- }
- return columns;
-
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.widgets.Display;
+
+
+
+/**
+ * Util class to manage the clipboard
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class TableClipboardUtils {
+
+ /**
+ * row separator in the clipboard contents
+ */
+ @Deprecated
+ // use the value defined in PasteHelpers
+ public static final String AXIS_SEPARATOR = "\n"; //$NON-NLS-1$
+
+ /**
+ * column separator in the clipboard contents
+ */
+ @Deprecated
+ // use the value defined into PasteHelper
+ public static final String CELL_SEPARATOR = "\t"; //$NON-NLS-1$
+
+ /**
+ * the separator used for multivalue
+ */
+ @Deprecated
+ // use the value defined into PasteHelper
+ public static final String MULTI_VALUE_SEPARATOR = ","; //$NON-NLS-1$
+
+ private TableClipboardUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param fullContents
+ * a table represented by a String
+ * @return the rows for this table
+ */
+ @Deprecated
+ // use PasteHelper
+ public static final String[] getRows(final String fullContents) {
+ final String[] rows = fullContents.split(AXIS_SEPARATOR);
+ return rows;
+ }
+
+ /**
+ *
+ * @return
+ * the rows as string extractzed from the clipboard
+ */
+ @Deprecated
+ // use PasteHelper
+ public static final String[] getRowsFromClipboard() {
+ final String clipboardContent = getClipboardContents();
+ if (clipboardContent != null && !clipboardContent.isEmpty()) {
+ return getRows(clipboardContent);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * the columns as string extractzed from the clipboard
+ */
+ @Deprecated
+ // use PasteHelper
+ public static final String[] getColumnsFromClipboard() {
+ final String clipboardContent = getClipboardContents();
+ if (clipboardContent != null && !clipboardContent.isEmpty()) {
+ return getColumns(clipboardContent);
+ }
+ return null;
+ }
+
+
+ /**
+ *
+ * @return
+ * the clipboard contents used to build the command
+ */
+ private static final String getClipboardContents() {
+ // examine system clipboard with AWT
+// String bufferSystem = null;
+//
+//
+// java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+//
+// if (clipboard.isDataFlavorAvailable(DataFlavor.stringFlavor)) {
+// try {
+// bufferSystem = clipboard.getData(DataFlavor.stringFlavor).toString();
+// } catch (UnsupportedFlavorException e) {
+// Activator.log.error(e);
+// } catch (IOException e) {
+// Activator.log.error(e);
+// }
+// }
+//
+// return bufferSystem;
+
+// using SWT
+ final Display display = Display.getCurrent();
+ final Clipboard cb = new Clipboard(display);
+ // we use the text transfert
+ final TextTransfer transfer = TextTransfer.getInstance();
+
+ // final Clipboard cb = new Clipboard(clipboard);
+ final String contents = (String) cb.getContents(transfer);
+
+ return contents;
+ }
+
+ /**
+ *
+ * @return
+ * the contents of the clipboard
+ */
+ public static final String getClipboardContentsAsString() {
+ return getClipboardContents();
+ }
+
+ /**
+ *
+ * @param row
+ * a row represented by a String
+ * @return the cells for this row
+ */
+ @Deprecated
+ // Use PasteHelpers#getCellsAsStringFromAxis
+ public static final String[] getCells(final String row) {
+ return row.split(CELL_SEPARATOR);
+ }
+
+
+ public static final String[] getColumns(final String fullContents) {
+ final String[] rows = fullContents.split(AXIS_SEPARATOR);
+ if (rows.length > 0) {
+ int nbColumn = rows[0].split(CELL_SEPARATOR).length;
+ String[] columns = new String[nbColumn];
+ for (int columnIndex = 0; columnIndex < nbColumn; columnIndex++) {
+ columns[columnIndex] = ""; //$NON-NLS-1$
+ }
+
+ for (int rowIndex = 0; rowIndex < rows.length; rowIndex++) {
+ String row = rows[rowIndex];
+ String[] currentColumns = row.split(CELL_SEPARATOR);
+ for (int columnIndex = 0; columnIndex < nbColumn; columnIndex++) {
+ if (currentColumns.length != 0) {
+ columns[columnIndex] += currentColumns[columnIndex];
+ } else {
+ columns[columnIndex] += ""; //$NON-NLS-1$
+ }
+ if (rowIndex < rows.length + 1) {
+ columns[columnIndex] += CELL_SEPARATOR;
+ } else {
+ columns[columnIndex] += AXIS_SEPARATOR;
+ }
+ }
+ }
+ return columns;
+
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableEditingDomainUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableEditingDomainUtils.java
index c3afe13bc69..ea0cc7ab1f2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableEditingDomainUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableEditingDomainUtils.java
@@ -1,75 +1,75 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-
-/**
- *
- * Utils class to get the best editing domain to use
- *
- */
-public class TableEditingDomainUtils {
-
- /**
- *
- * Constructor.
- *
- */
- private TableEditingDomainUtils() {
- // to prevent instanciation
- }
-
- /**
- * Returns the EditingDomain associated to the table
- *
- * @return
- * the EditingDomain associated to the table
- */
- public static final TransactionalEditingDomain getTableEditingDomain(final Table table) {
- ServicesRegistry registry = null;
- try {
- registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(table);
- return registry.getService(TransactionalEditingDomain.class);
- } catch (final ServiceException e) {
- // The table doesn't have an editing domain (e.g. the table is used in the properties view)
- // Activator.log.error(Messages.NattableModelManager_ServiceRegistryNotFound, e);
- }
- return null;
-
- }
-
- /**
- * Returns the EditingDomain associated to the context
- *
- * @return
- * the EditingDomain associated to the context
- */
- public static final TransactionalEditingDomain getTableContextEditingDomain(final Table table) {
- ServicesRegistry registry = null;
- try {
- registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(table.getContext());
- return registry.getService(TransactionalEditingDomain.class);
- } catch (final ServiceException e) {
- Activator.log.error(Messages.NattableModelManager_ServiceRegistryNotFound, e);
- }
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ *
+ * Utils class to get the best editing domain to use
+ *
+ */
+public class TableEditingDomainUtils {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ private TableEditingDomainUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ * Returns the EditingDomain associated to the table
+ *
+ * @return
+ * the EditingDomain associated to the table
+ */
+ public static final TransactionalEditingDomain getTableEditingDomain(final Table table) {
+ ServicesRegistry registry = null;
+ try {
+ registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(table);
+ return registry.getService(TransactionalEditingDomain.class);
+ } catch (final ServiceException e) {
+ // The table doesn't have an editing domain (e.g. the table is used in the properties view)
+ // Activator.log.error(Messages.NattableModelManager_ServiceRegistryNotFound, e);
+ }
+ return null;
+
+ }
+
+ /**
+ * Returns the EditingDomain associated to the context
+ *
+ * @return
+ * the EditingDomain associated to the context
+ */
+ public static final TransactionalEditingDomain getTableContextEditingDomain(final Table table) {
+ ServicesRegistry registry = null;
+ try {
+ registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(table.getContext());
+ return registry.getService(TransactionalEditingDomain.class);
+ } catch (final ServiceException e) {
+ Activator.log.error(Messages.NattableModelManager_ServiceRegistryNotFound, e);
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableGridRegion.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableGridRegion.java
index ad41e54c7f6..801363123e4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableGridRegion.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableGridRegion.java
@@ -1,23 +1,23 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-/**
- * the enumeration for the table region
- *
- *
- */
-public enum TableGridRegion {
- AFTER_COLUMN_HEADER, AFTER_ROW_HEADER, ROW_HEADER, COLUMN_HEADER, CELL, UNKNOWN, CORNER;
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+/**
+ * the enumeration for the table region
+ *
+ *
+ */
+public enum TableGridRegion {
+ AFTER_COLUMN_HEADER, AFTER_ROW_HEADER, ROW_HEADER, COLUMN_HEADER, CELL, UNKNOWN, CORNER;
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableSelectionHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableSelectionHelper.java
index 6b7846fd7df..f710e4c2a55 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableSelectionHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableSelectionHelper.java
@@ -1,139 +1,139 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.provider.TableStructuredSelection;
-import org.eclipse.papyrus.infra.ui.util.SelectionHelper;
-
-/**
- * this class provides methods to get the table selection using the Eclipse ISelectioService, so the editor must have the focus
- *
- */
-public class TableSelectionHelper {
-
- /**
- *
- * @return
- * the current table selection
- */
- public static final TableStructuredSelection getCurrentTableStructuredSelection() {
- IStructuredSelection selection = SelectionHelper.getCurrentStructuredSelection();
- if (selection instanceof TableStructuredSelection) {
- return (TableStructuredSelection) selection;
- }
- return null;
- }
-
- /**
- *
- * @return
- * a map with the index and the object of the fully selected rows
- */
- public static final Map<Integer, Object> getFullySelectedRows() {
- TableStructuredSelection selection = getCurrentTableStructuredSelection();
- if (selection != null) {
- TableSelectionWrapper wrapper = (TableSelectionWrapper) selection.getAdapter(TableSelectionWrapper.class);
- if (wrapper != null) {
- return wrapper.getFullySelectedRows();
- }
- }
- return Collections.emptyMap();
- }
-
- /**
- *
- * @return
- * a map with the index and the object of the fully selected columns
- */
- public static final Map<Integer, Object> getFullySelectedColumns() {
- TableStructuredSelection selection = getCurrentTableStructuredSelection();
- if (selection != null) {
- TableSelectionWrapper wrapper = (TableSelectionWrapper) selection.getAdapter(TableSelectionWrapper.class);
- if (wrapper != null) {
- return wrapper.getFullySelectedColumns();
- }
- }
- return Collections.emptyMap();
- }
-
- /**
- *
- * @return
- * the position coordinate of the selected cells, or <code>null</code>
- */
- public static final Collection<PositionCoordinate> getSelectedCells() {
- TableStructuredSelection selection = getCurrentTableStructuredSelection();
- if (selection != null) {
- TableSelectionWrapper wrapper = (TableSelectionWrapper) selection.getAdapter(TableSelectionWrapper.class);
- if (wrapper != null) {
- return wrapper.getSelectedCells();
- }
- }
- return null;
- }
-
- /**
- * @param tableManager
- * the tableManager for which we want the selected rows
- * @return
- * a map with the index and the object of the fully selected rows
- */
- public static final Map<Integer, Object> getFullySelectedRows(INattableModelManager tableManager) {
- TableSelectionWrapper wrapper = (TableSelectionWrapper) tableManager.getAdapter(TableSelectionWrapper.class);
- if (wrapper != null) {
- return wrapper.getFullySelectedRows();
- }
- return Collections.emptyMap();
- }
-
- /**
- *
- * @param tableManager
- * the tableManager for which we want the selected columns
- *
- * @return
- * a map with the index and the object of the fully selected columns
- */
- public static final Map<Integer, Object> getFullySelectedColumns(INattableModelManager tableManager) {
- TableSelectionWrapper wrapper = (TableSelectionWrapper) tableManager.getAdapter(TableSelectionWrapper.class);
- if (wrapper != null) {
- return wrapper.getFullySelectedColumns();
- }
- return Collections.emptyMap();
- }
-
- /**
- *
- * @param tableManager
- * the tableManager for which we want the selected rows
- * @return
- * the position coordinate of the selected cells, or <code>null</code>
- */
- public static final Collection<PositionCoordinate> getSelectedCells(INattableModelManager tableManager) {
- TableSelectionWrapper wrapper = (TableSelectionWrapper) tableManager.getAdapter(TableSelectionWrapper.class);
- if (wrapper != null) {
- return wrapper.getSelectedCells();
- }
- return null;
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.provider.TableStructuredSelection;
+import org.eclipse.papyrus.infra.ui.util.SelectionHelper;
+
+/**
+ * this class provides methods to get the table selection using the Eclipse ISelectioService, so the editor must have the focus
+ *
+ */
+public class TableSelectionHelper {
+
+ /**
+ *
+ * @return
+ * the current table selection
+ */
+ public static final TableStructuredSelection getCurrentTableStructuredSelection() {
+ IStructuredSelection selection = SelectionHelper.getCurrentStructuredSelection();
+ if (selection instanceof TableStructuredSelection) {
+ return (TableStructuredSelection) selection;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * a map with the index and the object of the fully selected rows
+ */
+ public static final Map<Integer, Object> getFullySelectedRows() {
+ TableStructuredSelection selection = getCurrentTableStructuredSelection();
+ if (selection != null) {
+ TableSelectionWrapper wrapper = (TableSelectionWrapper) selection.getAdapter(TableSelectionWrapper.class);
+ if (wrapper != null) {
+ return wrapper.getFullySelectedRows();
+ }
+ }
+ return Collections.emptyMap();
+ }
+
+ /**
+ *
+ * @return
+ * a map with the index and the object of the fully selected columns
+ */
+ public static final Map<Integer, Object> getFullySelectedColumns() {
+ TableStructuredSelection selection = getCurrentTableStructuredSelection();
+ if (selection != null) {
+ TableSelectionWrapper wrapper = (TableSelectionWrapper) selection.getAdapter(TableSelectionWrapper.class);
+ if (wrapper != null) {
+ return wrapper.getFullySelectedColumns();
+ }
+ }
+ return Collections.emptyMap();
+ }
+
+ /**
+ *
+ * @return
+ * the position coordinate of the selected cells, or <code>null</code>
+ */
+ public static final Collection<PositionCoordinate> getSelectedCells() {
+ TableStructuredSelection selection = getCurrentTableStructuredSelection();
+ if (selection != null) {
+ TableSelectionWrapper wrapper = (TableSelectionWrapper) selection.getAdapter(TableSelectionWrapper.class);
+ if (wrapper != null) {
+ return wrapper.getSelectedCells();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param tableManager
+ * the tableManager for which we want the selected rows
+ * @return
+ * a map with the index and the object of the fully selected rows
+ */
+ public static final Map<Integer, Object> getFullySelectedRows(INattableModelManager tableManager) {
+ TableSelectionWrapper wrapper = (TableSelectionWrapper) tableManager.getAdapter(TableSelectionWrapper.class);
+ if (wrapper != null) {
+ return wrapper.getFullySelectedRows();
+ }
+ return Collections.emptyMap();
+ }
+
+ /**
+ *
+ * @param tableManager
+ * the tableManager for which we want the selected columns
+ *
+ * @return
+ * a map with the index and the object of the fully selected columns
+ */
+ public static final Map<Integer, Object> getFullySelectedColumns(INattableModelManager tableManager) {
+ TableSelectionWrapper wrapper = (TableSelectionWrapper) tableManager.getAdapter(TableSelectionWrapper.class);
+ if (wrapper != null) {
+ return wrapper.getFullySelectedColumns();
+ }
+ return Collections.emptyMap();
+ }
+
+ /**
+ *
+ * @param tableManager
+ * the tableManager for which we want the selected rows
+ * @return
+ * the position coordinate of the selected cells, or <code>null</code>
+ */
+ public static final Collection<PositionCoordinate> getSelectedCells(INattableModelManager tableManager) {
+ TableSelectionWrapper wrapper = (TableSelectionWrapper) tableManager.getAdapter(TableSelectionWrapper.class);
+ if (wrapper != null) {
+ return wrapper.getSelectedCells();
+ }
+ return null;
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java
index bf0be1f71f2..aa50f1e6820 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java
@@ -1,258 +1,258 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.widget;
-
-import org.eclipse.nebula.widgets.nattable.style.IStyle;
-import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
-import org.eclipse.papyrus.infra.nattable.celleditor.ButtonConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * This widget provides a Combo with a button
- *
- */
-public class NatComboButton extends NatCombo {
-
- /**
- * the configuration of the button
- */
- private ButtonConfiguration buttonConfiguration;
-
- /**
- * the button
- */
- private Button button;
-
- /**
- *
- * Constructor.
- *
- * @see NatCombo#NatCombo(Composite, IStyle, int)
- * @param parent
- * @param cellStyle
- * @param style
- * @param buttonConfiguration
- * the configuration of the button
- */
- public NatComboButton(Composite parent, IStyle cellStyle, int style, ButtonConfiguration buttonConfiguration) {
- super(parent, cellStyle, style);
- this.buttonConfiguration = buttonConfiguration;
- configureButton();
- }
-
- /**
- *
- * Constructor.
- *
- * @see NatCombo#NatCombo(Composite, IStyle, int, int)
- * @param parent
- * @param cellStyle
- * @param maxVisibleItems
- * @param style
- * @param buttonConfiguration
- * the configuration of the button
- */
- public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, int style, ButtonConfiguration buttonConfiguration) {
- super(parent, cellStyle, maxVisibleItems, style);
- this.buttonConfiguration = buttonConfiguration;
- configureButton();
- }
-
- /**
- *
- * Constructor.
- *
- * @see NatCombo#NatCombo(Composite, IStyle, int, boolean, int)
- * @param parent
- * @param cellStyle
- * @param maxVisibleItems
- * @param freeEdit
- * @param style
- * @param buttonConfiguration
- * the configuration of the button
- * @deprecated freeEdit parameter is deprecated. Use the SWT.READ_ONLY flag to specify freeEdit = false
- */
- @Deprecated
- public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, int style, ButtonConfiguration buttonConfiguration) {
- super(parent, cellStyle, maxVisibleItems, computeFreeEditStyle(freeEdit, style));
- this.buttonConfiguration = buttonConfiguration;
- configureButton();
- }
-
- // NatCombo computes freeEdit from the style
- // freeEdit == true <=> style | SWT.READ_ONLY = false
- @Deprecated
- private static int computeFreeEditStyle(boolean freeEdit, int style) {
- if (freeEdit) {
- return style & ~SWT.READ_ONLY;
- } else {
- return style | SWT.READ_ONLY;
- }
- }
-
- @Deprecated
- private static int computeMultiSelectStyle(boolean multiselect, int style) {
- if (multiselect) {
- return style | SWT.MULTI; // Add the SWT.MULTI style
- } else {
- return style & ~SWT.MULTI; // Remove the SWT.MULTI style
- }
- }
-
- /**
- *
- * Constructor.
- *
- * @see NatCombo#NatCombo(Composite, IStyle, int, boolean, boolean, int)
- * @param parent
- * @param cellStyle
- * @param maxVisibleItems
- * @param freeEdit
- * @param multiselect
- * @param style
- * @param buttonConfiguration
- * the configuration of the button
- *
- * @deprecated multiselect parameter is deprecated. Use the SWT.MULTI flag instead
- */
- @Deprecated
- public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, boolean multiselect, int style, ButtonConfiguration buttonConfiguration) {
- this(parent, cellStyle, maxVisibleItems, multiselect, computeMultiSelectStyle(multiselect, style), buttonConfiguration);
- }
-
- /**
- *
- * Constructor.
- *
- * @see NatCombo#NatCombo(Composite, IStyle, int, boolean, boolean, int, Image)
- * @param parent
- * @param cellStyle
- * @param maxVisibleItems
- * @param freeEdit
- * @param multiselect
- * @param style
- * @param iconImage
- * @param buttonConfiguration
- * the configuration of the button
- *
- * @deprecated The freeEdit and multiselect parameter. Use the SWT.READ_ONLY flag to specify freeEdit = False. Use SWT.MULTI flag to specify
- * multiselect = True
- */
- @Deprecated
- public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, boolean multiselect, int style, Image iconImage, ButtonConfiguration buttonConfiguration) {
- this(parent, cellStyle, maxVisibleItems, computeMultiSelectStyle(multiselect, computeFreeEditStyle(freeEdit, style)), buttonConfiguration);
- }
-
- /**
- * Constructor
- *
- * @param parent
- * @param cellStyle
- * @param maxVisibleItems
- * @param style
- * @param iconImage
- * @param buttonConfiguration
- */
- public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, int style, Image iconImage, ButtonConfiguration buttonConfiguration) {
- super(parent, cellStyle, maxVisibleItems, style, iconImage);
- this.buttonConfiguration = buttonConfiguration;
- configureButton();
- }
-
- /**
- * Configure the created button
- */
- protected void configureButton() {
- final String txt = buttonConfiguration.getText();
- if (txt != null) {
- button.setText(txt);
- }
- final String toolTip = buttonConfiguration.getTooltipText();
- if (toolTip != null) {
- button.setToolTipText(toolTip);
- }
-
- final Image img = buttonConfiguration.getImage();
- if (img != null) {
- button.setImage(img);
- }
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.widget.NatCombo#createTextControl(int)
- *
- * @param style
- */
- @Override
- protected void createTextControl(int style) {
- super.createTextControl(style);
- createButton();
- // we change the layout because there is 3 elements now!
- GridLayout gridLayout = new GridLayout(3, false);
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- gridLayout.horizontalSpacing = 0;
- setLayout(gridLayout);
- }
-
- protected void createButton() {
- button = new Button(this, SWT.NONE);
-
-
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, true);
- button.setLayoutData(gridData);
- button.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- runAction();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- }
-
- /**
- * execute the action done by the button
- */
- protected void runAction() {
- buttonConfiguration.getAction().run();
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.widget.NatCombo#dispose()
- *
- */
- @Override
- public void dispose() {
- super.dispose();
- buttonConfiguration = null;
- button = null;
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.widget;
+
+import org.eclipse.nebula.widgets.nattable.style.IStyle;
+import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
+import org.eclipse.papyrus.infra.nattable.celleditor.ButtonConfiguration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ *
+ * This widget provides a Combo with a button
+ *
+ */
+public class NatComboButton extends NatCombo {
+
+ /**
+ * the configuration of the button
+ */
+ private ButtonConfiguration buttonConfiguration;
+
+ /**
+ * the button
+ */
+ private Button button;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @see NatCombo#NatCombo(Composite, IStyle, int)
+ * @param parent
+ * @param cellStyle
+ * @param style
+ * @param buttonConfiguration
+ * the configuration of the button
+ */
+ public NatComboButton(Composite parent, IStyle cellStyle, int style, ButtonConfiguration buttonConfiguration) {
+ super(parent, cellStyle, style);
+ this.buttonConfiguration = buttonConfiguration;
+ configureButton();
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @see NatCombo#NatCombo(Composite, IStyle, int, int)
+ * @param parent
+ * @param cellStyle
+ * @param maxVisibleItems
+ * @param style
+ * @param buttonConfiguration
+ * the configuration of the button
+ */
+ public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, int style, ButtonConfiguration buttonConfiguration) {
+ super(parent, cellStyle, maxVisibleItems, style);
+ this.buttonConfiguration = buttonConfiguration;
+ configureButton();
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @see NatCombo#NatCombo(Composite, IStyle, int, boolean, int)
+ * @param parent
+ * @param cellStyle
+ * @param maxVisibleItems
+ * @param freeEdit
+ * @param style
+ * @param buttonConfiguration
+ * the configuration of the button
+ * @deprecated freeEdit parameter is deprecated. Use the SWT.READ_ONLY flag to specify freeEdit = false
+ */
+ @Deprecated
+ public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, int style, ButtonConfiguration buttonConfiguration) {
+ super(parent, cellStyle, maxVisibleItems, computeFreeEditStyle(freeEdit, style));
+ this.buttonConfiguration = buttonConfiguration;
+ configureButton();
+ }
+
+ // NatCombo computes freeEdit from the style
+ // freeEdit == true <=> style | SWT.READ_ONLY = false
+ @Deprecated
+ private static int computeFreeEditStyle(boolean freeEdit, int style) {
+ if (freeEdit) {
+ return style & ~SWT.READ_ONLY;
+ } else {
+ return style | SWT.READ_ONLY;
+ }
+ }
+
+ @Deprecated
+ private static int computeMultiSelectStyle(boolean multiselect, int style) {
+ if (multiselect) {
+ return style | SWT.MULTI; // Add the SWT.MULTI style
+ } else {
+ return style & ~SWT.MULTI; // Remove the SWT.MULTI style
+ }
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @see NatCombo#NatCombo(Composite, IStyle, int, boolean, boolean, int)
+ * @param parent
+ * @param cellStyle
+ * @param maxVisibleItems
+ * @param freeEdit
+ * @param multiselect
+ * @param style
+ * @param buttonConfiguration
+ * the configuration of the button
+ *
+ * @deprecated multiselect parameter is deprecated. Use the SWT.MULTI flag instead
+ */
+ @Deprecated
+ public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, boolean multiselect, int style, ButtonConfiguration buttonConfiguration) {
+ this(parent, cellStyle, maxVisibleItems, multiselect, computeMultiSelectStyle(multiselect, style), buttonConfiguration);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @see NatCombo#NatCombo(Composite, IStyle, int, boolean, boolean, int, Image)
+ * @param parent
+ * @param cellStyle
+ * @param maxVisibleItems
+ * @param freeEdit
+ * @param multiselect
+ * @param style
+ * @param iconImage
+ * @param buttonConfiguration
+ * the configuration of the button
+ *
+ * @deprecated The freeEdit and multiselect parameter. Use the SWT.READ_ONLY flag to specify freeEdit = False. Use SWT.MULTI flag to specify
+ * multiselect = True
+ */
+ @Deprecated
+ public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, boolean multiselect, int style, Image iconImage, ButtonConfiguration buttonConfiguration) {
+ this(parent, cellStyle, maxVisibleItems, computeMultiSelectStyle(multiselect, computeFreeEditStyle(freeEdit, style)), buttonConfiguration);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param parent
+ * @param cellStyle
+ * @param maxVisibleItems
+ * @param style
+ * @param iconImage
+ * @param buttonConfiguration
+ */
+ public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, int style, Image iconImage, ButtonConfiguration buttonConfiguration) {
+ super(parent, cellStyle, maxVisibleItems, style, iconImage);
+ this.buttonConfiguration = buttonConfiguration;
+ configureButton();
+ }
+
+ /**
+ * Configure the created button
+ */
+ protected void configureButton() {
+ final String txt = buttonConfiguration.getText();
+ if (txt != null) {
+ button.setText(txt);
+ }
+ final String toolTip = buttonConfiguration.getTooltipText();
+ if (toolTip != null) {
+ button.setToolTipText(toolTip);
+ }
+
+ final Image img = buttonConfiguration.getImage();
+ if (img != null) {
+ button.setImage(img);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.widget.NatCombo#createTextControl(int)
+ *
+ * @param style
+ */
+ @Override
+ protected void createTextControl(int style) {
+ super.createTextControl(style);
+ createButton();
+ // we change the layout because there is 3 elements now!
+ GridLayout gridLayout = new GridLayout(3, false);
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.horizontalSpacing = 0;
+ setLayout(gridLayout);
+ }
+
+ protected void createButton() {
+ button = new Button(this, SWT.NONE);
+
+
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, true);
+ button.setLayoutData(gridData);
+ button.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ runAction();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ }
+
+ /**
+ * execute the action done by the button
+ */
+ protected void runAction() {
+ buttonConfiguration.getAction().run();
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.widget.NatCombo#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ buttonConfiguration = null;
+ button = null;
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/CategoriesWizardUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/CategoriesWizardUtils.java
index b7144c5dc5e..fcf59a09366 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/CategoriesWizardUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/CategoriesWizardUtils.java
@@ -1,70 +1,70 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.wizard;
-
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdTreeItemAxis;
-import org.eclipse.papyrus.infra.tools.util.TypeUtils;
-
-/**
- * @author Vincent Lorenzo
- *
- * This class is not in the API
- */
-public class CategoriesWizardUtils {
-
- /**
- * Constructor.
- *
- */
- private CategoriesWizardUtils() {
- // to prevent instanciation
- }
-
- /**
- *
- * @param axis
- * an axis
- * @return
- * <code>true</code> if the axis represents a root element
- */
- public static final boolean isRootItem(ITreeItemAxis axis) {
- return axis.getParent() == null;
- }
-
- /**
- *
- * @param axis
- * an axis
- * @return
- * <code>true</code> if the axis represents a depth
- */
- public static final boolean isDepthItem(ITreeItemAxis axis) {
- if (axis instanceof IdTreeItemAxis) {
- String element = ((IdTreeItemAxis) axis).getElement();
- return TypeUtils.isNaturalValue(element);
- }
- return false;
- }
-
- /**
- * @param axis
- * @returnplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/CategoriesWizardUtils.java
- * <code>true</code> if the axis represents a category item
- */
- public static boolean isCategoryItem(ITreeItemAxis axis) {
- return !(isDepthItem(axis) || isRootItem(axis));
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.wizard;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdTreeItemAxis;
+import org.eclipse.papyrus.infra.tools.util.TypeUtils;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ * This class is not in the API
+ */
+public class CategoriesWizardUtils {
+
+ /**
+ * Constructor.
+ *
+ */
+ private CategoriesWizardUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ *
+ * @param axis
+ * an axis
+ * @return
+ * <code>true</code> if the axis represents a root element
+ */
+ public static final boolean isRootItem(ITreeItemAxis axis) {
+ return axis.getParent() == null;
+ }
+
+ /**
+ *
+ * @param axis
+ * an axis
+ * @return
+ * <code>true</code> if the axis represents a depth
+ */
+ public static final boolean isDepthItem(ITreeItemAxis axis) {
+ if (axis instanceof IdTreeItemAxis) {
+ String element = ((IdTreeItemAxis) axis).getElement();
+ return TypeUtils.isNaturalValue(element);
+ }
+ return false;
+ }
+
+ /**
+ * @param axis
+ * @returnplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/CategoriesWizardUtils.java
+ * <code>true</code> if the axis represents a category item
+ */
+ public static boolean isCategoryItem(ITreeItemAxis axis) {
+ return !(isDepthItem(axis) || isRootItem(axis));
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ChooseCategoriesSelectionWidget.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ChooseCategoriesSelectionWidget.java
index 5d8447f07ec..2fb75a4986f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ChooseCategoriesSelectionWidget.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ChooseCategoriesSelectionWidget.java
@@ -1,732 +1,732 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.wizard.pages;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.factory.IAxisFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdTreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
-import org.eclipse.papyrus.infra.nattable.wizard.CategoriesWizardUtils;
-import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
-import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
-import org.eclipse.papyrus.infra.widgets.editors.InputDialog;
-import org.eclipse.papyrus.infra.widgets.widgets.MultipleValueEditAndSelectionWidget;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Vincent Lorenzo
- *
- * This widget allows to choose the categories to listen in the table
- * In the left part, we display multivalued features
- * In the right part, we display a tree :
- * <ul>
- * <li>first level : the root of the table</li>
- * <li>the depth</li>
- * <li>the feature to listen</li>
- * <li></li>
- * </ul>
- *
- * The create action allows to create new depth
- */
-public class ChooseCategoriesSelectionWidget extends MultipleValueEditAndSelectionWidget {
-
- /**
- * Constructor.
- *
- * @param selector
- */
- public ChooseCategoriesSelectionWidget(IElementSelector selector) {
- super(selector);
- }
-
- /**
- * Constructor.
- *
- * @param selector
- * @param unique
- */
- public ChooseCategoriesSelectionWidget(IElementSelector selector, boolean unique) {
- super(selector, unique);
- }
-
- /**
- * Constructor.
- *
- * @param selector
- * @param unique
- * @param ordered
- */
- public ChooseCategoriesSelectionWidget(IElementSelector selector, boolean unique, boolean ordered) {
- super(selector, unique, ordered);
- }
-
- /**
- * Constructor.
- *
- * @param selector
- * @param unique
- * @param ordered
- * @param upperBound
- */
- public ChooseCategoriesSelectionWidget(IElementSelector selector, boolean unique, boolean ordered, int upperBound) {
- super(selector, unique, ordered, upperBound);
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#init()
- *
- */
- @Override
- protected void init() {
- setFactory(new CategoriesValueFactory());
- setAllowEdition(true);
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#getSelection()
- *
- * @return
- */
- @Override
- public List<Object> getSelection() {
- return new ArrayList<Object>(this.initialSelection);
- }
-
- /**
- *
- * @return
- * the context object to use
- */
- protected Object getContextForCreateAction() {
- if (this.selectedElementsViewer != null) {
- ISelection selection = this.selectedElementsViewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- Object first = ((IStructuredSelection) selection).getFirstElement();
- if (first instanceof ITreeItemAxis) {
- ITreeItemAxis context = (ITreeItemAxis) first;
- while (((ITreeItemAxis) context).getParent() != null) {
- context = ((ITreeItemAxis) context).getParent();
- }
- return context;
- }
- }
- }
- return null;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#createAction()
- *
- */
- @Override
- protected void createAction() {
- Object context = getContextForCreateAction();
- if (factory == null || context == null) {
- return;
- }
- try {
- factory.createObject(this.create, context);
- } catch (OperationCanceledException e) {
- // The user cancelled and we rolled back pending model changes
- }
- if (!this.selectedElementsViewer.getExpandedState(context)) {
- this.selectedElementsViewer.setExpandedElements(new Object[] { context });
- }
- this.selectedElementsViewer.refresh();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueEditAndSelectionWidget#edit()
- *
- */
- @Override
- protected void edit() {
- List<ITreeItemAxis> selectedAxis = getSelectedAxisInSelectedElementsViewer();
- if (selectedAxis.size() == 1 && CategoriesWizardUtils.isCategoryItem(selectedAxis.get(0))) {
- this.factory.edit(this.edit, selectedAxis.get(0));
- }
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueEditAndSelectionWidget#canEdit()
- *
- * @return
- */
- @Override
- protected boolean canEdit() {
- List<ITreeItemAxis> selectedAxis = getSelectedAxisInSelectedElementsViewer();
- if (selectedAxis.size() == 1) {
- return CategoriesWizardUtils.isCategoryItem(selectedAxis.get(0));
- }
- return false;
-
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#createListSectionContentProvider()
- *
- * @return
- */
- @Override
- protected IContentProvider createListSectionContentProvider() {
- return new ITreeItemContentProvider() {
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.ITreeItemContentProvider#getChildren(java.lang.Object)
- *
- * @param arg0
- * @return
- */
- @Override
- public Object[] getChildren(Object arg0) {
- return super.getChildren(arg0);
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.ITreeItemContentProvider#hasChildren(java.lang.Object)
- *
- * @param arg0
- * @return
- */
- @Override
- public boolean hasChildren(Object arg0) {
- if (arg0 instanceof ITreeItemAxis && CategoriesWizardUtils.isCategoryItem((ITreeItemAxis) arg0)) {
- return false;
- }
- return super.hasChildren(arg0);
- }
- };
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#upAction()
- *
- */
- @Override
- protected void upAction() {
- moveAction(true);
- }
-
-
- /**
- *
- * @return
- * the selected axis in the selectedElementsViewer
- */
- protected List<ITreeItemAxis> getSelectedAxisInSelectedElementsViewer() {
- if (selectedElementsViewer != null && selectedElementsViewer.getSelection() instanceof IStructuredSelection) {
- List<ITreeItemAxis> selection = new ArrayList<ITreeItemAxis>();
- for (Object curr : ((IStructuredSelection) selectedElementsViewer.getSelection()).toList()) {
- if (curr instanceof ITreeItemAxis) {
- selection.add((ITreeItemAxis) curr);
- }
- }
- return selection;
- }
- return Collections.emptyList();
- }
-
-
- /**
- *
- * @return
- * the list with the current selection in the viewer.
- * <ul>
- * <li>if roots are in the selection, we returns only axis representing roots</li>
- * <li>we returns only axis representing FillingCategories</li>
- *
- * </ul>
- *
- */
- protected List<ITreeItemAxis> getConsistentSelectionInSelectedElementsViewer() {
- if (selectedElementsViewer == null) {
- return Collections.emptyList();
- }
- ISelection tmp = selectedElementsViewer.getSelection();
- if (tmp instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) tmp;
- List<ITreeItemAxis> fillingAxis = new ArrayList<ITreeItemAxis>();
- List<ITreeItemAxis> rootAxis = new ArrayList<ITreeItemAxis>();
- for (Object current : selection.toList()) {
- if (current instanceof ITreeItemAxis) {
- ITreeItemAxis axis = (ITreeItemAxis) current;
- if (axis.getParent() == null) {
- rootAxis.add(axis);
- } else if (rootAxis.isEmpty() && axis.getElement() instanceof String) {
- fillingAxis.add(axis);
- }
- }
- }
- if (rootAxis.isEmpty()) {
- return fillingAxis;
- }
- return rootAxis;
-
- }
- return Collections.emptyList();
- }
-
- /**
- *
- * @param wantedClass
- * the class represented the wanted type of the encapsulated element
- * @return
- * the list of wanted {@link ITreeItemAxis} which encapsulate elements instance of the wanted class
- */
- protected List<ITreeItemAxis> getSelectedFillingConfigurantionInSelectedElementsViewer() {
- List<ITreeItemAxis> axis = getConsistentSelectionInSelectedElementsViewer();
- if (!axis.isEmpty() && axis.get(0).getElement() instanceof TreeFillingConfiguration) {
- return axis;
- }
- return Collections.emptyList();
- }
-
-
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#deleteAction()
- *
- */
- @Override
- protected void deleteAction() {
- List<ITreeItemAxis> axis = getSelectionInSelectedElementsViewer();
- label: for (ITreeItemAxis current : axis) {
- if (CategoriesWizardUtils.isDepthItem(current)) {
- int depth = Integer.valueOf((String) current.getElement());
- if (depth == 0) {
- continue label;
- }
- }
- if (current.getParent() != null) {
- current.setParent(null);
- EcoreUtil.delete(current);
- }
- }
- selectedElementsViewer.refresh();
- }
-
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#canRemove()
- *
- * @return
- */
- @Override
- protected boolean canRemove() {
- List<ITreeItemAxis> axis = getSelectionInSelectedElementsViewer();
- for (ITreeItemAxis current : axis) {
- if (!CategoriesWizardUtils.isCategoryItem(current)) {
- return false;
- }
- }
- return super.canRemove();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#canDelete()
- *
- * @return
- */
- @Override
- protected boolean canDelete() {
- for (ITreeItemAxis curr : getSelectionInSelectedElementsViewer()) {
- if (!(CategoriesWizardUtils.isDepthItem(curr) || CategoriesWizardUtils.isCategoryItem(curr))) {
- return false;
- }
- // we can't delete the 0 depth
- if (CategoriesWizardUtils.isDepthItem(curr)) {
- int depth = Integer.valueOf((String) curr.getElement());
- if (depth == 0) {
- return false;
- }
- }
- }
- return true;
- }
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#canAdd()
- *
- * @return
- */
- @Override
- protected boolean canAdd() {
- return isCategorySelection() || isRootSelection();
- }
-
- protected boolean isRootSelection() {
- List<ITreeItemAxis> axis = getSelectedAxisInSelectedElementsViewer();
- for (ITreeItemAxis curr : axis) {
- if (!CategoriesWizardUtils.isRootItem(curr)) {
- return false;
- }
- }
- return true;
- }
-
- protected boolean isCategorySelection() {
- List<ITreeItemAxis> axis = getSelectedAxisInSelectedElementsViewer();
- for (ITreeItemAxis curr : axis) {
- if (!CategoriesWizardUtils.isDepthItem(curr)) {
- return false;
- }
- }
- return true;
- }
-
-
- /**
- *
- * @return
- * <ul>
- * <li>a list with the selected categories only when all selected elements are categories AND they have the same parent (a {@link IdTreeItemAxis} (which represents the depth))</li>
- * <li>an empty list in all others case</li>
- * </ul>
- *
- */
- protected List<ITreeItemAxis> getSelectedCategoriesInSelectedElementsViewer() {
- List<ITreeItemAxis> selection = getSelectedAxisInSelectedElementsViewer();
- ITreeItemAxis parent = null;
- List<ITreeItemAxis> returnedSelection = new ArrayList<ITreeItemAxis>();
- for (ITreeItemAxis curr : selection) {
- ITreeItemAxis tmp = curr.getParent();
- if (tmp == null) {
- return Collections.emptyList();
- }
- if (parent == null && tmp instanceof IdTreeItemAxis) {
- parent = tmp;
- returnedSelection.add(curr);
- } else if (parent != null && parent == tmp) {
- returnedSelection.add(curr);
- } else {
- return Collections.emptyList();
- }
- }
- return returnedSelection;
- }
-
- /**
- *
- * @author Vincent Lorenzo
- *
- * This comparator allows to sort comparator
- *
- */
- public static final class CategoriesComparator implements Comparator<ITreeItemAxis> {
-
- private List<ITreeItemAxis> children;
-
- /**
- * Constructor.
- *
- */
- public CategoriesComparator(List<ITreeItemAxis> children) {
- this.children = Collections.unmodifiableList(children);
- }
-
- /**
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- *
- * @param o1
- * @param o2
- * @return
- */
- @Override
- public int compare(ITreeItemAxis o1, ITreeItemAxis o2) {
- int index1 = children.indexOf(o1);
- int index2 = children.indexOf(o2);
- if (index1 < index2) {
- return -1;
- }
- return 1;
- }
- }
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#downAction()
- *
- */
- @Override
- protected void downAction() {
- moveAction(false);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#canMove(boolean)
- *
- * @param up
- * @return
- */
- protected boolean canMove(boolean up) {
- List<ITreeItemAxis> categories = getSelectedCategoriesInSelectedElementsViewer();
- if (categories.isEmpty()) {
- return false;
- }
- ITreeItemAxis parent = categories.get(0).getParent();
- List<ITreeItemAxis> children = parent.getChildren();
- int forbiddenIndex = up ? 0 : children.size() - 1;
-
- for (ITreeItemAxis child : categories) {
- if (children.indexOf(child) == forbiddenIndex) {
- return false;
- }
- }
- return true;
- }
-
- /**
- *
- * @param up
- * <code>true</code> if the elements must be move to up
- */
- protected void moveAction(boolean up) {
- List<ITreeItemAxis> categories = getSelectedCategoriesInSelectedElementsViewer();
-
- ITreeItemAxis parent = categories.get(0).getParent();
- final List<ITreeItemAxis> children = Collections.unmodifiableList(parent.getChildren());
- if (categories.isEmpty()) {
- return;
- }
-
- Collections.sort(categories, new CategoriesComparator(children));
- if (!up) {
- Collections.reverse(categories);
- }
- for (ITreeItemAxis child : categories) {
- int index = parent.getChildren().indexOf(child);
- index = up ? index - 1 : index + 1;
- parent.getChildren().move(index, child);
- }
- selectedElementsViewer.refresh();
- }
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#addElements(java.lang.Object[])
- *
- * @param elements
- */
- @Override
- public void addElements(Object[] elements) {
- List<ITreeItemAxis> selectedElements = getSelectedAxisInSelectedElementsViewer();
- if (selectedElements.isEmpty()) {
- return;
- }
-
- // 1. verify if the root is selected
- ITreeItemAxis root = null;
- for (ITreeItemAxis current : selectedElements) {
- if (CategoriesWizardUtils.isRootItem(current)) {
- root = current;
- break;
- }
- }
- // 2. find the categories to edit
- List<ITreeItemAxis> depthToEdit = new ArrayList<ITreeItemAxis>();
- if (root != null) {
- depthToEdit.addAll(root.getChildren());
- } else {
- for (ITreeItemAxis current : selectedElements) {
- if (CategoriesWizardUtils.isDepthItem(current)) {
- depthToEdit.add(current);
- }
- }
- }
-
- // 3. edit the categories
- for (ITreeItemAxis curr : depthToEdit) {
- List<Object> alreadyManagedObject = new ArrayList<Object>();
- for (ITreeItemAxis category : curr.getChildren()) {
- alreadyManagedObject.add(category.getElement());
- }
-
- for (Object el : elements) {
- if (!alreadyManagedObject.contains(el)) {
- IAxisFactory.createITreeItemAxis(curr, el, null, null);
- }
-
- }
- }
- selectedElementsViewer.refresh();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#removeAllAction()
- *
- */
- @Override
- protected void removeAllAction() {
- Object input = this.selectedElementsViewer.getInput();
- if (input instanceof List<?>) {
- for (Object curr : (List<?>) input) {
- if (curr instanceof ITreeItemAxis) {
- destroyCategoriesAxis((ITreeItemAxis) curr);
- }
- }
- this.selectedElementsViewer.refresh();
- }
- }
-
- /**
- * Destroy recursively all categories axis
- *
- * @param axis
- * an axis
- */
- protected void destroyCategoriesAxis(ITreeItemAxis axis) {
- for (ITreeItemAxis child : axis.getChildren()) {
- destroyCategoriesAxis(child);
- }
- if (CategoriesWizardUtils.isCategoryItem(axis)) {
- axis.setParent(null);
- EcoreUtil.delete(axis);
- }
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#removeAction()
- *
- */
- @Override
- protected void removeAction() {
- IStructuredSelection selection = (IStructuredSelection) this.selectedElementsViewer.getSelection();
- for (Object current : selection.toList()) {
- if (current instanceof ITreeItemAxis && ((ITreeItemAxis) current).getParent() != null) {
- ITreeItemAxis axis = (ITreeItemAxis) current;
- axis.setParent(null);
- EcoreUtil.delete(axis);
- }
- }
- this.selectedElementsViewer.refresh();
- }
-
- /**
- *
- * @return
- * the list of the selected element in the selection viewer
- */
- protected List<ITreeItemAxis> getSelectionInSelectedElementsViewer() {
- if (this.selectedElementsViewer != null) {
- ISelection selection = this.selectedElementsViewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- List<ITreeItemAxis> returnedValues = new ArrayList<ITreeItemAxis>();
- for (Object current : ((IStructuredSelection) selection).toList()) {
- if (current instanceof ITreeItemAxis) {
- returnedValues.add((ITreeItemAxis) current);
- }
- }
- return returnedValues;
- }
- }
- return Collections.emptyList();
- }
-
- /**
- *
- * @author Vincent Lorenzo
- * This class is the factory used to create new ITreeItemAxis in the viewer of selected element
- * It creates only {@link ITreeItemAxis} to represents depth to configure and its allows to edit only alias of categories
- */
- public class CategoriesValueFactory implements ReferenceValueFactory {
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory#validateObjects(java.util.Collection)
- *
- * @param objectsToValidate
- * @return
- */
- @Override
- public Collection<Object> validateObjects(Collection<Object> objectsToValidate) {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory#edit(org.eclipse.swt.widgets.Control, java.lang.Object)
- *
- * @param widget
- * @param object
- * @return
- */
- @Override
- public Object edit(Control widget, Object object) {
- String existingAlias = ((IAxis) object).getAlias();
- InputDialog dialog = new InputDialog(widget.getShell(), Messages.ChooseCategoriesSelectionWidget_EditAlias, Messages.ChooseCategoriesSelectionWidget_EnterAliasToUseForTheCategory, existingAlias, null);
-
- int result = dialog.open();
- if (result == Window.OK) {
- String newValue = dialog.getText();
- ((IAxis) object).setAlias(newValue);
- }
-
- return object;
- }
-
- @Override
- public Object createObject(Control widget, Object context) {
- Assert.isTrue(context instanceof ITreeItemAxis);
- ITreeItemAxis rootItem = (ITreeItemAxis) context;
- Assert.isTrue(rootItem.getParent() == null);
-
- // find the maxDepth
- int maxDepth = -1;
- for (ITreeItemAxis axis : rootItem.getChildren()) {
- Assert.isTrue(axis instanceof IdTreeItemAxis);
- maxDepth = Math.max(maxDepth, Integer.parseInt((String) axis.getElement()));
- }
- int nextDepth = maxDepth + 1;
- return IAxisFactory.createITreeItemAxis(rootItem, Integer.valueOf(nextDepth), null, null);
- }
-
- /**
- *
- * @return
- */
- @Override
- public boolean canEdit() {
- List<ITreeItemAxis> selectedAxis = getSelectedAxisInSelectedElementsViewer();
- if (selectedAxis.size() == 1) {
- return CategoriesWizardUtils.isCategoryItem(selectedAxis.get(0));
- }
- return false;
- }
-
- /**
- *
- * @return
- */
- @Override
- public boolean canCreateObject() {
- return getContextForCreateAction() != null;
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.wizard.pages;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.factory.IAxisFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdTreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.wizard.CategoriesWizardUtils;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
+import org.eclipse.papyrus.infra.widgets.editors.InputDialog;
+import org.eclipse.papyrus.infra.widgets.widgets.MultipleValueEditAndSelectionWidget;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ * This widget allows to choose the categories to listen in the table
+ * In the left part, we display multivalued features
+ * In the right part, we display a tree :
+ * <ul>
+ * <li>first level : the root of the table</li>
+ * <li>the depth</li>
+ * <li>the feature to listen</li>
+ * <li></li>
+ * </ul>
+ *
+ * The create action allows to create new depth
+ */
+public class ChooseCategoriesSelectionWidget extends MultipleValueEditAndSelectionWidget {
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ */
+ public ChooseCategoriesSelectionWidget(IElementSelector selector) {
+ super(selector);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ * @param unique
+ */
+ public ChooseCategoriesSelectionWidget(IElementSelector selector, boolean unique) {
+ super(selector, unique);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ * @param unique
+ * @param ordered
+ */
+ public ChooseCategoriesSelectionWidget(IElementSelector selector, boolean unique, boolean ordered) {
+ super(selector, unique, ordered);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ * @param unique
+ * @param ordered
+ * @param upperBound
+ */
+ public ChooseCategoriesSelectionWidget(IElementSelector selector, boolean unique, boolean ordered, int upperBound) {
+ super(selector, unique, ordered, upperBound);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#init()
+ *
+ */
+ @Override
+ protected void init() {
+ setFactory(new CategoriesValueFactory());
+ setAllowEdition(true);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#getSelection()
+ *
+ * @return
+ */
+ @Override
+ public List<Object> getSelection() {
+ return new ArrayList<Object>(this.initialSelection);
+ }
+
+ /**
+ *
+ * @return
+ * the context object to use
+ */
+ protected Object getContextForCreateAction() {
+ if (this.selectedElementsViewer != null) {
+ ISelection selection = this.selectedElementsViewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object first = ((IStructuredSelection) selection).getFirstElement();
+ if (first instanceof ITreeItemAxis) {
+ ITreeItemAxis context = (ITreeItemAxis) first;
+ while (((ITreeItemAxis) context).getParent() != null) {
+ context = ((ITreeItemAxis) context).getParent();
+ }
+ return context;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#createAction()
+ *
+ */
+ @Override
+ protected void createAction() {
+ Object context = getContextForCreateAction();
+ if (factory == null || context == null) {
+ return;
+ }
+ try {
+ factory.createObject(this.create, context);
+ } catch (OperationCanceledException e) {
+ // The user cancelled and we rolled back pending model changes
+ }
+ if (!this.selectedElementsViewer.getExpandedState(context)) {
+ this.selectedElementsViewer.setExpandedElements(new Object[] { context });
+ }
+ this.selectedElementsViewer.refresh();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueEditAndSelectionWidget#edit()
+ *
+ */
+ @Override
+ protected void edit() {
+ List<ITreeItemAxis> selectedAxis = getSelectedAxisInSelectedElementsViewer();
+ if (selectedAxis.size() == 1 && CategoriesWizardUtils.isCategoryItem(selectedAxis.get(0))) {
+ this.factory.edit(this.edit, selectedAxis.get(0));
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueEditAndSelectionWidget#canEdit()
+ *
+ * @return
+ */
+ @Override
+ protected boolean canEdit() {
+ List<ITreeItemAxis> selectedAxis = getSelectedAxisInSelectedElementsViewer();
+ if (selectedAxis.size() == 1) {
+ return CategoriesWizardUtils.isCategoryItem(selectedAxis.get(0));
+ }
+ return false;
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#createListSectionContentProvider()
+ *
+ * @return
+ */
+ @Override
+ protected IContentProvider createListSectionContentProvider() {
+ return new ITreeItemContentProvider() {
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.ITreeItemContentProvider#getChildren(java.lang.Object)
+ *
+ * @param arg0
+ * @return
+ */
+ @Override
+ public Object[] getChildren(Object arg0) {
+ return super.getChildren(arg0);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ *
+ * @param arg0
+ * @return
+ */
+ @Override
+ public boolean hasChildren(Object arg0) {
+ if (arg0 instanceof ITreeItemAxis && CategoriesWizardUtils.isCategoryItem((ITreeItemAxis) arg0)) {
+ return false;
+ }
+ return super.hasChildren(arg0);
+ }
+ };
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#upAction()
+ *
+ */
+ @Override
+ protected void upAction() {
+ moveAction(true);
+ }
+
+
+ /**
+ *
+ * @return
+ * the selected axis in the selectedElementsViewer
+ */
+ protected List<ITreeItemAxis> getSelectedAxisInSelectedElementsViewer() {
+ if (selectedElementsViewer != null && selectedElementsViewer.getSelection() instanceof IStructuredSelection) {
+ List<ITreeItemAxis> selection = new ArrayList<ITreeItemAxis>();
+ for (Object curr : ((IStructuredSelection) selectedElementsViewer.getSelection()).toList()) {
+ if (curr instanceof ITreeItemAxis) {
+ selection.add((ITreeItemAxis) curr);
+ }
+ }
+ return selection;
+ }
+ return Collections.emptyList();
+ }
+
+
+ /**
+ *
+ * @return
+ * the list with the current selection in the viewer.
+ * <ul>
+ * <li>if roots are in the selection, we returns only axis representing roots</li>
+ * <li>we returns only axis representing FillingCategories</li>
+ *
+ * </ul>
+ *
+ */
+ protected List<ITreeItemAxis> getConsistentSelectionInSelectedElementsViewer() {
+ if (selectedElementsViewer == null) {
+ return Collections.emptyList();
+ }
+ ISelection tmp = selectedElementsViewer.getSelection();
+ if (tmp instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) tmp;
+ List<ITreeItemAxis> fillingAxis = new ArrayList<ITreeItemAxis>();
+ List<ITreeItemAxis> rootAxis = new ArrayList<ITreeItemAxis>();
+ for (Object current : selection.toList()) {
+ if (current instanceof ITreeItemAxis) {
+ ITreeItemAxis axis = (ITreeItemAxis) current;
+ if (axis.getParent() == null) {
+ rootAxis.add(axis);
+ } else if (rootAxis.isEmpty() && axis.getElement() instanceof String) {
+ fillingAxis.add(axis);
+ }
+ }
+ }
+ if (rootAxis.isEmpty()) {
+ return fillingAxis;
+ }
+ return rootAxis;
+
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ *
+ * @param wantedClass
+ * the class represented the wanted type of the encapsulated element
+ * @return
+ * the list of wanted {@link ITreeItemAxis} which encapsulate elements instance of the wanted class
+ */
+ protected List<ITreeItemAxis> getSelectedFillingConfigurantionInSelectedElementsViewer() {
+ List<ITreeItemAxis> axis = getConsistentSelectionInSelectedElementsViewer();
+ if (!axis.isEmpty() && axis.get(0).getElement() instanceof TreeFillingConfiguration) {
+ return axis;
+ }
+ return Collections.emptyList();
+ }
+
+
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#deleteAction()
+ *
+ */
+ @Override
+ protected void deleteAction() {
+ List<ITreeItemAxis> axis = getSelectionInSelectedElementsViewer();
+ label: for (ITreeItemAxis current : axis) {
+ if (CategoriesWizardUtils.isDepthItem(current)) {
+ int depth = Integer.valueOf((String) current.getElement());
+ if (depth == 0) {
+ continue label;
+ }
+ }
+ if (current.getParent() != null) {
+ current.setParent(null);
+ EcoreUtil.delete(current);
+ }
+ }
+ selectedElementsViewer.refresh();
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#canRemove()
+ *
+ * @return
+ */
+ @Override
+ protected boolean canRemove() {
+ List<ITreeItemAxis> axis = getSelectionInSelectedElementsViewer();
+ for (ITreeItemAxis current : axis) {
+ if (!CategoriesWizardUtils.isCategoryItem(current)) {
+ return false;
+ }
+ }
+ return super.canRemove();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#canDelete()
+ *
+ * @return
+ */
+ @Override
+ protected boolean canDelete() {
+ for (ITreeItemAxis curr : getSelectionInSelectedElementsViewer()) {
+ if (!(CategoriesWizardUtils.isDepthItem(curr) || CategoriesWizardUtils.isCategoryItem(curr))) {
+ return false;
+ }
+ // we can't delete the 0 depth
+ if (CategoriesWizardUtils.isDepthItem(curr)) {
+ int depth = Integer.valueOf((String) curr.getElement());
+ if (depth == 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#canAdd()
+ *
+ * @return
+ */
+ @Override
+ protected boolean canAdd() {
+ return isCategorySelection() || isRootSelection();
+ }
+
+ protected boolean isRootSelection() {
+ List<ITreeItemAxis> axis = getSelectedAxisInSelectedElementsViewer();
+ for (ITreeItemAxis curr : axis) {
+ if (!CategoriesWizardUtils.isRootItem(curr)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected boolean isCategorySelection() {
+ List<ITreeItemAxis> axis = getSelectedAxisInSelectedElementsViewer();
+ for (ITreeItemAxis curr : axis) {
+ if (!CategoriesWizardUtils.isDepthItem(curr)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ *
+ * @return
+ * <ul>
+ * <li>a list with the selected categories only when all selected elements are categories AND they have the same parent (a {@link IdTreeItemAxis} (which represents the depth))</li>
+ * <li>an empty list in all others case</li>
+ * </ul>
+ *
+ */
+ protected List<ITreeItemAxis> getSelectedCategoriesInSelectedElementsViewer() {
+ List<ITreeItemAxis> selection = getSelectedAxisInSelectedElementsViewer();
+ ITreeItemAxis parent = null;
+ List<ITreeItemAxis> returnedSelection = new ArrayList<ITreeItemAxis>();
+ for (ITreeItemAxis curr : selection) {
+ ITreeItemAxis tmp = curr.getParent();
+ if (tmp == null) {
+ return Collections.emptyList();
+ }
+ if (parent == null && tmp instanceof IdTreeItemAxis) {
+ parent = tmp;
+ returnedSelection.add(curr);
+ } else if (parent != null && parent == tmp) {
+ returnedSelection.add(curr);
+ } else {
+ return Collections.emptyList();
+ }
+ }
+ return returnedSelection;
+ }
+
+ /**
+ *
+ * @author Vincent Lorenzo
+ *
+ * This comparator allows to sort comparator
+ *
+ */
+ public static final class CategoriesComparator implements Comparator<ITreeItemAxis> {
+
+ private List<ITreeItemAxis> children;
+
+ /**
+ * Constructor.
+ *
+ */
+ public CategoriesComparator(List<ITreeItemAxis> children) {
+ this.children = Collections.unmodifiableList(children);
+ }
+
+ /**
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ @Override
+ public int compare(ITreeItemAxis o1, ITreeItemAxis o2) {
+ int index1 = children.indexOf(o1);
+ int index2 = children.indexOf(o2);
+ if (index1 < index2) {
+ return -1;
+ }
+ return 1;
+ }
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#downAction()
+ *
+ */
+ @Override
+ protected void downAction() {
+ moveAction(false);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#canMove(boolean)
+ *
+ * @param up
+ * @return
+ */
+ protected boolean canMove(boolean up) {
+ List<ITreeItemAxis> categories = getSelectedCategoriesInSelectedElementsViewer();
+ if (categories.isEmpty()) {
+ return false;
+ }
+ ITreeItemAxis parent = categories.get(0).getParent();
+ List<ITreeItemAxis> children = parent.getChildren();
+ int forbiddenIndex = up ? 0 : children.size() - 1;
+
+ for (ITreeItemAxis child : categories) {
+ if (children.indexOf(child) == forbiddenIndex) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ *
+ * @param up
+ * <code>true</code> if the elements must be move to up
+ */
+ protected void moveAction(boolean up) {
+ List<ITreeItemAxis> categories = getSelectedCategoriesInSelectedElementsViewer();
+
+ ITreeItemAxis parent = categories.get(0).getParent();
+ final List<ITreeItemAxis> children = Collections.unmodifiableList(parent.getChildren());
+ if (categories.isEmpty()) {
+ return;
+ }
+
+ Collections.sort(categories, new CategoriesComparator(children));
+ if (!up) {
+ Collections.reverse(categories);
+ }
+ for (ITreeItemAxis child : categories) {
+ int index = parent.getChildren().indexOf(child);
+ index = up ? index - 1 : index + 1;
+ parent.getChildren().move(index, child);
+ }
+ selectedElementsViewer.refresh();
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#addElements(java.lang.Object[])
+ *
+ * @param elements
+ */
+ @Override
+ public void addElements(Object[] elements) {
+ List<ITreeItemAxis> selectedElements = getSelectedAxisInSelectedElementsViewer();
+ if (selectedElements.isEmpty()) {
+ return;
+ }
+
+ // 1. verify if the root is selected
+ ITreeItemAxis root = null;
+ for (ITreeItemAxis current : selectedElements) {
+ if (CategoriesWizardUtils.isRootItem(current)) {
+ root = current;
+ break;
+ }
+ }
+ // 2. find the categories to edit
+ List<ITreeItemAxis> depthToEdit = new ArrayList<ITreeItemAxis>();
+ if (root != null) {
+ depthToEdit.addAll(root.getChildren());
+ } else {
+ for (ITreeItemAxis current : selectedElements) {
+ if (CategoriesWizardUtils.isDepthItem(current)) {
+ depthToEdit.add(current);
+ }
+ }
+ }
+
+ // 3. edit the categories
+ for (ITreeItemAxis curr : depthToEdit) {
+ List<Object> alreadyManagedObject = new ArrayList<Object>();
+ for (ITreeItemAxis category : curr.getChildren()) {
+ alreadyManagedObject.add(category.getElement());
+ }
+
+ for (Object el : elements) {
+ if (!alreadyManagedObject.contains(el)) {
+ IAxisFactory.createITreeItemAxis(curr, el, null, null);
+ }
+
+ }
+ }
+ selectedElementsViewer.refresh();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#removeAllAction()
+ *
+ */
+ @Override
+ protected void removeAllAction() {
+ Object input = this.selectedElementsViewer.getInput();
+ if (input instanceof List<?>) {
+ for (Object curr : (List<?>) input) {
+ if (curr instanceof ITreeItemAxis) {
+ destroyCategoriesAxis((ITreeItemAxis) curr);
+ }
+ }
+ this.selectedElementsViewer.refresh();
+ }
+ }
+
+ /**
+ * Destroy recursively all categories axis
+ *
+ * @param axis
+ * an axis
+ */
+ protected void destroyCategoriesAxis(ITreeItemAxis axis) {
+ for (ITreeItemAxis child : axis.getChildren()) {
+ destroyCategoriesAxis(child);
+ }
+ if (CategoriesWizardUtils.isCategoryItem(axis)) {
+ axis.setParent(null);
+ EcoreUtil.delete(axis);
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.MultipleValueSelectionWizard#removeAction()
+ *
+ */
+ @Override
+ protected void removeAction() {
+ IStructuredSelection selection = (IStructuredSelection) this.selectedElementsViewer.getSelection();
+ for (Object current : selection.toList()) {
+ if (current instanceof ITreeItemAxis && ((ITreeItemAxis) current).getParent() != null) {
+ ITreeItemAxis axis = (ITreeItemAxis) current;
+ axis.setParent(null);
+ EcoreUtil.delete(axis);
+ }
+ }
+ this.selectedElementsViewer.refresh();
+ }
+
+ /**
+ *
+ * @return
+ * the list of the selected element in the selection viewer
+ */
+ protected List<ITreeItemAxis> getSelectionInSelectedElementsViewer() {
+ if (this.selectedElementsViewer != null) {
+ ISelection selection = this.selectedElementsViewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ List<ITreeItemAxis> returnedValues = new ArrayList<ITreeItemAxis>();
+ for (Object current : ((IStructuredSelection) selection).toList()) {
+ if (current instanceof ITreeItemAxis) {
+ returnedValues.add((ITreeItemAxis) current);
+ }
+ }
+ return returnedValues;
+ }
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ *
+ * @author Vincent Lorenzo
+ * This class is the factory used to create new ITreeItemAxis in the viewer of selected element
+ * It creates only {@link ITreeItemAxis} to represents depth to configure and its allows to edit only alias of categories
+ */
+ public class CategoriesValueFactory implements ReferenceValueFactory {
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory#validateObjects(java.util.Collection)
+ *
+ * @param objectsToValidate
+ * @return
+ */
+ @Override
+ public Collection<Object> validateObjects(Collection<Object> objectsToValidate) {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory#edit(org.eclipse.swt.widgets.Control, java.lang.Object)
+ *
+ * @param widget
+ * @param object
+ * @return
+ */
+ @Override
+ public Object edit(Control widget, Object object) {
+ String existingAlias = ((IAxis) object).getAlias();
+ InputDialog dialog = new InputDialog(widget.getShell(), Messages.ChooseCategoriesSelectionWidget_EditAlias, Messages.ChooseCategoriesSelectionWidget_EnterAliasToUseForTheCategory, existingAlias, null);
+
+ int result = dialog.open();
+ if (result == Window.OK) {
+ String newValue = dialog.getText();
+ ((IAxis) object).setAlias(newValue);
+ }
+
+ return object;
+ }
+
+ @Override
+ public Object createObject(Control widget, Object context) {
+ Assert.isTrue(context instanceof ITreeItemAxis);
+ ITreeItemAxis rootItem = (ITreeItemAxis) context;
+ Assert.isTrue(rootItem.getParent() == null);
+
+ // find the maxDepth
+ int maxDepth = -1;
+ for (ITreeItemAxis axis : rootItem.getChildren()) {
+ Assert.isTrue(axis instanceof IdTreeItemAxis);
+ maxDepth = Math.max(maxDepth, Integer.parseInt((String) axis.getElement()));
+ }
+ int nextDepth = maxDepth + 1;
+ return IAxisFactory.createITreeItemAxis(rootItem, Integer.valueOf(nextDepth), null, null);
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public boolean canEdit() {
+ List<ITreeItemAxis> selectedAxis = getSelectedAxisInSelectedElementsViewer();
+ if (selectedAxis.size() == 1) {
+ return CategoriesWizardUtils.isCategoryItem(selectedAxis.get(0));
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public boolean canCreateObject() {
+ return getContextForCreateAction() != null;
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesSelectionWidget.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesSelectionWidget.java
index 075fa2c0788..a731acf047d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesSelectionWidget.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesSelectionWidget.java
@@ -1,77 +1,77 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.wizard.pages;
-
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class ConfigurePasteForCategoriesSelectionWidget extends ChooseCategoriesSelectionWidget {
-
- /**
- * Constructor.
- *
- * @param selector
- * @param unique
- * @param ordered
- * @param upperBound
- */
- public ConfigurePasteForCategoriesSelectionWidget(IElementSelector selector, boolean unique, boolean ordered, int upperBound) {
- super(selector, unique, ordered, upperBound);
- }
-
- /**
- * Constructor.
- *
- * @param selector
- * @param unique
- * @param ordered
- */
- public ConfigurePasteForCategoriesSelectionWidget(IElementSelector selector, boolean unique, boolean ordered) {
- super(selector, unique, ordered);
- }
-
- /**
- * Constructor.
- *
- * @param selector
- * @param unique
- */
- public ConfigurePasteForCategoriesSelectionWidget(IElementSelector selector, boolean unique) {
- super(selector, unique);
- }
-
- /**
- * Constructor.
- *
- * @param selector
- */
- public ConfigurePasteForCategoriesSelectionWidget(IElementSelector selector) {
- super(selector);
- }
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.ChooseCategoriesSelectionWidget#createListSectionContentProvider()
- *
- * @return
- */
- @Override
- protected IContentProvider createListSectionContentProvider() {
- return new ITreeItemContentProvider();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.wizard.pages;
+
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class ConfigurePasteForCategoriesSelectionWidget extends ChooseCategoriesSelectionWidget {
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ * @param unique
+ * @param ordered
+ * @param upperBound
+ */
+ public ConfigurePasteForCategoriesSelectionWidget(IElementSelector selector, boolean unique, boolean ordered, int upperBound) {
+ super(selector, unique, ordered, upperBound);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ * @param unique
+ * @param ordered
+ */
+ public ConfigurePasteForCategoriesSelectionWidget(IElementSelector selector, boolean unique, boolean ordered) {
+ super(selector, unique, ordered);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ * @param unique
+ */
+ public ConfigurePasteForCategoriesSelectionWidget(IElementSelector selector, boolean unique) {
+ super(selector, unique);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ */
+ public ConfigurePasteForCategoriesSelectionWidget(IElementSelector selector) {
+ super(selector);
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.ChooseCategoriesSelectionWidget#createListSectionContentProvider()
+ *
+ * @return
+ */
+ @Override
+ protected IContentProvider createListSectionContentProvider() {
+ return new ITreeItemContentProvider();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesWizardPage.java
index 28b3894f0e4..027b1842e78 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesWizardPage.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ConfigurePasteForCategoriesWizardPage.java
@@ -1,67 +1,67 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.wizard.pages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
-import org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class ConfigurePasteForCategoriesWizardPage extends SelectCategoriesWizardPage {
-
- public static final String DEFAULT_CONFIGURE_PASTE_PAGE_NAME = "Configure Paste In Tree Table";
-
- public static final String DEFAULT_CONFIGURE_PASTE_PAGE_TITLE = "Configure the paste for each categories";
-
-
- /**
- * Constructor.
- *
- * @param selector
- */
- public ConfigurePasteForCategoriesWizardPage(IElementSelector selector) {
- this(DEFAULT_CONFIGURE_PASTE_PAGE_NAME, DEFAULT_CONFIGURE_PASTE_PAGE_TITLE, null, selector);
- }
-
- /**
- * Constructor.
- *
- * @param pageName
- * @param pageTitle
- * @param defaultImage
- * @param selector
- */
- public ConfigurePasteForCategoriesWizardPage(String pageName, String pageTitle, ImageDescriptor defaultImage, IElementSelector selector) {
- super(pageName, pageTitle, defaultImage, selector);
- }
-
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.wizard.pages.SelectCategoriesWizardPage#createWidget(org.eclipse.papyrus.infra.widgets.editors.IElementSelector, boolean, boolean, int)
- *
- * @param selector
- * @param unique
- * @param ordered
- * @param upperBound
- * @return
- */
- @Override
- protected MultipleValueSelectionWidget createWidget(IElementSelector selector, boolean unique, boolean ordered, int upperBound) {
- return new ConfigurePasteForCategoriesSelectionWidget(selector, unique, ordered, upperBound);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.wizard.pages;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
+import org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class ConfigurePasteForCategoriesWizardPage extends SelectCategoriesWizardPage {
+
+ public static final String DEFAULT_CONFIGURE_PASTE_PAGE_NAME = "Configure Paste In Tree Table";
+
+ public static final String DEFAULT_CONFIGURE_PASTE_PAGE_TITLE = "Configure the paste for each categories";
+
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ */
+ public ConfigurePasteForCategoriesWizardPage(IElementSelector selector) {
+ this(DEFAULT_CONFIGURE_PASTE_PAGE_NAME, DEFAULT_CONFIGURE_PASTE_PAGE_TITLE, null, selector);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param pageName
+ * @param pageTitle
+ * @param defaultImage
+ * @param selector
+ */
+ public ConfigurePasteForCategoriesWizardPage(String pageName, String pageTitle, ImageDescriptor defaultImage, IElementSelector selector) {
+ super(pageName, pageTitle, defaultImage, selector);
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.pages.SelectCategoriesWizardPage#createWidget(org.eclipse.papyrus.infra.widgets.editors.IElementSelector, boolean, boolean, int)
+ *
+ * @param selector
+ * @param unique
+ * @param ordered
+ * @param upperBound
+ * @return
+ */
+ @Override
+ protected MultipleValueSelectionWidget createWidget(IElementSelector selector, boolean unique, boolean ordered, int upperBound) {
+ return new ConfigurePasteForCategoriesSelectionWidget(selector, unique, ordered, upperBound);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ITreeItemContentProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ITreeItemContentProvider.java
index 4ead5810681..8f01f8ed152 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ITreeItemContentProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ITreeItemContentProvider.java
@@ -1,99 +1,99 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.wizard.pages;
-
-import java.util.Collection;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-// TODO : move me?
-public class ITreeItemContentProvider implements ITreeContentProvider {
- /**
- *
- */
- @Override
- public void dispose() {
- // nothing to do
- }
-
- /**
- *
- * @param arg0
- * @return
- */
- @Override
- public boolean hasChildren(Object arg0) {
- if (arg0 instanceof ITreeItemAxis) {
- return !((ITreeItemAxis) arg0).getChildren().isEmpty();
- }
- return false;
- }
-
- /**
- *
- * @param arg0
- * @return
- */
- @Override
- public Object getParent(Object arg0) {
- if (arg0 instanceof ITreeItemAxis) {
- return ((ITreeItemAxis) arg0).getParent();
- }
- return null;
- }
-
- /**
- *
- * @param arg0
- * @return
- */
- @Override
- public Object[] getElements(Object arg0) {
- if (arg0 instanceof Collection<?>) {
- return ((Collection<?>) arg0).toArray();
- }
- return new Object[] { arg0 };
- }
-
- /**
- *
- * @param arg0
- * @return
- */
- @Override
- public Object[] getChildren(Object arg0) {
- if (arg0 instanceof ITreeItemAxis) {
- return ((ITreeItemAxis) arg0).getChildren().toArray();
- }
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- *
- * @param arg0
- * @param arg1
- * @param arg2
- */
- @Override
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- // nothing to do
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.wizard.pages;
+
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+// TODO : move me?
+public class ITreeItemContentProvider implements ITreeContentProvider {
+ /**
+ *
+ */
+ @Override
+ public void dispose() {
+ // nothing to do
+ }
+
+ /**
+ *
+ * @param arg0
+ * @return
+ */
+ @Override
+ public boolean hasChildren(Object arg0) {
+ if (arg0 instanceof ITreeItemAxis) {
+ return !((ITreeItemAxis) arg0).getChildren().isEmpty();
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param arg0
+ * @return
+ */
+ @Override
+ public Object getParent(Object arg0) {
+ if (arg0 instanceof ITreeItemAxis) {
+ return ((ITreeItemAxis) arg0).getParent();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param arg0
+ * @return
+ */
+ @Override
+ public Object[] getElements(Object arg0) {
+ if (arg0 instanceof Collection<?>) {
+ return ((Collection<?>) arg0).toArray();
+ }
+ return new Object[] { arg0 };
+ }
+
+ /**
+ *
+ * @param arg0
+ * @return
+ */
+ @Override
+ public Object[] getChildren(Object arg0) {
+ if (arg0 instanceof ITreeItemAxis) {
+ return ((ITreeItemAxis) arg0).getChildren().toArray();
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ *
+ * @param arg0
+ * @param arg1
+ * @param arg2
+ */
+ @Override
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+ // nothing to do
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportCSVConfigurationPage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportCSVConfigurationPage.java
index 94251f9198d..2b2bcba0c0e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportCSVConfigurationPage.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportCSVConfigurationPage.java
@@ -1,218 +1,218 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.wizard.pages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.paste.PasteSeparator;
-import org.eclipse.papyrus.infra.nattable.paste.TextDelimiter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * The page to configure the separator used in the CSV file
- *
- * @author Vincent Lorenzo
- *
- */
-public class ImportCSVConfigurationPage extends WizardPage {
-
- /**
- * the paste separator
- */
- private PasteSeparator separator;
-
- /**
- * the text delimiter
- */
- private TextDelimiter textDelimiter;
-
- /**
- * the specific seaprator
- */
- private char[] textChar = null;
-
- /**
- *
- * Constructor.
- *
- * @param pageName
- * the name of the import page
- * @param title
- * the title of the page
- * @param titleImage
- * the image for this page
- * @param tableManager
- * the table manager where the import will be done
- */
- public ImportCSVConfigurationPage(final String pageName, final String title, final ImageDescriptor titleImage, final PasteSeparator defaultSeparator, final TextDelimiter defaultDelimiter) {
- super(pageName, title, titleImage);
- setDescription(Messages.ImportFilePage_SelectTheFileToImport);
- this.separator = defaultSeparator;
- this.textDelimiter = defaultDelimiter;
- }
-
- /**
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- *
- * @param parent
- */
- @Override
- public void createControl(final Composite parent1) {
- final Composite pageComposite = new Composite(parent1, SWT.NONE);
- setControl(pageComposite);
- pageComposite.setLayout(new GridLayout(2, true));
- final Group separatorGroup = new Group(pageComposite, SWT.NONE);
- separatorGroup.setText(Messages.ImportCSVConfigurationPage_Separators);
- separatorGroup.setLayout(new GridLayout(2, false));
-
- for (final PasteSeparator current : PasteSeparator.values()) {
- final Button button = new Button(separatorGroup, SWT.RADIO);
- button.setText(current.getName());
- button.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (button.isEnabled()) {
- separator = current;
- }
- setPageComplete(validate());
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // nothing to do
- }
- });
- button.setSelection(current == separator);
- final GridData data = new GridData();
- if (current == PasteSeparator.OTHER) {
- final Text text = new Text(separatorGroup, SWT.BORDER);
- text.addKeyListener(new org.eclipse.swt.events.KeyListener() {
-
- @Override
- public void keyReleased(KeyEvent e) {
- textChar = text.getTextChars();
- setPageComplete(validate());
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- // nothing to do
- }
- });
- button.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- text.setEnabled(button.getSelection());
- setPageComplete(validate());
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- text.setEnabled(this.separator == PasteSeparator.OTHER);
- } else {
- data.horizontalSpan = 2;
- }
- button.setLayoutData(data);
- }
-
- final Composite textDelimiterComp = new Composite(pageComposite, SWT.NONE);
- textDelimiterComp.setLayout(new GridLayout(2, false));
- textDelimiterComp.setLayoutData(new GridData());
- final Label label2 = new Label(textDelimiterComp, SWT.NONE);
- label2.setText(Messages.ImportCSVConfigurationPage_SelectTheTextDelimiter);
- final Combo combo = new Combo(textDelimiterComp, SWT.DROP_DOWN | SWT.READ_ONLY);
-
- for (int i = 0; i < TextDelimiter.values().length; i++) {
- final TextDelimiter current = TextDelimiter.values()[i];
- combo.add(String.valueOf(current.getDelimiter()), i);
- if (this.textDelimiter == current) {
- combo.select(i);
- }
- }
- combo.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- textDelimiter = TextDelimiter.values()[combo.getSelectionIndex()];
- setPageComplete(validate());
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // nothing to do
- }
- });
-
- setPageComplete(validate());
- }
-
- /**
- *
- * @return
- */
- private boolean validate() {
- if (this.separator == PasteSeparator.OTHER) {
- if (this.textChar == null || this.textChar.length == 0) {
- setErrorMessage(Messages.ImportCSVConfigurationPage_TheCellSeparatorIsNotDefined);
- return false;
- } else if (this.textChar.length > 1) {
- setErrorMessage(Messages.ImportCSVConfigurationPage_TheCellSeparatorMustBeExcatlyOneChar);
- return false;
- }
- }
- setErrorMessage(null);
- return true;
- }
-
- /**
- *
- * @return
- * the selected separator
- */
- public char getSeparator() {
- if (this.separator == PasteSeparator.OTHER) {
- return textChar[0];
- }
- return this.separator.getSeparator();
- }
-
- /**
- *
- * @return
- * the selected text delimiter
- */
- public char getTextDelimiter() {
- return this.textDelimiter.getDelimiter();
- }
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.wizard.pages;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.paste.PasteSeparator;
+import org.eclipse.papyrus.infra.nattable.paste.TextDelimiter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * The page to configure the separator used in the CSV file
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ImportCSVConfigurationPage extends WizardPage {
+
+ /**
+ * the paste separator
+ */
+ private PasteSeparator separator;
+
+ /**
+ * the text delimiter
+ */
+ private TextDelimiter textDelimiter;
+
+ /**
+ * the specific seaprator
+ */
+ private char[] textChar = null;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param pageName
+ * the name of the import page
+ * @param title
+ * the title of the page
+ * @param titleImage
+ * the image for this page
+ * @param tableManager
+ * the table manager where the import will be done
+ */
+ public ImportCSVConfigurationPage(final String pageName, final String title, final ImageDescriptor titleImage, final PasteSeparator defaultSeparator, final TextDelimiter defaultDelimiter) {
+ super(pageName, title, titleImage);
+ setDescription(Messages.ImportFilePage_SelectTheFileToImport);
+ this.separator = defaultSeparator;
+ this.textDelimiter = defaultDelimiter;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ */
+ @Override
+ public void createControl(final Composite parent1) {
+ final Composite pageComposite = new Composite(parent1, SWT.NONE);
+ setControl(pageComposite);
+ pageComposite.setLayout(new GridLayout(2, true));
+ final Group separatorGroup = new Group(pageComposite, SWT.NONE);
+ separatorGroup.setText(Messages.ImportCSVConfigurationPage_Separators);
+ separatorGroup.setLayout(new GridLayout(2, false));
+
+ for (final PasteSeparator current : PasteSeparator.values()) {
+ final Button button = new Button(separatorGroup, SWT.RADIO);
+ button.setText(current.getName());
+ button.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (button.isEnabled()) {
+ separator = current;
+ }
+ setPageComplete(validate());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // nothing to do
+ }
+ });
+ button.setSelection(current == separator);
+ final GridData data = new GridData();
+ if (current == PasteSeparator.OTHER) {
+ final Text text = new Text(separatorGroup, SWT.BORDER);
+ text.addKeyListener(new org.eclipse.swt.events.KeyListener() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ textChar = text.getTextChars();
+ setPageComplete(validate());
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ // nothing to do
+ }
+ });
+ button.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ text.setEnabled(button.getSelection());
+ setPageComplete(validate());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ text.setEnabled(this.separator == PasteSeparator.OTHER);
+ } else {
+ data.horizontalSpan = 2;
+ }
+ button.setLayoutData(data);
+ }
+
+ final Composite textDelimiterComp = new Composite(pageComposite, SWT.NONE);
+ textDelimiterComp.setLayout(new GridLayout(2, false));
+ textDelimiterComp.setLayoutData(new GridData());
+ final Label label2 = new Label(textDelimiterComp, SWT.NONE);
+ label2.setText(Messages.ImportCSVConfigurationPage_SelectTheTextDelimiter);
+ final Combo combo = new Combo(textDelimiterComp, SWT.DROP_DOWN | SWT.READ_ONLY);
+
+ for (int i = 0; i < TextDelimiter.values().length; i++) {
+ final TextDelimiter current = TextDelimiter.values()[i];
+ combo.add(String.valueOf(current.getDelimiter()), i);
+ if (this.textDelimiter == current) {
+ combo.select(i);
+ }
+ }
+ combo.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ textDelimiter = TextDelimiter.values()[combo.getSelectionIndex()];
+ setPageComplete(validate());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // nothing to do
+ }
+ });
+
+ setPageComplete(validate());
+ }
+
+ /**
+ *
+ * @return
+ */
+ private boolean validate() {
+ if (this.separator == PasteSeparator.OTHER) {
+ if (this.textChar == null || this.textChar.length == 0) {
+ setErrorMessage(Messages.ImportCSVConfigurationPage_TheCellSeparatorIsNotDefined);
+ return false;
+ } else if (this.textChar.length > 1) {
+ setErrorMessage(Messages.ImportCSVConfigurationPage_TheCellSeparatorMustBeExcatlyOneChar);
+ return false;
+ }
+ }
+ setErrorMessage(null);
+ return true;
+ }
+
+ /**
+ *
+ * @return
+ * the selected separator
+ */
+ public char getSeparator() {
+ if (this.separator == PasteSeparator.OTHER) {
+ return textChar[0];
+ }
+ return this.separator.getSeparator();
+ }
+
+ /**
+ *
+ * @return
+ * the selected text delimiter
+ */
+ public char getTextDelimiter() {
+ return this.textDelimiter.getDelimiter();
+ }
+
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportInvertedTableErrorPage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportInvertedTableErrorPage.java
index d28cc75a5e8..5ac205af9f6 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportInvertedTableErrorPage.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportInvertedTableErrorPage.java
@@ -1,67 +1,67 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.wizard.pages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class ImportInvertedTableErrorPage extends WizardPage {
-
- /**
- *
- * Constructor.
- *
- * @param pageName
- * the page name
- * @param title
- * the title of the page
- * @param titleImage
- * the image of the page
- */
- public ImportInvertedTableErrorPage(final String pageName, final String title, final ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /**
- * Create contents of the wizard.
- *
- * @param parent
- */
- @Override
- public void createControl(final Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText("Inverted Table are not yet managed"); //$NON-NLS-1$
- setControl(label);
- }
-
- /**
- *
- * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
- *
- * @return
- */
- @Override
- public boolean isPageComplete() {
- return false;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.wizard.pages;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ImportInvertedTableErrorPage extends WizardPage {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param pageName
+ * the page name
+ * @param title
+ * the title of the page
+ * @param titleImage
+ * the image of the page
+ */
+ public ImportInvertedTableErrorPage(final String pageName, final String title, final ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ /**
+ * Create contents of the wizard.
+ *
+ * @param parent
+ */
+ @Override
+ public void createControl(final Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText("Inverted Table are not yet managed"); //$NON-NLS-1$
+ setControl(label);
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ *
+ * @return
+ */
+ @Override
+ public boolean isPageComplete() {
+ return false;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportTableErrorPage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportTableErrorPage.java
index b4e8ba34e44..3509acb03fc 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportTableErrorPage.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/ImportTableErrorPage.java
@@ -1,68 +1,68 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.wizard.pages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class ImportTableErrorPage extends WizardPage {
-
- /**
- *
- * Constructor.
- *
- * @param pageName
- * the page name
- * @param title
- * the title of the page
- * @param titleImage
- * the image of the page
- */
- public ImportTableErrorPage(final String pageName, final String title, final ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /**
- * Create contents of the wizard.
- *
- * @param parent
- */
- @Override
- public void createControl(final Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(Messages.ImportTableErrorPage_PleaseOpenAPapyrusEditor);
- setControl(label);
- }
-
- /**
- *
- * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
- *
- * @return
- */
- @Override
- public boolean isPageComplete() {
- return super.isPageComplete();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.wizard.pages;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ImportTableErrorPage extends WizardPage {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param pageName
+ * the page name
+ * @param title
+ * the title of the page
+ * @param titleImage
+ * the image of the page
+ */
+ public ImportTableErrorPage(final String pageName, final String title, final ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ /**
+ * Create contents of the wizard.
+ *
+ * @param parent
+ */
+ @Override
+ public void createControl(final Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(Messages.ImportTableErrorPage_PleaseOpenAPapyrusEditor);
+ setControl(label);
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ *
+ * @return
+ */
+ @Override
+ public boolean isPageComplete() {
+ return super.isPageComplete();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/SelectCategoriesWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/SelectCategoriesWizardPage.java
index f3adf3a732a..e7c8fc5563c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/SelectCategoriesWizardPage.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/wizard/pages/SelectCategoriesWizardPage.java
@@ -1,195 +1,195 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.nattable.wizard.pages;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
-import org.eclipse.papyrus.infra.nattable.wizard.CategoriesWizardUtils;
-import org.eclipse.papyrus.infra.widgets.editors.IElementSelectionListener;
-import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
-import org.eclipse.papyrus.infra.widgets.util.ValueUtils;
-import org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget;
-import org.eclipse.papyrus.infra.widgets.wizard.pages.MultipleValueEditAndSelectionWizardPage;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class SelectCategoriesWizardPage extends MultipleValueEditAndSelectionWizardPage {
-
- public static final String DEFAULT_SELECT_CATEGORIES_PAGE_NAME = Messages.SelectCategoriesWizardPage_SelectCategoriesPage;
-
- public static final String DEFAULT_SELECT_CATEGORIES_TITLE = Messages.SelectCategoriesWizardPage_SelectCategoriesToListenInTheTreeTable;
-
- private IElementSelector selector;
-
- private IElementSelectionListener selectorListener;
-
- /**
- * Constructor.
- *
- * @param selector
- */
- public SelectCategoriesWizardPage(IElementSelector selector) {
- this(DEFAULT_SELECT_CATEGORIES_PAGE_NAME, DEFAULT_SELECT_CATEGORIES_TITLE, null, selector);
- }
-
- /**
- *
- * Constructor.
- *
- * @param pageName
- * the name of the page
- * @param pageTitle
- * the title of the page
- * @param defaultImage
- * the image to use for the page
- * @param selector
- * the selector to use
- */
- public SelectCategoriesWizardPage(String pageName, String pageTitle, ImageDescriptor defaultImage, IElementSelector selector) {
- super(pageName, pageTitle, defaultImage, selector, false, true, ValueUtils.MANY);
- }
-
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.wizard.pages.MultipleValueEditAndSelectionWizardPage#createWidget(org.eclipse.papyrus.infra.widgets.editors.IElementSelector, boolean, boolean, int)
- *
- * @param selector
- * @param unique
- * @param ordered
- * @param upperBound
- * @return
- */
- @Override
- protected MultipleValueSelectionWidget createWidget(IElementSelector selector, boolean unique, boolean ordered, int upperBound) {
- this.selector = selector;
- this.selectorListener = new SelectorListener();
- // the only way found to refresh properly next button
- this.selector.addElementSelectionListener(this.selectorListener);
-
- return new ChooseCategoriesSelectionWidget(selector, unique, ordered, upperBound) {
-
-
-
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueEditAndSelectionWidget#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- *
- * @param e
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- validate();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
- *
- * @param event
- */
- @Override
- public void doubleClick(DoubleClickEvent event) {
- super.doubleClick(event);
- validate();
- }
- };
- }
-
- /**
- *
- * @author Vincent Lorenzo
- *
- * this class allows to refresh properly the next button after a double click on the left part of the widget
- *
- */
- private class SelectorListener implements IElementSelectionListener {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.editors.IElementSelectionListener#addElements(java.lang.Object[])
- *
- * @param elements
- */
- @Override
- public void addElements(Object[] elements) {
- Display.getDefault().asyncExec(new Runnable() {
-
- /**
- *
- * @see java.lang.Runnable#run()
- *
- */
- @Override
- public void run() {
- validate();
-
- }
- });
- }
- }
-
- /**
- * @see org.eclipse.papyrus.infra.widgets.wizard.pages.MultipleValueEditAndSelectionWizardPage#dispose()
- *
- */
- @Override
- public void dispose() {
- if (this.selector != null) {
- this.selector.removeElementSelectionListener(selectorListener);
- this.selector = null;
- }
- super.dispose();
- }
-
- /**
- * validate the page and display error message if required
- */
- protected void validate() {
- List<Object> selection = getWidget().getSelection();
- List<Integer> incompleteDepth = new ArrayList<Integer>();
- for (Object current : selection) {
- Assert.isTrue(current instanceof ITreeItemAxis);
- ITreeItemAxis rootItem = (ITreeItemAxis) current;
- Assert.isTrue(CategoriesWizardUtils.isRootItem(rootItem));
- for (ITreeItemAxis depthItem : rootItem.getChildren()) {
- Assert.isTrue(CategoriesWizardUtils.isDepthItem(depthItem));
- if (depthItem.getChildren().isEmpty()) {
- int depth = Integer.valueOf(depthItem.getElement().toString()).intValue();
- if (depth != 0) {
- incompleteDepth.add(Integer.valueOf(depth));
- }
- }
- }
- }
- if (incompleteDepth.isEmpty()) {
- setErrorMessage(null);
- } else {
- StringBuilder builder = new StringBuilder(NLS.bind("The following depths don't have categories {0}", incompleteDepth.toString()));
- setErrorMessage(builder.toString());
- }
-
- setPageComplete(getErrorMessage() == null);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.wizard.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.wizard.CategoriesWizardUtils;
+import org.eclipse.papyrus.infra.widgets.editors.IElementSelectionListener;
+import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
+import org.eclipse.papyrus.infra.widgets.util.ValueUtils;
+import org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget;
+import org.eclipse.papyrus.infra.widgets.wizard.pages.MultipleValueEditAndSelectionWizardPage;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class SelectCategoriesWizardPage extends MultipleValueEditAndSelectionWizardPage {
+
+ public static final String DEFAULT_SELECT_CATEGORIES_PAGE_NAME = Messages.SelectCategoriesWizardPage_SelectCategoriesPage;
+
+ public static final String DEFAULT_SELECT_CATEGORIES_TITLE = Messages.SelectCategoriesWizardPage_SelectCategoriesToListenInTheTreeTable;
+
+ private IElementSelector selector;
+
+ private IElementSelectionListener selectorListener;
+
+ /**
+ * Constructor.
+ *
+ * @param selector
+ */
+ public SelectCategoriesWizardPage(IElementSelector selector) {
+ this(DEFAULT_SELECT_CATEGORIES_PAGE_NAME, DEFAULT_SELECT_CATEGORIES_TITLE, null, selector);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param pageName
+ * the name of the page
+ * @param pageTitle
+ * the title of the page
+ * @param defaultImage
+ * the image to use for the page
+ * @param selector
+ * the selector to use
+ */
+ public SelectCategoriesWizardPage(String pageName, String pageTitle, ImageDescriptor defaultImage, IElementSelector selector) {
+ super(pageName, pageTitle, defaultImage, selector, false, true, ValueUtils.MANY);
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.wizard.pages.MultipleValueEditAndSelectionWizardPage#createWidget(org.eclipse.papyrus.infra.widgets.editors.IElementSelector, boolean, boolean, int)
+ *
+ * @param selector
+ * @param unique
+ * @param ordered
+ * @param upperBound
+ * @return
+ */
+ @Override
+ protected MultipleValueSelectionWidget createWidget(IElementSelector selector, boolean unique, boolean ordered, int upperBound) {
+ this.selector = selector;
+ this.selectorListener = new SelectorListener();
+ // the only way found to refresh properly next button
+ this.selector.addElementSelectionListener(this.selectorListener);
+
+ return new ChooseCategoriesSelectionWidget(selector, unique, ordered, upperBound) {
+
+
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueEditAndSelectionWidget#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ *
+ * @param e
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ validate();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.widgets.MultipleValueSelectionWidget#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ *
+ * @param event
+ */
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ super.doubleClick(event);
+ validate();
+ }
+ };
+ }
+
+ /**
+ *
+ * @author Vincent Lorenzo
+ *
+ * this class allows to refresh properly the next button after a double click on the left part of the widget
+ *
+ */
+ private class SelectorListener implements IElementSelectionListener {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.IElementSelectionListener#addElements(java.lang.Object[])
+ *
+ * @param elements
+ */
+ @Override
+ public void addElements(Object[] elements) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ /**
+ *
+ * @see java.lang.Runnable#run()
+ *
+ */
+ @Override
+ public void run() {
+ validate();
+
+ }
+ });
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.wizard.pages.MultipleValueEditAndSelectionWizardPage#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ if (this.selector != null) {
+ this.selector.removeElementSelectionListener(selectorListener);
+ this.selector = null;
+ }
+ super.dispose();
+ }
+
+ /**
+ * validate the page and display error message if required
+ */
+ protected void validate() {
+ List<Object> selection = getWidget().getSelection();
+ List<Integer> incompleteDepth = new ArrayList<Integer>();
+ for (Object current : selection) {
+ Assert.isTrue(current instanceof ITreeItemAxis);
+ ITreeItemAxis rootItem = (ITreeItemAxis) current;
+ Assert.isTrue(CategoriesWizardUtils.isRootItem(rootItem));
+ for (ITreeItemAxis depthItem : rootItem.getChildren()) {
+ Assert.isTrue(CategoriesWizardUtils.isDepthItem(depthItem));
+ if (depthItem.getChildren().isEmpty()) {
+ int depth = Integer.valueOf(depthItem.getElement().toString()).intValue();
+ if (depth != 0) {
+ incompleteDepth.add(Integer.valueOf(depth));
+ }
+ }
+ }
+ }
+ if (incompleteDepth.isEmpty()) {
+ setErrorMessage(null);
+ } else {
+ StringBuilder builder = new StringBuilder(NLS.bind("The following depths don't have categories {0}", incompleteDepth.toString()));
+ setErrorMessage(builder.toString());
+ }
+
+ setPageComplete(getErrorMessage() == null);
+ }
+}

Back to the top