Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Le Fevre2016-12-06 14:28:08 +0000
committerFrancois Le Fevre2016-12-15 13:46:26 +0000
commit7bd88035738b787152afc12d452ed1634c45105f (patch)
tree0683e62b9b7b7883631ff6bfd3b40d3b6aacb762 /plugins/infra
parent379d660168afcde15f3c14f53617b1185ff0c6b9 (diff)
downloadorg.eclipse.papyrus-7bd88035738b787152afc12d452ed1634c45105f.tar.gz
org.eclipse.papyrus-7bd88035738b787152afc12d452ed1634c45105f.tar.xz
org.eclipse.papyrus-7bd88035738b787152afc12d452ed1634c45105f.zip
Bug 508746 - [Toolsmiths] dispatching customization nattable plugins in
there own functional unit Change-Id: Ie7a1621ebe5478885f1ca8ab99d0067470d5929a Signed-off-by: Francois Le Fevre <francois.le-fevre@cea.fr>
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.classpath7
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.project28
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.settings/org.eclipse.jdt.core.prefs291
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF39
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/OSGI-INF/l10n/bundle.properties3
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/about.html28
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/build.properties10
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/icons/papyrusNattableconfigurationWizban.pngbin0 -> 2386 bytes
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/icons/wizard_icon.pngbin0 -> 319 bytes
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/plugin.properties5
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/plugin.xml69
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/pom.xml14
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/Activator.java78
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/FeatureFillingConfigurationDialog.java256
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/PasteEObjectConfigurationDialog.java313
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/TreeFillingConfigurationDialog.java657
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java60
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/helper/TableConfigurationHelper.java358
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/messages/Messages.java161
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/messages/messages.properties64
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/AbstractAxisConfigurationWizardPage.java880
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/AbstractTableConfigurationWizardPage.java41
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/ColumnConfigurationWizardPage.java240
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/EditGenericNattableConfigurationFieldsNattableWizardPage.java838
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/NattableConfigurationFileCreationPage.java122
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/RowConfigurationWizardPage.java563
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/SlaveConfigurationWizardPage.java732
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NameSimplifier.java99
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NattableConfigurationConstants.java88
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NattableConfigurationEditingSupport.java82
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/CreateAndEditTableConfigurationWizard.java181
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/CreateNattableConfigurationProjectWizard.java223
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/EditTableConfigurationWizard.java231
-rwxr-xr-xplugins/infra/nattable/pom.xml1
35 files changed, 6830 insertions, 0 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.classpath b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.classpath
new file mode 100644
index 00000000000..098194ca4b7
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.project b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.project
new file mode 100644
index 00000000000..61f2e67f3bd
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.customization.nattableconfiguration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f08be2b06c4
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,291 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=260
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=260
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..954281dbc31
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,68 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Papyrus
+cleanup_settings_version=2
+eclipse.preferences.version=1
+formatter_profile=_Papyrus
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ae89ae09070
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF
@@ -0,0 +1,39 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.customization.nattableconfiguration;singleton:=true
+Bundle-Version: 2.0.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.customization.nattableconfiguration.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.transaction;bundle-version="1.9.0",
+ org.eclipse.ui.forms,
+ org.eclipse.jface,
+ org.eclipse.swt,
+ org.eclipse.emf.common.ui,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.pde.ui,
+ org.eclipse.nebula.widgets.nattable.core;bundle-version="1.4.0",
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.core;bundle-version="2.2.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.nattable.model.edit;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.ui.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.customization.nattableconfiguration,
+ org.eclipse.papyrus.customization.nattableconfiguration.edition,
+ org.eclipse.papyrus.customization.nattableconfiguration.handlers,
+ org.eclipse.papyrus.customization.nattableconfiguration.helper,
+ org.eclipse.papyrus.customization.nattableconfiguration.messages,
+ org.eclipse.papyrus.customization.nattableconfiguration.pages,
+ org.eclipse.papyrus.customization.nattableconfiguration.utils
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Description: %Bundle-Description
+Bundle-Localization: plugin
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/OSGI-INF/l10n/bundle.properties b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..ad72e5822fa
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.infra.nattable.wizard
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Nattable configuration \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/about.html b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/build.properties b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/build.properties
new file mode 100644
index 00000000000..c68a0b3eaaa
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ about.html,\
+ OSGI-INF/,\
+ plugin.properties
+src.includes = about.html
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/icons/papyrusNattableconfigurationWizban.png b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/icons/papyrusNattableconfigurationWizban.png
new file mode 100644
index 00000000000..35da2fed4ce
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/icons/papyrusNattableconfigurationWizban.png
Binary files differ
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/icons/wizard_icon.png b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/icons/wizard_icon.png
new file mode 100644
index 00000000000..9e5fd4be268
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/icons/wizard_icon.png
Binary files differ
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/plugin.properties b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/plugin.properties
new file mode 100644
index 00000000000..e1812e03f29
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/plugin.properties
@@ -0,0 +1,5 @@
+#Properties file for org.eclipse.papyrus.uml.nattable
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Customization of Nattable Configuration
+
+Bundle-Description = This plugin provides the Wizard used to create a new project with a Papyrus Table Configuration, to create a new Papyrus Table Configuration inside an existing project and the handler to edit an exiting table configuration \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/plugin.xml
new file mode 100644
index 00000000000..baaf57e1f28
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/plugin.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu">
+ <command
+ commandId="org.eclipse.papyrus.infra.nattable.edit.configuration.wizard"
+ label="Edit Table Configuration"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <adapt
+ type="org.eclipse.core.resources.IFile">
+ <test
+ property="org.eclipse.core.resources.extension"
+ value="nattableconfiguration">
+ </test>
+ </adapt>
+ </iterate>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.papyrus.customization.nattableconfiguration.handlers.EditExistingTableConfigurationWizardHandler"
+ id="org.eclipse.papyrus.infra.nattable.edit.configuration.wizard"
+ name="Edit Table Configuration Wizard">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.eclipse.papyrus.infra.nattable.edit.configuration.wizard"
+ icon="icons/wizard_icon.png">
+ </image>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.papyrus.wizards.category"
+ class="org.eclipse.papyrus.customization.nattableconfiguration.wizards.CreateNattableConfigurationProjectWizard"
+ hasPages="true"
+ icon="icons/wizard_icon.png"
+ id="org.eclipse.papyrus.customization.nattableconfiguration.createconfigurationproject"
+ name="Create Papyrus Table Configuration Project"
+ preferredPerspectives="org.eclipse.papyrus.infra.core.perspective"
+ project="true">
+ </wizard>
+ <wizard
+ category="org.eclipse.papyrus.wizards.category"
+ class="org.eclipse.papyrus.customization.nattableconfiguration.wizards.CreateAndEditTableConfigurationWizard"
+ hasPages="true"
+ icon="icons/wizard_icon.png"
+ id="org.eclipse.papyrus.customization.nattableconfiguration.createandeditconfigurationfile"
+ name="Create Papyrus Table Configuration File"
+ preferredPerspectives="org.eclipse.papyrus.infra.core.perspective"
+ project="true">
+ </wizard>
+ </extension>
+
+</plugin>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/pom.xml
new file mode 100644
index 00000000000..91d8a643636
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-nattable</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.customization.nattableconfiguration</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/Activator.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/Activator.java
new file mode 100644
index 00000000000..347b9c03825
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/Activator.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+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.customization.nattableconfiguration"; //$NON-NLS-1$
+
+ /**
+ * The shared instance
+ */
+ private static Activator plugin;
+
+
+ public static LogHelper log;
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/FeatureFillingConfigurationDialog.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/FeatureFillingConfigurationDialog.java
new file mode 100644
index 00000000000..201fa84b58b
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/FeatureFillingConfigurationDialog.java
@@ -0,0 +1,256 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.edition;
+
+import java.util.Collections;
+
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.EStructuralFeatureValueFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.StringComparator;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.editors.ITreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.providers.CompoundFilteredRestrictedContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.FlattenableRestrictedFilteredContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IRestrictedContentProvider;
+import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * The dialog which allow to edit the feature filling configuration features.
+ */
+public class FeatureFillingConfigurationDialog extends SelectionDialog {
+
+ /**
+ * A copy of initial feature filling configuration to modify with this dialog.
+ */
+ protected final EStructuralFeatureValueFillingConfiguration modifiedFeatureFillingConf;
+
+ /**
+ * The label provider for the UML elements.
+ */
+ protected final ILabelProvider labelProvider;
+
+ /**
+ * The CLabel composite for the listen feature.
+ */
+ protected CLabel listenFeatureText;
+
+ /**
+ * The browse button which allow to edit the listen feature.
+ */
+ protected Button browseValuesButton;
+
+ /**
+ * The delete button which allow to unset the listen feature value.
+ */
+ protected Button deleteValuesButton;
+
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * The parent shell of the dialog.
+ * @param featureFillingConf
+ * The initial feature filling configuration to edit.
+ */
+ public FeatureFillingConfigurationDialog(final Shell parentShell, final EStructuralFeatureValueFillingConfiguration featureFillingConf) {
+ super(parentShell);
+ this.modifiedFeatureFillingConf = EcoreUtil.copy(featureFillingConf);
+ setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.FeatureFillingConfigurationDialog_featureFillingConfigurationDialogName);
+
+ LabelProviderService labelProviderService = new LabelProviderServiceImpl();
+ try {
+ labelProviderService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ labelProvider = labelProviderService.getLabelProvider();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#create()
+ */
+ @Override
+ public void create() {
+ super.create();
+ getShell().setImage(Activator.getDefault().getImage(NattableConfigurationConstants.PAPYRUS_ICON_PATH));
+
+ final Composite parent = new Composite((Composite) getDialogArea(), SWT.NONE);
+ parent.setLayout(new GridLayout(4, false));
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+ getShell().setSize(600, 400);
+
+ // Create the fields
+ createFields(parent);
+
+ getShell().pack();
+ Point size = getShell().getSize();
+ int minWidth = 600;
+ if (size.x < minWidth) {
+ size.x = minWidth;
+ }
+ getShell().setSize(size);
+ }
+
+ /**
+ * This allows to create the fields to edit the feature filling configuration.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createFields(final Composite parent) {
+ // Create the listen feature labels and dialog
+ final Label listenFeatureLabel = new Label(parent, SWT.NONE);
+ listenFeatureLabel.setText(Messages.FeatureFillingConfigurationDialog_listenFeature);
+ listenFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ listenFeatureText = new CLabel(parent, SWT.BORDER);
+ listenFeatureText.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ browseValuesButton = new Button(parent, SWT.PUSH);
+ browseValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.BROWSE_ICON_PATH));
+ browseValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_EditValue);
+ browseValuesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ browseAction(modifiedFeatureFillingConf.getListenFeature());
+ }
+ });
+
+ deleteValuesButton = new Button(parent, SWT.PUSH);
+ deleteValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH));
+ deleteValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_UnsetValue);
+ deleteValuesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ setListenFeature(null);
+ }
+ });
+
+ setListenFeature(modifiedFeatureFillingConf.getListenFeature());
+ }
+
+ /**
+ * The action executed when the "browse" button is selected Choose a value
+ * from a selection of already created objects.
+ *
+ * @param value
+ * The initial value of the listen feature.
+ */
+ protected void browseAction(final Object value) {
+ final ITreeSelectorDialog dialog = new TreeSelectorDialog(getShell()) {
+ @Override
+ protected void initViewerAndProvider() {
+ super.initViewerAndProvider();
+ // Set a comparator to sort the tree viewer
+ getViewer().setComparator(new ViewerComparator(new StringComparator()));// should always be string element
+ }
+ };
+ dialog.setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.FeatureFillingConfigurationDialog_listenFeatureDialogName);
+
+ final CompoundFilteredRestrictedContentProvider contentProvider = new CompoundFilteredRestrictedContentProvider();
+ final ReferenceSelector selector = new ReferenceSelector(false) {
+
+ @Override
+ public void createControls(Composite parent) {
+ super.createControls(parent);
+ this.treeViewer.setComparator(new ViewerComparator(new StringComparator()));// should always be string element
+ }
+ };
+
+ selector.setLabelProvider(labelProvider);
+ selector.setContentProvider(contentProvider);
+ final ITreeContentProvider treeContentProvider = new FlattenableRestrictedFilteredContentProvider((IRestrictedContentProvider) contentProvider, selector) {
+
+ @Override
+ public boolean isValidValue(final Object element) {
+ // EMF dependency, must not be done here, it should be better with a new content provider service
+ return element instanceof EReference && ((EReference) element).isMany() && element != EcorePackage.eINSTANCE.getEModelElement_EAnnotations();
+ }
+ };
+
+ dialog.setContentProvider(treeContentProvider);
+ dialog.setLabelProvider(labelProvider);
+ if (null != value) {
+ dialog.setInitialElementSelections(Collections.singletonList(value));
+ }
+ int result = dialog.open();
+ if (Window.OK == result) {
+ Object[] newValue = dialog.getResult();
+ if (null == newValue) {
+ return;
+ }
+
+ if (0 == newValue.length) {
+ setListenFeature(null);
+ } else {
+ setListenFeature((EStructuralFeature) newValue[0]);
+ }
+ }
+ }
+
+ /**
+ * This allows to set the listen feature and refresh the button corresponding to the listen feature value.
+ *
+ * @param structuralFeature
+ * The structural feature to set.
+ */
+ protected void setListenFeature(final EStructuralFeature structuralFeature) {
+ if (null == modifiedFeatureFillingConf.getListenFeature() || !structuralFeature.equals(modifiedFeatureFillingConf.getListenFeature())) {
+ modifiedFeatureFillingConf.setListenFeature(structuralFeature);
+ }
+ listenFeatureText.setImage(labelProvider.getImage(modifiedFeatureFillingConf.getListenFeature()));
+ listenFeatureText.setText(labelProvider.getText(modifiedFeatureFillingConf.getListenFeature()));
+
+ deleteValuesButton.setEnabled(null != structuralFeature);
+ }
+
+ /**
+ * Returns the modified feature filling configuration.
+ *
+ * @return The modified feature filling configuration.
+ */
+ public EStructuralFeatureValueFillingConfiguration getModifiedFeatureFillingConfiguration() {
+ return modifiedFeatureFillingConf;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/PasteEObjectConfigurationDialog.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/PasteEObjectConfigurationDialog.java
new file mode 100644
index 00000000000..032c7cfa743
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/PasteEObjectConfigurationDialog.java
@@ -0,0 +1,313 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.edition;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.StringComparator;
+import org.eclipse.papyrus.infra.services.edit.utils.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.editors.ITreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.providers.CompoundFilteredRestrictedContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.FlattenableRestrictedFilteredContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IRestrictedContentProvider;
+import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * The dialog which allow to edit the paste configuration features.
+ */
+public class PasteEObjectConfigurationDialog extends SelectionDialog {
+
+ /**
+ * A copy of initial paste configuration to modify with this dialog.
+ */
+ protected final PasteEObjectConfiguration modifiedPasteConfiguration;
+
+ /**
+ * The label provider for the UML elements.
+ */
+ protected final ILabelProvider labelProvider;
+
+ /**
+ * The CLabel composite for the containment feature.
+ */
+ protected CLabel containmentFeatureText;
+
+ /**
+ * The browse button which allow to edit the containment feature.
+ */
+ protected Button browseValuesButton;
+
+ /**
+ * The delete button which allow to unset the containment feature value.
+ */
+ protected Button deleteValuesButton;
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * The parent shell of the dialog.
+ * @param pasteConfiguration
+ * The initial paste configuration to edit.
+ */
+ public PasteEObjectConfigurationDialog(final Shell parentShell, final PasteEObjectConfiguration pasteConfiguration) {
+ super(parentShell);
+ this.modifiedPasteConfiguration = EcoreUtil.copy(pasteConfiguration);
+ setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.PasteEObjectConfigurationDialog_pasteEObjectConfigurationDialogName);
+
+ LabelProviderService labelProviderService = new LabelProviderServiceImpl();
+ try {
+ labelProviderService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ labelProvider = labelProviderService.getLabelProvider();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#create()
+ */
+ @Override
+ public void create() {
+ super.create();
+ getShell().setImage(Activator.getDefault().getImage(NattableConfigurationConstants.PAPYRUS_ICON_PATH));
+
+ final Composite parent = new Composite((Composite) getDialogArea(), SWT.NONE);
+ parent.setLayout(new GridLayout(4, false));
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+ getShell().setSize(600, 400);
+
+ // Create the fields
+ createFields(parent);
+
+ getShell().pack();
+ Point size = getShell().getSize();
+ int minWidth = 600;
+ if (size.x < minWidth) {
+ size.x = minWidth;
+ }
+ getShell().setSize(size);
+ }
+
+ /**
+ * This allows to create the fields to edit the paste configuration.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createFields(final Composite parent) {
+ // Create the detached mode checkbox
+ final Label detachedModeLabel = new Label(parent, SWT.NONE);
+ detachedModeLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.PasteEObjectConfigurationDialog_detachedModeLabel);
+ detachedModeLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ final Button detachedModeButton = new Button(parent, SWT.CHECK);
+ detachedModeButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 3, 1));
+ detachedModeButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ modifiedPasteConfiguration.setDetachedMode(detachedModeButton.getSelection());
+ }
+ });
+ detachedModeButton.setSelection(modifiedPasteConfiguration.isDetachedMode());
+
+ // Create the pasted element id combo box
+ final Label pastedElementIdLabel = new Label(parent, SWT.NONE);
+ pastedElementIdLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.PasteEObjectConfigurationDialog_pastedElementIdLabel);
+ pastedElementIdLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ final Combo pastedElementIdCombo = new Combo(parent, SWT.READ_ONLY);
+ pastedElementIdCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 3, 1));
+ pastedElementIdCombo.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ modifiedPasteConfiguration.setPastedElementId(pastedElementIdCombo.getText());
+ }
+ });
+
+ final Collection<IElementType> possibleValues = ElementTypeUtils.getAllExistingElementTypes();
+ final List<String> possibleValuesAsString = new ArrayList<String>(possibleValues.size());
+
+ int indexToSelect = -1;
+ int index = 0;
+
+ for (final IElementType elementType : possibleValues) {
+ possibleValuesAsString.add(elementType.getDisplayName());
+ if (elementType.getDisplayName().equals(modifiedPasteConfiguration.getPastedElementId())) {
+ indexToSelect = index;
+ }
+ index++;
+ }
+
+ pastedElementIdCombo.setItems((String[]) possibleValuesAsString.toArray(new String[possibleValuesAsString.size()]));
+ if (-1 != indexToSelect) {
+ pastedElementIdCombo.select(indexToSelect);
+ }
+
+ // Create the containment feature labels and dialog
+ final Label containmentFeatureLabel = new Label(parent, SWT.NONE);
+ containmentFeatureLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.PasteEObjectConfigurationDialog_containmentFeatureLabel);
+ containmentFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ containmentFeatureText = new CLabel(parent, SWT.BORDER);
+ containmentFeatureText.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ browseValuesButton = new Button(parent, SWT.PUSH);
+ browseValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.BROWSE_ICON_PATH));
+ browseValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_EditValue);
+ browseValuesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ browseAction(modifiedPasteConfiguration.getPasteElementContainementFeature());
+ }
+ });
+
+ deleteValuesButton = new Button(parent, SWT.PUSH);
+ deleteValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH));
+ deleteValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_UnsetValue);
+ deleteValuesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ setPasteElementContainementFeature(null);
+ }
+ });
+
+ setPasteElementContainementFeature(modifiedPasteConfiguration.getPasteElementContainementFeature());
+
+ // TODO : Post actions
+ }
+
+ /**
+ * The action executed when the "browse" button is selected Choose a value
+ * from a selection of already created objects.
+ *
+ * @param value
+ * The initial value of the containment feature.
+ */
+ protected void browseAction(final Object value) {
+ ITreeSelectorDialog dialog = new TreeSelectorDialog(getShell()) {
+ @Override
+ protected void initViewerAndProvider() {
+ super.initViewerAndProvider();
+ // Set a comparator to sort the tree viewer
+ getViewer().setComparator(new ViewerComparator(new StringComparator()));// should always be string element
+ }
+ };
+ dialog.setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.PasteEObjectConfigurationDialog_containmentFeatureDialogName);
+
+ final CompoundFilteredRestrictedContentProvider contentProvider = new CompoundFilteredRestrictedContentProvider();
+ final ReferenceSelector selector = new ReferenceSelector(false) {
+
+ @Override
+ public void createControls(final Composite parent) {
+ super.createControls(parent);
+ this.treeViewer.setComparator(new ViewerComparator(new StringComparator()));// should always be string element
+ }
+ };
+
+ selector.setLabelProvider(labelProvider);
+ selector.setContentProvider(contentProvider);
+ final ITreeContentProvider treeContentProvider = new FlattenableRestrictedFilteredContentProvider((IRestrictedContentProvider) contentProvider, selector) {
+
+ @Override
+ public boolean isValidValue(final Object element) {
+ // EMF dependency, must not be done here, it should be better with a new content provider service
+ return element instanceof EReference && ((EReference) element).isMany() && element != EcorePackage.eINSTANCE.getEModelElement_EAnnotations();
+ }
+ };
+
+ dialog.setContentProvider(treeContentProvider);
+ dialog.setLabelProvider(labelProvider);
+ if (null != value) {
+ dialog.setInitialElementSelections(Collections.singletonList(value));
+ }
+ int result = dialog.open();
+ if (Window.OK == result) {
+ Object[] newValue = dialog.getResult();
+ if (null == newValue) {
+ return;
+ }
+
+ if (0 == newValue.length) {
+ setPasteElementContainementFeature(null);
+ } else {
+ Object selectedValue = newValue[0];
+ setPasteElementContainementFeature((EStructuralFeature) selectedValue);
+ }
+ }
+ }
+
+ /**
+ * This allows to set the containment feature and refresh the button corresponding to the containment feature value.
+ *
+ * @param structuralFeature
+ * The structural feature to set.
+ */
+ protected void setPasteElementContainementFeature(final EStructuralFeature structuralFeature) {
+ if (null == modifiedPasteConfiguration.getPasteElementContainementFeature() || !structuralFeature.equals(modifiedPasteConfiguration.getPasteElementContainementFeature())) {
+ modifiedPasteConfiguration.setPasteElementContainementFeature(structuralFeature);
+ }
+ containmentFeatureText.setImage(labelProvider.getImage(modifiedPasteConfiguration.getPasteElementContainementFeature()));
+ containmentFeatureText.setText(labelProvider.getText(modifiedPasteConfiguration.getPasteElementContainementFeature()));
+
+ deleteValuesButton.setEnabled(null != structuralFeature);
+ }
+
+ /**
+ * Returns the modified paste configuration.
+ *
+ * @return The modified paste configuration.
+ */
+ public PasteEObjectConfiguration getModifiedPasteEObjectConfiguration() {
+ return modifiedPasteConfiguration;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/TreeFillingConfigurationDialog.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/TreeFillingConfigurationDialog.java
new file mode 100644
index 00000000000..f85f7110e01
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/edition/TreeFillingConfigurationDialog.java
@@ -0,0 +1,657 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.edition;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NameSimplifier;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EObjectAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EOperationAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EStructuralFeatureAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.FeatureIdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.StringComparator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.editors.ITreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.providers.CompoundFilteredRestrictedContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.FlattenableRestrictedFilteredContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IRestrictedContentProvider;
+import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+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.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * The dialog which allow to edit the tree filling configuration features.
+ */
+public class TreeFillingConfigurationDialog extends SelectionDialog {
+
+ /**
+ * The list of possible axis creation.
+ */
+ protected final static List<String> possibleAxisCreation = new ArrayList<String>();
+
+ static {
+ possibleAxisCreation.add("EObjectAxis"); //$NON-NLS-1$
+ possibleAxisCreation.add("EOperationAxis"); //$NON-NLS-1$
+ possibleAxisCreation.add("EStructuralFeatureAxis"); //$NON-NLS-1$
+ possibleAxisCreation.add("FeatureIdAxis"); //$NON-NLS-1$
+ possibleAxisCreation.add("ObjectAxis"); //$NON-NLS-1$
+ }
+
+
+ /**
+ * A copy of initial tree filling configuration to modify with this dialog.
+ */
+ protected final TreeFillingConfiguration modifiedTreefillingConfiguration;
+
+ /**
+ * The list of existing label provider configurations for the tree filling configuration label provider reference.
+ */
+ protected final List<ILabelProviderConfiguration> existingLabelProviderConfigurations;
+
+ /**
+ * The list of existing paste configurations for the tree filling configuration paste configuration reference.
+ */
+ protected final List<PasteEObjectConfiguration> existingPasteConfigurations;
+
+ /**
+ * The label provider for the UML elements.
+ */
+ protected final ILabelProvider labelProvider;
+
+ /**
+ * The stack layout which allow to display the correct element composite corresponding to the type of axis.
+ */
+ protected StackLayout stackLayout;
+
+ /**
+ * The parent element composite which contains the stack layout.
+ */
+ protected Composite compositeElement;
+
+ /**
+ * The composite for the element referenced from the axis.
+ */
+ protected Composite compositeElementReference;
+
+ /**
+ * The composite for the string element from the axis.
+ */
+ protected Composite compositeElementString;
+
+ /**
+ * The CLabel composite for the element reference.
+ */
+ protected CLabel elementCLabel;
+
+ /**
+ * The CLabel composite for the element string.
+ */
+ protected Text elementText;
+
+ /**
+ * The browse button which allow to edit the element.
+ */
+ protected Button browseValuesButton;
+
+ /**
+ * The delete button which allow to unset the element value.
+ */
+ protected Button deleteValuesButton;
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * The parent shell of the dialog.
+ * @param treefillingConfiguration
+ * The initial tree filling configuration to edit.
+ * @param existingLabelProvidersConfiguration
+ * The list of existing label provider configurations for the tree filling configuration label provider reference.
+ * @param existingPasteConfigurations
+ * The list of existing paste configurations for the tree filling configuration paste configuration reference.
+ */
+ public TreeFillingConfigurationDialog(final Shell parentShell, final TreeFillingConfiguration treefillingConfiguration, final List<ILabelProviderConfiguration> existingLabelProvidersConfiguration,
+ final List<PasteEObjectConfiguration> existingPasteConfigurations) {
+ super(parentShell);
+ this.modifiedTreefillingConfiguration = EcoreUtil.copy(treefillingConfiguration);
+ this.existingLabelProviderConfigurations = existingLabelProvidersConfiguration;
+ this.existingPasteConfigurations = existingPasteConfigurations;
+ setTitle(Messages.TreeFillingConfigurationDialog_treeFillingConfigurationDialogName);
+
+ LabelProviderService labelProviderService = new LabelProviderServiceImpl();
+ try {
+ labelProviderService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ labelProvider = labelProviderService.getLabelProvider();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#create()
+ */
+ @Override
+ public void create() {
+ super.create();
+ getShell().setImage(Activator.getDefault().getImage(NattableConfigurationConstants.PAPYRUS_ICON_PATH));
+
+ final Composite parent = new Composite((Composite) getDialogArea(), SWT.NONE);
+ parent.setLayout(new GridLayout(4, false));
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+ getShell().setSize(600, 400);
+
+ // Create the fields
+ createFields(parent);
+
+ getShell().pack();
+ Point size = getShell().getSize();
+ int minWidth = 600;
+ if (size.x < minWidth) {
+ size.x = minWidth;
+ }
+ getShell().setSize(size);
+ }
+
+ /**
+ * This allows to create the fields to edit the tree filling configuration.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createFields(final Composite parent) {
+ // Create the depth level combo
+ createDepthLevelCombo(parent);
+
+ // Create the label provider configuration combo
+ createLabelProviderCombo(parent);
+
+ // Create the paste configuration combo
+ createPasteConfigurationCombo(parent);
+
+ // Create the axis group management
+ createAxisGroup(parent);
+
+ setAxisUsedAsAxisProvider(modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider());
+ if (null != modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider()) {
+ setAxisElement(modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider().getElement());
+ }
+
+ }
+
+ /**
+ * This allows to create the depth level combo.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createDepthLevelCombo(final Composite parent) {
+ final Label depthLabel = new Label(parent, SWT.NONE);
+ depthLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_depthLabel);
+ depthLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ final Combo depthCombo = new Combo(parent, SWT.READ_ONLY);
+ depthCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 3, 1));
+ depthCombo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ modifiedTreefillingConfiguration.setDepth(Integer.valueOf(depthCombo.getText()));
+ }
+ });
+ final Collection<String> possiblesDepth = new ArrayList<String>(10);
+ for (int i = 0; i < 10; i++) {
+ possiblesDepth.add(String.valueOf(i));
+ }
+ depthCombo.setItems((String[]) possiblesDepth.toArray(new String[possiblesDepth.size()]));
+ depthCombo.select(modifiedTreefillingConfiguration.getDepth());
+ }
+
+ /**
+ * This allows to create the label provider combo.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createLabelProviderCombo(final Composite parent) {
+ final Label labelProviderConfigurationLabel = new Label(parent, SWT.NONE);
+ labelProviderConfigurationLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_labelProviderLabel);
+ labelProviderConfigurationLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ final Combo labelProviderConfigurationCombo = new Combo(parent, SWT.READ_ONLY);
+ labelProviderConfigurationCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 3, 1));
+ labelProviderConfigurationCombo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ if (labelProviderConfigurationCombo.getText().isEmpty()) {
+ modifiedTreefillingConfiguration.setLabelProvider(null);
+ } else {
+ modifiedTreefillingConfiguration.setLabelProvider(existingLabelProviderConfigurations.get(labelProviderConfigurationCombo.getSelectionIndex() - 1));
+ }
+ }
+ });
+
+ final List<String> labelProviders = new ArrayList<String>(existingLabelProviderConfigurations.size());
+ for (final ILabelProviderConfiguration existingLabelProviderConf : existingLabelProviderConfigurations) {
+ final String className = existingLabelProviderConf.getClass().getSimpleName();
+ if (NameSimplifier.labelProviderConfigurationNames.containsKey(className)) {
+ final String shortLabelProviderName = NameSimplifier.labelProviderConfigurationNames.get(className);
+ String finalShortLabelProviderName = shortLabelProviderName;
+ int index = 1;
+ while (labelProviders.contains(finalShortLabelProviderName)) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(shortLabelProviderName);
+ builder.append("_"); //$NON-NLS-1$
+ builder.append(index);
+ finalShortLabelProviderName = builder.toString();
+ index++;
+ }
+ labelProviders.add(finalShortLabelProviderName);
+ }
+ }
+
+ labelProviderConfigurationCombo.setItems((String[]) labelProviders.toArray(new String[labelProviders.size()]));
+ if (null != modifiedTreefillingConfiguration.getLabelProvider()) {
+ int index = existingLabelProviderConfigurations.indexOf(modifiedTreefillingConfiguration.getLabelProvider());
+ labelProviderConfigurationCombo.select(index);
+ }
+ }
+
+ /**
+ * This allows to create the paste configuration combo.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createPasteConfigurationCombo(final Composite parent) {
+ final Label pasteConfigurationLabel = new Label(parent, SWT.NONE);
+ pasteConfigurationLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_pasteConfigurationLabel);
+ pasteConfigurationLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ final Combo pasteConfigurationCombo = new Combo(parent, SWT.READ_ONLY);
+ pasteConfigurationCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 3, 1));
+ pasteConfigurationCombo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ if (pasteConfigurationCombo.getText().isEmpty()) {
+ modifiedTreefillingConfiguration.setPasteConfiguration(null);
+ } else {
+ modifiedTreefillingConfiguration.setPasteConfiguration(existingPasteConfigurations.get(pasteConfigurationCombo.getSelectionIndex() - 1));
+ }
+ }
+ });
+
+ final List<String> pasteConfigurations = new ArrayList<String>(existingPasteConfigurations.size());
+ pasteConfigurations.add(""); //$NON-NLS-1$
+ for (final PasteEObjectConfiguration existingPasteConf : existingPasteConfigurations) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("Paste Conf: '"); //$NON-NLS-1$
+ builder.append(existingPasteConf.getPastedElementId());
+ builder.append("' in '"); //$NON-NLS-1$
+ builder.append(existingPasteConf.getPasteElementContainementFeature().getName());
+ builder.append("'"); //$NON-NLS-1$
+ pasteConfigurations.add(builder.toString());
+ }
+
+ pasteConfigurationCombo.setItems((String[]) pasteConfigurations.toArray(new String[pasteConfigurations.size()]));
+ if (null != modifiedTreefillingConfiguration.getPasteConfiguration()) {
+ int index = existingPasteConfigurations.indexOf(modifiedTreefillingConfiguration.getPasteConfiguration());
+ pasteConfigurationCombo.select(index);
+ }
+ }
+
+ /**
+ * This allows to create the axis group.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createAxisGroup(final Composite parent) {
+ final Group axisGroup = new Group(parent, SWT.NONE);
+ axisGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 4, 1));
+ axisGroup.setLayout(new GridLayout(4, false));
+ axisGroup.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_axisUsedAsAxisProviderLabel);
+
+ // Create the paste configuration combo
+ final Label axisTypeLabel = new Label(axisGroup, SWT.NONE);
+ axisTypeLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_typeLabel);
+ axisTypeLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ final Combo axisTypeCombo = new Combo(axisGroup, SWT.READ_ONLY);
+ axisTypeCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 3, 1));
+ axisTypeCombo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ final IAxis existingAxis = modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider();
+
+ if (axisTypeCombo.getText().isEmpty() && null != existingAxis) {
+ setAxisUsedAsAxisProvider(null);
+ } else {
+ if (null == existingAxis || !existingAxis.getClass().getSimpleName().substring(0, existingAxis.getClass().getSimpleName().length() - 4).equals(axisTypeCombo.getText())) {
+ IAxis recreatedAxis = null;
+ if ("EObjectAxis".equals(axisTypeCombo.getText())) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createEObjectAxis();
+ } else if ("EOperationAxis".equals(axisTypeCombo.getText())) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createEOperationAxis();
+ } else if ("EStructuralFeatureAxis".equals(axisTypeCombo.getText())) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createEStructuralFeatureAxis();
+ } else if ("FeatureIdAxis".equals(axisTypeCombo.getText())) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createFeatureIdAxis();
+ } else if ("ObjectAxis".equals(axisTypeCombo.getText())) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createObjectIdAxis();
+ }
+
+ if (null != existingAxis) {
+ recreatedAxis.setAlias(existingAxis.getAlias());
+ }
+
+ setAxisUsedAsAxisProvider(recreatedAxis);
+ }
+ }
+ }
+ });
+
+ // Add the possibility to reset it
+ final List<String> possiblesAxis = new ArrayList<String>(possibleAxisCreation);
+ possiblesAxis.add(0, ""); //$NON-NLS-1$
+
+ axisTypeCombo.setItems((String[]) possiblesAxis.toArray(new String[possiblesAxis.size()]));
+ boolean foundAxis = false;
+
+ // Manage the initial value corresponding to the current axis used
+ if (null != modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider()) {
+ final IAxis existingAxis = modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider();
+ final String existingAxisClassName = existingAxis.getClass().getSimpleName().substring(0, existingAxis.getClass().getSimpleName().length() - 4);
+
+ for (int index = 0; index < possiblesAxis.size() && !foundAxis; index++) {
+ final String axisClass = possiblesAxis.get(index);
+
+ if (existingAxisClassName.equals(axisClass)) {
+ axisTypeCombo.select(index);
+ foundAxis = true;
+ }
+ }
+ } else {
+ axisTypeCombo.select(0);
+ }
+
+ // Create the stack layout to display the composite string element or the reference element
+ stackLayout = new StackLayout();
+
+ // The parent composite for the element value
+ compositeElement = new Composite(axisGroup, SWT.NONE);
+ compositeElement.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));
+ compositeElement.setLayout(stackLayout);
+
+ // Create the composite element reference for the element reference (contrary to String value)
+ compositeElementReference = new Composite(compositeElement, SWT.NONE);
+ compositeElementReference.setLayout(new GridLayout(4, false));
+ // Create the element labels and dialog for the reference
+ final Label elementLabel = new Label(compositeElementReference, SWT.NONE);
+ elementLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_elementLabel);
+ elementLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ elementCLabel = new CLabel(compositeElementReference, SWT.BORDER);
+ elementCLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ browseValuesButton = new Button(compositeElementReference, SWT.PUSH);
+ browseValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.BROWSE_ICON_PATH));
+ browseValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_EditValue);
+ browseValuesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ Object element = null;
+ final IAxis existingAxis = modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider();
+
+ if (existingAxis instanceof EObjectAxis) {
+ element = ((EObjectAxis) existingAxis).getElement();
+ } else if (existingAxis instanceof EStructuralFeatureAxis) {
+ element = ((EStructuralFeatureAxis) existingAxis).getElement();
+ } else if (existingAxis instanceof EOperationAxis) {
+ element = ((EOperationAxis) existingAxis).getElement();
+ }
+ browseAction(element);
+ }
+ });
+
+ deleteValuesButton = new Button(compositeElementReference, SWT.PUSH);
+ deleteValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH));
+ deleteValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_UnsetValue);
+ deleteValuesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ setAxisElement(null);
+ }
+ });
+
+ // Create the composite element reference for the element reference (contrary to String value)
+ compositeElementString = new Composite(compositeElement, SWT.NONE);
+ compositeElementString.setLayout(new GridLayout(4, false));
+ // Create the element label and the text for the string value
+ final Label secondElementLabel = new Label(compositeElementString, SWT.NONE);
+ secondElementLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_elementLabel);
+ secondElementLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ elementText = new Text(compositeElementString, SWT.BORDER);
+ elementText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+ elementText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ setAxisElement(elementText.getText());
+ }
+ });
+ }
+
+ /**
+ * The action executed when the "browse" button is selected Choose a value
+ * from a selection of already created objects
+ */
+ protected void browseAction(final Object value) {
+ final ITreeSelectorDialog dialog = new TreeSelectorDialog(getShell()) {
+ @Override
+ protected void initViewerAndProvider() {
+ super.initViewerAndProvider();
+ // Set a comparator to sort the tree viewer
+ getViewer().setComparator(new ViewerComparator(new StringComparator()));// should always be string element
+ }
+ };
+ dialog.setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_elementDialogName);
+
+ final CompoundFilteredRestrictedContentProvider contentProvider = new CompoundFilteredRestrictedContentProvider() {
+
+ @Override
+ public Object[] getChildren(final Object parentElement) {
+ List<Object> childrenList = Arrays.asList(super.getChildren(parentElement));
+ if (parentElement instanceof EClass) {
+ childrenList = new ArrayList<Object>(childrenList);
+ final EClass eClass = (EClass) parentElement;
+ if (isIgnoringInheritedElements()) {
+ childrenList.addAll(eClass.getEOperations());
+ } else {
+ childrenList.addAll(eClass.getEAllOperations());
+ }
+ childrenList.remove(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
+ }
+ return childrenList.toArray();
+ }
+ };
+ final ReferenceSelector selector = new ReferenceSelector(false) {
+
+ @Override
+ public void createControls(Composite parent) {
+ super.createControls(parent);
+ this.treeViewer.setComparator(new ViewerComparator(new StringComparator()));// should always be string element
+ }
+ };
+
+ selector.setLabelProvider(labelProvider);
+ selector.setContentProvider(contentProvider);
+ final ITreeContentProvider treeContentProvider = new FlattenableRestrictedFilteredContentProvider((IRestrictedContentProvider) contentProvider, selector) {
+
+ @Override
+ public boolean isValidValue(final Object element) {
+ return isTypeNeeded(element);
+ }
+ };
+
+ dialog.setContentProvider(treeContentProvider);
+ dialog.setLabelProvider(labelProvider);
+ if (null != value) {
+ dialog.setInitialElementSelections(Collections.singletonList(value));
+ }
+ int result = dialog.open();
+ if (Window.OK == result) {
+ Object[] newValue = dialog.getResult();
+ if (null == newValue) {
+ return;
+ }
+
+ if (0 == newValue.length) {
+ setAxisElement(null);
+ } else {
+ setAxisElement(newValue[0]);
+ }
+ }
+ }
+
+ /**
+ * This allows to check if the element in dialog must be used for the axis element.
+ *
+ * @param element
+ * The element selected to check.
+ * @return <code>true</code> if the element can be set to the axis, <code>false</code> otherwise.
+ */
+ protected boolean isTypeNeeded(final Object element) {
+ boolean result = false;
+
+ final IAxis existingAxis = modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider();
+ if (null != existingAxis) {
+ result = element != EcorePackage.eINSTANCE.getEModelElement_EAnnotations();
+
+ // Depending to the axis, objects displayed are not the same
+ if (existingAxis instanceof EObjectAxis && result) {
+ result = element instanceof EClass;
+ } else if (existingAxis instanceof EStructuralFeatureAxis && result) {
+ result = element instanceof EStructuralFeature;
+ } else if (existingAxis instanceof EOperationAxis && result) {
+ result = element instanceof EOperation;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * This allows to set the axis and refresh the button corresponding to the axis value.
+ *
+ * @param newAxis
+ * The axis to set to the tree filling configuration.
+ */
+ protected void setAxisUsedAsAxisProvider(final IAxis newAxis) {
+ if (null == modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider() || !modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider().equals(newAxis)) {
+ modifiedTreefillingConfiguration.setAxisUsedAsAxisProvider(newAxis);
+ }
+
+ // This allows to refresh the composite to display for the axis element value
+ stackLayout.topControl = newAxis instanceof FeatureIdAxis ? compositeElementString : compositeElementReference;
+ compositeElement.layout();
+ if (stackLayout.topControl.equals(compositeElementString)) {
+ elementText.setText(null != newAxis && null != newAxis.getElement() ? ((FeatureIdAxis) newAxis).getElement() : ""); //$NON-NLS-1$
+ }
+
+ setAxisElement(null != newAxis ? newAxis.getElement() : null);
+ }
+
+ /**
+ * This allows to set the axis and refresh the button corresponding to the axis value.
+ *
+ * @param newAxis
+ * The axis to set to the tree filling configuration.
+ */
+ protected void setAxisElement(final Object element) {
+ final IAxis existingAxis = modifiedTreefillingConfiguration.getAxisUsedAsAxisProvider();
+ if (null != existingAxis) {
+ if (existingAxis instanceof EObjectAxis && (null == element || element instanceof EObject)) {
+ ((EObjectAxis) existingAxis).setElement((EObject) element);
+ } else if (existingAxis instanceof EStructuralFeatureAxis && (null == element || element instanceof EStructuralFeature)) {
+ ((EStructuralFeatureAxis) existingAxis).setElement((EStructuralFeature) element);
+ } else if (existingAxis instanceof EOperationAxis && (null == element || element instanceof EOperation)) {
+ ((EOperationAxis) existingAxis).setElement((EOperation) element);
+ } else if (existingAxis instanceof FeatureIdAxis && (null == element || element instanceof String)) {
+ ((FeatureIdAxis) existingAxis).setElement((String) element);
+ }
+ }
+
+ // Manage the enabling and displayed composites
+ if (stackLayout.topControl.equals(compositeElementReference)) {
+ elementCLabel.setEnabled(null != existingAxis);
+ elementCLabel.setImage(labelProvider.getImage(element));
+ elementCLabel.setText(labelProvider.getText(element));
+
+ browseValuesButton.setEnabled(null != existingAxis);
+ deleteValuesButton.setEnabled(null != existingAxis && null != element);
+ }
+ }
+
+ /**
+ * Returns the modified tree filling configuration.
+ *
+ * @return The modified tree filling configuration.
+ */
+ public TreeFillingConfiguration getModifiedTreeFillingConfiguration() {
+ return modifiedTreefillingConfiguration;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java
new file mode 100644
index 00000000000..d227167e975
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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 and Bug 49356
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.customization.nattableconfiguration.wizards.EditTableConfigurationWizard;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler used to edit an existing table configuration
+ */
+public class EditExistingTableConfigurationWizardHandler extends AbstractHandler {
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final EditTableConfigurationWizard wizard = new EditTableConfigurationWizard();
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof StructuredSelection) {
+ wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) selection);
+ final WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
+ dialog.open();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ */
+ @Override
+ public void setEnabled(final Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ setBaseEnabled(true);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/helper/TableConfigurationHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/helper/TableConfigurationHelper.java
new file mode 100644
index 00000000000..2009a0140d5
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/helper/TableConfigurationHelper.java
@@ -0,0 +1,358 @@
+/*****************************************************************************
+ * 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:
+ * Vincent LORENZO (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.helper;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.TableDisplayStyle;
+
+/**
+ * This class is a helper to get and edit TableConfiguration values easily, with no command and not editing domain
+ */
+public class TableConfigurationHelper {
+
+ /**
+ * the table configuration we are manipulating
+ */
+ private final TableConfiguration configuration;
+
+ /**
+ * String for not yet supported operation
+ */
+ private static final String NOT_YET_SUPPORTED = "not yet supported"; //$NON-NLS-1$
+ /**
+ * the empty string
+ */
+ public static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ /**
+ * Flat style for axis
+ * Please, notice, than
+ * <ul>
+ * <li>the real implementation works only for Tree Row</li>
+ * <li>this style is declared on the tree, and not on the axis in the metamodel</li>
+ * </ul>
+ *
+ */
+ public static final String AXIS_FLAT_STYLE = "Flat"; //$NON-NLS-1$
+
+ /**
+ * Tree style for axis
+ * Please, notice, than
+ * <ul>
+ * <li>the real implementation works only for Tree Row</li>
+ * <li>this style is declared on the tree, and not on the axis in the metamodel</li>
+ * </ul>
+ *
+ */
+ public static final String AXIS_TREE_STYLE = "Tree"; //$NON-NLS-1$
+
+ /**
+ * Compact Tree style for axis
+ * Please, notice, than
+ * <ul>
+ * <li>the real implementation works only for Tree Row</li>
+ * <li>this style is declared on the tree, and not on the axis in the metamodel</li>
+ * </ul>
+ *
+ */
+ public static final String AXIS_COMPACT_TREE_STYLE = "Compact"; //$NON-NLS-1$
+
+ /**
+ * Large Tree style for axis
+ * Please, notice, than
+ * <ul>
+ * <li>the real implementation works only for Tree Row</li>
+ * <li>this style is declared on the tree, and not on the axis in the metamodel</li>
+ * </ul>
+ *
+ */
+ public static final String AXIS_LARGE_TREE_STYLE = "Large"; //$NON-NLS-1$
+
+
+
+ /**
+ * Constructor.
+ *
+ */
+ public TableConfigurationHelper(final TableConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+
+ /**
+ * Declare row axis as a flat axis
+ */
+ public void setRowAxisAsFlat() {
+ TableDisplayStyle displayStyle = (TableDisplayStyle) this.configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ if (null == displayStyle) {
+ displayStyle = (TableDisplayStyle) this.configuration.createStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ }
+ displayStyle.setDisplayStyle(DisplayStyle.NORMAL);
+ }
+
+ /**
+ * Declare row axis as a tree displayed with the compact style
+ */
+ public void setRowAxisAsCompactTree() {
+ TableDisplayStyle displayStyle = (TableDisplayStyle) this.configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ if (null == displayStyle) {
+ displayStyle = (TableDisplayStyle) this.configuration.createStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ }
+ displayStyle.setDisplayStyle(DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN);
+ }
+
+ /**
+ * Declare row axis as a tree displayed with the large style
+ */
+ public void setRowAxisAsLargeTree() {
+ TableDisplayStyle displayStyle = (TableDisplayStyle) this.configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ if (null == displayStyle) {
+ displayStyle = (TableDisplayStyle) this.configuration.createStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ }
+ displayStyle.setDisplayStyle(DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN);
+ }
+
+ /**
+ * set the row axis as tree, displayed as a compact tree by default
+ */
+ public void setRowAxisAsTree() {
+ setRowAxisAsCompactTree();
+ }
+
+
+ /**
+ * Declare column axis as a flat axis
+ *
+ * @not_yet_supported
+ */
+ public void setColumnAxisAsFlat() {
+ throw new UnsupportedOperationException(NOT_YET_SUPPORTED);
+ }
+
+
+ /**
+ * Declare column axis as a tree displayed with the compact style
+ *
+ * @not_yet_supported
+ */
+ public void setColumnAxisAsCompactTree() {
+ throw new UnsupportedOperationException(NOT_YET_SUPPORTED);
+ }
+
+
+ /**
+ * Declare column axis as a tree displayed with the large style
+ *
+ * @not_yet_supported
+ */
+ public void setColumnAxisAsLargeTree() {
+ throw new UnsupportedOperationException(NOT_YET_SUPPORTED);
+ }
+
+ /**
+ * set the row axis as tree, displayed as a compact tree by default
+ */
+ public void setColumnAxisAsTree() {
+ throw new UnsupportedOperationException(NOT_YET_SUPPORTED);
+ }
+
+
+ /**
+ *
+ * @return
+ * <code>null</code> if the value has never been initialized, <code>true</code> if the row axis is flat, and <code>false</code> in other cases
+ */
+ public Boolean isRowAxisFlat() {
+ final TableDisplayStyle displayStyle = (TableDisplayStyle) this.configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ Boolean returnedValue = null;
+ if (null != displayStyle) {
+ returnedValue = Boolean.valueOf(DisplayStyle.NORMAL.equals(displayStyle.getDisplayStyle()));
+ }
+ return returnedValue;
+ }
+
+ /**
+ *
+ * @return
+ * <code>null</code> if the value has never been initialized, <code>true</code> if the row axis is flat, and <code>false</code> in other cases
+ *
+ * @not_yet_supported
+ */
+ public Boolean isColumnAxisFlat() {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * <code>null</code> if the value has never been initialized, <code>true</code> if the row axis is a tree, and <code>false</code> in other cases
+ */
+ public Boolean isRowAxisTree() {
+ final TableDisplayStyle displayStyle = (TableDisplayStyle) this.configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ Boolean returnedValue = null;
+ if (null != displayStyle) {
+ returnedValue = Boolean.valueOf(DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(displayStyle.getDisplayStyle()) || DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(displayStyle.getDisplayStyle()));
+ }
+ return returnedValue;
+ }
+
+ /**
+ *
+ * @return
+ * <code>null</code> if the value has never been initialized, <code>true</code> if the row axis is a tree, and <code>false</code> in other cases
+ *
+ * @not_yet_supported
+ */
+ public Boolean isColumnAxisTree() {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * <code>null</code> if the value has never been initialized, <code>true</code> if the row axis is a compact tree, and <code>false</code> in other cases
+ */
+ public Boolean isRowAxisCompactTree() {
+ final TableDisplayStyle displayStyle = (TableDisplayStyle) this.configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ Boolean returnedValue = null;
+ if (null != displayStyle) {
+ returnedValue = Boolean.valueOf(DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(displayStyle.getDisplayStyle()));
+ }
+ return returnedValue;
+ }
+
+ /**
+ *
+ * @return
+ * <code>null</code> if the value has never been initialized, <code>true</code> if the row axis is a compact tree, and <code>false</code> in other cases
+ *
+ * @not_yet_supported
+ */
+ public Boolean isColumnAxisCompactTree() {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * <code>null</code> if the value has never been initialized, <code>true</code> if the row axis is a large tree, and <code>false</code> in other cases
+ */
+ public Boolean isRowAxisLargeTree() {
+ final TableDisplayStyle displayStyle = (TableDisplayStyle) this.configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ Boolean returnedValue = null;
+ if (null != displayStyle) {
+ returnedValue = Boolean.valueOf(DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(displayStyle.getDisplayStyle()));
+ }
+ return returnedValue;
+ }
+
+ /**
+ *
+ * @return
+ * <code>null</code> if the value has never been initialized, <code>true</code> if the row axis is a compact tree, and <code>false</code> in other cases
+ *
+ * @not_yet_supported
+ */
+ public Boolean isColumnAxisLargeTree() {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * the type of the table, never <code>null</code>
+ */
+ public String getTableType() {
+ String type = this.configuration.getType();
+ if (null == type) {
+ type = EMPTY_STRING;
+ }
+ return type;
+ }
+
+ /**
+ *
+ * @return
+ * the default table name, never <code>null</code>
+ */
+ public String getDefaultTableName() {
+ String name = this.configuration.getName();
+ if (null == name) {
+ name = EMPTY_STRING;
+ }
+ return name;
+ }
+
+ /**
+ *
+ * @return
+ * the table configuration description, never <code>null</code>
+ */
+ public String getTableConfigurationDescription() {
+ String description = this.configuration.getDescription();
+ if (null == description) {
+ description = EMPTY_STRING;
+ }
+ return description;
+ }
+
+ /**
+ * Get the table configuration.
+ *
+ * @return The table configuration.
+ */
+ public TableConfiguration getTableConfiguration() {
+ return configuration;
+ }
+
+ /**
+ *
+ * @param name
+ * the default name of the table
+ */
+ public void setDefaultTableName(final String name) {
+ this.configuration.setName(name);
+ }
+
+ /**
+ *
+ * @param type
+ * the type of the table
+ */
+ public void setTableType(final String type) {
+ this.configuration.setType(type);
+ }
+
+ /**
+ *
+ * @param iconPath
+ * the path of the icon to use for the table
+ */
+ public void setTableIcon(final String iconPath) {
+ this.configuration.setIconPath(iconPath);
+ }
+
+ /**
+ *
+ * @param description
+ * the table configuration description
+ */
+ public void setTableConfigurationDescription(final String description) {
+ this.configuration.setDescription(description);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/messages/Messages.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/messages/Messages.java
new file mode 100644
index 00000000000..acfa52dcd37
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/messages/Messages.java
@@ -0,0 +1,161 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * The string messages.
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.customization.nattableconfiguration.messages.messages"; //$NON-NLS-1$
+
+
+ public static String AbstractAxisConfigurationWizardPage_axisManagersLabel;
+
+ public static String AbstractAxisConfigurationWizardPage_displayIconColumnLabel;
+
+ public static String AbstractAxisConfigurationWizardPage_displayIsDerivedColumnLabel;
+
+ public static String AbstractAxisConfigurationWizardPage_displayLabelColumnLabel;
+
+ public static String AbstractAxisConfigurationWizardPage_displayMultiplicityColumnLabel;
+
+ public static String AbstractAxisConfigurationWizardPage_displayNameColumnLabel;
+
+ public static String AbstractAxisConfigurationWizardPage_displayTypeColumnLabel;
+
+ public static String AbstractAxisConfigurationWizardPage_labelProviderConfigurationColumnLabel;
+
+ public static String ColumnConfigurationWizardPage_pageName;
+
+ public static String ConfigurationWizardPage_axisManagerIdColumnName;
+
+ public static String ConfigurationWizardPage_labelProviderContextColumnName;
+
+ public static String CreateNattableConfigurationWizard_WizardTitke;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_axisKindLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_columnsManagementLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_defaultTableNameLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_descriptionLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_disconnectSlaveLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_displayFilterLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_displayIndexLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_displayLabelLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_iconToUseLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_indexStyleLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_javaTableTesterLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_masterLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_nameLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_nameMustBeSetError;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_pageName;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_rowsManagementLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_slaveLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_tableConfigurationLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_tableTypeLabel;
+
+ public static String EditGenericNattableConfigurationFieldsNattableWizardPage_typeMustBeSetError;
+
+ public static String FeatureFillingConfigurationDialog_featureFillingConfigurationDialogName;
+
+ public static String FeatureFillingConfigurationDialog_listenFeature;
+
+ public static String FeatureFillingConfigurationDialog_listenFeatureDialogName;
+
+ public static String NattableConfigurationProjectCreationPage_nattableConfigurationFileNameLabel;
+
+ public static String NattableConfigurationProjectCreationPage_pageName;
+
+ public static String PasteEObjectConfigurationDialog_containmentFeatureDialogName;
+
+ public static String PasteEObjectConfigurationDialog_containmentFeatureLabel;
+
+ public static String PasteEObjectConfigurationDialog_detachedModeLabel;
+
+ public static String PasteEObjectConfigurationDialog_pastedElementIdLabel;
+
+ public static String PasteEObjectConfigurationDialog_pasteEObjectConfigurationDialogName;
+
+ public static String ReferenceDialog_EditValue;
+
+ public static String ReferenceDialog_UnsetValue;
+
+ public static String RowConfigurationWizardPage_axisConfigurationsColumnName;
+
+ public static String RowConfigurationWizardPage_axisConfigurationsLabel;
+
+ public static String RowConfigurationWizardPage_eStructuralFeatureValueFillingConfigurationLabel;
+
+ public static String RowConfigurationWizardPage_featureAxisLabel;
+
+ public static String RowConfigurationWizardPage_pageName;
+
+ public static String RowConfigurationWizardPage_pasteConfigurationLabel;
+
+ public static String RowConfigurationWizardPage_treeFillingConfigurationLabel;
+
+ public static String SlaveConfigurationWizardPage_aliasColumnName;
+
+ public static String SlaveConfigurationWizardPage_elementColumnName;
+
+ public static String SlaveConfigurationWizardPage_managerColumnName;
+
+ public static String SlaveConfigurationWizardPage_pageName;
+
+ public static String SlaveConfigurationWizardPage_typeColumnName;
+
+ public static String TreeFillingConfigurationDialog_axisUsedAsAxisProviderLabel;
+
+ public static String TreeFillingConfigurationDialog_depthLabel;
+
+ public static String TreeFillingConfigurationDialog_elementDialogName;
+
+ public static String TreeFillingConfigurationDialog_elementLabel;
+
+ public static String TreeFillingConfigurationDialog_labelProviderLabel;
+
+ public static String TreeFillingConfigurationDialog_pasteConfigurationLabel;
+
+ public static String TreeFillingConfigurationDialog_treeFillingConfigurationDialogName;
+
+ public static String TreeFillingConfigurationDialog_typeLabel;
+
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/messages/messages.properties b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/messages/messages.properties
new file mode 100644
index 00000000000..e605462faa8
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/messages/messages.properties
@@ -0,0 +1,64 @@
+AbstractAxisConfigurationWizardPage_axisManagersLabel=Axis managers
+AbstractAxisConfigurationWizardPage_displayIconColumnLabel=Display icon
+AbstractAxisConfigurationWizardPage_displayIsDerivedColumnLabel=Display isDerived
+AbstractAxisConfigurationWizardPage_displayLabelColumnLabel=Display label
+AbstractAxisConfigurationWizardPage_displayMultiplicityColumnLabel=Display multiplicity
+AbstractAxisConfigurationWizardPage_displayNameColumnLabel=Display name
+AbstractAxisConfigurationWizardPage_displayTypeColumnLabel=Display type
+AbstractAxisConfigurationWizardPage_labelProviderConfigurationColumnLabel=Label provider configuration
+ColumnConfigurationWizardPage_pageName=Define column axis elements
+ConfigurationWizardPage_axisManagerIdColumnName=Axis manager id
+ConfigurationWizardPage_labelProviderContextColumnName=Label provider context
+CreateNattableConfigurationWizard_WizardTitke=Papyrus table configuration editor
+EditGenericNattableConfigurationFieldsNattableWizardPage_axisKindLabel=Axis kind
+EditGenericNattableConfigurationFieldsNattableWizardPage_columnsManagementLabel=Columns configuration
+EditGenericNattableConfigurationFieldsNattableWizardPage_defaultTableNameLabel=Default table name
+EditGenericNattableConfigurationFieldsNattableWizardPage_descriptionLabel=Description
+EditGenericNattableConfigurationFieldsNattableWizardPage_disconnectSlaveLabel=Disconnect slave
+EditGenericNattableConfigurationFieldsNattableWizardPage_displayFilterLabel=Display filter
+EditGenericNattableConfigurationFieldsNattableWizardPage_displayIndexLabel=Display index
+EditGenericNattableConfigurationFieldsNattableWizardPage_displayLabelLabel=Display label
+EditGenericNattableConfigurationFieldsNattableWizardPage_iconToUseLabel=Select icon to use
+EditGenericNattableConfigurationFieldsNattableWizardPage_indexStyleLabel=Index style
+EditGenericNattableConfigurationFieldsNattableWizardPage_javaTableTesterLabel=Java table tester
+EditGenericNattableConfigurationFieldsNattableWizardPage_masterLabel=Rows manager
+EditGenericNattableConfigurationFieldsNattableWizardPage_nameLabel=Name
+EditGenericNattableConfigurationFieldsNattableWizardPage_nameMustBeSetError=Name must be set. \n
+EditGenericNattableConfigurationFieldsNattableWizardPage_pageName=Enter generic data table configuration
+EditGenericNattableConfigurationFieldsNattableWizardPage_rowsManagementLabel=Rows configuration
+EditGenericNattableConfigurationFieldsNattableWizardPage_slaveLabel=Columns manager
+EditGenericNattableConfigurationFieldsNattableWizardPage_tableConfigurationLabel=Table configuration
+EditGenericNattableConfigurationFieldsNattableWizardPage_tableTypeLabel=Table type
+EditGenericNattableConfigurationFieldsNattableWizardPage_typeMustBeSetError=Type must be set. \n
+FeatureFillingConfigurationDialog_featureFillingConfigurationDialogName=Structural feature value filling configuration edition
+FeatureFillingConfigurationDialog_listenFeature=Listen feature
+FeatureFillingConfigurationDialog_listenFeatureDialogName=Listen feature
+NattableConfigurationProjectCreationPage_nattableConfigurationFileNameLabel=Nattable configuration file name
+NattableConfigurationProjectCreationPage_pageName=Project creation
+PasteEObjectConfigurationDialog_containmentFeatureDialogName=Containment feature
+PasteEObjectConfigurationDialog_containmentFeatureLabel=Containment feature
+PasteEObjectConfigurationDialog_detachedModeLabel=Detached mode
+PasteEObjectConfigurationDialog_pastedElementIdLabel=Pasted element id
+PasteEObjectConfigurationDialog_pasteEObjectConfigurationDialogName=Paste EObject configuration edition
+ReferenceDialog_EditValue=Edit the reference value
+ReferenceDialog_UnsetValue=Unset the reference value
+RowConfigurationWizardPage_axisConfigurationsColumnName=Axis configurations
+RowConfigurationWizardPage_axisConfigurationsLabel=Axis configurations
+RowConfigurationWizardPage_eStructuralFeatureValueFillingConfigurationLabel=EStructural feature value filling configuration
+RowConfigurationWizardPage_featureAxisLabel=Feature axis
+RowConfigurationWizardPage_pageName=Define row axis elements
+RowConfigurationWizardPage_pasteConfigurationLabel=Paste EObject configuration
+RowConfigurationWizardPage_treeFillingConfigurationLabel=Tree filling configuration
+SlaveConfigurationWizardPage_aliasColumnName=Alias
+SlaveConfigurationWizardPage_elementColumnName=Element
+SlaveConfigurationWizardPage_managerColumnName=Manager
+SlaveConfigurationWizardPage_pageName=Define the default columns
+SlaveConfigurationWizardPage_typeColumnName=Type
+TreeFillingConfigurationDialog_axisUsedAsAxisProviderLabel=Axis used as axis provider
+TreeFillingConfigurationDialog_depthLabel=Depth
+TreeFillingConfigurationDialog_elementDialogName=Element
+TreeFillingConfigurationDialog_elementLabel=Element
+TreeFillingConfigurationDialog_labelProviderLabel=Label provider
+TreeFillingConfigurationDialog_pasteConfigurationLabel=Paste configuration
+TreeFillingConfigurationDialog_treeFillingConfigurationDialogName=Tree filling configuration edition
+TreeFillingConfigurationDialog_typeLabel=Type
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/AbstractAxisConfigurationWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/AbstractAxisConfigurationWizardPage.java
new file mode 100644
index 00000000000..d51d78f31ed
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/AbstractAxisConfigurationWizardPage.java
@@ -0,0 +1,880 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.pages;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+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.papyrus.customization.nattableconfiguration.helper.TableConfigurationHelper;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NameSimplifier;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationEditingSupport;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+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.FeatureLabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ObjectLabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.OperationLabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.impl.FeatureLabelProviderConfigurationImpl;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.impl.ObjectLabelProviderConfigurationImpl;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.impl.OperationLabelProviderConfigurationImpl;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * The axis header configuration wizard page which allow to define the axis managers, the label provider configurations (hidden for user).
+ */
+public abstract class AbstractAxisConfigurationWizardPage extends AbstractTableConfigurationWizardPage {
+
+ /**
+ * The header axis configuration from the table configuration;
+ */
+ protected final TableHeaderAxisConfiguration headerAxisConfiguration;
+
+ /**
+ * The button to add an axis manager representation.
+ */
+ protected Button addAxisManagerRepresentation;
+
+ /**
+ * The button to remove an existing axis manager representation.
+ */
+ protected Button removeAxisManagerRepresentation;
+
+ /**
+ * The table viewer corresponding to the label provider configurations.
+ */
+ protected TableViewer labelProviderConfigurationTableViewer;
+
+
+ /**
+ * Constructor.
+ *
+ * @param pageName
+ * The current page name.
+ * @param helper
+ * The table configuration helper.
+ */
+ public AbstractAxisConfigurationWizardPage(final String pageName, final TableConfigurationHelper helper) {
+ super(pageName, helper);
+ this.headerAxisConfiguration = getHeaderAxisConfiguration();
+ }
+
+ /**
+ * This allows to get the header axis configuration to edit.
+ *
+ * @return The header axis configuration to edit.
+ */
+ public abstract TableHeaderAxisConfiguration getHeaderAxisConfiguration();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(final Composite parent) {
+ // Manage the page complete
+ setPageComplete(isPageComplete());
+
+ // Create the parent composite
+ final Composite container = new Composite(parent, SWT.BORDER);
+ container.setLayout(new GridLayout(1, false));
+
+ // Create the axis managers group
+ final Group axisManagersGroup = new Group(container, SWT.NONE);
+ axisManagersGroup.setText(Messages.AbstractAxisConfigurationWizardPage_axisManagersLabel);
+ axisManagersGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ axisManagersGroup.setLayout(new GridLayout(2, false));
+
+ // Create the table viewer (table, column and its layout)
+ final TableViewer axisManagerTableViewer = createAxisManagersTableViewer(axisManagersGroup);
+
+ // Create the buttons composite
+ final Composite buttonsComposite = new Composite(axisManagersGroup, SWT.NONE);
+ buttonsComposite.setLayout(new GridLayout(1, false));
+ buttonsComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+
+ // Create the add button
+ addAxisManagerRepresentation = new Button(buttonsComposite, SWT.PUSH);
+ addAxisManagerRepresentation.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.ADD_ICON_PATH));
+ addAxisManagerRepresentation.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the add action which allow to create an axis manager representation
+ addAxisManagerRepresentation.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ final AxisManagerRepresentation createRepresentation = createAxisManagerRepresentation();
+ headerAxisConfiguration.getAxisManagers().add(createRepresentation);
+
+ manageLabelProviderConfiguration(createRepresentation);
+
+ recalculateButtonsAvailability(axisManagerTableViewer.getStructuredSelection());
+ axisManagerTableViewer.refresh();
+
+ setPageComplete(isPageComplete());
+ }
+ });
+
+ // Create the remove button
+ removeAxisManagerRepresentation = new Button(buttonsComposite, SWT.PUSH);
+ removeAxisManagerRepresentation.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH));
+ removeAxisManagerRepresentation.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the remove action which allow to remove an axis manager representation
+ removeAxisManagerRepresentation.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ final Iterator<?> selectedObjects = axisManagerTableViewer.getStructuredSelection().iterator();
+ while (selectedObjects.hasNext()) {
+ Object selectedObject = selectedObjects.next();
+
+ if (selectedObject instanceof AxisManagerRepresentation) {
+ final AxisManagerRepresentation axisManagerRepresentation = (AxisManagerRepresentation) selectedObject;
+ removeLabelProviderConfiguration(axisManagerRepresentation.getHeaderLabelConfiguration(), axisManagerRepresentation);
+ headerAxisConfiguration.getAxisManagers().remove(axisManagerRepresentation);
+ }
+ }
+
+ recalculateButtonsAvailability(axisManagerTableViewer.getStructuredSelection());
+ axisManagerTableViewer.refresh();
+
+ setPageComplete(isPageComplete());
+ }
+ });
+
+ // Manage the selection change
+ axisManagerTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ recalculateButtonsAvailability(event.getSelection());
+ }
+ });
+ axisManagerTableViewer.setSelection(new StructuredSelection());
+
+ // Create the table viewer (table, column and its layout)
+ labelProviderConfigurationTableViewer = createLabelProviderConfigurationsTableViewer(axisManagersGroup);
+
+ createMoreComposite(container);
+
+ setControl(container);
+ }
+
+ /**
+ * This allows to create an axis manager representation.
+ *
+ * @return The created axis manager representation.
+ */
+ public AxisManagerRepresentation createAxisManagerRepresentation() {
+ return NattableaxisconfigurationFactory.eINSTANCE.createAxisManagerRepresentation();
+ }
+
+ /**
+ * This allows to calculate the buttons availability (remove button musn't be enabled when there is no selection).
+ *
+ * @param selection
+ * The current table viewer selection.
+ */
+ protected void recalculateButtonsAvailability(final ISelection selection) {
+ removeAxisManagerRepresentation.setEnabled(null != selection && !selection.isEmpty());
+ }
+
+ /**
+ * This allows to define other composite in the container.
+ *
+ * @param parent
+ * the parent composite.
+ */
+ public void createMoreComposite(final Composite parent) {
+ // Do nothing here
+ }
+
+ /**
+ * This allows to create the table viewer and its columns.
+ *
+ * @param parent
+ * The parent composite.
+ * @return The created table viewer.
+ */
+ protected TableViewer createAxisManagersTableViewer(final Composite parent) {
+
+ final TableViewer tableViewer = new TableViewer(parent, (SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER));
+
+ // Create the columns
+ createAxisManagersColumns(tableViewer);
+
+ // Manage some table display
+ final Table table = tableViewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ // The content provider of the initial selection
+ tableViewer.setContentProvider(new ArrayContentProvider());
+
+ // Define the table input
+ tableViewer.setInput(headerAxisConfiguration.getAxisManagers());
+
+ // define layout for the viewer
+ tableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ tableViewer.refresh();
+ return tableViewer;
+ }
+
+ /**
+ * This allows to create the table viewer columns.
+ *
+ * @param tableViewer
+ * The table viewer.
+ */
+ protected abstract void createAxisManagersColumns(final TableViewer tableViewer);
+
+ /**
+ * This allows to create the table viewer and its columns.
+ *
+ * @param parent
+ * The parent composite.
+ * @return The created table viewer.
+ */
+ protected TableViewer createLabelProviderConfigurationsTableViewer(final Composite parent) {
+ final TableViewer tableViewer = new TableViewer(parent, (SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER));
+
+ // Create the columns
+ createLabelProviderConfigurationsColumns(tableViewer);
+
+ // Manage some table display
+ final Table table = tableViewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ // The content provider of the initial selection
+ tableViewer.setContentProvider(new ArrayContentProvider());
+
+ // Define the table input
+ tableViewer.setInput(headerAxisConfiguration.getOwnedLabelConfigurations());
+
+ // define layout for the viewer
+ tableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
+
+ tableViewer.refresh();
+ return tableViewer;
+ }
+
+ /**
+ * This allows to create the table viewer columns.
+ *
+ * @param tableViewer
+ * The table viewer.
+ */
+ protected void createLabelProviderConfigurationsColumns(final TableViewer tableViewer) {
+ final Table table = tableViewer.getTable();
+
+ // Define the titles and bounds of each columns
+ final int[] bounds = { 200, 125, 125, 125, 125, 125, 125 };
+ final String[] titles = { Messages.AbstractAxisConfigurationWizardPage_labelProviderConfigurationColumnLabel, Messages.AbstractAxisConfigurationWizardPage_displayIconColumnLabel, Messages.AbstractAxisConfigurationWizardPage_displayLabelColumnLabel,
+ Messages.AbstractAxisConfigurationWizardPage_displayNameColumnLabel, Messages.AbstractAxisConfigurationWizardPage_displayTypeColumnLabel, Messages.AbstractAxisConfigurationWizardPage_displayMultiplicityColumnLabel,
+ Messages.AbstractAxisConfigurationWizardPage_displayIsDerivedColumnLabel };
+
+ // Create the first column for the axis manager id
+ final TableViewerColumn labelProviderConfigurationColumn = createTableViewerColumn(tableViewer, titles[0], bounds[0]);
+ final ColumnLabelProvider axisManagerIdLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ String value = ""; //$NON-NLS-1$
+ if (element instanceof ILabelProviderConfiguration) {
+ final String className = element.getClass().getSimpleName();
+ if (NameSimplifier.labelProviderConfigurationNames.containsKey(className)) {
+ value = NameSimplifier.labelProviderConfigurationNames.get(className);
+ }
+ }
+ return value;
+ }
+ };
+ labelProviderConfigurationColumn.setLabelProvider(axisManagerIdLabelProvider);
+
+ final ColumnLabelProvider nullLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ return null;
+ }
+ };
+
+ // Create the column for the display icon value
+ final TableViewerColumn displayIconColumn = createTableViewerColumn(tableViewer, titles[1], bounds[1]);
+ displayIconColumn.setLabelProvider(nullLabelProvider);
+ // Create the check box cell editor
+ displayIconColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, nullLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof ObjectLabelProviderConfiguration) {
+ ((ObjectLabelProviderConfiguration) element).setDisplayIcon((Boolean) value);
+ } else if (element instanceof FeatureLabelProviderConfiguration) {
+ ((FeatureLabelProviderConfiguration) element).setDisplayIcon((Boolean) value);
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ ((OperationLabelProviderConfiguration) element).setDisplayIcon((Boolean) value);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ return isDisplayIcon(element);
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new CheckboxCellEditor(table, SWT.CHECK | SWT.READ_ONLY);
+ }
+ });
+
+ // Create the column for the display label value
+ final TableViewerColumn displayLabelColumn = createTableViewerColumn(tableViewer, titles[2], bounds[2]);
+ displayLabelColumn.setLabelProvider(nullLabelProvider);
+ // Create the check box cell editor
+ displayLabelColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, nullLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof ObjectLabelProviderConfiguration) {
+ ((ObjectLabelProviderConfiguration) element).setDisplayLabel((Boolean) value);
+ } else if (element instanceof FeatureLabelProviderConfiguration) {
+ ((FeatureLabelProviderConfiguration) element).setDisplayLabel((Boolean) value);
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ ((OperationLabelProviderConfiguration) element).setDisplayLabel((Boolean) value);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ return isDisplayLabel(element);
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new CheckboxCellEditor(table, SWT.CHECK | SWT.READ_ONLY);
+ }
+ });
+
+ // Create the column for the display name value
+ final TableViewerColumn displayNameColumn = createTableViewerColumn(tableViewer, titles[3], bounds[3]);
+ displayNameColumn.setLabelProvider(nullLabelProvider);
+ // Create the check box cell editor
+ displayNameColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, nullLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof FeatureLabelProviderConfiguration) {
+ ((FeatureLabelProviderConfiguration) element).setDisplayName((Boolean) value);
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ ((OperationLabelProviderConfiguration) element).setDisplayName((Boolean) value);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ return isDisplayName(element);
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new CheckboxCellEditor(table, SWT.CHECK | SWT.READ_ONLY);
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return element instanceof FeatureLabelProviderConfiguration || element instanceof OperationLabelProviderConfiguration;
+ }
+ });
+
+ // Create the column for the display type value
+ final TableViewerColumn displayTypeColumn = createTableViewerColumn(tableViewer, titles[4], bounds[4]);
+ displayTypeColumn.setLabelProvider(nullLabelProvider);
+ // Create the check box cell editor
+ displayTypeColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, nullLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof FeatureLabelProviderConfiguration) {
+ ((FeatureLabelProviderConfiguration) element).setDisplayType((Boolean) value);
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ ((OperationLabelProviderConfiguration) element).setDisplayType((Boolean) value);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ return isDisplayType(element);
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new CheckboxCellEditor(table, SWT.CHECK | SWT.READ_ONLY);
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return element instanceof FeatureLabelProviderConfiguration || element instanceof OperationLabelProviderConfiguration;
+ }
+ });
+
+ // Create the column for the display multiplicity value
+ final TableViewerColumn displayMultiplicityColumn = createTableViewerColumn(tableViewer, titles[5], bounds[5]);
+ displayMultiplicityColumn.setLabelProvider(nullLabelProvider);
+ // Create the check box cell editor
+ displayMultiplicityColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, nullLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof FeatureLabelProviderConfiguration) {
+ ((FeatureLabelProviderConfiguration) element).setDisplayMultiplicity((Boolean) value);
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ ((OperationLabelProviderConfiguration) element).setDisplayMultiplicity((Boolean) value);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ return isDisplayMultiplicity(element);
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new CheckboxCellEditor(table, SWT.CHECK | SWT.READ_ONLY);
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return element instanceof FeatureLabelProviderConfiguration || element instanceof OperationLabelProviderConfiguration;
+ }
+ });
+
+ // Create the column for the display is derived value
+ final TableViewerColumn displayIsDerivedColumn = createTableViewerColumn(tableViewer, titles[6], bounds[6]);
+ displayIsDerivedColumn.setLabelProvider(nullLabelProvider);
+ // Create the check box cell editor
+ displayIsDerivedColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, nullLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof FeatureLabelProviderConfiguration) {
+ ((FeatureLabelProviderConfiguration) element).setDisplayIsDerived((Boolean) value);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ return isDisplayIsDerived(element);
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new CheckboxCellEditor(table, SWT.CHECK | SWT.READ_ONLY);
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return element instanceof FeatureLabelProviderConfiguration;
+ }
+ });
+
+ // Redefine the paint item listener to manage custom display in tree table
+ table.addListener(SWT.PaintItem, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.index > 0) {
+ Item item = (Item) event.item;
+ Image trailingImage = null;
+
+ Object value = null;
+
+ switch (event.index) {
+ case 1:
+ value = isDisplayIcon(item.getData());
+ break;
+ case 2:
+ value = isDisplayLabel(item.getData());
+ break;
+ case 3:
+ value = isDisplayName(item.getData());
+ break;
+ case 4:
+ value = isDisplayType(item.getData());
+ break;
+ case 5:
+ value = isDisplayMultiplicity(item.getData());
+ break;
+ case 6:
+ value = isDisplayIsDerived(item.getData());
+ break;
+ default:
+ break;
+ }
+
+ if (value instanceof Boolean) {
+ trailingImage = (Boolean) value ? NattableConfigurationConstants.CHECKED : NattableConfigurationConstants.UNCHECKED;
+ }
+
+ if (null != trailingImage) {
+ // Calculate the center position
+ int itemWidth = table.getColumn(event.index).getWidth();
+ int imageWidth = trailingImage.getBounds().width;
+ int x = event.x + (itemWidth - imageWidth) / 2;
+ int itemHeight = table.getItemHeight();
+ int imageHeight = trailingImage.getBounds().height;
+ int y = event.y + (itemHeight - imageHeight) / 2;
+
+ // Draw the image
+ event.gc.drawImage(trailingImage, x, y);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Get the display icon value of the element.
+ *
+ * @param element
+ * The element.
+ * @return Boolean value or <code>null</code>.
+ */
+ protected Object isDisplayIcon(final Object element) {
+ Object result = null;
+ if (element instanceof ObjectLabelProviderConfiguration) {
+ result = ((ObjectLabelProviderConfiguration) element).isDisplayIcon();
+ } else if (element instanceof FeatureLabelProviderConfiguration) {
+ result = ((FeatureLabelProviderConfiguration) element).isDisplayIcon();
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ result = ((OperationLabelProviderConfiguration) element).isDisplayIcon();
+ }
+ return result;
+ }
+
+ /**
+ * Get the display label value of the element.
+ *
+ * @param element
+ * The element.
+ * @return Boolean value or <code>null</code>.
+ */
+ protected Object isDisplayLabel(final Object element) {
+ Object result = null;
+ if (element instanceof ObjectLabelProviderConfiguration) {
+ result = ((ObjectLabelProviderConfiguration) element).isDisplayLabel();
+ } else if (element instanceof FeatureLabelProviderConfiguration) {
+ result = ((FeatureLabelProviderConfiguration) element).isDisplayLabel();
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ result = ((OperationLabelProviderConfiguration) element).isDisplayLabel();
+ }
+ return result;
+ }
+
+ /**
+ * Get the display name value of the element.
+ *
+ * @param element
+ * The element.
+ * @return Boolean value or <code>null</code>.
+ */
+ protected Object isDisplayName(final Object element) {
+ Object result = null;
+ if (element instanceof FeatureLabelProviderConfiguration) {
+ result = ((FeatureLabelProviderConfiguration) element).isDisplayName();
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ result = ((OperationLabelProviderConfiguration) element).isDisplayName();
+ }
+ return result;
+ }
+
+ /**
+ * Get the display type value of the element.
+ *
+ * @param element
+ * The element.
+ * @return Boolean value or <code>null</code>.
+ */
+ protected Object isDisplayType(final Object element) {
+ Object result = null;
+ if (element instanceof FeatureLabelProviderConfiguration) {
+ result = ((FeatureLabelProviderConfiguration) element).isDisplayType();
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ result = ((OperationLabelProviderConfiguration) element).isDisplayType();
+ }
+ return result;
+ }
+
+ /**
+ * Get the display multiplicity value of the element.
+ *
+ * @param element
+ * The element.
+ * @return Boolean value or <code>null</code>.
+ */
+ protected Object isDisplayMultiplicity(final Object element) {
+ Object result = null;
+ if (element instanceof FeatureLabelProviderConfiguration) {
+ result = ((FeatureLabelProviderConfiguration) element).isDisplayMultiplicity();
+ } else if (element instanceof OperationLabelProviderConfiguration) {
+ result = ((OperationLabelProviderConfiguration) element).isDisplayMultiplicity();
+ }
+ return result;
+ }
+
+ /**
+ * Get the display isDerived value of the element.
+ *
+ * @param element
+ * The element.
+ * @return Boolean value or <code>null</code>.
+ */
+ protected Object isDisplayIsDerived(final Object element) {
+ Object result = null;
+ if (element instanceof FeatureLabelProviderConfiguration) {
+ result = ((FeatureLabelProviderConfiguration) element).isDisplayIsDerived();
+ }
+ return result;
+ }
+
+ /**
+ * This allows to create and return a table viewer column.
+ *
+ * @param tableViewer
+ * The parent table viewer of the column to create.
+ * @param title
+ * The title of the column to create.
+ * @param width
+ * The width of the column to create.
+ * @return The created viewer column.
+ */
+ protected TableViewerColumn createTableViewerColumn(final TableViewer tableViewer, final String title, final int width) {
+ final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
+ final TableColumn column = viewerColumn.getColumn();
+ column.setText(title);
+ column.setWidth(width);
+ column.setResizable(true);
+ column.setMoveable(true);
+ return viewerColumn;
+ }
+
+ /**
+ * Create the list of axis manager identifiers (managing the simple axis manager name and the others with the full identifier).
+ *
+ * @param requiredProposedAxisManagers
+ * The required axis managers.
+ * @param knownAxisCollection
+ * The axis managers registered in the plugins extension.
+ * @return The list of axis manager identifiers.
+ */
+ protected List<String> createAxisManagerIdItems(final List<String> requiredProposedAxisManagers, final Collection<String> knownAxisCollection) {
+ final List<String> input = new ArrayList<String>();
+
+ // Add the simple axis manager identifier
+ for (final String requiredAxisManager : requiredProposedAxisManagers) {
+ input.add(requiredAxisManager);
+ }
+
+ // Add the axis manager identifiers from the registered axis managers
+ for (final String knownAxis : knownAxisCollection) {
+
+ // The known axis will be added only if
+ // - the input list does not contain the known axis
+ // - and there is no added axis which contains the known axis
+ // For example if "EMF Feature (org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager)" is already in the input list,
+ // "org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager" will not be added
+ if (!input.contains(knownAxis)) {
+ boolean isKnownAxisAdded = false;
+
+ for (final String addedAxis : input) {
+ if (addedAxis.contains(knownAxis)) {
+ isKnownAxisAdded = true;
+ break;
+ }
+ }
+
+ if (!isKnownAxisAdded) {
+ input.add(knownAxis);
+ }
+ }
+ }
+
+ return input;
+ }
+
+ /**
+ * This allows to manage the label provider configuration (create, get and/or remove) and set it to the current axis manager representation in parameter.
+ *
+ * @param axisManagerRepresentation
+ * The current axis manager representation.
+ */
+ protected void manageLabelProviderConfiguration(final AxisManagerRepresentation axisManagerRepresentation) {
+ final String axisManagerId = axisManagerRepresentation.getAxisManagerId();
+
+ if (null != axisManagerId && !axisManagerId.isEmpty()) {
+ // No label provider configuration is affected to the axis manager representation, create or get an existing and set it to the representation
+ if (null == axisManagerRepresentation.getHeaderLabelConfiguration()) {
+ // set the new label provider configuration
+ axisManagerRepresentation.setHeaderLabelConfiguration(createLabelProviderConfiguration(axisManagerId));
+ } else {
+ final ILabelProviderConfiguration existingLabelProviderConfiguration = axisManagerRepresentation.getHeaderLabelConfiguration();
+ final String typeOfLabelProviderConfiguration = getTypeOfLabelProviderConfiguration(axisManagerId);
+
+ // Check if it needs to set a new label provider configuration depending to the current label provider configuration type
+ if (!existingLabelProviderConfiguration.getClass().getSimpleName().equals(typeOfLabelProviderConfiguration)) {
+ // Remove the current label provider configuration
+ removeLabelProviderConfiguration(existingLabelProviderConfiguration, axisManagerRepresentation);
+ // Set it the new one
+ axisManagerRepresentation.setHeaderLabelConfiguration(createLabelProviderConfiguration(axisManagerId));
+ }
+ }
+ }
+ }
+
+ /**
+ * This allows to create (or get if already existing) the label provider configuration corresponding to the axis manager identifier.
+ *
+ * @param axisManagerId
+ * The axis manager identifier.
+ * @return The created (or gotten) label provider configuration.
+ */
+ protected ILabelProviderConfiguration createLabelProviderConfiguration(final String axisManagerId) {
+ ILabelProviderConfiguration createdLabelProviderConfiguration = null;
+
+ final String typeOfLabelProviderConfiguration = getTypeOfLabelProviderConfiguration(axisManagerId);
+
+ // Try to check if a label provider configuration with the same type is already existing
+ final Iterator<ILabelProviderConfiguration> existingLabelProviderConfigurationsIterator = headerAxisConfiguration.getOwnedLabelConfigurations().iterator();
+ while (existingLabelProviderConfigurationsIterator.hasNext() && null == createdLabelProviderConfiguration) {
+ final ILabelProviderConfiguration existingLabelProviderConfiguration = existingLabelProviderConfigurationsIterator.next();
+ if (existingLabelProviderConfiguration.getClass().getSimpleName().equals(typeOfLabelProviderConfiguration)) {
+ createdLabelProviderConfiguration = existingLabelProviderConfiguration;
+ }
+ }
+
+ // No label provider configuration with the same type that needed exists, so create it corresponding to the needed type
+ if (null == createdLabelProviderConfiguration) {
+ if (FeatureLabelProviderConfigurationImpl.class.getSimpleName().equals(typeOfLabelProviderConfiguration)) {
+ createdLabelProviderConfiguration = NattablelabelproviderFactory.eINSTANCE.createFeatureLabelProviderConfiguration();
+ } else if (OperationLabelProviderConfigurationImpl.class.getSimpleName().equals(typeOfLabelProviderConfiguration)) {
+ createdLabelProviderConfiguration = NattablelabelproviderFactory.eINSTANCE.createOperationLabelProviderConfiguration();
+ } else {
+ createdLabelProviderConfiguration = NattablelabelproviderFactory.eINSTANCE.createObjectLabelProviderConfiguration();
+ }
+
+ // Add the label provider configuration to the header axis configuration
+ headerAxisConfiguration.getOwnedLabelConfigurations().add(createdLabelProviderConfiguration);
+
+ labelProviderConfigurationTableViewer.refresh();
+ }
+
+ return createdLabelProviderConfiguration;
+ }
+
+ /**
+ * This allows to remove the label provider configuration from the header axis configuration when it is not always used.
+ *
+ * @param labelProviderConfiguration
+ * The label provider configuration to remove.
+ * @param currentRepresentation
+ * The current axis manager representation.
+ */
+ protected void removeLabelProviderConfiguration(final ILabelProviderConfiguration labelProviderConfiguration, final AxisManagerRepresentation currentRepresentation) {
+ if (null != labelProviderConfiguration) {
+ boolean canBeRemoved = true;
+
+ // check if the label provider configuration is not used in another axis manager representation
+ final Iterator<AxisManagerRepresentation> axisManagerIterator = headerAxisConfiguration.getAxisManagers().iterator();
+ while (axisManagerIterator.hasNext() && canBeRemoved) {
+ final AxisManagerRepresentation axisManager = axisManagerIterator.next();
+ if (!axisManager.equals(currentRepresentation)) {
+ canBeRemoved = !labelProviderConfiguration.equals(axisManager.getHeaderLabelConfiguration());
+ }
+ }
+
+ // The label provider configuration to remove is not used in another axis manager representation, so remove it from the header axis configuration
+ if (canBeRemoved) {
+ headerAxisConfiguration.getOwnedLabelConfigurations().remove(labelProviderConfiguration);
+
+ labelProviderConfigurationTableViewer.refresh();
+ }
+ }
+ }
+
+ /**
+ * Get the label provider configuration class name corresponding to the axis manager.
+ *
+ * @param axisManagerId
+ * The axis manager identifier.
+ * @return The label provider configuration class name corresponding to the axis manager.
+ */
+ protected String getTypeOfLabelProviderConfiguration(final String axisManagerId) {
+ // By default, we need to set the object label provider configuration
+ String result = ObjectLabelProviderConfigurationImpl.class.getSimpleName();
+ if (NameSimplifier.labelProviderConfigurationByAxisManager.containsKey(axisManagerId)) {
+ result = NameSimplifier.labelProviderConfigurationByAxisManager.get(axisManagerId);
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ */
+ @Override
+ public boolean isPageComplete() {
+ boolean isComplete = true;
+
+ // The axis manager representation have to be filled
+ final Iterator<AxisManagerRepresentation> axisManagerIterator = headerAxisConfiguration.getAxisManagers().iterator();
+ while (axisManagerIterator.hasNext() && isComplete) {
+ final AxisManagerRepresentation axisManager = axisManagerIterator.next();
+ isComplete = null != axisManager.getAxisManagerId() && !axisManager.getAxisManagerId().isEmpty()
+ && null != axisManager.getLabelProviderContext() && !axisManager.getLabelProviderContext().isEmpty()
+ && null != axisManager.getHeaderLabelConfiguration();
+ }
+
+ return isComplete;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/AbstractTableConfigurationWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/AbstractTableConfigurationWizardPage.java
new file mode 100644
index 00000000000..4940dbdd707
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/AbstractTableConfigurationWizardPage.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.pages;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.papyrus.customization.nattableconfiguration.helper.TableConfigurationHelper;
+
+/**
+ * The abstract wizard page for the table configuration.
+ */
+public abstract class AbstractTableConfigurationWizardPage extends WizardPage {
+
+ /**
+ * The table configuration helper
+ */
+ protected final TableConfigurationHelper helper;
+
+ /**
+ * Constructor.
+ *
+ * @param pageName
+ * The page name.
+ * @param helper
+ * The table configuration helper.
+ */
+ public AbstractTableConfigurationWizardPage(final String pageName, final TableConfigurationHelper helper) {
+ super(pageName, pageName, null);
+ this.helper = helper;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/ColumnConfigurationWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/ColumnConfigurationWizardPage.java
new file mode 100644
index 00000000000..cebd62382f5
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/ColumnConfigurationWizardPage.java
@@ -0,0 +1,240 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.pages;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.papyrus.customization.nattableconfiguration.helper.TableConfigurationHelper;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NameSimplifier;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationEditingSupport;
+import org.eclipse.papyrus.infra.nattable.manager.axis.AxisManagerFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.widgets.Table;
+
+/**
+ * The column axis header configuration wizard page which allow to define the axis managers, the label provider configurations (hidden for user).
+ */
+public class ColumnConfigurationWizardPage extends AbstractAxisConfigurationWizardPage {
+
+ /**
+ * The axis manager proposed to the user(even if the registered axis managers in plugins are not correctly managed).
+ */
+ protected static final List<String> requiredProposedAxisManagers = new ArrayList<String>();
+
+ /**
+ * The label provider context proposed to the user(even if the registered axis managers in plugins are not correctly managed).
+ */
+ protected static final List<String> requiredProposedLabelProviderContexts = new ArrayList<String>();
+
+ /**
+ * Initialize the previous map.
+ */
+ static {
+ requiredProposedAxisManagers.add("EMF Feature (org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("EMF Operation (org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("UML Element (org.eclipse.papyrus.uml.nattable.element.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("UML Feature (org.eclipse.papyrus.uml.nattable.feature.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("UML Operation (org.eclipse.papyrus.uml.nattable.operation.axis.manager)"); //$NON-NLS-1$
+
+ requiredProposedLabelProviderContexts.add("Header"); //$NON-NLS-1$
+ requiredProposedLabelProviderContexts.add("Header Feature"); //$NON-NLS-1$
+ requiredProposedLabelProviderContexts.add("Header Operation"); //$NON-NLS-1$
+ }
+
+
+ /**
+ * Constructor.
+ *
+ * @param helper
+ * The table configuration helper.
+ */
+ public ColumnConfigurationWizardPage(final TableConfigurationHelper helper) {
+ super(Messages.ColumnConfigurationWizardPage_pageName, helper);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.pages.AbstractAxisConfigurationWizardPage#getHeaderAxisConfiguration()
+ */
+ @Override
+ public TableHeaderAxisConfiguration getHeaderAxisConfiguration() {
+ return helper.getTableConfiguration().getColumnHeaderAxisConfiguration();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.pages.AbstractAxisConfigurationWizardPage#createAxisManagerRepresentation()
+ */
+ @Override
+ public AxisManagerRepresentation createAxisManagerRepresentation() {
+ final AxisManagerRepresentation createdRepresentation = super.createAxisManagerRepresentation();
+ createdRepresentation.setAxisManagerId("org.eclipse.papyrus.uml.nattable.element.axis.manager"); //$NON-NLS-1$
+
+ // Manage the label provider configuration and the label provider context depending to the axis manager
+ manageLabelProviderConfiguration(createdRepresentation);
+ manageCorrespondenceAxisManagerAndContext(createdRepresentation);
+
+ return createdRepresentation;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.pages.AbstractAxisConfigurationWizardPage#createColumns(org.eclipse.jface.viewers.TableViewer)
+ */
+ @Override
+ protected void createAxisManagersColumns(final TableViewer tableViewer) {
+
+ final Table table = tableViewer.getTable();
+ final Collection<String> knownAxis = AxisManagerFactory.INSTANCE.getAllRegisteredAxisManager().keySet();
+
+ // Define the titles and bounds of each columns
+ final int[] bounds = { 500, 500 };
+ final String[] titles = { Messages.ConfigurationWizardPage_axisManagerIdColumnName, Messages.ConfigurationWizardPage_labelProviderContextColumnName };
+
+ // Create the first column for the axis manager id
+ final TableViewerColumn axisManagerIdColumn = createTableViewerColumn(tableViewer, titles[0], bounds[0]);
+ final ColumnLabelProvider axisManagerIdLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ final StringBuilder value = new StringBuilder();
+ if (element instanceof AxisManagerRepresentation) {
+ final String axisManagerId = ((AxisManagerRepresentation) element).getAxisManagerId();
+ boolean axisManagerFound = NameSimplifier.axisManagerNames.containsKey(axisManagerId);
+ if (axisManagerFound) {
+ value.append(NameSimplifier.axisManagerNames.get(axisManagerId));
+ } else {
+ value.append(null != axisManagerId ? axisManagerId : ""); //$NON-NLS-1$
+ }
+ }
+ return value.toString();
+ }
+ };
+ axisManagerIdColumn.setLabelProvider(axisManagerIdLabelProvider);
+ // Create the combo box of the axis manager identifier
+ axisManagerIdColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, axisManagerIdLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof AxisManagerRepresentation) {
+ // set the new value
+ if (NameSimplifier.axisManagerNames.containsValue(value)) {
+ for (final Entry<String, String> entry : NameSimplifier.axisManagerNames.entrySet()) {
+ if (((String) value).contains(entry.getValue()) && ((String) value).contains(entry.getKey())) {
+ ((AxisManagerRepresentation) element).setAxisManagerId(entry.getKey());
+ }
+ }
+ } else {
+ ((AxisManagerRepresentation) element).setAxisManagerId((String) value);
+ }
+
+ // Manage the label provider configuration and the label provider context depending to the axis manager
+ manageLabelProviderConfiguration((AxisManagerRepresentation) element);
+ manageCorrespondenceAxisManagerAndContext((AxisManagerRepresentation) element);
+
+ tableViewer.refresh();
+ setPageComplete(isPageComplete());
+ }
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new ExtendedComboBoxCellEditor(table, createAxisManagerIdItems(requiredProposedAxisManagers, knownAxis), new LabelProvider(), SWT.NONE) {
+
+ @Override
+ public Object doGetValue() {
+ // Redefine this to allow other value than the proposed ones from the combo
+ if (getControl() instanceof CCombo) {
+ return ((CCombo) getControl()).getText();
+ }
+ return super.doGetValue();
+ }
+ };
+ }
+ });
+
+ // Create the second column for the label provider context
+ final TableViewerColumn labelProviderContextColumn = createTableViewerColumn(tableViewer, titles[1], bounds[1]);
+ final ColumnLabelProvider labelProviderContextLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ String result = ""; //$NON-NLS-1$
+ if (element instanceof AxisManagerRepresentation) {
+ if (NameSimplifier.labelProviderContextNames.containsKey(((AxisManagerRepresentation) element).getLabelProviderContext())) {
+ result = NameSimplifier.labelProviderContextNames.get(((AxisManagerRepresentation) element).getLabelProviderContext());
+ } else {
+ result = ((AxisManagerRepresentation) element).getLabelProviderContext();
+ }
+ }
+ return result;
+ }
+ };
+ labelProviderContextColumn.setLabelProvider(labelProviderContextLabelProvider);
+ // Create the combo box of the label provider contexts
+ labelProviderContextColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, labelProviderContextLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof AxisManagerRepresentation) {
+ // set the new value
+ if (NameSimplifier.labelProviderContextNames.containsValue(value)) {
+
+ for (final Entry<String, String> entry : NameSimplifier.labelProviderContextNames.entrySet()) {
+ if (entry.getValue().equals(value)) {
+ ((AxisManagerRepresentation) element).setLabelProviderContext(entry.getKey());
+ }
+ }
+
+ tableViewer.refresh();
+ setPageComplete(isPageComplete());
+ }
+ }
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new ExtendedComboBoxCellEditor(table, requiredProposedLabelProviderContexts, new LabelProvider(), SWT.NONE);
+ }
+ });
+ }
+
+ /**
+ * This allows to change the label provider context corresponding to the axis manager id set.
+ *
+ * @param element
+ * The current axis manager representation.
+ */
+ protected void manageCorrespondenceAxisManagerAndContext(final AxisManagerRepresentation element) {
+ if (NameSimplifier.correspondenceAxisManagerAndContext.containsKey(element.getAxisManagerId())) {
+ element.setLabelProviderContext(NameSimplifier.correspondenceAxisManagerAndContext.get(element.getAxisManagerId()));
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/EditGenericNattableConfigurationFieldsNattableWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/EditGenericNattableConfigurationFieldsNattableWizardPage.java
new file mode 100644
index 00000000000..29630976bac
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/EditGenericNattableConfigurationFieldsNattableWizardPage.java
@@ -0,0 +1,838 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Bug 493756
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.pages;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.papyrus.customization.nattableconfiguration.helper.TableConfigurationHelper;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisIndexStyle;
+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.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.MasterObjectAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.SlaveObjectAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+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.model.nattable.nattabletester.JavaTableTester;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.NattabletesterFactory;
+import org.eclipse.papyrus.infra.widgets.editors.BrowseFileEditor;
+import org.eclipse.papyrus.infra.widgets.providers.FileExtensions;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * This page allows to edit the name, type and icon of a table
+ */
+public class EditGenericNattableConfigurationFieldsNattableWizardPage extends AbstractTableConfigurationWizardPage {
+
+ /**
+ * The current configuration to modify.
+ */
+ private final TableConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param helper
+ * The table configuration helper.
+ */
+ public EditGenericNattableConfigurationFieldsNattableWizardPage(final TableConfigurationHelper helper) {
+ super(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_pageName, helper);
+ configuration = helper.getTableConfiguration();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(final Composite parent) {
+ setPageComplete(isPageComplete());
+ final Composite container = new Composite(parent, SWT.BORDER);
+ container.setLayout(new GridLayout(1, false));
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ // Create the table group and its grid data
+ final Group tableGroup = new Group(container, SWT.NONE);
+ tableGroup.setLayout(new GridLayout(2, false));
+ tableGroup.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_tableConfigurationLabel);
+ final GridData tableGroupData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
+ tableGroupData.horizontalSpan = 2;
+ tableGroup.setLayoutData(tableGroupData);
+
+ // Create the default name text of the table
+ final Label labelDefaultName = new Label(tableGroup, SWT.NONE);
+ labelDefaultName.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_defaultTableNameLabel);
+ labelDefaultName.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Text defaultName = new Text(tableGroup, SWT.BORDER);
+ defaultName.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ if (!helper.getDefaultTableName().equals(defaultName.getText())) {
+ helper.setDefaultTableName(defaultName.getText());
+ }
+ setPageComplete(isPageComplete());
+ }
+ });
+ final GridData defaultNameLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ defaultNameLayoutData.minimumWidth = 200;
+ defaultName.setLayoutData(defaultNameLayoutData);
+
+ // Create the type text of the table
+ final Label labelType = new Label(tableGroup, SWT.NONE);
+ labelType.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_tableTypeLabel);
+ labelType.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Text type = new Text(tableGroup, SWT.BORDER);
+ type.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ if (!helper.getTableType().equals(type.getText())) {
+ helper.setTableType(type.getText());
+ }
+ setPageComplete(isPageComplete());
+ }
+ });
+ final GridData typeLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ typeLayoutData.minimumWidth = 200;
+ type.setLayoutData(typeLayoutData);
+
+ // Create the description text of the table
+ final Label labelDescription = new Label(tableGroup, SWT.NONE);
+ labelDescription.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_descriptionLabel);
+ labelDescription.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Text description = new Text(tableGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
+ description.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ if (!helper.getTableConfigurationDescription().equals(description.getText())) {
+ helper.setTableConfigurationDescription(description.getText());
+ }
+ }
+ });
+ final GridData descriptionLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ descriptionLayoutData.minimumWidth = 400;
+ descriptionLayoutData.heightHint = 50;
+ description.setLayoutData(descriptionLayoutData);
+
+ // Create the icon browse editor for the icon of the table
+ final BrowseFileEditor iconEditor = new BrowseFileEditor(tableGroup, SWT.NONE);
+ iconEditor.setLabel(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_iconToUseLabel);
+ iconEditor.setAllowFileSystem(false);
+ iconEditor.setAllowWorkspace(true);
+
+ // Get file extensions
+ final Set<String> extensions = FileExtensions.imagesFilesExtensions.keySet();
+ String[] str1 = extensions.toArray(new String[extensions.size()]);
+
+ final Collection<String> extension2 = FileExtensions.imagesFilesExtensions.values();
+ String[] str2 = extension2.toArray(new String[extensions.size()]);
+
+ iconEditor.setFilters(str1, str2);
+
+ iconEditor.getText().setEnabled(false);
+ iconEditor.getText().addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ if (!configuration.getIconPath().equals(iconEditor.getText().getText())) {
+ helper.setTableIcon(iconEditor.getText().getText());
+ }
+ }
+ });
+ final GridData iconGridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ iconGridData.horizontalSpan = 2;
+ iconEditor.setLayoutData(iconGridData);
+
+ // Create the combo for the table style (flat or tree)
+ final Label labelAxisKind = new Label(tableGroup, SWT.NONE);
+ labelAxisKind.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_axisKindLabel);
+ final Composite styleComposite = new Composite(tableGroup, SWT.NONE);
+ final GridLayout styleCompositeLayoutData = new GridLayout(2, false);
+ styleCompositeLayoutData.marginWidth = 0;
+ styleCompositeLayoutData.marginHeight = 0;
+ styleComposite.setLayout(styleCompositeLayoutData);
+ styleComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
+ final Combo axisKindCombo = new Combo(styleComposite, SWT.NONE);
+ final List<String> axisKindStyleList = new ArrayList<String>();
+ axisKindStyleList.add(TableConfigurationHelper.AXIS_FLAT_STYLE);
+ axisKindStyleList.add(TableConfigurationHelper.AXIS_TREE_STYLE);
+ axisKindCombo.setItems((String[]) axisKindStyleList.toArray(new String[axisKindStyleList.size()]));
+ final GridData axisKindLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ axisKindLayoutData.minimumWidth = 100;
+ axisKindCombo.setLayoutData(axisKindLayoutData);
+
+ // Create the combo for the column header style when this is a tree table
+ final Combo treeAxisStyleCombo = new Combo(styleComposite, SWT.NONE);
+ final List<String> treeAxisStyleList = new ArrayList<String>();
+ treeAxisStyleList.add("Single header column"); //$NON-NLS-1$
+ treeAxisStyleList.add("Multiple header column"); //$NON-NLS-1$
+ treeAxisStyleCombo.setItems((String[]) treeAxisStyleList.toArray(new String[treeAxisStyleList.size()]));
+ final GridData treeAxisStyleLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ treeAxisStyleLayoutData.minimumWidth = 200;
+ treeAxisStyleCombo.setLayoutData(treeAxisStyleLayoutData);
+ treeAxisStyleCombo.setVisible(false);
+
+ // Manage the modification of the axis kind combo
+ axisKindCombo.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ // if this is flat, remove the possible table display value and hide the tree axis display style combo
+ if (0 == axisKindCombo.getSelectionIndex()) {
+ treeAxisStyleCombo.setVisible(false);
+ TableDisplayStyle displayStyle = (TableDisplayStyle) configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ if (null != displayStyle) {
+ configuration.getStyles().remove(displayStyle);
+ }
+ } else {
+ // This is tree table, set visible the tree axis display style combo
+ treeAxisStyleCombo.setVisible(true);
+ treeAxisStyleCombo.select(0);
+ }
+ }
+ });
+
+ // Manage the modification of the tree axis display style combo
+ treeAxisStyleCombo.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ // Get the table display style (or create it if necessary)
+ TableDisplayStyle displayStyle = (TableDisplayStyle) configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ if (null == displayStyle) {
+ displayStyle = NattablestyleFactory.eINSTANCE.createTableDisplayStyle();
+ configuration.getStyles().add(displayStyle);
+ }
+
+ // Set the correct value
+ if (0 == treeAxisStyleCombo.getSelectionIndex()) {
+ displayStyle.setDisplayStyle(DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN);
+ } else {
+ displayStyle.setDisplayStyle(DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN);
+ }
+ }
+ });
+
+ // Create the description text of the table
+ final Label labelJavaTableTester = new Label(tableGroup, SWT.NONE);
+ labelJavaTableTester.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_javaTableTesterLabel);
+ labelJavaTableTester.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Text javaTableTester = new Text(tableGroup, SWT.BORDER);
+ javaTableTester.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ JavaTableTester tableTester = configuration.getCreationTester() instanceof JavaTableTester ? (JavaTableTester) configuration.getCreationTester() : null;
+
+ if (null == tableTester) {
+ tableTester = NattabletesterFactory.eINSTANCE.createJavaTableTester();
+ configuration.setCreationTester(tableTester);
+ }
+
+ tableTester.setTester(javaTableTester.getText());
+ }
+ });
+ final GridData javaTableTesterLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ javaTableTesterLayoutData.minimumWidth = 600;
+ javaTableTester.setLayoutData(javaTableTesterLayoutData);
+
+ // Initialize the fields
+ defaultName.setText(helper.getDefaultTableName());
+ type.setText(helper.getTableType());
+ description.setText(helper.getTableConfigurationDescription());
+ if (null != configuration.getIconPath()) {
+ iconEditor.getText().setText(configuration.getIconPath());
+ }
+ // Select the correct combo item corresponding to the current configuration
+ TableDisplayStyle displayStyle = (TableDisplayStyle) configuration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle());
+ if (null != displayStyle) {
+ axisKindCombo.select(1);
+ if (DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(displayStyle.getDisplayStyle())) {
+ treeAxisStyleCombo.select(0);
+ } else if (DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(displayStyle.getDisplayStyle())) {
+ treeAxisStyleCombo.select(1);
+ }
+ } else {
+ axisKindCombo.select(0);
+ }
+ if (configuration.getCreationTester() instanceof JavaTableTester) {
+ javaTableTester.setText(((JavaTableTester) configuration.getCreationTester()).getTester());
+ }
+
+ // Create the rows and columns groups
+ createRowsGroup(tableGroup);
+ createColumnsGroup(tableGroup);
+
+ // Create the master and slave groups
+ createMasterGroup(tableGroup);
+ createSlaveGroup(tableGroup);
+
+ setControl(container); // should be a container composite here!
+ }
+
+ /**
+ * This allows to create the rows group and its fields.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createRowsGroup(final Composite parent) {
+
+ // Create the rows composite
+ final Composite rowsGroup = createSection(parent, Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_rowsManagementLabel);
+ rowsGroup.setLayout(new GridLayout(4, false));
+
+ // Create the index style combo
+ final Label labelIndexStyle = new Label(rowsGroup, SWT.NONE);
+ labelIndexStyle.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_indexStyleLabel);
+ labelIndexStyle.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Combo rowsIndexStyleCombo = new Combo(rowsGroup, SWT.NONE);
+ final List<String> indexStyleList = new ArrayList<String>();
+ indexStyleList.add(AxisIndexStyle.ALPHABETIC.getName());
+ indexStyleList.add(AxisIndexStyle.NUMERIC.getName());
+ rowsIndexStyleCombo.setItems((String[]) indexStyleList.toArray(new String[indexStyleList.size()]));
+ final GridData rowsIndexStyleLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
+ rowsIndexStyleLayoutData.minimumWidth = 100;
+ rowsIndexStyleCombo.setLayoutData(rowsIndexStyleLayoutData);
+ rowsIndexStyleCombo.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ TableHeaderAxisConfiguration rowHeaderAxisConfiguration = configuration.getRowHeaderAxisConfiguration();
+ if (null == rowHeaderAxisConfiguration) {
+ rowHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setRowHeaderAxisConfiguration(rowHeaderAxisConfiguration);
+ }
+
+ if (0 == rowsIndexStyleCombo.getSelectionIndex()) {
+ rowHeaderAxisConfiguration.setIndexStyle(AxisIndexStyle.ALPHABETIC);
+ } else {
+ rowHeaderAxisConfiguration.setIndexStyle(AxisIndexStyle.NUMERIC);
+ }
+ }
+ });
+
+ // Create the display index checkbox
+ final Label displayIndexLabel = new Label(rowsGroup, SWT.NONE);
+ displayIndexLabel.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_displayIndexLabel);
+ displayIndexLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Button displayIndexButton = new Button(rowsGroup, SWT.CHECK);
+ displayIndexButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ displayIndexButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ TableHeaderAxisConfiguration rowHeaderAxisConfiguration = configuration.getRowHeaderAxisConfiguration();
+ if (null == rowHeaderAxisConfiguration) {
+ rowHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setRowHeaderAxisConfiguration(rowHeaderAxisConfiguration);
+ }
+
+ rowHeaderAxisConfiguration.setDisplayIndex(displayIndexButton.getSelection());
+ }
+ });
+
+ // Create the display label checkbox
+ final Label displayLabelLabel = new Label(rowsGroup, SWT.NONE);
+ displayLabelLabel.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_displayLabelLabel);
+ displayLabelLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Button displayLabelButton = new Button(rowsGroup, SWT.CHECK);
+ displayLabelButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ displayLabelButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ TableHeaderAxisConfiguration rowHeaderAxisConfiguration = configuration.getRowHeaderAxisConfiguration();
+ if (null == rowHeaderAxisConfiguration) {
+ rowHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setRowHeaderAxisConfiguration(rowHeaderAxisConfiguration);
+ }
+
+ rowHeaderAxisConfiguration.setDisplayLabel(displayLabelButton.getSelection());
+ }
+ });
+
+ // Create the display filter checkbox
+ final Label displayFilterLabel = new Label(rowsGroup, SWT.NONE);
+ displayFilterLabel.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_displayFilterLabel);
+ displayFilterLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Button displayFilterButton = new Button(rowsGroup, SWT.CHECK);
+ displayFilterButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ displayFilterButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ TableHeaderAxisConfiguration rowHeaderAxisConfiguration = configuration.getRowHeaderAxisConfiguration();
+ if (null == rowHeaderAxisConfiguration) {
+ rowHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setRowHeaderAxisConfiguration(rowHeaderAxisConfiguration);
+ }
+
+ rowHeaderAxisConfiguration.setDisplayFilter(displayFilterButton.getSelection());
+ }
+ });
+
+ // Initialize the fields
+ // Select the correct combo item corresponding to the current configuration
+ TableHeaderAxisConfiguration rowHeaderAxisConfiguration = configuration.getRowHeaderAxisConfiguration();
+ if (null != rowHeaderAxisConfiguration) {
+ if (AxisIndexStyle.ALPHABETIC.equals(rowHeaderAxisConfiguration.getIndexStyle())) {
+ rowsIndexStyleCombo.select(0);
+ } else {
+ rowsIndexStyleCombo.select(1);
+ }
+ displayFilterButton.setSelection(rowHeaderAxisConfiguration.isDisplayFilter());
+ displayIndexButton.setSelection(rowHeaderAxisConfiguration.isDisplayIndex());
+ displayLabelButton.setSelection(rowHeaderAxisConfiguration.isDisplayLabel());
+ } else {
+ rowsIndexStyleCombo.select(1);
+ displayFilterButton.setSelection(false);
+ displayIndexButton.setSelection(true);
+ displayLabelButton.setSelection(true);
+ }
+ }
+
+ /**
+ * This allows to create the columns group and its fields.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createColumnsGroup(final Composite parent) {
+
+ // Create the columns composite
+ final Composite columnsGroup = createSection(parent, Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_columnsManagementLabel);
+ columnsGroup.setLayout(new GridLayout(4, false));
+
+ // Create the index style combo
+ final Label labelIndexStyle = new Label(columnsGroup, SWT.NONE);
+ labelIndexStyle.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_indexStyleLabel);
+ labelIndexStyle.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Combo columnsIndexStyleCombo = new Combo(columnsGroup, SWT.NONE);
+ final List<String> indexStyleList = new ArrayList<String>();
+ indexStyleList.add(AxisIndexStyle.ALPHABETIC.getName());
+ indexStyleList.add(AxisIndexStyle.NUMERIC.getName());
+ columnsIndexStyleCombo.setItems((String[]) indexStyleList.toArray(new String[indexStyleList.size()]));
+ final GridData columnsIndexStyleLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
+ columnsIndexStyleLayoutData.minimumWidth = 100;
+ columnsIndexStyleCombo.setLayoutData(columnsIndexStyleLayoutData);
+ columnsIndexStyleCombo.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ TableHeaderAxisConfiguration columnHeaderAxisConfiguration = configuration.getColumnHeaderAxisConfiguration();
+ if (null == columnHeaderAxisConfiguration) {
+ columnHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setColumnHeaderAxisConfiguration(columnHeaderAxisConfiguration);
+ }
+
+ if (0 == columnsIndexStyleCombo.getSelectionIndex()) {
+ columnHeaderAxisConfiguration.setIndexStyle(AxisIndexStyle.ALPHABETIC);
+ } else {
+ columnHeaderAxisConfiguration.setIndexStyle(AxisIndexStyle.NUMERIC);
+ }
+ }
+ });
+
+ // Create the display index checkbox
+ final Label displayIndexLabel = new Label(columnsGroup, SWT.NONE);
+ displayIndexLabel.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_displayIndexLabel);
+ displayIndexLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Button displayIndexButton = new Button(columnsGroup, SWT.CHECK);
+ displayIndexButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ displayIndexButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ TableHeaderAxisConfiguration columnHeaderAxisConfiguration = configuration.getColumnHeaderAxisConfiguration();
+ if (null == columnHeaderAxisConfiguration) {
+ columnHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setColumnHeaderAxisConfiguration(columnHeaderAxisConfiguration);
+ }
+
+ columnHeaderAxisConfiguration.setDisplayIndex(displayIndexButton.getSelection());
+ }
+ });
+
+ // Create the display label checkbox
+ final Label displayLabelLabel = new Label(columnsGroup, SWT.NONE);
+ displayLabelLabel.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_displayLabelLabel);
+ displayLabelLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Button displayLabelButton = new Button(columnsGroup, SWT.CHECK);
+ displayLabelButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ displayLabelButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ TableHeaderAxisConfiguration columnHeaderAxisConfiguration = configuration.getColumnHeaderAxisConfiguration();
+ if (null == columnHeaderAxisConfiguration) {
+ columnHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setColumnHeaderAxisConfiguration(columnHeaderAxisConfiguration);
+ }
+
+ columnHeaderAxisConfiguration.setDisplayLabel(displayLabelButton.getSelection());
+ }
+ });
+
+ // Create the display filter checkbox
+ final Label displayFilterLabel = new Label(columnsGroup, SWT.NONE);
+ displayFilterLabel.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_displayFilterLabel);
+ displayFilterLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Button displayFilterButton = new Button(columnsGroup, SWT.CHECK);
+ displayFilterButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ displayFilterButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TableHeaderAxisConfiguration columnHeaderAxisConfiguration = configuration.getColumnHeaderAxisConfiguration();
+ if (null == columnHeaderAxisConfiguration) {
+ columnHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setColumnHeaderAxisConfiguration(columnHeaderAxisConfiguration);
+ }
+
+ columnHeaderAxisConfiguration.setDisplayFilter(displayFilterButton.getSelection());
+ }
+ });
+
+ // Initialize the fields
+ // Select the correct combo item corresponding to the current configuration
+ TableHeaderAxisConfiguration columnHeaderAxisConfiguration = configuration.getColumnHeaderAxisConfiguration();
+ if (null != columnHeaderAxisConfiguration) {
+ if (AxisIndexStyle.NUMERIC.equals(columnHeaderAxisConfiguration.getIndexStyle())) {
+ columnsIndexStyleCombo.select(1);
+ } else {
+ columnsIndexStyleCombo.select(0);
+ }
+ displayFilterButton.setSelection(columnHeaderAxisConfiguration.isDisplayFilter());
+ displayIndexButton.setSelection(columnHeaderAxisConfiguration.isDisplayIndex());
+ displayLabelButton.setSelection(columnHeaderAxisConfiguration.isDisplayLabel());
+ } else {
+ columnsIndexStyleCombo.select(0);
+ displayFilterButton.setSelection(false);
+ displayIndexButton.setSelection(true);
+ displayLabelButton.setSelection(true);
+ }
+ }
+
+ /**
+ * This allows to create the master group and its fields.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createMasterGroup(final Composite parent) {
+
+ // Create the master group
+ final Composite masterGroup = createSection(parent, Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_masterLabel);
+ masterGroup.setLayout(new GridLayout(2, false));
+
+ // Create the name text of the master
+ final Label labelame = new Label(masterGroup, SWT.NONE);
+ labelame.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_nameLabel);
+ labelame.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Text name = new Text(masterGroup, SWT.BORDER);
+ name.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ // Set the master name
+ getOrCreateMasterObjectAxisProvider(configuration).setName(name.getText());
+ }
+ });
+ final GridData nameLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ nameLayoutData.minimumWidth = 200;
+ name.setLayoutData(nameLayoutData);
+
+ // Create the description text of the master
+ final Label labelDescription = new Label(masterGroup, SWT.NONE);
+ labelDescription.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_descriptionLabel);
+ labelDescription.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Text description = new Text(masterGroup, SWT.BORDER | SWT.MULTI);
+ description.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ // Set the master description
+ getOrCreateMasterObjectAxisProvider(configuration).setDescription(description.getText());
+ }
+ });
+ final GridData descriptionLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ descriptionLayoutData.minimumWidth = 400;
+ descriptionLayoutData.heightHint = 50;
+ description.setLayoutData(descriptionLayoutData);
+
+ // Create the disconnect slave checkbox for the master
+ final Label labelDisconnectSlave = new Label(masterGroup, SWT.NONE);
+ labelDisconnectSlave.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_disconnectSlaveLabel);
+ labelDisconnectSlave.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Button disconnectSlave = new Button(masterGroup, SWT.CHECK);
+ disconnectSlave.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(final SelectionEvent e) {
+ // Set the disconnect slave
+ getOrCreateMasterObjectAxisProvider(configuration).setDisconnectSlave(disconnectSlave.getSelection());
+ };
+ });
+
+ // Initialize the fields
+ MasterObjectAxisProvider master = getMasterObjectAxisProvider(configuration);
+ if (null != master) {
+ name.setText(master.getName());
+ description.setText(master.getDescription());
+ disconnectSlave.setSelection(master.isDisconnectSlave());
+ }
+ }
+
+ /**
+ * This allows to create the slave group and its fields.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createSlaveGroup(final Composite parent) {
+ // Create the slave group
+ final Composite slaveGroup = createSection(parent, Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_slaveLabel);
+ slaveGroup.setLayout(new GridLayout(2, false));
+
+ // Create the name text for the slave
+ final Label labelame = new Label(slaveGroup, SWT.NONE);
+ labelame.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_nameLabel);
+ labelame.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Text name = new Text(slaveGroup, SWT.BORDER);
+ name.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ // Set the slave description
+ getOrCreateSlaveObjectAxisProvider(configuration).setName(name.getText());
+ }
+ });
+ final GridData nameLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ nameLayoutData.minimumWidth = 200;
+ name.setLayoutData(nameLayoutData);
+
+ // Create the description text for the slave
+ final Label labelDescription = new Label(slaveGroup, SWT.NONE);
+ labelDescription.setText(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_descriptionLabel);
+ labelDescription.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+ final Text description = new Text(slaveGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
+ description.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ // Set the slave description
+ getOrCreateSlaveObjectAxisProvider(configuration).setDescription(description.getText());
+ }
+ });
+ final GridData descriptionLayoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ descriptionLayoutData.minimumWidth = 400;
+ descriptionLayoutData.heightHint = 50;
+ description.setLayoutData(descriptionLayoutData);
+
+ // Initialize the fields
+ SlaveObjectAxisProvider slave = getSlaveObjectAxisProvider(configuration);
+ if (null != slave) {
+ name.setText(slave.getName());
+ description.setText(slave.getDescription());
+ }
+ }
+
+ /**
+ * This allows to create a section (which can be expand or collapse).
+ *
+ * @param parent
+ * The parent composite.
+ * @param sectionTitle
+ * The section title.
+ * @return The created section.
+ */
+ protected Composite createSection(final Composite parent, final String sectionTitle) {
+ // Create a section to manage a better user-friendly interface
+ final Section expandableCompoosite = new Section(parent, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
+ expandableCompoosite.setText(sectionTitle);
+ expandableCompoosite.setExpanded(true);
+ expandableCompoosite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
+ expandableCompoosite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1));
+ expandableCompoosite.addExpansionListener(new ExpansionAdapter() {
+ @Override
+ public void expansionStateChanged(final ExpansionEvent e) {
+ expandableCompoosite.getParent().getParent().layout();
+ expandableCompoosite.getParent().getParent().redraw();
+ }
+ });
+
+ // Create the composite
+ final Composite composite = new Composite(expandableCompoosite, SWT.NONE);
+ expandableCompoosite.setClient(composite);
+
+ return composite;
+ }
+
+ /**
+ * This allows to get the master axis provider of the configuration.
+ *
+ * @param configuration
+ * The current configuration.
+ * @return The master axis provider or <code>null</code> if not existing.
+ */
+ protected MasterObjectAxisProvider getMasterObjectAxisProvider(final TableConfiguration configuration) {
+ MasterObjectAxisProvider master = null;
+
+ // Try to get an existing master axis provider
+ if (0 < configuration.getRowAxisProviders().size()) {
+ final Iterator<AbstractAxisProvider> rowAxisProvidersIterator = configuration.getRowAxisProviders().iterator();
+ while (rowAxisProvidersIterator.hasNext() && null == master) {
+ final AbstractAxisProvider axisProvider = rowAxisProvidersIterator.next();
+ if (axisProvider instanceof MasterObjectAxisProvider) {
+ master = (MasterObjectAxisProvider) axisProvider;
+ }
+ }
+ }
+
+ return master;
+ }
+
+ /**
+ * This allows to get the master axis provider of the configuration if existing or create it otherwise.
+ *
+ * @param configuration
+ * The current configuration.
+ * @return The got or created master axis provider.
+ */
+ protected MasterObjectAxisProvider getOrCreateMasterObjectAxisProvider(final TableConfiguration configuration) {
+ MasterObjectAxisProvider master = getMasterObjectAxisProvider(configuration);
+
+ // The master doesn't exist, create it
+ if (null == master) {
+ master = NattableaxisproviderFactory.eINSTANCE.createMasterObjectAxisProvider();
+ configuration.getRowAxisProviders().add(master);
+ }
+
+ // Set the master as default row axis provider if this is not already done
+ if (null == configuration.getDefaultRowAxisProvider()) {
+ configuration.setDefaultRowAxisProvider(master);
+ }
+
+ return master;
+ }
+
+ /**
+ * This allows to get the slave axis provider of the configuration.
+ *
+ * @param configuration
+ * The current configuration.
+ * @return The slave axis provider or <code>null</code> if not existing.
+ */
+ protected SlaveObjectAxisProvider getSlaveObjectAxisProvider(final TableConfiguration configuration) {
+ SlaveObjectAxisProvider slave = null;
+
+ // Try to get an existing master axis provider
+ if (0 < configuration.getRowAxisProviders().size()) {
+ final Iterator<AbstractAxisProvider> columnAxisProvidersIterator = configuration.getColumnAxisProviders().iterator();
+ while (columnAxisProvidersIterator.hasNext() && null == slave) {
+ final AbstractAxisProvider axisProvider = columnAxisProvidersIterator.next();
+ if (axisProvider instanceof SlaveObjectAxisProvider) {
+ slave = (SlaveObjectAxisProvider) axisProvider;
+ }
+ }
+ }
+
+ return slave;
+ }
+
+ /**
+ * This allows to get the slave axis provider of the configuration if existing or create it otherwise.
+ *
+ * @param configuration
+ * The current configuration.
+ * @return The got or created slave axis provider.
+ */
+ protected SlaveObjectAxisProvider getOrCreateSlaveObjectAxisProvider(final TableConfiguration configuration) {
+ SlaveObjectAxisProvider slave = getSlaveObjectAxisProvider(configuration);
+
+ // The master doesn't exist, create it
+ if (null == slave) {
+ slave = NattableaxisproviderFactory.eINSTANCE.createSlaveObjectAxisProvider();
+ configuration.getColumnAxisProviders().add(slave);
+ }
+
+ // Set the master as default row axis provider if this is not already done
+ if (null == configuration.getDefaultColumnAxisProvider()) {
+ configuration.setDefaultColumnAxisProvider(slave);
+ }
+
+ return slave;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ */
+ @Override
+ public boolean isPageComplete() {
+ boolean isComplete = true;
+ final String name = helper.getDefaultTableName();
+ final String type = helper.getTableType();
+ String errorMessage = null;
+ StringBuffer buffer = new StringBuffer();
+ if (name.isEmpty()) {
+ buffer.append(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_nameMustBeSetError);
+ }
+
+ if (type.isEmpty()) {
+ buffer.append(Messages.EditGenericNattableConfigurationFieldsNattableWizardPage_typeMustBeSetError);
+ }
+
+ errorMessage = buffer.toString();
+ if (errorMessage.isEmpty()) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(errorMessage.toString());
+ }
+
+ isComplete = !name.isEmpty() && !type.isEmpty();
+ return isComplete;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/NattableConfigurationFileCreationPage.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/NattableConfigurationFileCreationPage.java
new file mode 100644
index 00000000000..724197a3e1d
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/NattableConfigurationFileCreationPage.java
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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.customization.nattableconfiguration.pages;
+
+import org.eclipse.papyrus.customization.nattableconfiguration.helper.TableConfigurationHelper;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * This page allows to edit the name of the Papyrus Table configuration to create.
+ */
+public class NattableConfigurationFileCreationPage extends EditGenericNattableConfigurationFieldsNattableWizardPage {
+ /**
+ * The nattable configuration file name text composite.
+ */
+ private Text nattableConfigurationFileName;
+
+ /**
+ * The file name modify listener.
+ */
+ private Listener fileNameModifyListener = new Listener() {
+
+ @Override
+ public void handleEvent(final Event e) {
+ setPageComplete(canFlipToNextPage());
+ }
+ };
+
+ /**
+ * Default constructor.
+ *
+ * @param helper
+ * The table configuration helper
+ */
+ public NattableConfigurationFileCreationPage(TableConfigurationHelper helper) {
+ super(helper);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(final Composite parent) {
+ Composite container = new Composite(parent, SWT.BORDER);
+ final GridLayout gridLayout = new GridLayout(1, false);
+ container.setLayout(gridLayout);
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ final Group group = createGroup(container, Messages.NattableConfigurationProjectCreationPage_nattableConfigurationFileNameLabel);
+ nattableConfigurationFileName = new Text(group, SWT.BORDER);
+ nattableConfigurationFileName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ nattableConfigurationFileName.addListener(SWT.Modify, fileNameModifyListener);
+ super.createControl(container);
+ setControl(container);
+ }
+
+ /**
+ * Create a new group with the given name.
+ *
+ * @param parent
+ * The parent composite
+ * @param name
+ * The name of the group
+ * @return The created group
+ */
+ private static Group createGroup(final Composite parent, final String name) {
+ final Group group = new Group(parent, SWT.NONE);
+ group.setText(name);
+ final GridLayout layout = new GridLayout(1, true);
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ group.setLayout(layout);
+ final GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
+ group.setLayoutData(data);
+ return group;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.pages.EditGenericNattableConfigurationFieldsNattableWizardPage#isPageComplete()
+ *
+ * @return <code>true</code> if the page is complete, <code>false</false> otherwise
+ */
+ @Override
+ public boolean isPageComplete() {
+ if (null != nattableConfigurationFileName) {
+ if ("".equals(nattableConfigurationFileName.getText())) { //$NON-NLS-1$
+ this.setErrorMessage("Set nattable configuration file name"); //$NON-NLS-1$
+ return false;
+ }
+ }
+
+ return super.isPageComplete();
+ }
+
+ /**
+ * @return The nattable configuration file name
+ */
+ public String getNattableConfigurationFileName() {
+ return nattableConfigurationFileName.getText();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/RowConfigurationWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/RowConfigurationWizardPage.java
new file mode 100644
index 00000000000..feac88e3c95
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/RowConfigurationWizardPage.java
@@ -0,0 +1,563 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.pages;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+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.jface.viewers.TreeColumnViewerLabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.customization.nattableconfiguration.edition.FeatureFillingConfigurationDialog;
+import org.eclipse.papyrus.customization.nattableconfiguration.edition.PasteEObjectConfigurationDialog;
+import org.eclipse.papyrus.customization.nattableconfiguration.edition.TreeFillingConfigurationDialog;
+import org.eclipse.papyrus.customization.nattableconfiguration.helper.TableConfigurationHelper;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NameSimplifier;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationEditingSupport;
+import org.eclipse.papyrus.infra.nattable.manager.axis.AxisManagerFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EObjectAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EOperationAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EStructuralFeatureAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.FeatureIdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.EStructuralFeatureValueFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+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;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.SelectionAdapter;
+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.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/**
+ * The row axis header configuration wizard page which allow to define the axis managers, the label provider configurations (hidden for user) and, maybe, the tree filling configuration.
+ */
+public class RowConfigurationWizardPage extends AbstractAxisConfigurationWizardPage {
+
+ /**
+ * The eClass constant.
+ */
+ private static final String E_CLASS = "eClass"; //$NON-NLS-1$
+
+ /**
+ * The axis manager proposed to the user(even if the registered axis managers in plugins are not correctly managed).
+ */
+ protected static final List<String> requiredProposedAxisManagers = new ArrayList<String>();
+
+ /**
+ * The button to add an axis configuration.
+ */
+ protected Button addAxisConfiguration;
+
+ /**
+ * The button to edit an axis configuration.
+ */
+ protected Button editAxisConfiguration;
+
+ /**
+ * The button to remove an existing axis configuration.
+ */
+ protected Button removeAxisConfiguration;
+
+ /**
+ * Initialize the previous map.
+ */
+ static {
+ requiredProposedAxisManagers.add("EMF Feature (org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("EMF Operation (org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("UML Element (org.eclipse.papyrus.uml.nattable.element.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("UML Feature (org.eclipse.papyrus.uml.nattable.feature.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("UML Operation (org.eclipse.papyrus.uml.nattable.operation.axis.manager)"); //$NON-NLS-1$
+ requiredProposedAxisManagers.add("UML Tree Axis (org.eclipse.papyrus.infra.uml.nattable.class.tree.axis.manager)"); //$NON-NLS-1$
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param helper
+ * The table configuration helper.
+ */
+ public RowConfigurationWizardPage(final TableConfigurationHelper helper) {
+ super(Messages.RowConfigurationWizardPage_pageName, helper);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.pages.AbstractAxisConfigurationWizardPage#getHeaderAxisConfiguration()
+ */
+ @Override
+ public TableHeaderAxisConfiguration getHeaderAxisConfiguration() {
+ return helper.getTableConfiguration().getRowHeaderAxisConfiguration();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.pages.AbstractAxisConfigurationWizardPage#createMoreComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createMoreComposite(final Composite parent) {
+ // Create the axis managers group
+ final Group axisManagersGroup = new Group(parent, SWT.NONE);
+ axisManagersGroup.setText(Messages.RowConfigurationWizardPage_axisConfigurationsLabel);
+ axisManagersGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ axisManagersGroup.setLayout(new GridLayout(2, false));
+
+ // Create the axis configurations tree viewer
+ final TreeViewer treeViewer = createAxisConfigurationTreeViewer(axisManagersGroup);
+
+ // Create the buttons composite
+ final Composite buttonsComposite = new Composite(axisManagersGroup, SWT.NONE);
+ buttonsComposite.setLayout(new GridLayout(1, false));
+ buttonsComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+
+ // Create the add button
+ addAxisConfiguration = new Button(buttonsComposite, SWT.PUSH);
+ addAxisConfiguration.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.ADD_ICON_PATH));
+ addAxisConfiguration.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the add action which allow to create an axis configuration
+ addAxisConfiguration.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+
+ final SelectionListener selectionListener = new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ final EClass eClass = (EClass) event.widget.getData(E_CLASS);
+ final EObject instance = eClass.getEPackage().getEFactoryInstance().create(eClass);
+
+ if (instance instanceof IAxisConfiguration) {
+ headerAxisConfiguration.getOwnedAxisConfigurations().add((IAxisConfiguration) instance);
+
+ editAxisConfiguration(instance);
+
+ treeViewer.setSelection(new StructuredSelection(instance));
+ }
+ }
+
+ };
+
+ final Menu menu = new Menu(addAxisConfiguration);
+ final MenuItem treeFillingItem = new MenuItem(menu, SWT.NONE);
+ treeFillingItem.setText(Messages.RowConfigurationWizardPage_treeFillingConfigurationLabel);
+ treeFillingItem.setData(E_CLASS, NattableaxisconfigurationPackage.eINSTANCE.getEClassifier("TreeFillingConfiguration")); //$NON-NLS-1$ //$NON-NLS-2$
+ treeFillingItem.addSelectionListener(selectionListener);
+ final MenuItem pasteEObjectItem = new MenuItem(menu, SWT.NONE);
+ pasteEObjectItem.setText(Messages.RowConfigurationWizardPage_pasteConfigurationLabel);
+ pasteEObjectItem.setData(E_CLASS, NattableaxisconfigurationPackage.eINSTANCE.getEClassifier("PasteEObjectConfiguration")); //$NON-NLS-1$ //$NON-NLS-2$
+ pasteEObjectItem.addSelectionListener(selectionListener);
+ final MenuItem featureAxisItem = new MenuItem(menu, SWT.NONE);
+ featureAxisItem.setText(Messages.RowConfigurationWizardPage_featureAxisLabel);
+ featureAxisItem.setData(E_CLASS, NattableaxisconfigurationPackage.eINSTANCE.getEClassifier("FeatureAxisConfiguration")); //$NON-NLS-1$ //$NON-NLS-2$
+ featureAxisItem.addSelectionListener(selectionListener);
+ final MenuItem featureValueFillingItem = new MenuItem(menu, SWT.NONE);
+ featureValueFillingItem.setText(Messages.RowConfigurationWizardPage_eStructuralFeatureValueFillingConfigurationLabel);
+ featureValueFillingItem.setData(E_CLASS, NattableaxisconfigurationPackage.eINSTANCE.getEClassifier("EStructuralFeatureValueFillingConfiguration")); //$NON-NLS-1$ //$NON-NLS-2$
+ featureValueFillingItem.addSelectionListener(selectionListener);
+
+ menu.setVisible(true);
+
+ // The menu is blocking the thread
+ final Display display = addAxisConfiguration.getDisplay();
+ while (menu.isVisible()) {
+ try {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ } catch (Throwable ex) {
+ System.out.println(ex);
+ }
+ }
+ if (!display.isDisposed()) {
+ display.update();
+ }
+ }
+ });
+
+ // Create the edit button
+ editAxisConfiguration = new Button(buttonsComposite, SWT.PUSH);
+ editAxisConfiguration.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.EDIT_ICON_PATH));
+ editAxisConfiguration.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the edit action which allow to edit an axis configuration
+ editAxisConfiguration.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ final Object selectedObject = treeViewer.getStructuredSelection().getFirstElement();
+ editAxisConfiguration((EObject) selectedObject);
+ }
+ });
+
+ // Create the remove button
+ removeAxisConfiguration = new Button(buttonsComposite, SWT.PUSH);
+ removeAxisConfiguration.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH));
+ removeAxisConfiguration.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the remove action which allow to remove an axis configuration
+ removeAxisConfiguration.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ final Iterator<?> selectedObjects = treeViewer.getStructuredSelection().iterator();
+ while (selectedObjects.hasNext()) {
+ headerAxisConfiguration.getOwnedAxisConfigurations().remove(selectedObjects.next());
+ }
+
+ recalculateAxisConfigurationButtonsAvailability(treeViewer.getStructuredSelection());
+
+ treeViewer.refresh();
+ }
+ });
+
+ // Manage the selection change
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(final SelectionChangedEvent event) {
+ recalculateAxisConfigurationButtonsAvailability(event.getSelection());
+ }
+ });
+
+ treeViewer.setSelection(new StructuredSelection());
+ }
+
+ /**
+ * This allows to calculate the axis configurations buttons availability (remove button musn't be enabled when there is no selection).
+ *
+ * @param selection
+ * The current table viewer selection.
+ */
+ protected void recalculateAxisConfigurationButtonsAvailability(final ISelection selection) {
+ editAxisConfiguration.setEnabled(selection instanceof StructuredSelection && 1 == ((StructuredSelection) selection).size() && ((StructuredSelection) selection).getFirstElement() instanceof IAxisConfiguration);
+ removeAxisConfiguration.setEnabled(null != selection && !selection.isEmpty());
+ }
+
+ /**
+ * This allows to edit axis configuration via a dialog corresponding to a type.
+ *
+ * @param object
+ * The object to edit.
+ */
+ protected void editAxisConfiguration(final EObject object) {
+ if (object instanceof PasteEObjectConfiguration) {
+ final PasteEObjectConfiguration pasteEObjectConfiguration = (PasteEObjectConfiguration) object;
+ final PasteEObjectConfigurationDialog dialog = new PasteEObjectConfigurationDialog(getShell(), pasteEObjectConfiguration);
+ if (Window.OK == dialog.open()) {
+ final PasteEObjectConfiguration modifiedPasteConfiguration = dialog.getModifiedPasteEObjectConfiguration();
+ pasteEObjectConfiguration.setDetachedMode(modifiedPasteConfiguration.isDetachedMode());
+ pasteEObjectConfiguration.setPastedElementId(modifiedPasteConfiguration.getPastedElementId());
+ pasteEObjectConfiguration.setPasteElementContainementFeature(modifiedPasteConfiguration.getPasteElementContainementFeature());
+ pasteEObjectConfiguration.getPostActions().addAll(modifiedPasteConfiguration.getPostActions());
+ }
+ } else if (object instanceof EStructuralFeatureValueFillingConfiguration) {
+ final EStructuralFeatureValueFillingConfiguration featureFillingConfiguration = (EStructuralFeatureValueFillingConfiguration) object;
+ final FeatureFillingConfigurationDialog dialog = new FeatureFillingConfigurationDialog(getShell(), featureFillingConfiguration);
+ if (Window.OK == dialog.open()) {
+ final EStructuralFeatureValueFillingConfiguration modifiedFeatureFillingConfiguration = dialog.getModifiedFeatureFillingConfiguration();
+ featureFillingConfiguration.setListenFeature(modifiedFeatureFillingConfiguration.getListenFeature());
+ }
+ } else if (object instanceof TreeFillingConfiguration) {
+ final TreeFillingConfiguration treeFillingConfiguration = (TreeFillingConfiguration) object;
+ final TreeFillingConfigurationDialog dialog = new TreeFillingConfigurationDialog(getShell(), treeFillingConfiguration, headerAxisConfiguration.getOwnedLabelConfigurations(), getPasteConfigurations());
+ if (Window.OK == dialog.open()) {
+ final TreeFillingConfiguration modifiedTreeFillingConfiguration = dialog.getModifiedTreeFillingConfiguration();
+ treeFillingConfiguration.setDepth(modifiedTreeFillingConfiguration.getDepth());
+ treeFillingConfiguration.setLabelProvider(modifiedTreeFillingConfiguration.getLabelProvider());
+ treeFillingConfiguration.setPasteConfiguration(modifiedTreeFillingConfiguration.getPasteConfiguration());
+ final IAxis modifiedAxis = modifiedTreeFillingConfiguration.getAxisUsedAsAxisProvider();
+ if (null != modifiedAxis) {
+ final IAxis existingAxis = treeFillingConfiguration.getAxisUsedAsAxisProvider();
+ if (null != existingAxis && modifiedAxis.getClass().getSimpleName().equals(existingAxis.getClass().getSimpleName())) {
+ if (existingAxis instanceof EObjectAxis) {
+ ((EObjectAxis) existingAxis).setElement(((EObjectAxis) modifiedAxis).getElement());
+ } else if (existingAxis instanceof EStructuralFeatureAxis) {
+ ((EStructuralFeatureAxis) existingAxis).setElement(((EStructuralFeatureAxis) modifiedAxis).getElement());
+ } else if (existingAxis instanceof EOperationAxis) {
+ ((EOperationAxis) existingAxis).setElement(((EOperationAxis) modifiedAxis).getElement());
+ } else if (existingAxis instanceof FeatureIdAxis) {
+ ((FeatureIdAxis) existingAxis).setElement(((FeatureIdAxis) modifiedAxis).getElement());
+ }
+ } else {
+ treeFillingConfiguration.setAxisUsedAsAxisProvider(modifiedAxis);
+ }
+ } else {
+ treeFillingConfiguration.setAxisUsedAsAxisProvider(null);
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the paste configuration available in the header axis configuration.
+ *
+ * @return The list of paste configuration available in the header axis configuration.
+ */
+ protected List<PasteEObjectConfiguration> getPasteConfigurations() {
+ List<PasteEObjectConfiguration> pasteConfigurations = new ArrayList<PasteEObjectConfiguration>();
+ for (final IAxisConfiguration axisConfiguration : headerAxisConfiguration.getOwnedAxisConfigurations()) {
+ if (axisConfiguration instanceof PasteEObjectConfiguration) {
+ pasteConfigurations.add((PasteEObjectConfiguration) axisConfiguration);
+ }
+ }
+ return pasteConfigurations;
+ }
+
+ /**
+ * This allows to create the axis configurations tree viewer and its columns.
+ *
+ * @param parent
+ * The parent composite.
+ * @return The created tree viewer.
+ */
+ protected TreeViewer createAxisConfigurationTreeViewer(final Composite parent) {
+ final TreeViewer treeViewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER));
+
+ // Create the columns
+ createAxisConfigurationsColumns(treeViewer);
+
+ // Manage some table display
+ final Tree tree = treeViewer.getTree();
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ // The content provider of the tree viewer
+ // Here, we can use the content provider of the nattable axis configuration
+ final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory();
+ adapterFactory.addAdapterFactory(new NattableaxisconfigurationItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new NattableaxisItemProviderAdapterFactory());
+ final IContentProvider contentProvider = new AdapterFactoryContentProvider(adapterFactory) {
+
+ @Override
+ public Object[] getElements(final Object object) {
+ final Object[] elements = super.getElements(object);
+ final List<Object> elementsList = new ArrayList<Object>(Arrays.asList(elements));
+
+ final Iterator<Object> elementsIterator = elementsList.iterator();
+
+ // Display only the axis configurations
+ while (elementsIterator.hasNext()) {
+ if (!(elementsIterator.next() instanceof IAxisConfiguration)) {
+ elementsIterator.remove();
+ }
+ }
+ return elementsList.toArray();
+ }
+ };
+
+ treeViewer.setContentProvider(contentProvider);
+
+ // Define the table input
+ treeViewer.setInput(headerAxisConfiguration);
+
+ // define layout for the viewer
+ treeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ treeViewer.refresh();
+ return treeViewer;
+ }
+
+ /**
+ * This allows to create the table viewer axis configurations columns.
+ *
+ * @param tableViewer
+ * The table viewer.
+ */
+ protected void createAxisConfigurationsColumns(final TreeViewer treeViewer) {
+
+ // Define the titles and bounds of each columns
+ final int[] bounds = { 600 };
+ final String[] titles = { Messages.RowConfigurationWizardPage_axisConfigurationsColumnName };
+
+ // Create the first column for the axis manager id
+ final TreeViewerColumn axisManagerIdColumn = createTreeViewerColumn(treeViewer, titles[0], bounds[0]);
+
+ final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory();
+ adapterFactory.addAdapterFactory(new NattableaxisconfigurationItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new NattableaxisItemProviderAdapterFactory());
+ final ILabelProvider labelProvider = new AdapterFactoryLabelProvider(adapterFactory);
+
+ axisManagerIdColumn.setLabelProvider(new TreeColumnViewerLabelProvider(labelProvider));
+ }
+
+ /**
+ * This allows to create a tree viewer column in the tree viewer.
+ *
+ * @param viewer
+ * the tree viewer.
+ * @param title
+ * The title of the column.
+ * @param width
+ * The width of the column to create.
+ * @return The created tree viewer column.
+ */
+ protected TreeViewerColumn createTreeViewerColumn(final TreeViewer viewer, final String title, final int width) {
+ final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
+ final TreeColumn column = viewerColumn.getColumn();
+ column.setText(title);
+ column.setWidth(width);
+ column.setResizable(true);
+ column.setMoveable(false);
+ return viewerColumn;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.pages.AbstractAxisConfigurationWizardPage#createAxisManagerRepresentation()
+ *
+ * @return
+ */
+ @Override
+ public AxisManagerRepresentation createAxisManagerRepresentation() {
+ final AxisManagerRepresentation createdRepresentation = super.createAxisManagerRepresentation();
+ // Set the label provider context
+ createdRepresentation.setLabelProviderContext("org.eclipse.papyrus.infra.nattable.header.labelprovider"); //$NON-NLS-1$
+ return createdRepresentation;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.pages.AbstractAxisConfigurationWizardPage#createColumns(org.eclipse.jface.viewers.TableViewer)
+ */
+ @Override
+ protected void createAxisManagersColumns(final TableViewer tableViewer) {
+
+ final Table table = tableViewer.getTable();
+ final Collection<String> knownAxis = AxisManagerFactory.INSTANCE.getAllRegisteredAxisManager().keySet();
+
+ // Define the titles and bounds of each columns
+ final int[] bounds = { 500, 500 };
+ final String[] titles = { Messages.ConfigurationWizardPage_axisManagerIdColumnName, Messages.ConfigurationWizardPage_labelProviderContextColumnName };
+
+ // Create the first column for the axis manager id
+ final TableViewerColumn axisManagerIdColumn = createTableViewerColumn(tableViewer, titles[0], bounds[0]);
+ final ColumnLabelProvider axisManagerIdLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ final StringBuilder value = new StringBuilder();
+ if (element instanceof AxisManagerRepresentation) {
+ final String axisManagerId = ((AxisManagerRepresentation) element).getAxisManagerId();
+ boolean axisManagerFound = NameSimplifier.axisManagerNames.containsKey(axisManagerId);
+ if (axisManagerFound) {
+ value.append(NameSimplifier.axisManagerNames.get(axisManagerId));
+ } else {
+ value.append(null != axisManagerId ? axisManagerId : ""); //$NON-NLS-1$
+ }
+ }
+ return value.toString();
+ }
+ };
+ axisManagerIdColumn.setLabelProvider(axisManagerIdLabelProvider);
+ // Create the combo box of the axis manager identifier
+ axisManagerIdColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, axisManagerIdLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ if (element instanceof AxisManagerRepresentation) {
+ // set the new value
+ if (NameSimplifier.axisManagerNames.containsValue(value)) {
+ for (final Entry<String, String> entry : NameSimplifier.axisManagerNames.entrySet()) {
+ if (((String) value).contains(entry.getValue()) && ((String) value).contains(entry.getKey())) {
+ ((AxisManagerRepresentation) element).setAxisManagerId(entry.getKey());
+ }
+ }
+ } else {
+ ((AxisManagerRepresentation) element).setAxisManagerId((String) value);
+ }
+
+ // Manage the label provider configuration depending to the new axis manager identifier
+ manageLabelProviderConfiguration((AxisManagerRepresentation) element);
+
+ tableViewer.refresh();
+ setPageComplete(isPageComplete());
+ }
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new ExtendedComboBoxCellEditor(table, createAxisManagerIdItems(requiredProposedAxisManagers, knownAxis), new LabelProvider(), SWT.NONE) {
+
+ @Override
+ public Object doGetValue() {
+ // Redefine this to allow other value than the proposed ones from the combo
+ if (getControl() instanceof CCombo) {
+ return ((CCombo) getControl()).getText();
+ }
+ return super.doGetValue();
+ }
+ };
+ }
+ });
+
+ // Create the second column for the label provider context
+ final TableViewerColumn labelProviderContextColumn = createTableViewerColumn(tableViewer, titles[1], bounds[1]);
+ final ColumnLabelProvider labelProviderContextLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ String result = ""; //$NON-NLS-1$
+ if (element instanceof AxisManagerRepresentation) {
+ if (NameSimplifier.labelProviderContextNames.containsKey(((AxisManagerRepresentation) element).getLabelProviderContext())) {
+ result = NameSimplifier.labelProviderContextNames.get(((AxisManagerRepresentation) element).getLabelProviderContext());
+ } else {
+ result = ((AxisManagerRepresentation) element).getLabelProviderContext();
+ }
+ }
+ return result;
+ }
+ };
+ labelProviderContextColumn.setLabelProvider(labelProviderContextLabelProvider);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/SlaveConfigurationWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/SlaveConfigurationWizardPage.java
new file mode 100644
index 00000000000..29fb6106cfd
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/pages/SlaveConfigurationWizardPage.java
@@ -0,0 +1,732 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.pages;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.DialogCellEditor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+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.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.customization.nattableconfiguration.helper.TableConfigurationHelper;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationEditingSupport;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.nattable.comparator.IntegerFilterComparator;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EObjectAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EOperationAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EStructuralFeatureAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.FeatureIdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ObjectIdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.SlaveObjectAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.StringComparator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.editors.ITreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.providers.CompoundFilteredRestrictedContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.FlattenableRestrictedFilteredContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IRestrictedContentProvider;
+import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * The slave configuration wizard page for the nattable configuration.
+ */
+public class SlaveConfigurationWizardPage extends AbstractTableConfigurationWizardPage {
+
+ /**
+ * The table configuration.
+ */
+ protected final TableConfiguration configuration;
+
+ /**
+ * The label provider for the UML elements.
+ */
+ protected final ILabelProvider labelProvider;
+
+ /**
+ * The button which allow to add an axis.
+ */
+ protected Button addAxis;
+
+ /**
+ * The button which allow to remove the axis.
+ */
+ protected Button removeAxis;
+
+ /**
+ * The button which allow to move up the axis.
+ */
+ protected Button upAxis;
+
+ /**
+ * The button which allow to move down the axis.
+ */
+ protected Button downAxis;
+
+ /**
+ * Constructor.
+ *
+ * @param helper
+ * The table configuration helper.
+ */
+ public SlaveConfigurationWizardPage(final TableConfigurationHelper helper) {
+ super(Messages.SlaveConfigurationWizardPage_pageName, helper);
+ configuration = helper.getTableConfiguration();
+
+ LabelProviderService labelProviderService = new LabelProviderServiceImpl();
+ try {
+ labelProviderService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ labelProvider = labelProviderService.getLabelProvider();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(final Composite parent) {
+
+ // Create the parent composite
+ final Composite container = new Composite(parent, SWT.BORDER);
+ container.setLayout(new GridLayout(2, false));
+
+ final SlaveObjectAxisProvider slave = getOrCreateSlaveObjectAxisProvider(configuration);
+
+ // Create the table viewer (table, column and its layout)
+ final TableViewer tableViewer = createTableViewer(container, slave);
+
+ // Create the buttons composite
+ final Composite buttonsComposite = new Composite(container, SWT.NONE);
+ buttonsComposite.setLayout(new GridLayout(1, false));
+ buttonsComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+
+ // Create the add button
+ addAxis = new Button(buttonsComposite, SWT.PUSH);
+ addAxis.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.ADD_ICON_PATH));
+ addAxis.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the add action which allow to create an axis
+ addAxis.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ int lastPosition = slave.getAxis().size();
+ if (!tableViewer.getStructuredSelection().isEmpty()) {
+ final Iterator<?> selectedObjects = tableViewer.getStructuredSelection().iterator();
+ while (selectedObjects.hasNext()) {
+ final Object selectedObject = selectedObjects.next();
+ final int objectPosition = slave.getAxis().indexOf(selectedObject);
+ if (objectPosition > lastPosition) {
+ lastPosition = objectPosition;
+ }
+ }
+ }
+
+ final EStructuralFeatureAxis createdAxis = NattableaxisFactory.eINSTANCE.createEStructuralFeatureAxis();
+ if (lastPosition + 1 < slave.getAxis().size()) {
+ getSlaveObjectAxisProvider(configuration).getAxis().add(lastPosition + 1, createdAxis);
+ } else {
+ getSlaveObjectAxisProvider(configuration).getAxis().add(createdAxis);
+ }
+ recalculateButtonsAvailability(tableViewer.getStructuredSelection(), slave);
+ tableViewer.refresh();
+ }
+ });
+
+ // Create the remove button
+ removeAxis = new Button(buttonsComposite, SWT.PUSH);
+ removeAxis.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH));
+ removeAxis.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the remove action which allow to remove an axis
+ removeAxis.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ final Iterator<?> selectedObjects = tableViewer.getStructuredSelection().iterator();
+ while (selectedObjects.hasNext()) {
+ slave.getAxis().remove(selectedObjects.next());
+ }
+ recalculateButtonsAvailability(tableViewer.getStructuredSelection(), slave);
+ tableViewer.refresh();
+ }
+ });
+
+ // Create the move up button
+ upAxis = new Button(buttonsComposite, SWT.UP);
+ upAxis.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.UP_ICON_PATH));
+ upAxis.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the remove action which allow to move up an axis
+ upAxis.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ // Create a list of index to move.
+ // To move all the selected item correctly, get all index to move, sort the integer and move it from the first to the last
+ // (to avoid multiple same object moved)
+ final List<Integer> indexToMove = new ArrayList<Integer>();
+
+ final Iterator<?> selectedObjects = tableViewer.getStructuredSelection().iterator();
+ while (selectedObjects.hasNext()) {
+ IAxis selectedAxis = (IAxis) selectedObjects.next();
+ indexToMove.add(slave.getAxis().indexOf(selectedAxis));
+ }
+
+ // Sort the index to move
+ indexToMove.sort(IntegerFilterComparator.getInstance());
+
+ // Move the objects from the first to the last
+ for (final Integer index : indexToMove) {
+ slave.getAxis().move(index - 1, index);
+ }
+
+ recalculateButtonsAvailability(tableViewer.getStructuredSelection(), slave);
+ tableViewer.refresh();
+ }
+ });
+
+ // Create the move down button
+ downAxis = new Button(buttonsComposite, SWT.DOWN);
+ downAxis.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DOWN_ICON_PATH));
+ downAxis.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
+ // Manage the remove action which allow to move down an axis
+ downAxis.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ // Create a list of index to move.
+ // To move all the selected item correctly, get all index to move, sort the integer and move it from the last to the first
+ // (to avoid multiple same object moved)
+ final List<Integer> indexToMove = new ArrayList<Integer>();
+
+ final Iterator<?> selectedObjects = tableViewer.getStructuredSelection().iterator();
+ while (selectedObjects.hasNext()) {
+ final IAxis selectedAxis = (IAxis) selectedObjects.next();
+ indexToMove.add(slave.getAxis().indexOf(selectedAxis));
+ }
+
+ // Sort the index to move
+ indexToMove.sort(IntegerFilterComparator.getInstance());
+
+ // Move the objects from the last to the first
+ for (int it = indexToMove.size() - 1; it >= 0; it--) {
+ int index = indexToMove.get(it);
+ slave.getAxis().move(index + 1, index);
+ }
+
+ recalculateButtonsAvailability(tableViewer.getStructuredSelection(), slave);
+ tableViewer.refresh();
+ }
+ });
+
+ // Manage the selection change
+ tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ recalculateButtonsAvailability(event.getSelection(), slave);
+ }
+ });
+ tableViewer.setSelection(new StructuredSelection());
+
+ setControl(container);
+ }
+
+ /**
+ * This allows to calculate if buttons availability depending to the selection.
+ *
+ * @param selection
+ * The current table viewer selection.
+ * @param slave
+ * The slave axis provider.
+ */
+ protected void recalculateButtonsAvailability(final ISelection selection, final SlaveObjectAxisProvider slave) {
+ if (null != selection && !selection.isEmpty()) {
+ // A selection is available, enabled the remove button
+ removeAxis.setEnabled(true);
+
+ // check if the is not the first or last position, because otherwise, the up or down button must be always disabled
+ int firstPosition = -1;
+ int lastPosition = -1;
+ if (selection instanceof StructuredSelection) {
+ final Iterator<?> selectedObjects = ((StructuredSelection) selection).iterator();
+ while (selectedObjects.hasNext()) {
+ final Object selectedObject = selectedObjects.next();
+ final int objectPosition = slave.getAxis().indexOf(selectedObject);
+ if (-1 == firstPosition || objectPosition < firstPosition) {
+ firstPosition = objectPosition;
+ }
+ if (objectPosition > lastPosition) {
+ lastPosition = objectPosition;
+ }
+ }
+ }
+
+ upAxis.setEnabled(firstPosition != 0);
+ downAxis.setEnabled(lastPosition < slave.getAxis().size() - 1);
+ } else {
+ // Only add button must be enable when no selection occured
+ removeAxis.setEnabled(false);
+ upAxis.setEnabled(false);
+ downAxis.setEnabled(false);
+ }
+ }
+
+ /**
+ * This allows to create the table viewer and its columns.
+ *
+ * @param parent
+ * The parent composite.
+ * @param slave
+ * The slave axis provider.
+ * @return The created table viewer.
+ */
+ protected TableViewer createTableViewer(final Composite parent, final SlaveObjectAxisProvider slave) {
+
+ final TableViewer tableViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
+
+ // Create the columns
+ createColumns(tableViewer);
+
+ // Manage some table display
+ final Table table = tableViewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ // The content provider of the initial selection
+ tableViewer.setContentProvider(new ArrayContentProvider());
+
+ // Define the table input
+ tableViewer.setInput(slave.getAxis());
+
+ // define layout for the viewer
+ tableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ tableViewer.refresh();
+ return tableViewer;
+ }
+
+ /**
+ * This allows to create the table viewer columns.
+ *
+ * @param tableViewer
+ * The table viewer.
+ */
+ protected void createColumns(final TableViewer tableViewer) {
+
+ final Table table = tableViewer.getTable();
+
+ // Define the titles and bounds of each columns
+ final int[] bounds = { 150, 250, 450, 100 };
+ final String[] titles = { Messages.SlaveConfigurationWizardPage_typeColumnName, Messages.SlaveConfigurationWizardPage_elementColumnName, Messages.SlaveConfigurationWizardPage_managerColumnName, Messages.SlaveConfigurationWizardPage_aliasColumnName };
+
+ // Create the first column and manage its display by the label provider of the initial selection
+ final List<String> typesPossible = new ArrayList<String>();
+ typesPossible.add("EObjectAxis"); //$NON-NLS-1$
+ typesPossible.add("EOperationAxis"); //$NON-NLS-1$
+ typesPossible.add("EStructuralFeatureAxis"); //$NON-NLS-1$
+ typesPossible.add("FeatureIdAxis"); //$NON-NLS-1$
+ typesPossible.add("ObjectAxis"); //$NON-NLS-1$
+
+ // Create the first column for the type
+ final TableViewerColumn firstColumn = createTableViewerColumn(tableViewer, titles[0], bounds[0]);
+ final ColumnLabelProvider typeLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ return ((IAxis) element).getClass().getSimpleName().substring(0, ((IAxis) element).getClass().getSimpleName().length() - 4);
+ }
+ };
+ firstColumn.setLabelProvider(typeLabelProvider);
+ // Create the combo box of the type
+ firstColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, typeLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ final IAxis axis = (IAxis) element;
+
+ if (null == element || !((IAxis) element).getClass().getSimpleName().substring(0, ((IAxis) element).getClass().getSimpleName().length() - 4).equals(value) && !value.toString().isEmpty()) {
+ // Create the axis
+ IAxis recreatedAxis = null;
+ if ("EObjectAxis".equals(value)) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createEObjectAxis();
+ } else if ("EOperationAxis".equals(value)) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createEOperationAxis();
+ } else if ("EStructuralFeatureAxis".equals(value)) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createEStructuralFeatureAxis();
+ } else if ("FeatureIdAxis".equals(value)) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createFeatureIdAxis();
+ } else if ("ObjectAxis".equals(value)) { //$NON-NLS-1$
+ recreatedAxis = NattableaxisFactory.eINSTANCE.createObjectIdAxis();
+ }
+
+ recreatedAxis.setAlias(axis.getAlias());
+ recreatedAxis.setManager(axis.getManager());
+
+ SlaveObjectAxisProvider slave = getSlaveObjectAxisProvider(configuration);
+ int indexAxisInParent = slave.getAxis().indexOf(axis);
+ slave.getAxis().add(indexAxisInParent, recreatedAxis);
+ slave.getAxis().remove(axis);
+
+ tableViewer.refresh();
+ }
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new ExtendedComboBoxCellEditor(table, typesPossible, new LabelProvider(), SWT.READ_ONLY);
+ }
+ });
+
+ // Create the second viewer column and manage its display and edition
+ final TableViewerColumn secondColumn = createTableViewerColumn(tableViewer, titles[1], bounds[1]);
+ final ColumnLabelProvider elementLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ String result = null;
+ if (element instanceof IAxis) {
+ final IAxis axis = (IAxis) element;
+ if (null != axis.getElement()) {
+ result = labelProvider.getText(axis.getElement());
+ }
+ }
+ return null != result ? result : null;
+ }
+
+ @Override
+ public Image getImage(final Object element) {
+ Image result = null;
+ if (element instanceof IAxis) {
+ final IAxis axis = (IAxis) element;
+ if (null != axis.getElement()) {
+ result = labelProvider.getImage(axis.getElement());
+ }
+ }
+ return null != result ? result : null;
+
+ }
+ };
+ secondColumn.setLabelProvider(elementLabelProvider);
+ secondColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, labelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ final IAxis axis = (IAxis) element;
+
+ if (null == axis.getElement() || !axis.getElement().equals(value)) {
+ if (axis instanceof EObjectAxis && value instanceof EObject) {
+ ((EObjectAxis) axis).setElement((EObject) value);
+ } else if (axis instanceof EOperationAxis && value instanceof EOperation) {
+ ((EOperationAxis) axis).setElement((EOperation) value);
+ } else if (axis instanceof EStructuralFeatureAxis && value instanceof EStructuralFeature) {
+ ((EStructuralFeatureAxis) axis).setElement((EStructuralFeature) value);
+ } else if (axis instanceof FeatureIdAxis && value instanceof String) {
+ ((FeatureIdAxis) axis).setElement((String) value);
+ } else if (axis instanceof ObjectIdAxis && value instanceof String) {
+ ((ObjectIdAxis) axis).setElement((String) value);
+ }
+ tableViewer.refresh();
+ }
+ }
+
+ @Override
+ protected Object getValue(final Object element) {
+ String result = null;
+ if (element instanceof IAxis) {
+ final IAxis axis = (IAxis) element;
+ if (null != axis.getElement()) {
+ result = labelProvider.getText(axis.getElement());
+ }
+ }
+ return null != result ? result : ""; //$NON-NLS-1$
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ if (element instanceof IdAxis) {
+ return new TextCellEditor(table);
+ } else {
+ final IAxis existingAxis = (IAxis) element;
+ final Object initialValue = getValue(element);
+ return new DialogCellEditor(table) {
+
+ @Override
+ protected Object openDialogBox(Control cellEditorWindow) {
+ final ITreeSelectorDialog dialog = new TreeSelectorDialog(getShell()) {
+ @Override
+ protected void initViewerAndProvider() {
+ super.initViewerAndProvider();
+ // Set a comparator to sort the tree viewer
+ getViewer().setComparator(new ViewerComparator(new StringComparator()));// should always be string element
+ }
+ };
+ dialog.setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.FeatureFillingConfigurationDialog_listenFeatureDialogName);
+
+ final CompoundFilteredRestrictedContentProvider contentProvider = new CompoundFilteredRestrictedContentProvider() {
+
+ @Override
+ public Object[] getChildren(final Object parentElement) {
+ List<Object> childrenList = Arrays.asList(super.getChildren(parentElement));
+ if (parentElement instanceof EClass) {
+ childrenList = new ArrayList<Object>(childrenList);
+ final EClass eClass = (EClass) parentElement;
+ if (isIgnoringInheritedElements()) {
+ childrenList.addAll(eClass.getEOperations());
+ } else {
+ childrenList.addAll(eClass.getEAllOperations());
+ }
+ childrenList.remove(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
+ }
+ return childrenList.toArray();
+ }
+ };
+ final ReferenceSelector selector = new ReferenceSelector(false) {
+
+ @Override
+ public void createControls(Composite parent) {
+ super.createControls(parent);
+ this.treeViewer.setComparator(new ViewerComparator(new StringComparator()));// should always be string element
+ }
+ };
+
+ selector.setLabelProvider(labelProvider);
+ selector.setContentProvider(contentProvider);
+ final ITreeContentProvider treeContentProvider = new FlattenableRestrictedFilteredContentProvider((IRestrictedContentProvider) contentProvider, selector) {
+
+ @Override
+ public boolean isValidValue(final Object element) {
+ // EMF dependency, must not be done here, it should be better with a new content provider service
+ boolean result = false;
+
+ if (null != existingAxis) {
+ result = element != EcorePackage.eINSTANCE.getEModelElement_EAnnotations();
+
+ // Depending to the axis, objects displayed are not the same
+ if (existingAxis instanceof EObjectAxis && result) {
+ result = element instanceof EClass;
+ } else if (existingAxis instanceof EStructuralFeatureAxis && result) {
+ result = element instanceof EStructuralFeature;
+ } else if (existingAxis instanceof EOperationAxis && result) {
+ result = element instanceof EOperation;
+ }
+ }
+
+ return result;
+ }
+ };
+
+ dialog.setContentProvider(treeContentProvider);
+ dialog.setLabelProvider(labelProvider);
+ if (null != initialValue) {
+ dialog.setInitialElementSelections(Collections.singletonList(initialValue));
+ }
+ Object value = null;
+ int result = dialog.open();
+ if (Window.OK == result) {
+ Object[] newValue = dialog.getResult();
+ if (null != newValue) {
+ if (0 == newValue.length) {
+ value = null;
+ } else {
+ value = newValue[0];
+ }
+ }
+ setValue(value);
+ }
+
+ return value;
+ }
+ };
+ }
+ }
+ });
+
+ // Create the third viewer column and manage its display and edition
+ final TableViewerColumn thirdColumn = createTableViewerColumn(tableViewer, titles[2], bounds[2]);
+ final ColumnLabelProvider managerLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ return null != ((IAxis) element).getManager() ? ((IAxis) element).getManager().getAxisManagerId() : ""; //$NON-NLS-1$
+ }
+ };
+ thirdColumn.setLabelProvider(managerLabelProvider);
+ // Create the combo box for the manager
+ thirdColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, managerLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ final IAxis axis = (IAxis) element;
+
+ if (null != value && !value.equals(axis.getManager())) {
+ // Change the manager
+ axis.setManager((AxisManagerRepresentation) value);
+ tableViewer.refresh();
+ }
+ }
+
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return new ExtendedComboBoxCellEditor(table, configuration.getColumnHeaderAxisConfiguration().getAxisManagers(), new LabelProvider() {
+ @Override
+ public String getText(final Object element) {
+ return ((AxisManagerRepresentation) element).getAxisManagerId();
+ }
+ }, SWT.READ_ONLY);
+ }
+ });
+
+ // Create the fourth viewer column and manage its display and edition
+ final TableViewerColumn fourthColumn = createTableViewerColumn(tableViewer, titles[3], bounds[3]);
+ final ColumnLabelProvider aliasLabelProvider = new ColumnLabelProvider() {
+
+ @Override
+ public String getText(final Object element) {
+ return null != ((IAxis) element).getAlias() ? ((IAxis) element).getAlias() : ""; //$NON-NLS-1$
+ }
+ };
+ fourthColumn.setLabelProvider(aliasLabelProvider);
+ // Create the text editor for the manager
+ fourthColumn.setEditingSupport(new NattableConfigurationEditingSupport(tableViewer, aliasLabelProvider) {
+
+ @Override
+ protected void setValue(final Object element, final Object value) {
+ final IAxis axis = (IAxis) element;
+
+ if (!value.toString().isEmpty() && !value.equals(axis.getAlias())) {
+ // Change the manager
+ axis.setAlias((String) value);
+ tableViewer.refresh();
+ }
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return new TextCellEditor(table);
+ }
+ });
+ }
+
+ /**
+ * This allows to create and return a table viewer column.
+ *
+ * @param tableViewer
+ * The parent table viewer of the column to create.
+ * @param title
+ * The title of the column to create.
+ * @param width
+ * The width of the column to create.
+ * @return The created viewer column.
+ */
+ private TableViewerColumn createTableViewerColumn(final TableViewer tableViewer, final String title, final int width) {
+ final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
+ final TableColumn column = viewerColumn.getColumn();
+ column.setText(title);
+ column.setWidth(width);
+ column.setResizable(true);
+ column.setMoveable(true);
+ return viewerColumn;
+ }
+
+ /**
+ * This allows to get the slave axis provider of the nattable configuration.
+ *
+ * @param configuration
+ * The nattable configuration.
+ * @return The slave axis provider is exists or <code>null</code>.
+ */
+ protected SlaveObjectAxisProvider getSlaveObjectAxisProvider(final TableConfiguration configuration) {
+ SlaveObjectAxisProvider slave = null;
+
+ // Try to get an existing slave axis provider
+ if (0 < configuration.getColumnAxisProviders().size()) {
+ final Iterator<AbstractAxisProvider> columnAxisProvidersIterator = configuration.getColumnAxisProviders().iterator();
+ while (columnAxisProvidersIterator.hasNext() && null == slave) {
+ AbstractAxisProvider axisProvider = columnAxisProvidersIterator.next();
+ if (axisProvider instanceof SlaveObjectAxisProvider) {
+ slave = (SlaveObjectAxisProvider) axisProvider;
+ }
+ }
+ }
+
+ return slave;
+ }
+
+ /**
+ * Get the existing slave axis provider or create it otherwise.
+ *
+ * @param configuration
+ * The nattable configuration.
+ * @return The existing or created axis provider.
+ */
+ protected SlaveObjectAxisProvider getOrCreateSlaveObjectAxisProvider(final TableConfiguration configuration) {
+ SlaveObjectAxisProvider slave = getSlaveObjectAxisProvider(configuration);
+
+ // The slave doesn't exist, create it
+ if (null == slave) {
+ slave = NattableaxisproviderFactory.eINSTANCE.createSlaveObjectAxisProvider();
+ configuration.getColumnAxisProviders().add(slave);
+ }
+
+ // Set the slave as default row axis provider if this is not already done
+ if (null == configuration.getDefaultColumnAxisProvider()) {
+ configuration.setDefaultColumnAxisProvider(slave);
+ }
+
+ return slave;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NameSimplifier.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NameSimplifier.java
new file mode 100644
index 00000000000..9ea3e49424e
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NameSimplifier.java
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.impl.FeatureLabelProviderConfigurationImpl;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.impl.ObjectLabelProviderConfigurationImpl;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.impl.OperationLabelProviderConfigurationImpl;
+
+/**
+ * This class allows to define the simplification names for the nattable configuration wizard.
+ */
+public class NameSimplifier {
+
+ /**
+ * Map the axis manager id (as key) to its name (as value).
+ */
+ public static final Map<String, String> axisManagerNames = new HashMap<String, String>();
+
+ /**
+ * Define the label provider configuration class to use corresponding to axis manager.
+ * If one is not filled in this map, by default, the ObjectLabelProviderConfiguration must be used.
+ */
+ public static final Map<String, String> labelProviderConfigurationByAxisManager = new HashMap<String, String>();
+
+ /**
+ * The correspondence between the axis manager identifiers and the label provider contexts.
+ */
+ public static final Map<String, String> correspondenceAxisManagerAndContext = new HashMap<String, String>();
+
+ /**
+ * To simplify the user comprehension, the label provider configuration must be managed with simplest names.
+ */
+ public static final Map<String, String> labelProviderConfigurationNames = new HashMap<String, String>();
+
+ /**
+ * To simplify the user choice, the label provider context names must be simplified.
+ */
+ public static final Map<String, String> labelProviderContextNames = new HashMap<String, String>();
+
+ /**
+ * Initialize the previous map.
+ */
+ static {
+ axisManagerNames.put("org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager", "EMF Feature (org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager)"); //$NON-NLS-1$ //$NON-NLS-2$
+ axisManagerNames.put("org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager", "EMF Operation (org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager)"); //$NON-NLS-1$ //$NON-NLS-2$
+ axisManagerNames.put("org.eclipse.papyrus.uml.nattable.element.axis.manager", "UML Element (org.eclipse.papyrus.uml.nattable.element.axis.manager)"); //$NON-NLS-1$ //$NON-NLS-2$
+ axisManagerNames.put("org.eclipse.papyrus.uml.nattable.feature.axis.manager", "UML Feature (org.eclipse.papyrus.uml.nattable.feature.axis.manager)"); //$NON-NLS-1$ //$NON-NLS-2$
+ axisManagerNames.put("org.eclipse.papyrus.uml.nattable.operation.axis.manager", "UML Operation (org.eclipse.papyrus.uml.nattable.operation.axis.manager)"); //$NON-NLS-1$ //$NON-NLS-2$
+ axisManagerNames.put("org.eclipse.papyrus.infra.uml.nattable.class.tree.axis.manager", "UML Tree Axis (org.eclipse.papyrus.infra.uml.nattable.class.tree.axis.manager)"); //$NON-NLS-1$ //$NON-NLS-2$
+ axisManagerNames.put("org.eclipse.papyrus.sysml.nattable.requirement.axis.manager", "SysML Requirement (org.eclipse.papyrus.sysml.nattable.requirement.axis.manager)"); //$NON-NLS-1$ //$NON-NLS-2$
+ axisManagerNames.put("org.eclipse.papyrus.sysml.nattable.allocate.axis.manager", "SysML Allocation (org.eclipse.papyrus.sysml.nattable.allocate.axis.manager)"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager", FeatureLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager", OperationLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.uml.nattable.element.axis.manager", ObjectLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.uml.nattable.feature.axis.manager", FeatureLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.uml.nattable.operation.axis.manager", OperationLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.infra.uml.nattable.class.tree.axis.manager", ObjectLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.sysml.nattable.requirement.axis.manager", ObjectLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.sysml.nattable.allocate.axis.manager", ObjectLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.uml.nattable.stereotype.display.axis.manager", FeatureLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$ //$NON-NLS-2$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.uml.nattable.stereotype.display.properties.axis.manager", ObjectLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$
+ labelProviderConfigurationByAxisManager.put("org.eclipse.papyrus.uml.nattable.stereotype.property.axis.manager", FeatureLabelProviderConfigurationImpl.class.getSimpleName()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager", "org.eclipse.papyrus.infra.nattable.header.feature.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager", "org.eclipse.papyrus.infra.nattable.header.operation.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.uml.nattable.element.axis.manager", "org.eclipse.papyrus.infra.nattable.header.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.uml.nattable.feature.axis.manager", "org.eclipse.papyrus.infra.nattable.header.feature.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.uml.nattable.operation.axis.manager", "org.eclipse.papyrus.infra.nattable.header.operation.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.infra.uml.nattable.class.tree.axis.manager", "org.eclipse.papyrus.infra.nattable.header.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.sysml.nattable.requirement.axis.manager", "org.eclipse.papyrus.infra.nattable.header.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.sysml.nattable.allocate.axis.manager", "org.eclipse.papyrus.infra.nattable.header.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.uml.nattable.stereotype.display.axis.manager", "org.eclipse.papyrus.infra.nattable.header.feature.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.uml.nattable.stereotype.display.properties.axis.manager", "org.eclipse.papyrus.infra.nattable.header.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+ correspondenceAxisManagerAndContext.put("org.eclipse.papyrus.uml.nattable.stereotype.property.axis.manager", "org.eclipse.papyrus.infra.nattable.header.feature.labelprovider"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ labelProviderConfigurationNames.put(ObjectLabelProviderConfigurationImpl.class.getSimpleName(), "Object"); //$NON-NLS-1$
+ labelProviderConfigurationNames.put(FeatureLabelProviderConfigurationImpl.class.getSimpleName(), "Feature"); //$NON-NLS-1$
+ labelProviderConfigurationNames.put(OperationLabelProviderConfigurationImpl.class.getSimpleName(), "Operation"); //$NON-NLS-1$
+
+ labelProviderContextNames.put("org.eclipse.papyrus.infra.nattable.header.labelprovider", "Header"); //$NON-NLS-1$ //$NON-NLS-2$
+ labelProviderContextNames.put("org.eclipse.papyrus.infra.nattable.header.feature.labelprovider", "Header Feature"); //$NON-NLS-1$ //$NON-NLS-2$
+ labelProviderContextNames.put("org.eclipse.papyrus.infra.nattable.header.operation.labelprovider", "Header Operation"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NattableConfigurationConstants.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NattableConfigurationConstants.java
new file mode 100644
index 00000000000..aaa7c6e7961
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NattableConfigurationConstants.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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.customization.nattableconfiguration.utils;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * The constants for the nattable configuration wizard.
+ */
+public class NattableConfigurationConstants {
+
+ /**
+ * the path of the wizban image.
+ */
+ public static final String ICON_WIZBAN_PATH = "icons/papyrusNattableconfigurationWizban.png"; //$NON-NLS-1$
+
+ /**
+ * The extension for the nattable configuration file.
+ */
+ public static final String NATTABLE_CONFIGURATION_EXTENSION_FILE = org.eclipse.papyrus.infra.nattable.utils.NattableConfigurationConstants.NATTABLE_CONFIGURATION_EXTENSION_FILE;
+
+ /**
+ * The config folder path.
+ */
+ public static final String CONFIG_FOLDER = "/configs/"; //$NON-NLS-1$
+
+ /**
+ * The name of the about file.
+ */
+ public static final String ABOUT_FILE_NAME = "about.html"; //$NON-NLS-1$
+
+ /**
+ * The path for the papyrus icon.
+ */
+ public static final String PAPYRUS_ICON_PATH = "/icons/papyrus.png"; //$NON-NLS-1$
+
+ /**
+ * The add icon path.
+ */
+ public static final String ADD_ICON_PATH = "/icons/Add_12x12.gif"; //$NON-NLS-1$
+
+ /**
+ * The edit icon path.
+ */
+ public static final String EDIT_ICON_PATH = "/icons/Edit_12x12.gif"; //$NON-NLS-1$
+
+ /**
+ * The browse icon path.
+ */
+ public static final String BROWSE_ICON_PATH = "/icons/browse_12x12.gif"; //$NON-NLS-1$
+
+ /**
+ * The delete icon path.
+ */
+ public static final String DELETE_ICON_PATH = "/icons/Delete_12x12.gif"; //$NON-NLS-1$
+
+ /**
+ * The down icon path.
+ */
+ public static final String DOWN_ICON_PATH = "/icons/Down_12x12.gif"; //$NON-NLS-1$
+
+ /**
+ * The up icon path.
+ */
+ public static final String UP_ICON_PATH = "/icons/Up_12x12.gif"; //$NON-NLS-1$
+
+ /**
+ * The checked image.
+ */
+ public static final Image CHECKED = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("org.eclipse.papyrus.infra.nattable.common", "icons/checked.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The unchecked image.
+ */
+ public static final Image UNCHECKED = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("org.eclipse.papyrus.infra.nattable.common", "icons/unchecked.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NattableConfigurationEditingSupport.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NattableConfigurationEditingSupport.java
new file mode 100644
index 00000000000..0cb9c0405ef
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/utils/NattableConfigurationEditingSupport.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.utils;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * The editing support specific for the nattable configuration wizard which allow to use the label provider to get the value.
+ */
+public abstract class NattableConfigurationEditingSupport extends EditingSupport {
+
+ /**
+ * The label provider used.
+ */
+ protected ILabelProvider labelProvider;
+
+ /**
+ * Constructor.
+ *
+ * @param viewer
+ * The viewer.
+ * @param labelProvider
+ * The label provider to use.
+ */
+ public NattableConfigurationEditingSupport(final ColumnViewer viewer, final ILabelProvider labelProvider) {
+ super(viewer);
+ this.labelProvider = labelProvider;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ */
+ @Override
+ protected CellEditor getCellEditor(final Object element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ */
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ */
+ @Override
+ protected Object getValue(final Object element) {
+ return labelProvider.getText(element);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ protected abstract void setValue(final Object element, final Object value);
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/CreateAndEditTableConfigurationWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/CreateAndEditTableConfigurationWizard.java
new file mode 100644
index 00000000000..41f87ff6888
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/CreateAndEditTableConfigurationWizard.java
@@ -0,0 +1,181 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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.customization.nattableconfiguration.wizards;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.customization.nattableconfiguration.Activator;
+import org.eclipse.papyrus.customization.nattableconfiguration.pages.NattableConfigurationFileCreationPage;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+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.nattableconfiguration.NattableconfigurationFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.infra.tools.util.FileUtils;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * The wizard used to create and edit a Papyrus Table configuration in an existing project
+ *
+ */
+public class CreateAndEditTableConfigurationWizard extends EditTableConfigurationWizard {
+
+ /**
+ * the page used to create the table configuration
+ */
+ private NattableConfigurationFileCreationPage page = null;
+
+ /**
+ * the initial selection done by the used on which the wizard has been called
+ */
+ private Object firstSelectedElement;
+
+ /**
+ *
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.wizards.EditTableConfigurationWizard#addEditNattableConfigurationPage()
+ *
+ */
+ protected void addEditNattableConfigurationPage() {
+ addPage(this.page = new NattableConfigurationFileCreationPage(this.helper));
+ }
+
+ /**
+ * Get the edited table configuration.
+ *
+ * @return
+ * the edited table configuration.
+ */
+ protected TableConfiguration getEditedTableConfiguration(final Resource resource) {
+ // 1. create the configuration itself
+ TableConfiguration configuration = NattableconfigurationFactory.eINSTANCE.createTableConfiguration();
+
+ // 2. create the row and the column header axis configuration
+ final TableHeaderAxisConfiguration rowHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ final TableHeaderAxisConfiguration columnHeaderAxisConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createTableHeaderAxisConfiguration();
+ configuration.setColumnHeaderAxisConfiguration(columnHeaderAxisConfiguration);
+ configuration.setRowHeaderAxisConfiguration(rowHeaderAxisConfiguration);
+ return configuration;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.wizards.EditTableConfigurationWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ *
+ * @param workbench
+ * @param selection
+ */
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ super.init(workbench, selection);
+ if (selection instanceof StructuredSelection) {
+ this.firstSelectedElement = selection.getFirstElement();
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.wizards.EditTableConfigurationWizard#performFinish()
+ *
+ * @return
+ */
+ @Override
+ public boolean performFinish() {
+ StringBuilder nattableConfigurationFileName = new StringBuilder(this.page.getNattableConfigurationFileName());
+
+ // Check if the file has the nattable configuration extension file, else add it
+
+ if (!nattableConfigurationFileName.toString().contains(FileUtils.DOT_STRING)
+ || !NattableConfigurationConstants.NATTABLE_CONFIGURATION_EXTENSION_FILE.equals(nattableConfigurationFileName.toString().substring(nattableConfigurationFileName.lastIndexOf(FileUtils.DOT_STRING) + 1))) {
+ nattableConfigurationFileName.append(FileUtils.DOT_STRING);
+ nattableConfigurationFileName.append(NattableConfigurationConstants.NATTABLE_CONFIGURATION_EXTENSION_FILE);
+ }
+
+ final ResourceSet set = new ResourceSetImpl();
+ final StringBuilder nattableConfFileURI = new StringBuilder();
+ nattableConfFileURI.append(getPathForTableConfigurationCreation());
+ nattableConfFileURI.append(nattableConfigurationFileName);
+ this.initialResource = set.createResource(URI.createFileURI(nattableConfFileURI.toString()));
+ // the configuration is added into the resource in the super class
+ // initialResource.getContents().add(configuration);
+ boolean result = super.performFinish();
+ refreshProject();
+ return result;
+ }
+
+ /**
+ *
+ * @return
+ * the location to use to create the new Papyrus Table Configuration.
+ * The location will be the folder selected by the user or for others selections, a folfer called {@link NattableConfigurationConstants#CONFIG_FOLDER} in others cases
+ */
+ protected String getPathForTableConfigurationCreation() {
+ String location = null;
+ if (this.firstSelectedElement instanceof IFolder) {
+ String projectLocation = ((IFolder) this.firstSelectedElement).getLocation().toString();
+ StringBuilder builder = new StringBuilder(projectLocation);
+ builder.append(FileUtils.SLASH_STRING);
+ location = builder.toString();
+ } else if (this.firstSelectedElement instanceof IResource) {
+ String projectLocation = getProjectLocation();
+ StringBuilder builder = new StringBuilder(projectLocation);
+ builder.append(NattableConfigurationConstants.CONFIG_FOLDER);
+ location = builder.toString();
+ }
+ return location;
+ }
+
+ /**
+ * This method allows to refresh the project (required to display the created table configuration)
+ */
+ protected final void refreshProject() {
+ try {
+ getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ /**
+ *
+ * @return
+ * the project in which is created the table configuration
+ */
+ protected IProject getProject() {
+ IProject project = null;
+ if (this.firstSelectedElement instanceof org.eclipse.core.internal.resources.Resource) {
+ project = ((org.eclipse.core.internal.resources.Resource) firstSelectedElement).getProject();
+ }
+ return project;
+ }
+
+ /**
+ *
+ * @return
+ * the location of the project
+ */
+ protected String getProjectLocation() {
+ IProject project = getProject();
+ if (null != project) {
+ return project.getLocation().toString();
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/CreateNattableConfigurationProjectWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/CreateNattableConfigurationProjectWizard.java
new file mode 100644
index 00000000000..b4380c784d5
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/CreateNattableConfigurationProjectWizard.java
@@ -0,0 +1,223 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Bug 493756
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.wizards;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.customization.nattableconfiguration.Activator;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+import org.eclipse.pde.internal.ui.wizards.IProjectProvider;
+import org.eclipse.pde.internal.ui.wizards.plugin.NewProjectCreationOperation;
+import org.eclipse.pde.internal.ui.wizards.plugin.NewProjectCreationPage;
+import org.eclipse.pde.internal.ui.wizards.plugin.PluginContentPage;
+import org.eclipse.pde.internal.ui.wizards.plugin.PluginFieldData;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The wizard used to create a Papyrus Table Configuration Project
+ */
+public class CreateNattableConfigurationProjectWizard extends CreateAndEditTableConfigurationWizard implements IWorkbenchWizard {
+
+
+ /**
+ * The page for the project creation.
+ */
+ private NewProjectCreationPage nattableConfigurationProjectCreationPage;
+
+ /**
+ * The project provider.
+ */
+ private IProjectProvider projectProvider;
+
+ /**
+ * The content page for the project creation.
+ */
+ protected PluginContentPage contentPage;
+
+ /**
+ * The fields data to manage the project creation
+ */
+ private PluginFieldData pluginData;
+
+ /**
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.EditTableConfigurationWizard#addPages()
+ *
+ */
+ @Override
+ public void addPages() {
+ pluginData = new PluginFieldData();
+
+ nattableConfigurationProjectCreationPage = new NewProjectCreationPage(Messages.NattableConfigurationProjectCreationPage_pageName, pluginData, false,new StructuredSelection());
+ addPage(nattableConfigurationProjectCreationPage);
+
+ projectProvider = new IProjectProvider() {
+ @Override
+ public String getProjectName() {
+ return nattableConfigurationProjectCreationPage.getProjectName();
+ }
+
+ @Override
+ public IProject getProject() {
+ return nattableConfigurationProjectCreationPage.getProjectHandle();
+ }
+
+ @Override
+ public IPath getLocationPath() {
+ return nattableConfigurationProjectCreationPage.getLocationPath();
+ }
+ };
+
+ contentPage = new PluginContentPage("page2", projectProvider, nattableConfigurationProjectCreationPage, pluginData); //$NON-NLS-1$
+
+ addPage(contentPage);
+ super.addPages();
+ }
+
+
+
+
+ /**
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.EditTableConfigurationWizard#performFinish()
+ *
+ * @return
+ */
+ @Override
+ public boolean performFinish() {
+ boolean result = false;
+
+ IProject createdProject = null;
+
+ try {
+
+ // Create the project
+ getContainer().run(false, true, new NewProjectCreationOperation(pluginData, projectProvider, null));
+
+ createdProject = getProject();
+
+ // Set the project into the working sets
+ final IWorkingSet[] workingSets = nattableConfigurationProjectCreationPage.getSelectedWorkingSets();
+ if (0 < workingSets.length) {
+ PlatformUI.getWorkbench().getWorkingSetManager().addToWorkingSets(createdProject, workingSets);
+ }
+
+ // Copy the about file
+ copyAboutFile(createdProject);
+ result = super.performFinish();
+ } catch (final InvocationTargetException e) {
+ Activator.log.error(e);
+ } catch (final InterruptedException e) {
+ Activator.log.error(e);
+ }
+
+ if (result) {
+ result = saveResource();
+ }
+ refreshProject();
+ return result;
+ }
+
+ /**
+ * This allows to get the project created folder.
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.wizards.CreateAndEditTableConfigurationWizard#getPathForTableConfigurationCreation()
+ */
+ @Override
+ protected String getPathForTableConfigurationCreation() {
+ final String projectLocation = getProjectLocation();
+ final StringBuilder builder = new StringBuilder(projectLocation);
+ builder.append(NattableConfigurationConstants.CONFIG_FOLDER);
+
+ return builder.toString();
+ }
+
+ /**
+ * This allows to copy the about file in the created project.
+ *
+ * @param createdProject
+ * The created project.
+ */
+ protected void copyAboutFile(final IProject createdProject) {
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ try {
+ final URL url = Activator.getDefault().getBundle().getResource(NattableConfigurationConstants.ABOUT_FILE_NAME);
+ inputStream = url.openStream();
+
+ final java.io.File newAboutFile = new java.io.File(createdProject.getLocation().toOSString() + java.io.File.separator + NattableConfigurationConstants.ABOUT_FILE_NAME);
+ newAboutFile.createNewFile();
+
+ outputStream = new FileOutputStream(newAboutFile);
+
+ int read = 0;
+ byte[] bytes = new byte[1024];
+
+ while ((read = inputStream.read(bytes)) != -1) {
+ outputStream.write(bytes, 0, read);
+ }
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ } finally {
+ if (null != inputStream) {
+ try {
+ inputStream.close();
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ if (null != outputStream) {
+ try {
+ // outputStream.flush();
+ outputStream.close();
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ }
+
+ }
+ }
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.wizards.CreateAndEditTableConfigurationWizard#getProject()
+ *
+ * @return
+ */
+ @Override
+ protected IProject getProject() {
+ return this.projectProvider.getProject();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.customization.nattableconfiguration.wizards.CreateAndEditTableConfigurationWizard#getProjectLocation()
+ *
+ * @return
+ */
+ @Override
+ protected String getProjectLocation() {
+ IProject createdProject = getProject();
+ return createdProject.getLocation().toString();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/EditTableConfigurationWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/EditTableConfigurationWizard.java
new file mode 100644
index 00000000000..3bd3bf34759
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/wizards/EditTableConfigurationWizard.java
@@ -0,0 +1,231 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.wizards;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.internal.resources.File;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.dialogs.DialogSettings;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.customization.nattableconfiguration.Activator;
+import org.eclipse.papyrus.customization.nattableconfiguration.helper.TableConfigurationHelper;
+import org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages;
+import org.eclipse.papyrus.customization.nattableconfiguration.pages.ColumnConfigurationWizardPage;
+import org.eclipse.papyrus.customization.nattableconfiguration.pages.EditGenericNattableConfigurationFieldsNattableWizardPage;
+import org.eclipse.papyrus.customization.nattableconfiguration.pages.RowConfigurationWizardPage;
+import org.eclipse.papyrus.customization.nattableconfiguration.pages.SlaveConfigurationWizardPage;
+import org.eclipse.papyrus.customization.nattableconfiguration.utils.NattableConfigurationConstants;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils;
+import org.eclipse.papyrus.infra.nattable.wizard.AbstractTableWizard;
+import org.eclipse.papyrus.infra.ui.util.WorkbenchPartHelper;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+/**
+ * The wizard to edit an existing TableConfiguration file
+ */
+public class EditTableConfigurationWizard extends AbstractTableWizard implements IWorkbenchWizard {
+
+ /**
+ * The generate plugin activator setting.
+ */
+ private static final String GENERATE_PlUGIN_ACTIVATOR = "generatePluginActivator"; //$NON-NLS-1$
+
+ /**
+ * The ui plugin setting.
+ */
+ private static final String UI_PLUGIN = "uiPlugin"; //$NON-NLS-1$
+
+ /**
+ * The edited table configuration
+ */
+ protected TableConfiguration configuration;
+
+ /**
+ * The initial resource selected.
+ */
+ protected Resource initialResource;
+
+ /**
+ * the edited Table Configuration Helper;
+ */
+ protected TableConfigurationHelper helper;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * Thi sconstructor is used when we create a new Papyrus Table Configuration Poject from the wizard Dialog
+ *
+ */
+ public EditTableConfigurationWizard() {
+ final ImageDescriptor desc = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor(Activator.PLUGIN_ID, NattableConfigurationConstants.ICON_WIZBAN_PATH);
+ setDefaultPageImageDescriptor(desc);
+ setWindowTitle(Messages.CreateNattableConfigurationWizard_WizardTitke);
+ setForcePreviousAndNextButtons(true);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.wizard.AbstractTableWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ *
+ * @param workbench
+ * @param selection
+ */
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ super.init(workbench, selection);
+ this.initialResource = getSelectedResource(selection);
+ this.configuration = getEditedTableConfiguration(this.initialResource);
+ Assert.isNotNull(this.configuration);
+ this.helper = new TableConfigurationHelper(configuration);
+ }
+
+ /**
+ *
+ * @param currentSelection
+ * the current selection
+ * @return
+ * the resource if it already exist or <code>null</code>;
+ */
+ protected Resource getSelectedResource(final ISelection currentSelection) {
+ Resource resource = null;
+
+ if (currentSelection instanceof StructuredSelection && 1 == ((StructuredSelection) currentSelection).size()) {
+ final Object selectedElement = ((StructuredSelection) currentSelection).getFirstElement();
+ if (selectedElement instanceof File && NattableConfigurationConstants.NATTABLE_CONFIGURATION_EXTENSION_FILE.equals(((File) selectedElement).getFileExtension())) {
+
+ INattableModelManager manager = null;
+ // TODO required ?
+ final IEditorPart currentPart = WorkbenchPartHelper.getCurrentActiveWorkbenchPart().getSite().getPage().getActiveEditor();
+ if (null != currentPart) {
+ manager = (INattableModelManager) currentPart.getAdapter(INattableModelManager.class);
+ }
+
+ if (null != manager) {
+ resource = TableEditingDomainUtils.getTableEditingDomain(manager.getTable()).getResourceSet().getResource(URI.createFileURI(((File) selectedElement).getLocation().toString()), true);
+ } else {
+ final ResourceSet set = new ResourceSetImpl();
+ resource = set.getResource(URI.createFileURI(((File) selectedElement).getLocation().toString()), true);
+ }
+ }
+ }
+
+ return resource;
+ }
+
+ /**
+ * Get the edited table configuration.
+ *
+ * @return
+ * the edited table configuration.
+ */
+ protected TableConfiguration getEditedTableConfiguration(final Resource resource) {
+ TableConfiguration configuration = null;
+ if (null != resource) {
+ if (!resource.getContents().isEmpty() && resource.getContents().get(0) instanceof TableConfiguration) {
+ configuration = EcoreUtil.copy((TableConfiguration) resource.getContents().get(0));
+ }
+ }
+ return configuration;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ addEditNattableConfigurationPage();
+ addPage(new RowConfigurationWizardPage(this.helper));
+ addPage(new ColumnConfigurationWizardPage(this.helper));
+ addPage(new SlaveConfigurationWizardPage(this.helper));
+ }
+
+ protected void addEditNattableConfigurationPage(){
+ addPage(new EditGenericNattableConfigurationFieldsNattableWizardPage(this.helper));
+ }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.Wizard#getDialogSettings()
+ */
+ @Override
+ public IDialogSettings getDialogSettings() {
+ DialogSettings dialogSettings = new DialogSettings(""); //$NON-NLS-1$
+ dialogSettings.put(GENERATE_PlUGIN_ACTIVATOR, true);
+ dialogSettings.put(UI_PLUGIN, false);
+ return dialogSettings;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+
+ boolean result = false;
+
+ // The resource is modified directly without command (undo/redo impossible)
+ // Save DiagramDialog at proper position
+ if (null != this.initialResource) {
+ this.initialResource.getContents().clear();
+ this.initialResource.getContents().add(this.configuration);
+ result = true;
+ }
+ if (result) {
+ result = saveResource();
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> if the resource has been properly saved
+ */
+ protected final boolean saveResource() {
+ boolean result = true;
+ final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+ saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED);
+
+ try {
+ initialResource.save(saveOptions);
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ result = false;
+ }
+ return result;
+ }
+}
diff --git a/plugins/infra/nattable/pom.xml b/plugins/infra/nattable/pom.xml
index 1931a14bd13..e28441e678f 100755
--- a/plugins/infra/nattable/pom.xml
+++ b/plugins/infra/nattable/pom.xml
@@ -21,6 +21,7 @@
<module>org.eclipse.papyrus.infra.nattable.model.edit</module>
<module>org.eclipse.papyrus.infra.nattable.model.editor</module>
<module>org.eclipse.papyrus.infra.nattable.modelexplorer</module>
+ <module>org.eclipse.papyrus.customization.nattableconfiguration</module>
<module>org.eclipse.papyrus.infra.nattable.properties</module>
<module>org.eclipse.papyrus.infra.nattable.views.config</module>
<module>org.eclipse.papyrus.infra.nattable.views.editor</module>

Back to the top