Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2017-03-21 14:54:02 +0000
committerGerrit Code Review @ Eclipse.org2017-04-14 09:47:41 +0000
commit4cb2981a4c989a031eb145291a8d7faf66308f56 (patch)
tree015ff8f602db273ca13db1f29418e828ad4b9b27 /plugins/customization
parent8ca14a59e728ebc6c36e80b1b95efac0bb2cd6e1 (diff)
downloadorg.eclipse.papyrus-4cb2981a4c989a031eb145291a8d7faf66308f56.tar.gz
org.eclipse.papyrus-4cb2981a4c989a031eb145291a8d7faf66308f56.tar.xz
org.eclipse.papyrus-4cb2981a4c989a031eb145291a8d7faf66308f56.zip
Bug 512343 - [Palette] Papyrus Palette framework should be refactored
Change-Id: I4170f878f144bc9e47ed21f1f3beaeb53911a887 Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net>
Diffstat (limited to 'plugins/customization')
-rw-r--r--plugins/customization/.project11
-rw-r--r--plugins/customization/README.md5
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/.classpath7
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/.project52
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.jdt.core.prefs291
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.pde.api.tools.prefs98
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/about.html28
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/build.properties11
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/icons/configuration.gifbin341 -> 0 bytes
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/icons/error.gifbin353 -> 0 bytes
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/plugin.properties13
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/plugin.xml136
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/pom.xml14
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/Messages.java301
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/PaletteConstants.java53
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/AbstractPaletteConfigurationWizard.java465
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/AspectActionsInformationComposite.java574
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ConfigurationInformationComposite.java349
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/DrawerInformationPage.java425
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExportPaletteConfigurationWizard.java119
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExtendedPaletteContentPage.java2463
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExtendedPaletteInformationPage.java462
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/LocalPaletteContentPage.java2548
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/LocalPaletteInformationPage.java488
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/NewDrawerWizard.java58
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/NewLocalPaletteWizard.java92
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteAspectToolEntryProxy.java181
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationContentPage.java1498
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationInformationPage.java108
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationWizard.java280
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteContainerProxy.java110
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteEntryProxy.java299
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteEntryProxyInformationComposite.java359
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalDrawerProxy.java187
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java71
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java86
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PapyrusPaletteCustomizerDialog.java928
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateExtendedPaletteWizard.java107
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateLocalDrawerWizard.java64
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateLocalPaletteWizard.java99
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/AbstractDeployPaletteConfigurationHandler.java442
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/AbstractUndeployPaletteConfigurationHandler.java136
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/DeployExtendedPaletteConfigurationHandler.java58
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/DeployPaletteConfigurationHandler.java58
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/UndeployExtendedPaletteConfigurationHandler.java44
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/UndeployPaletteConfigurationHandler.java42
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/messages.properties123
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/PaletteLabelProvider.java100
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/ProfileToolsMetaclassStereotypeTreeContentProvider.java159
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/ProfileToolsStereotypeMetaclassTreeContentProvider.java148
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/UMLToolsTreeContentProvider.java105
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/proxies/XMLPaletteDefinitionProxyFactory.java151
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/utils/PaletteUtils.java99
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.classpath7
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.project53
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.jdt.core.prefs291
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.pde.api.tools.prefs98
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/META-INF/MANIFEST.MF20
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/about.html28
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/build.properties13
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.custom34
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.facetset37
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.uiCustom79
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/plugin.properties3
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/plugin.xml16
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/pom.xml14
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/Activator.java67
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetDrawerLabelQuery.java28
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetIconQuery.java44
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetToolLabelQuery.java43
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/HasIconQuery.java35
73 files changed, 0 insertions, 16151 deletions
diff --git a/plugins/customization/.project b/plugins/customization/.project
deleted file mode 100644
index aaabe77120a..00000000000
--- a/plugins/customization/.project
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>customization</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- </buildSpec>
- <natures>
- </natures>
-</projectDescription>
diff --git a/plugins/customization/README.md b/plugins/customization/README.md
deleted file mode 100644
index 9c1a07bc24e..00000000000
--- a/plugins/customization/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-=Warning=
-
-Customization folder is deprecated.
-No plugin should be created inside it.
-if you want to create customization plugin, aka a plugin that helps the development of a DSML, you have to develop it in the toolsmiths folder. \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/.classpath b/plugins/customization/org.eclipse.papyrus.customization.palette/.classpath
deleted file mode 100644
index eca7bdba8f0..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.8"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/.project b/plugins/customization/org.eclipse.papyrus.customization.palette/.project
deleted file mode 100644
index fa7327cd26e..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/.project
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.customization.palette</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>
- <buildCommand>
- <name>org.eclipse.oomph.version.VersionBuilder</name>
- <arguments>
- <dictionary>
- <key>check.maven.pom</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>ignore.lower.bound.dependency.ranges</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>release.path</key>
- <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
- </dictionary>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.oomph.version.VersionNature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.jdt.core.prefs b/plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b3aa6d60f94..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,291 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
-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/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.jdt.ui.prefs b/plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 954281dbc31..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,68 +0,0 @@
-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/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.pde.api.tools.prefs b/plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.pde.api.tools.prefs
deleted file mode 100644
index 23fb95e120f..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/.settings/org.eclipse.pde.api.tools.prefs
+++ /dev/null
@@ -1,98 +0,0 @@
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_ANNOTATION=Ignore
-INVALID_JAVADOC_TAG=Ignore
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=Enabled
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Warning
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/about.html b/plugins/customization/org.eclipse.papyrus.customization.palette/about.html
deleted file mode 100644
index 209103075a7..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>November 14, 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/customization/org.eclipse.papyrus.customization.palette/build.properties b/plugins/customization/org.eclipse.papyrus.customization.palette/build.properties
deleted file mode 100644
index 447b2cd9ef8..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/build.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-#Mon Sep 12 09:29:44 CEST 2011
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.xml,\
- plugin.properties,\
- icons/
-src.includes=about.html
-source..=src/
-bin..=bin/
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/icons/configuration.gif b/plugins/customization/org.eclipse.papyrus.customization.palette/icons/configuration.gif
deleted file mode 100644
index 0b1be97b8cf..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/icons/configuration.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/icons/error.gif b/plugins/customization/org.eclipse.papyrus.customization.palette/icons/error.gif
deleted file mode 100644
index 9b048d60532..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/icons/error.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/plugin.properties b/plugins/customization/org.eclipse.papyrus.customization.palette/plugin.properties
deleted file mode 100644
index e87e2fa8664..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-#################################################################################
-# Copyright (c) 2010 CEA LIST.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - initial API and implementation
-##################################################################################
-pluginName=Papyrus Palette Customization
-providerName=Eclipse Modeling Project
-
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/plugin.xml b/plugins/customization/org.eclipse.papyrus.customization.palette/plugin.xml
deleted file mode 100644
index db6c9b24fb3..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/plugin.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.papyrus.uml.diagram.common.paletteCustomization">
- <customizer
- customizerDialog="org.eclipse.papyrus.customization.palette.dialog.PapyrusPaletteCustomizerDialog">
- </customizer>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.ui.popup.any?after=additions">
- <command
- commandId="org.eclipse.papyrus.customization.palette.deploy"
- icon="icons/configuration.gif"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="and">
- <adapt
- type="org.eclipse.core.resources.IFile">
- <or>
- <test
- property="org.eclipse.core.resources.extension"
- value="palette">
- </test>
- </or>
- </adapt>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.papyrus.customization.palette.undeploy"
- icon="icons/configuration.gif"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="and">
- <adapt
- type="org.eclipse.core.resources.IFile">
- <or>
- <test
- property="org.eclipse.core.resources.extension"
- value="palette">
- </test>
- </or>
- </adapt>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.papyrus.customization.palette.extended.undeploy"
- icon="icons/configuration.gif"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="and">
- <adapt
- type="org.eclipse.core.resources.IFile">
- <or>
- <test
- property="org.eclipse.core.resources.extension"
- value="paletteconfiguration">
- </test>
- </or>
- </adapt>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.papyrus.customization.palette.extended.deploy"
- icon="icons/configuration.gif"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="and">
- <adapt
- type="org.eclipse.core.resources.IFile">
- <or>
- <test
- property="org.eclipse.core.resources.extension"
- value="paletteconfiguration">
- </test>
- </or>
- </adapt>
- </iterate>
- </with>
- </visibleWhen>
- </command>
-</menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="org.eclipse.papyrus.customization.palette.handler.DeployPaletteConfigurationHandler"
- id="org.eclipse.papyrus.customization.palette.deploy"
- name="Deploy Palette configuration">
- </command>
- <command
- defaultHandler="org.eclipse.papyrus.customization.palette.handler.UndeployPaletteConfigurationHandler"
- id="org.eclipse.papyrus.customization.palette.undeploy"
- name="Disable Palette configuration">
- </command>
- <command
- defaultHandler="org.eclipse.papyrus.customization.palette.handler.DeployExtendedPaletteConfigurationHandler"
- id="org.eclipse.papyrus.customization.palette.extended.deploy"
- name="Deploy Extended Palette configuration">
- </command>
- <command
- defaultHandler="org.eclipse.papyrus.customization.palette.handler.UndeployExtendedPaletteConfigurationHandler"
- id="org.eclipse.papyrus.customization.palette.extended.undeploy"
- name="Disable Extended Palette configuration">
- </command>
- </extension>
-</plugin>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/pom.xml b/plugins/customization/org.eclipse.papyrus.customization.palette/pom.xml
deleted file mode 100644
index b14c35d4468..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/pom.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?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>
- <groupId>org.eclipse.papyrus</groupId>
- <artifactId>org.eclipse.papyrus.toolsmiths</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <relativePath>../../toolsmiths/pom.xml</relativePath>
- </parent>
- <artifactId>org.eclipse.papyrus.customization.palette</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project> \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/Messages.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/Messages.java
deleted file mode 100644
index 39c59829cd1..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/Messages.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Messages for the plugin
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.customization.palette.messages"; //$NON-NLS-1$
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-
- public static String BundleIconExplorerDialog_Message;
-
- public static String BundleIconExplorerDialog_Title;
-
- public static String BundleIconExplorerDialog_UnknownFileName;
-
- public static String ExportPaletteConfigurationWizard_error_cant_read_file;
-
- public static String ExportPaletteConfigurationWizard_error_file_not_existe;
-
- public static String ExportPaletteConfigurationWizard_Export_description;
-
- public static String ExportPaletteConfigurationWizard_ExportWiazrdLabel;
-
- public static String ExportPaletteConfigurationWizard_export_palette;
-
- public static String PaletteConfigurationWizard_EditionPaletteInfoPageWizard_Tilte;
-
- public static String PaletteConfigurationWizard_EditPaletteWizardLabel;
-
- public static String PaletteConfigurationWizard_NewPaletteContentPageWizard_Description;
-
- public static String PaletteConfigurationWizard_NewPaletteContentPageWizard_Title;
-
- public static String PaletteConfigurationWizard_NewPaletteDefaultName;
-
- public static String PaletteConfigurationWizard_PaletteInfoPageWizard_Description;
-
- public static String PaletteConfigurationWizard_NewPaletteInfoPageWizard_Title;
-
- public static String PaletteConfigurationWizard_NewPaletteWizardLabel;
-
- public static String PaletteConfigurationWizard_ImpossibleToReadDefinitionOfTheFile;
-
- public static String PaletteConfigurationWizard_FileDontExist;
-
- public static String PaletteConfigurationContentPage_NewTool;
-
- public static String PaletteConfigurationContentPage_Separator;
-
- public static String PaletteConfigurationContentPage_Stack;
-
- public static String PaletteConfigurationContentPage_UMLTools;
-
- public static String PaletteConfigurationContentPage_UnknownElement;
-
- public static String PaletteConfigurationContentPage_CreateAnElementWithAStereotype;
-
- public static String PaletteConfigurationContentPage_Drawer;
-
- // ///////////////////////// Palette Customisation
- // /////////////////////////////////////
-
- public static String Dialog_Export_Palette_Tooltip;
-
- /** Tooltip for the add button */
- public static String PapyrusPaletteCustomizerDialog_AddButtonTooltip;
-
- /** Tooltip for the remove button */
- public static String PapyrusPaletteCustomizerDialog_RemoveButtonTooltip;
-
- public static String AbstractDeployPaletteConfigurationHandler_ConfigureDeploymentOfThePalette;
-
- public static String AbstractDeployPaletteConfigurationHandler_Deploy;
-
- public static String AbstractDeployPaletteConfigurationHandler_Editor;
-
- public static String AbstractDeployPaletteConfigurationHandler_Error_UserCancelDialog;
-
- public static String AbstractDeployPaletteConfigurationHandler_Error_ContentDialogNotValid;
-
- public static String AbstractDeployPaletteConfigurationHandler_Error_SomeErrorsOccured;
-
- public static String AbstractDeployPaletteConfigurationHandler_Identifier;
-
- public static String AbstractDeployPaletteConfigurationHandler_Priority;
-
- public static String AbstractDeployPaletteConfigurationHandler_Profiles;
-
- public static String AbstractDeployPaletteConfigurationHandler_Success;
-
- public static String AbstractDeployPaletteConfigurationHandler_ThePaletteConfigurationHasBeenSuccessfullyDeployedAndActivated;
-
- public static String AbstractDeployPaletteConfigurationHandler_TheSelectedElementIsNotAFile;
-
- /** label for the available palettes viewer */
- public static String Available_Palettes;
-
- /** label for the palette tree viewer */
- public static String Palette_Viewer;
-
- /** label for the palette name in the wizard */
- public static String Local_Palette_Name;
-
- /** label for the palette id in the wizard */
- public static String Local_Palette_Id;
-
- /** label for the editor id in the palette wizard */
- public static String Local_Palette_Editor_Id;
-
- /** tooltip for the palette name in the palette wizard */
- public static String Local_Palette_Name_Tooltip;
-
- /** tooltip for the palette id in the palette wizard */
- public static String Local_Palette_Id_Tooltip;
-
- /** tooltip for the editor id in the palette wizard */
- public static String Local_Palette_Editor_Id_Tooltip;
-
- /** label for the provider priority in the palette wizard */
- public static String Local_Palette_Priority;
-
- /** tooltip for the provider priority in the palette wizard */
- public static String Local_Palette_Priority_Tooltip;
-
- /** label for the advanced button, when advanced are not shown */
- public static String Dialog_Advanced_Button_Closed;
-
- /** label for the advanced button, when advanced are shown */
- public static String Dialog_Advanced_Button_Opened;
-
- /** Error message for the wizard page, when priority is not correctly filled */
- public static String Local_Palette_Error_Priority;
-
- /**
- * Error message for the wizard page, when palette ID is not correctly
- * filled
- */
- public static String Local_Palette_Error_PaletteId;
-
- /** Error message for the wizard page, when name is not correctly filled */
- public static String Local_Palette_Error_Name;
-
- /**
- * Error message for the wizard page, when Editor ID is not correctly filled
- */
- public static String Local_Palette_Error_EditorId;
-
- /** Name of the information page */
- public static String Local_Palette_InfoPage_Name;
-
- /** Title of the information page */
- public static String Local_Palette_InfoPage_Title;
-
- /** Name of the content page */
- public static String Local_Palette_ContentPage_Name;
-
- /** Title of the content page */
- public static String Local_Palette_ContentPage_Title;
-
- /** name of the available tools group */
- public static String Local_Palette_Available_Tools;
-
- /** tooltip for the show/hide drawer button */
- public static String Local_Palette_ShowDrawers_Tooltip;
-
- /** tooltip for the show/hide drawer button */
- public static String Local_Palette_ShowTools_Tooltip;
-
- /** palette preview label */
- public static String Local_Palette_Palette_Preview;
-
- /** Title for dialog box when palette to delete is not a local palette */
- public static String Dialog_Not_Local_Palette_Title;
-
- /** Message for dialog box when palette to delete is not a local palette */
- public static String Dialog_Not_Local_Palette_Message;
-
- /** Title for dialog box when palette to restore is not an extended palette */
- public static String Dialog_Not_Extended_Palette_Title;
-
- /** Message for dialog box when palette to restore is not an extended palette */
- public static String Dialog_Not_Extended_Palette_Message;
-
- /** Tooltip for the restore palette button. */
- public static String Dialog_Restore_Palette_Tooltip;
-
- /** tooltip for the delete palette button */
- public static String Dialog_Delete_Palette_Tooltip;
-
- /** tooltip for the create palette button */
- public static String Dialog_Create_Palette_Tooltip;
-
- /** tooltip for the edit palette button */
- public static String Dialog_Edit_Palette_Tooltip;
-
- /** tooltip for the create drawer button */
- public static String Local_Palette_Create_Drawer_Tooltip;
-
- /** tooltip for the create separator button */
- public static String Local_Palette_Create_Separator_Tooltip;
-
- /** tooltip for the create separator button */
- public static String Local_Palette_Create_Tool_Tooltip;
-
- /** tooltip for the create stack button */
- public static String Local_Palette_Create_Stack_Tooltip;
-
- /** name of the drawer wizard page */
- public static String Wizard_Drawer_Page_Name;
-
- /** title of the drawer wizard page */
- public static String Wizard_Drawer_Page_Title;
-
- /** error on the name in the drawer wizard */
- public static String Wizard_Drawer_Error_Name;
-
- /** error on the id in the drawer wizard */
- public static String Wizard_Drawer_Error_Id;
-
- /** error on the icon in the drawer wizard */
- public static String Wizard_Drawer_Error_Icon;
-
- /** label for the id field */
- public static String Wizard_Drawer_Id;
-
- /** tooltip for the id field */
- public static String Wizard_Drawer_Id_Tooltip;
-
- /** label for the name field */
- public static String Wizard_Drawer_Name;
-
- /** tooltip for the name field */
- public static String Wizard_Drawer_Name_Tooltip;
-
- /** tooltip for the icon field */
- public static String Wizard_Drawer_Icon_Tooltip;
-
- /** name for the icon field */
- public static String Wizard_Drawer_Icon;
-
- /** tooltip for the tool item */
- public static String Local_Palette_SwitchToolsContentProvider_Tooltip;
-
- /**
- * tooltip for the edit local palette action disabled because of bad
- * selection
- */
- public static String PapyrusPaletteCustomizerDialog_EditButtonTooltip_LocalPaletteNotSelected;
-
- /** tooltip for the edit local palette action */
- public static String PapyrusPaletteCustomizerDialog_EditButtonTooltip_LocalPaletteSelected;
-
- /**
- * tooltip for the edit local palette action disabled because of missing
- * profiles
- */
- public static String PapyrusPaletteCustomizerDialog_EditButtonTooltip_MissingProfile;
-
- /** label for the name text editor for a given proxy */
- public static String Local_Palette_Entry_Name;
-
- /** label for the description editor for a given proxy */
- public static String Local_Palette_Entry_Description;
-
- /** label for the group information about entry */
- public static String Local_Palette_Entry_Information;
-
- /** label for the icon information about entry */
- public static String Local_Palette_Entry_Icon;
-
- /** label for the referenced entry information about entry */
- public static String Local_Palette_Entry_Reference;
-
- /** label for the composite displaying the lis of aspect actions */
- public static String Aspect_Action_Information_List_Label;
-
- /** label for the tooltip of the edit drawer icon */
- public static String PapyrusPaletteCustomizerDialog_EditButtonTooltip;
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/PaletteConstants.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/PaletteConstants.java
deleted file mode 100644
index 35ad4b1a6b6..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/PaletteConstants.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.eclipse.papyrus.infra.types.presentation.TypesConfigurationsEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.presentation.PaletteConfigurationEditorPlugin;
-
-/**
- * The palette customization plugin constants.
- */
-public class PaletteConstants {
-
- /**
- * Constructor.
- */
- private PaletteConstants() {
- // to prevent instantiation
- }
-
- /** the file extension for palette configuration */
- public static final String PALETTECONFIGURATION_EXTENSION = Collections.unmodifiableList(Arrays.asList(PaletteConfigurationEditorPlugin.INSTANCE.getString("_UI_PaletteconfigurationEditorFilenameExtensions").split("\\s*,\\s*"))).get(0); //$NON-NLS-1$ //$NON-NLS-2$
-
- /** the file extension for element type files */
- public static final String ELEMENTTYPE_EXTENSION = Collections.unmodifiableList(Arrays.asList(TypesConfigurationsEditorPlugin.INSTANCE.getString("_UI_ElementtypesconfigurationsEditorFilenameExtensions").split("\\s*,\\s*"))).get(0); //$NON-NLS-1$ //$NON-NLS-2$
-
- /** The postfix for semantic element type model file. */
- public static final String ELEMENTTYPE_SEMENTIC_IDENTIFIER_POSTFIX = "_Semantic"; //$NON-NLS-1$
-
- /** The postfix for ui element type model file. */
- public static final String ELEMENTTYPE_UI_IDENTIFIER_POSTFIX = "_UI";//$NON-NLS-1$
-
- /** The enumeration of the context of the palette configuration model in case of customization */
- public enum PaletteModelContextEnum {
- New, // It's a new palette from scratch. Files will be place on local folder.
- Workspace, // It's a workspace palette. Files will be place on WS.
- Plugin, // It's a palette coming from a plugin definition. It's read-only, a copy and associated files will be placed on local folder
- Local // It's come from the local folder
- };
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/AbstractPaletteConfigurationWizard.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/AbstractPaletteConfigurationWizard.java
deleted file mode 100644
index 5d302806620..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/AbstractPaletteConfigurationWizard.java
+++ /dev/null
@@ -1,465 +0,0 @@
-/*****************************************************************************
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 507654 Change load order and add EcoreUtil.resolveAll(resource) to avoid absolute references
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceSetItemProvider;
-import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.customization.palette.PaletteConstants;
-import org.eclipse.papyrus.customization.palette.PaletteConstants.PaletteModelContextEnum;
-import org.eclipse.papyrus.customization.palette.utils.PaletteUtils;
-import org.eclipse.papyrus.infra.types.ElementTypeSetConfiguration;
-import org.eclipse.papyrus.infra.types.ElementTypesConfigurationsFactory;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.ProviderDescriptor;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteRessourcesConstants;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.CustomPaletteconfigurationItemProviderAdapterFactory;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.utils.CreatePaletteItemUtil;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Abstract class for wizard of edition of palette configuration models.
- */
-public abstract class AbstractPaletteConfigurationWizard extends Wizard {
-
- /**
- * The dot string constant.
- */
- protected static final String STR_DOT = "."; //$NON-NLS-1$
-
- /** the palette resource */
- protected Resource paletteResource;
-
- /** the element type resource for the ui */
- protected Resource elementTypeUIResource;
-
- /** the element type resource for the semantic */
- protected Resource elementTypeSemResource;
-
- /** the string builder */
- protected StringBuilder stringBuilder = new StringBuilder();
-
- /** customizer used by the palette viewer */
- protected ProviderDescriptor descriptor;
-
- /** the editing domain */
- protected AdapterFactoryEditingDomain editingDomain;
-
- /** the adapter factory */
- protected ComposedAdapterFactory adapterFactory;
-
- /** The context of the palette contribution */
- protected PaletteModelContextEnum paletteContext;
-
- /** Editor part in which the palette is displayed */
- protected IEditorPart editorPart;
-
- /** the provider priority */
- protected ProviderPriority priority;
-
- /**
- * Constructor.
- */
- public AbstractPaletteConfigurationWizard(final IEditorPart part, final ProviderDescriptor descriptor) {
- this.editorPart = part;
- this.descriptor = descriptor;
- // initialize the context
- paletteContext = PaletteUtils.getPaletteModelContext(descriptor);
-
- ProviderPriority localPalettePriority = null;
- if (PaletteModelContextEnum.New.equals(paletteContext)) {
- // Create New Palette
- setWindowTitle(Messages.PaletteConfigurationWizard_NewPaletteWizardLabel);
- } else {
- // Edit Palette
- localPalettePriority = PapyrusPalettePreferences.getLocalPalettePriority(descriptor.getContributionID());
- setWindowTitle(Messages.PaletteConfigurationWizard_EditPaletteWizardLabel);
- }
-
- initPriority(localPalettePriority);
-
- initializeEditingDomain();
-
- createResources();
- }
-
- /**
- * inits the priority value
- *
- * @param value
- * value to set
- */
- protected void initPriority(final ProviderPriority value) {
- if (null != value) {
- this.priority = value;
- } else {
- // by default, Medium
- this.priority = ProviderPriority.MEDIUM;
- }
- }
-
- /**
- * unloads resources.
- */
- protected void unloadRessources() {
- if (null != paletteResource && paletteResource.isLoaded()) {
- paletteResource.unload();
- }
- if (null != elementTypeSemResource && elementTypeSemResource.isLoaded()) {
- elementTypeSemResource.unload();
- }
- if (null != elementTypeUIResource && elementTypeUIResource.isLoaded()) {
- elementTypeUIResource.unload();
- }
- }
-
-
- /**
- * delete resources.
- */
- public void deleteResource() {
- unloadRessources();
- try {
- if (null != paletteResource) {
- paletteResource.delete(Collections.EMPTY_MAP);
- }
- if (null != elementTypeSemResource) {
- elementTypeSemResource.delete(Collections.EMPTY_MAP);
- }
- if (null != elementTypeUIResource) {
- elementTypeUIResource.delete(Collections.EMPTY_MAP);
- }
- } catch (IOException e) {
- Activator.log.error(e);
- }
- }
-
-
-
- /**
- * Clear the string builder.
- */
- protected void clearStringBuilder() {
- stringBuilder.setLength(0); // set length of buffer to 0
- stringBuilder.trimToSize(); // trim the underlying buffer
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
-
- // Save files
- saveResources();
-
- // Load models on papyrus( Palettes, element types, etc...)
- deployModels();
-
- // unload ressources
- unloadRessources();
-
- return true;
- }
-
- /**
- * Load models on papyrus( Palettes, element types, etc...).
- */
- abstract protected void deployModels();
-
- /**
- * save resources()
- */
- abstract protected void saveResources();
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performCancel() {
- unloadRessources();
- return super.performCancel();
- }
-
- /**
- * create the resource and set it the palette configuration model
- */
- protected void createResources() {
- createPaletteResource();
- createElementTypesResources();
- }
-
-
- /**
- * Create Element type resources.
- */
- protected void createElementTypesResources() {
-
- URI elementTypeUIURI = null;
- URI elementTypeSemURI = null;
-
- File elementTypeUIFile = null;
- File elementTypeSemFile = null;
-
- switch (paletteContext) {
-
- case New:
- PaletteConfiguration paletteModel = (PaletteConfiguration) paletteResource.getContents().get(0);
- clearStringBuilder();
- stringBuilder.append(paletteModel.getId());
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_UI_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- String pathUI = Activator.getDefault().getStateLocation().append(stringBuilder.toString()).toString();
-
- clearStringBuilder();
- stringBuilder.append(paletteModel.getId());
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_SEMENTIC_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- String pathSem = Activator.getDefault().getStateLocation().append(stringBuilder.toString()).toString();
-
- elementTypeUIFile = new File(pathUI);
- elementTypeSemFile = new File(pathSem);
- break;
-
- case Local:
- clearStringBuilder();
- stringBuilder.append(((PapyrusPaletteService.LocalExtendedProviderDescriptor) descriptor).getContributionID());
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_UI_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- elementTypeUIFile = Activator.getDefault().getStateLocation().append(stringBuilder.toString()).toFile();
-
- clearStringBuilder();
- stringBuilder.append(((PapyrusPaletteService.LocalExtendedProviderDescriptor) descriptor).getContributionID());
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_SEMENTIC_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- elementTypeSemFile = Activator.getDefault().getStateLocation().append(stringBuilder.toString()).toFile();
- break;
-
- case Plugin:
- String path = PapyrusPalettePreferences.getPaletteRedefinition(descriptor.getContributionID());
- path = path.substring(0, path.length() - PaletteConstants.PALETTECONFIGURATION_EXTENSION.length() - 1);
-
- clearStringBuilder();
- stringBuilder.append(path);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_UI_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- elementTypeUIFile = Activator.getDefault().getStateLocation().append(stringBuilder.toString()).toFile();
-
- clearStringBuilder();
- stringBuilder.append(path);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_SEMENTIC_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- elementTypeSemFile = Activator.getDefault().getStateLocation().append(stringBuilder.toString()).toFile();
- break;
-
- case Workspace:
- Object contributions = ((PapyrusPaletteService.LocalProviderDescriptor) descriptor).getDescription().getContributions();
- if (contributions instanceof String) {
-
- elementTypeUIFile = new File(((String) contributions).replace(STR_DOT + PaletteConstants.PALETTECONFIGURATION_EXTENSION, PaletteConstants.ELEMENTTYPE_UI_IDENTIFIER_POSTFIX + STR_DOT +
- PaletteConstants.ELEMENTTYPE_EXTENSION));
- elementTypeSemFile = new File(((String) contributions).replace(STR_DOT + PaletteConstants.PALETTECONFIGURATION_EXTENSION, PaletteConstants.ELEMENTTYPE_SEMENTIC_IDENTIFIER_POSTFIX + STR_DOT + PaletteConstants.ELEMENTTYPE_EXTENSION));
-
- elementTypeUIURI = URI.createPlatformResourceURI(elementTypeUIFile.getPath(), false);
- elementTypeSemURI = URI.createPlatformResourceURI(elementTypeSemFile.getPath(), false);
- }
- break;
-
- default:
- break;
- }
-
- if (null == elementTypeUIFile || null == elementTypeSemURI) {
- elementTypeUIURI = URI.createFileURI(elementTypeUIFile.getAbsolutePath());
- elementTypeSemURI = URI.createFileURI(elementTypeSemFile.getAbsolutePath());
- }
-
- // Create resource
- elementTypeSemResource = editingDomain.getResourceSet().createResource(elementTypeSemURI);
- elementTypeUIResource = editingDomain.getResourceSet().createResource(elementTypeUIURI);
-
- if (!PaletteUtils.notErrorOnFile(elementTypeUIFile) && !PaletteUtils.notErrorOnFile(elementTypeSemFile)) {
-
- ElementTypeSetConfiguration emptyElementTypeModelSem = getEmptyElementTypeModel(elementTypeSemResource.getURI().lastSegment().replace(STR_DOT + PaletteConstants.ELEMENTTYPE_EXTENSION, ""));//$NON-NLS-1$
- ElementTypeSetConfiguration emptyElementTypeModelUI = getEmptyElementTypeModel(elementTypeUIResource.getURI().lastSegment().replace(STR_DOT + PaletteConstants.ELEMENTTYPE_EXTENSION, ""));//$NON-NLS-1$
-
- // Add it to the resource
- CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.append(new AddCommand(editingDomain, elementTypeSemResource.getContents(), emptyElementTypeModelSem));
- compoundCommand.append(new AddCommand(editingDomain, elementTypeUIResource.getContents(), emptyElementTypeModelUI));
- editingDomain.getCommandStack().execute(compoundCommand);
- }
-
- if (null != elementTypeUIResource || null != elementTypeSemResource) {
- try {
- elementTypeSemResource.load(Collections.emptyMap());
- EcoreUtil.resolveAll(elementTypeSemResource);
- elementTypeUIResource.load(Collections.emptyMap());
- EcoreUtil.resolveAll(elementTypeUIResource);
- elementTypeSemResource.getResourceSet().getLoadOptions().put(PaletteRessourcesConstants.ELEMENTTYPE_SEMENTIC_RESSOURCE_IDENTIFIER, elementTypeSemResource);
- elementTypeUIResource.getResourceSet().getLoadOptions().put(PaletteRessourcesConstants.ELEMENTTYPE_UI_RESSOURCE_IDENTIFIER, elementTypeUIResource);
- } catch (IOException e) {
- Activator.log.error(e);
- }
- }
- }
-
-
-
- /**
- * @return An empty Element type model with intialIdentifier as identifier.
- */
- protected ElementTypeSetConfiguration getEmptyElementTypeModel(final String initialIdentifer) {
- // Create elementType models
- ElementTypeSetConfiguration elementTypeUI = ElementTypesConfigurationsFactory.eINSTANCE.createElementTypeSetConfiguration();
- elementTypeUI.setIdentifier(initialIdentifer);
- elementTypeUI.setName(initialIdentifer);
- elementTypeUI.setMetamodelNsURI(initialIdentifer);
- return elementTypeUI;
- }
-
- /**
- * Create palette resource.
- */
- protected void createPaletteResource() {
-
- URI fileURI = null;
-
- switch (paletteContext) {
-
- case New:
- // Create a volatile default file (not to be save)
- // Create a initial void model
- PaletteConfiguration paletteModel = CreatePaletteItemUtil.createInitialModel();
-
- clearStringBuilder();
- stringBuilder.append("NewPalette");//$NON-NLS-1$
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.PALETTECONFIGURATION_EXTENSION);
-
- String path = Activator.getDefault().getStateLocation().append(stringBuilder.toString()).toString();// $NON-NLS-1$
- fileURI = URI.createFileURI(path);
-
- paletteResource = editingDomain.getResourceSet().createResource(fileURI);
- // Add it to the resource
- Command addCommand = new AddCommand(editingDomain, paletteResource.getContents(), paletteModel);
- editingDomain.getCommandStack().execute(addCommand);
- break;
-
- case Local:
- clearStringBuilder();
- stringBuilder.append(((PapyrusPaletteService.LocalExtendedProviderDescriptor) descriptor).getContributionID());
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.PALETTECONFIGURATION_EXTENSION);
-
- File file = Activator.getDefault().getStateLocation().append(stringBuilder.toString()).toFile();
-
- if (PaletteUtils.notErrorOnFile(file)) {
- fileURI = URI.createFileURI(file.getAbsolutePath());
- paletteResource = editingDomain.getResourceSet().createResource(fileURI);
- }
- break;
-
- case Plugin:
- fileURI = PaletteUtil.getRedefinitionFileURI(descriptor.getContributionID());
- if (null != fileURI) {
- paletteResource = editingDomain.getResourceSet().createResource(fileURI);
- }
- break;
-
- case Workspace:
- Object contributions = ((PapyrusPaletteService.LocalProviderDescriptor) descriptor).getDescription().getContributions();
- if (contributions instanceof String) {
- fileURI = URI.createPlatformResourceURI((String) contributions, false);
- paletteResource = editingDomain.getResourceSet().createResource(fileURI);
- }
- break;
-
- default:
- break;
-
- }
-
- if (null != paletteResource) {
- try {
- paletteResource.load(Collections.emptyMap());
- paletteResource.getResourceSet().getLoadOptions().put(PaletteRessourcesConstants.PALETTE_RESSOURCE_IDENTIFIER, paletteResource);
- EcoreUtil.resolveAll(paletteResource);
- } catch (IOException e) {
- Activator.log.error(e);
- }
- }
- }
-
- /**
- * This sets up the editing domain for the model editor.
- */
- protected void initializeEditingDomain() {
- // Create an adapter factory that yields item providers.
- //
- adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
-
- adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory() {
- @Override
- public Adapter createResourceSetAdapter() {
- return new ResourceSetItemProvider(this) {
- @Override
- public Collection<?> getChildren(final Object object) {
- ResourceSet resourceSet = (ResourceSet) object;
- if (!resourceSet.getResources().isEmpty() && resourceSet.getResources().get(0).getContents().get(0) instanceof PaletteConfiguration) {
- return ((PaletteConfiguration) resourceSet.getResources().get(0).getContents().get(0)).getDrawerConfigurations(); // For Drawers as root
- }
- return Collections.emptyList();
- }
- };
- }
- });
- adapterFactory.addAdapterFactory(new CustomPaletteconfigurationItemProviderAdapterFactory());
- adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
- adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
-
- // Create the editing domain with a special command stack.
- editingDomain = new TransactionalEditingDomainImpl(adapterFactory);
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/AspectActionsInformationComposite.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/AspectActionsInformationComposite.java
deleted file mode 100644
index 5a1ffad1299..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/AspectActionsInformationComposite.java
+++ /dev/null
@@ -1,574 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.AspectToolService;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectAction;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectActionProvider;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IPaletteAspectToolEntryProxy;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IPostAction;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IPreAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.uml2.uml.Profile;
-
-
-/**
- * Class in charge of the composite in the {@link LocalPaletteContentPage}
- */
-public class AspectActionsInformationComposite {
-
- /** add icon path */
- private static final String ICONS_ADD = "/icons/obj16/Add_16x16.gif";
-
- /** remove icon path */
- protected static final String ICONS_REMOVE = "/icons/delete.gif";
-
- /** move up icon path */
- protected static final String ICONS_UP = "/icons/arrow_up.gif";
-
- /** move down icon path */
- protected static final String ICONS_DOWN = "/icons/arrow_down.gif";
-
- /** proxy name text */
- protected Text nameText;
-
- /** proxy description text */
- protected Text descriptionText;
-
- /** proxy icon text */
- protected Text iconText;
-
- /** referenced proxy text */
- protected Text referencedText;
-
- /** current selected action proxy */
- protected PaletteEntryProxy selectedEntryProxy;
-
- /** tree viewer for the list of aspect actions */
- protected TreeViewer viewer;
-
- /** page book where specific pages are displayed for configuration of the aspect actions */
- protected PageBook actionDescriptionComposite;
-
- /** list of applied profiles */
- protected List<Profile> appliedProfiles;
-
- /** remove aspect action button */
- protected Button removeActionButton;
-
- /** add aspect action button */
- protected Button addActionButton;
-
- /** move up aspect action button */
- protected Button moveUpActionButton;
-
- /** move down aspect action button */
- protected Button moveDownActionButton;
-
- /**
- * Creates the content for this composite
- *
- * @param parent
- * the conainer of the created content
- * @return the created composite
- */
- public Composite createComposite(Composite parent, List<Profile> appliedProfiles) {
- this.appliedProfiles = appliedProfiles;
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.horizontalSpan = 4;
- composite.setLayoutData(data);
-
- // composite for the list of aspect actions
- Composite actionList = new Composite(composite, SWT.NONE);
- layout = new GridLayout(5, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- actionList.setLayout(layout);
- data = new GridData(SWT.FILL, SWT.FILL, false, true);
- actionList.setLayoutData(data);
-
- Label aspectListLabel = new Label(actionList, SWT.LEAD);
- aspectListLabel.setText(Messages.Aspect_Action_Information_List_Label);
- data = new GridData(SWT.FILL, SWT.CENTER, true, false);
- data.horizontalIndent = 5;
- aspectListLabel.setLayoutData(data);
-
- addActionButton = new Button(actionList, SWT.NONE);
- addActionButton.setImage(Activator.getPluginIconImage(Activator.ID, ICONS_ADD));
- addActionButton.addMouseListener(new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- addButtonPressed();
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
-
- }
-
- @Override
- public void mouseDoubleClick(MouseEvent e) {
-
- }
- });
-
- removeActionButton = new Button(actionList, SWT.NONE);
- removeActionButton.setImage(Activator.getPluginIconImage(Activator.ID, ICONS_REMOVE));
- removeActionButton.addMouseListener(new MouseListener() {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseUp(MouseEvent e) {
- // remove the selected aspect action(s)
- ITreeSelection selection = (ITreeSelection) viewer.getSelection();
- if (selection != null && selection.size() > 0) {
- for (Object selected : selection.toList()) {
- if (selected instanceof IPostAction && selectedEntryProxy instanceof IPaletteAspectToolEntryProxy) {
- ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPostActions().remove(selected);
- } else if (selected instanceof IPreAction && selectedEntryProxy instanceof IPaletteAspectToolEntryProxy) {
- ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPreActions().remove(selected);
- }
- }
- }
- setSelectedEntryProxy(selectedEntryProxy);
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDown(MouseEvent e) {
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
-
- }
- });
-
- moveUpActionButton = new Button(actionList, SWT.NONE);
- moveUpActionButton.setImage(Activator.getPluginIconImage(Activator.ID, ICONS_UP));
- moveUpActionButton.addMouseListener(new MouseListener() {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseUp(MouseEvent e) {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection != null && selection.size() > 0 && selectedEntryProxy instanceof IPaletteAspectToolEntryProxy) {
- IAspectAction action = (IAspectAction) selection.getFirstElement();
- List<IPreAction> initialPreList = ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPreActions();
- List<IPostAction> initialPostList = ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPostActions();
-
- if (action instanceof IPreAction) {
- // move from pre action list
- if (initialPreList.indexOf(action) > 0) {
- Collections.swap(initialPreList, initialPreList.indexOf(action), initialPreList.indexOf(action) - 1);
- }
- } else if (action instanceof IPostAction) {
- if (initialPostList.indexOf(action) > 0) {
- Collections.swap(initialPostList, initialPostList.indexOf(action), initialPostList.indexOf(action) - 1);
- }
- }
-
- // update content
- viewer.setInput(selectedEntryProxy);
- // restore selection
- viewer.setSelection(new StructuredSelection(action), true);
- }
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDown(MouseEvent e) {
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
-
- }
- });
-
- moveDownActionButton = new Button(actionList, SWT.NONE);
- moveDownActionButton.setImage(Activator.getPluginIconImage(Activator.ID, ICONS_DOWN));
- moveDownActionButton.addMouseListener(new MouseListener() {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseUp(MouseEvent e) {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection != null && selection.size() > 0 && selectedEntryProxy instanceof IPaletteAspectToolEntryProxy) {
- IAspectAction action = (IAspectAction) selection.getFirstElement();
- List<IPreAction> initialPreList = ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPreActions();
- List<IPostAction> initialPostList = ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPostActions();
-
- if (action instanceof IPreAction) {
- // move from pre action list
- if (initialPreList.indexOf(action) < initialPreList.size() - 1) {
- Collections.swap(initialPreList, initialPreList.indexOf(action), initialPreList.indexOf(action) + 1);
- }
- } else if (action instanceof IPostAction) {
- if (initialPostList.indexOf(action) < initialPostList.size() - 1) {
- Collections.swap(initialPostList, initialPostList.indexOf(action), initialPostList.indexOf(action) + 1);
- }
- }
-
- // update content
- viewer.setInput(selectedEntryProxy);
- // restore selection
- viewer.setSelection(new StructuredSelection(action), true);
- }
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDown(MouseEvent e) {
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
-
- }
- });
-
- updateButtons();
-
- viewer = new TreeViewer(actionList, SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.horizontalSpan = 5;
- data.heightHint = 150;
- viewer.getControl().setLayoutData(data);
- viewer.setLabelProvider(new AspectActionLabelProvider());
- viewer.setContentProvider(new AspectActionContentProvider());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleActionListSelectionChanged(event);
- }
-
- });
-
- actionDescriptionComposite = new PageBook(composite, SWT.NONE);
- data = new GridData(SWT.FILL, SWT.FILL, true, true);
- actionDescriptionComposite.setLayoutData(data);
-
- return composite;
- }
-
- /**
- * Action run when the button add is pressed
- */
- protected void addButtonPressed() {
- Menu menu = new Menu(addActionButton);
- for (IAspectActionProvider factory : AspectToolService.getInstance().getProviders()) {
-
- // check if action can be added (not present if one instance allowed)
- if (factory.isEnable(selectedEntryProxy)) {
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setText(factory.getName());
- item.setImage(factory.getImage());
- item.setData(factory);
- item.addSelectionListener(new SelectionListener() {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- IAspectActionProvider factory = (IAspectActionProvider) ((MenuItem) e.getSource()).getData();
- IAspectAction action = factory.createAction(null);
- if (selectedEntryProxy instanceof IPaletteAspectToolEntryProxy) {
- if (action instanceof IPostAction) {
- ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPostActions().add((IPostAction) action);
- } else if (action instanceof IPreAction) {
- ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPreActions().add((IPreAction) action);
- }
- setSelectedEntryProxy(selectedEntryProxy);
- }
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- });
- }
- }
- menu.setVisible(true);
-
- }
-
- /**
- * Handles the selection changed event in the tree viewer of actions
- *
- * @param event
- * the event fired by the tree viewer or <code>null</code>
- */
- protected void handleActionListSelectionChanged(SelectionChangedEvent event) {
- if (event == null) {
- actionDescriptionComposite.showPage(new Composite(actionDescriptionComposite, SWT.NONE));
- removeActionButton.setEnabled(false);
- } else {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection != null && selection.getFirstElement() instanceof IAspectAction) {
- // udpate the page book where parameters are handled
- actionDescriptionComposite.showPage(((IAspectAction) selection.getFirstElement()).createConfigurationComposite(actionDescriptionComposite, selectedEntryProxy, appliedProfiles));
- removeActionButton.setEnabled(true);
- } else {
- actionDescriptionComposite.showPage(new Composite(actionDescriptionComposite, SWT.NONE));
- removeActionButton.setEnabled(false);
- }
- }
- }
-
- /**
- * Sets the new Selected entry
- *
- * @param selectedConfiguration
- * the selectedConfiguration to set
- */
- public void setSelectedEntryProxy(PaletteEntryProxy selectedEntryProxy) {
- // should save the content for the previous selected entry proxy...
- this.selectedEntryProxy = selectedEntryProxy;
-
- if (viewer != null) {
- viewer.setInput(selectedEntryProxy);
-
- // select first action
- handleActionListSelectionChanged(null);
-
- // select first post action
- if (selectedEntryProxy instanceof IPaletteAspectToolEntryProxy && ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPostActions().size() > 0) {
- viewer.setSelection(new StructuredSelection(((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPostActions().get(0)), true);
- }
- // select first pre action
- else if (selectedEntryProxy instanceof IPaletteAspectToolEntryProxy && ((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPreActions().size() > 0) {
- viewer.setSelection(new StructuredSelection(((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPreActions().get(0)), true);
- }
-
- updateButtons();
- }
- }
-
- /**
- * Call this method to update the buttons enablement.
- */
- protected void updateButtons() {
- if (selectedEntryProxy instanceof IPaletteAspectToolEntryProxy) {
- addActionButton.setEnabled(true);
- if (((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPreActions().isEmpty() && !((IPaletteAspectToolEntryProxy) selectedEntryProxy).getPostActions().isEmpty()) {
- removeActionButton.setEnabled(true);
- moveUpActionButton.setEnabled(true);
- moveDownActionButton.setEnabled(true);
- } else {
- removeActionButton.setEnabled(false);
- moveUpActionButton.setEnabled(false);
- moveDownActionButton.setEnabled(false);
- }
- } else {
- addActionButton.setEnabled(false);
- removeActionButton.setEnabled(false);
- moveUpActionButton.setEnabled(false);
- moveDownActionButton.setEnabled(false);
- }
-
- }
-
- /**
- * Content provider for the aspect action list
- */
- protected class AspectActionContentProvider implements ITreeContentProvider {
-
- /**
- * @{inheritDoc
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof IPaletteAspectToolEntryProxy) {
- List<IAspectAction> actions = new ArrayList<IAspectAction>();
- actions.addAll(((IPaletteAspectToolEntryProxy) parentElement).getPostActions());
- actions.addAll(((IPaletteAspectToolEntryProxy) parentElement).getPreActions());
- return actions.toArray();
- }
- return new Object[0];
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public Object getParent(Object element) {
- if (element instanceof IAspectAction) {
- return selectedEntryProxy;
- }
- return null;
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public boolean hasChildren(Object element) {
- return getChildren(element) != null && getChildren(element).length > 0;
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void dispose() {
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- }
-
- /**
- * Label provider for the aspect actions viewer
- */
- protected class AspectActionLabelProvider implements ILabelProvider {
-
- /**
- * @{inheritDoc
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof IAspectAction) {
- return ((IAspectAction) element).getImage();
- }
- return null;
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public String getText(Object element) {
- if (element instanceof IAspectAction) {
- return ((IAspectAction) element).getLabel();
- }
- return "notAnAction";
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void dispose() {
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void removeListener(ILabelProviderListener listener) {
-
- }
-
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ConfigurationInformationComposite.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ConfigurationInformationComposite.java
deleted file mode 100644
index 6dce046b3d6..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ConfigurationInformationComposite.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.util.List;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.infra.widgets.editors.BundleIconExplorerDialog;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Configuration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.IconDescriptor;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteconfigurationFactory;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ToolConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-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.Text;
-import org.eclipse.uml2.uml.Profile;
-
-
-/**
- * Class in charge of the composite in the {@link LocalPaletteContentPage}
- */
-public class ConfigurationInformationComposite {
-
- /** current selected entry proxy */
- protected Configuration selectedConfiguration;
-
- /** proxy name text */
- protected Text nameText;
-
- /** proxy description text */
- protected Text descriptionText;
-
- /** proxy icon text */
- protected Text iconText;
-
- /** referenced proxy text */
- protected Text referencedText;
-
- /** list of applied profiles */
- protected List<Profile> appliedProfiles;
-
- /** button for icon selection */
- protected Button iconButton;
-
- /** protocol for platform plugin URLs */
- protected static final String PLUGIN_PROTOCOL = "platform:/plugin/"; //$NON-NLS-1$
-
- /**
- * Creates the content of the information composite
- *
- * @param parent
- * the composite where to add created controls
- * @param appliedProfiles
- * the list of applied profiles
- * @return the newly created composite
- */
- public Composite createComposite(final Composite parent, List<Profile> appliedProfiles) {
- this.appliedProfiles = appliedProfiles;
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- composite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.widthHint = 260;
- data.horizontalIndent = 10;
- composite.setLayoutData(data);
-
- Label entryInformationLabel = new Label(composite, SWT.NONE);
- entryInformationLabel.setText(Messages.Local_Palette_Entry_Information);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.horizontalSpan = 3;
- entryInformationLabel.setLayoutData(data);
-
- Label nameLabel = new Label(composite, SWT.NONE);
- nameLabel.setText(Messages.Local_Palette_Entry_Name);
- data = new GridData(SWT.FILL, SWT.FILL, false, false);
- nameLabel.setLayoutData(data);
- nameText = new Text(composite, SWT.LEAD | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- nameText.setLayoutData(data);
- nameText.addFocusListener(new NameFocusListener());
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.horizontalSpan = 2;
- nameText.setLayoutData(data);
-
- Label referencedLabel = new Label(composite, SWT.NONE);
- referencedLabel.setText(Messages.Local_Palette_Entry_Reference);
- data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- referencedLabel.setLayoutData(data);
- referencedText = new Text(composite, SWT.LEAD | SWT.BORDER | SWT.READ_ONLY);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- referencedText.setLayoutData(data);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.horizontalSpan = 2;
- referencedText.setLayoutData(data);
-
- Label descriptionLabel = new Label(composite, SWT.NONE);
- descriptionLabel.setText(Messages.Local_Palette_Entry_Description);
- data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- descriptionLabel.setLayoutData(data);
- descriptionText = new Text(composite, SWT.WRAP | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.horizontalSpan = 2;
- data.widthHint = 160;
- descriptionText.setLayoutData(data);
- descriptionText.addFocusListener(new DescriptionFocusListener());
-
-
- Label iconLabel = new Label(composite, SWT.NONE);
- iconLabel.setText(Messages.Local_Palette_Entry_Icon);
- data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- iconLabel.setLayoutData(data);
- iconText = new Text(composite, SWT.LEAD | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- iconText.setLayoutData(data);
- iconText.addFocusListener(new IconFocusListener());
- iconButton = new Button(composite, SWT.NONE);
- iconButton.setText("Select...");
- iconButton.addMouseListener(new MouseListener() {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseUp(MouseEvent e) {
- BundleIconExplorerDialog dialog = new BundleIconExplorerDialog(parent.getShell(), iconText.getText());
- if (Window.OK == dialog.open()) {
- Object[] values = dialog.getResult();
- if (values.length != 1) {
- Activator.log.error("Waiting one icon path, but found " + values.length, null);//$NON-NLS-1$
- } else {
- iconText.setText(values[0].toString());
-
- String bundleId = dialog.getCurrentBundleName();
- String iconPath = dialog.getIconPath();
- updateIconInConfiguration(bundleId, iconPath);
- }
- }
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
-
- return composite;
- }
-
-
- private void updateIconInConfiguration(String bundleId, String iconPath) {
- if (selectedConfiguration != null) {
- IconDescriptor descriptor = PaletteconfigurationFactory.eINSTANCE.createIconDescriptor();
- if (bundleId != null && iconPath != null) {
- descriptor.setPluginID(bundleId);
- descriptor.setIconPath(iconPath);
- }
- selectedConfiguration.setIcon(descriptor);
- }
- }
-
- /**
- * Updates the name field in the information area
- */
- protected void updateNameEntryField() {
- if (selectedConfiguration != null) {
- nameText.setText((selectedConfiguration.getLabel() != null) ? selectedConfiguration.getLabel() : "");
- nameText.setEnabled(true);
- } else {
- nameText.setText("");
- nameText.setEnabled(false);
- }
-
- }
-
- /**
- * Updates the reference field in the information area
- */
- protected void updateReferencedEntryField() {
- if (selectedConfiguration instanceof ToolConfiguration) {
- ToolConfiguration configuration = ((ToolConfiguration) selectedConfiguration);
- } else {
- referencedText.setText("");
- referencedText.setEnabled(false);
- }
- }
-
- /**
- * Updates the description field in the information area
- */
- protected void updateDescriptionEntryField() {
- if (selectedConfiguration != null) {
- descriptionText.setText((selectedConfiguration.getDescription() != null) ? selectedConfiguration.getDescription() : "");
- descriptionText.setEnabled(true);
- } else {
- descriptionText.setText("");
- descriptionText.setEnabled(false);
- }
- }
-
- /**
- * Updates the icon field in the information area
- */
- protected void updateIconEntryField() {
- if (selectedConfiguration != null) {
- IconDescriptor descriptor = selectedConfiguration.getIcon();
- if (descriptor != null) {
- String iconPath = descriptor.getIconPath();
- String bundleId = descriptor.getPluginID();
- if (iconPath != null && bundleId != null) {
- iconText.setText(PLUGIN_PROTOCOL + bundleId + iconPath);
- }
- }
- iconText.setEnabled(true);
- } else {
- iconText.setText("");
- iconText.setEnabled(true);
- }
- }
-
- /**
- * Sets the new Selected entry
- *
- * @param configuration
- * the selectedConfiguration to set
- */
- public void setSelectedConfiguration(Configuration configuration) {
- this.selectedConfiguration = configuration;
-
- updateNameEntryField();
- updateIconEntryField();
- updateReferencedEntryField();
- updateDescriptionEntryField();
- }
-
- /**
- * focus listener for the name text field
- */
- protected class NameFocusListener implements FocusListener {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusLost(FocusEvent e) {
- if (selectedConfiguration != null) {
- selectedConfiguration.setLabel(nameText.getText().trim());
- }
- }
-
- }
-
- /**
- * focus listener for the name text field
- */
- protected class DescriptionFocusListener implements FocusListener {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusLost(FocusEvent e) {
- if (selectedConfiguration != null) {
- selectedConfiguration.setDescription(descriptionText.getText().trim());
- }
- }
- }
-
- /**
- * focus listener for the name text field
- */
- protected class IconFocusListener implements FocusListener {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusLost(FocusEvent e) {
- String text = iconText.getText();
- if (selectedConfiguration != null && text != null && !text.equals("")) {
-
- // parse the text....
- if (!text.startsWith(PLUGIN_PROTOCOL)) {
- return;
- }
-
- text = text.substring(PLUGIN_PROTOCOL.length(), text.length());
-
- int i = text.indexOf("/");
- if (i < 1) {
- return;
- }
- String bundlePath = text.substring(0, i);
- String iconPath = text.substring(bundlePath.length(), text.length());
-
- updateIconInConfiguration(bundlePath, iconPath);
- }
- }
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/DrawerInformationPage.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/DrawerInformationPage.java
deleted file mode 100644
index 41cf5e622d7..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/DrawerInformationPage.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.infra.widgets.editors.BundleIconExplorerDialog;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-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.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * Wizard page for information about the new drawer
- */
-public class DrawerInformationPage extends WizardPage implements Listener {
-
- /** text area for the name of the palette definition */
- protected Text nameText;
-
- /** text area for the id of the palette definition */
- protected Text idText;
-
- /** parent composite for advanced fields */
- protected Composite advancedComposite;
-
- /** Button to show/hide advanced fields */
- protected Button advancedButton;
-
- /** drawer ID */
- protected String drawerID;
-
- /** palette name */
- protected String name;
-
- /** image descriptor for the drawer icon */
- protected String imageDescriptorPath;
-
- /** Text area for icon path */
- protected Text imageText;
-
- /** drawer proxy to edit, if one exists */
- protected final PaletteLocalDrawerProxy drawerProxy;
-
- /** path to the icon */
- protected static final String WIZARD_ICON = "/icons/new_drawer_wiz.gif";
-
- /**
- * Creates a new wizard page with the given name, title, and image.
- *
- * @param part
- * the editor part in which the wizard was created
- */
- public DrawerInformationPage() {
- super(Messages.Wizard_Drawer_Page_Name, Messages.Wizard_Drawer_Page_Title, Activator.getImageDescriptor(WIZARD_ICON));
- drawerProxy = null;
- }
-
- /**
- * Creates a new wizard page with the given name, title, and image.
- *
- * @param part
- * the editor part in which the wizard was created
- */
- public DrawerInformationPage(PaletteLocalDrawerProxy drawerProxy) {
- super(Messages.Wizard_Drawer_Page_Name, Messages.Wizard_Drawer_Page_Title, Activator.getImageDescriptor(WIZARD_ICON));
- this.drawerProxy = drawerProxy;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createControl(Composite parent) {
-
- // initialize dialog units
- initializeDialogUnits(parent);
-
- // initialize values
- intializeValues();
-
- // Create a new composite as there is the title bar seperator
- // to deal with
- Composite control = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- control.setLayout(layout);
- control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setControl(control);
-
- createNameControl(control);
-
- createAdvancedControls(control);
-
- // end of the control creation
- Dialog.applyDialogFont(control);
-
- validatePage();
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setPageComplete(false);
- setControl(control);
- }
-
- /**
- * initializes fields using context information
- */
- protected void intializeValues() {
- initName();
- initDrawerID();
- initImageDescriptor();
- }
-
- /**
- * Returns the current value of palette name
- *
- * @return the current value of palette name
- */
- public String getDrawerName() {
- return name;
- }
-
- /**
- * Returns the current value of palette ID
- *
- * @return the current value of palette ID
- */
- public String getDrawerID() {
- return drawerID;
- }
-
- /**
- * Returns the current value of path for image descriptor
- *
- * @return the current value of path for image descriptor
- */
- public String getImageDescriptorPath() {
- return imageDescriptorPath;
- }
-
- /**
- * inits the name field value
- */
- protected void initName() {
- if (drawerProxy == null) {
- name = "";
- } else {
- name = drawerProxy.getLabel();
- }
-
- }
-
- /**
- * inits the palette id value
- */
- protected void initDrawerID() {
- if (drawerProxy == null) {
- drawerID = "drawer_" + System.currentTimeMillis();
- } else {
- drawerID = drawerProxy.getId();
- }
-
- }
-
- /**
- * Inits the image descriptor
- */
- protected void initImageDescriptor() {
- if (drawerProxy == null) {
- imageDescriptorPath = "/icons/drawer.gif";
- } else {
- imageDescriptorPath = drawerProxy.getImagePath();
- }
-
- }
-
- /**
- * Validates the content of the fields in this page
- */
- protected boolean validatePage() {
- boolean valid = true;
- if (advancedComposite != null && !advancedComposite.isDisposed()) {
-
- if ("".equals(getDrawerID())) {
- setErrorMessage(Messages.Wizard_Drawer_Error_Id);
- valid = false;
- } else if ("".equals(getImageDescriptorPath())) {
- setErrorMessage(Messages.Wizard_Drawer_Error_Icon);
- valid = false;
- }
- }
-
- if ("".equals(getDrawerName())) {
- setErrorMessage(Messages.Wizard_Drawer_Error_Name);
- valid = false;
- }
-
- if (valid) {
- setMessage(null);
- setErrorMessage(null);
- }
- return valid;
- }
-
- /**
- * Creates the widget for advanced options.
- *
- * @param parent
- * the parent composite
- */
- protected void createAdvancedControls(Composite parent) {
- advancedButton = new Button(parent, SWT.PUSH);
- advancedButton.setFont(parent.getFont());
- advancedButton.setText(Messages.Dialog_Advanced_Button_Closed);
- GridData data = setButtonLayoutData(advancedButton);
- data.horizontalAlignment = GridData.BEGINNING;
- data.horizontalSpan = 2;
- advancedButton.setLayoutData(data);
- advancedButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleAdvancedButtonSelect();
- }
- });
- }
-
- public Composite createAdvancedComposite(Composite parent) {
- advancedComposite = new Composite(parent, SWT.NONE);
- advancedComposite.setFont(parent.getFont());
- advancedComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- advancedComposite.setLayout(layout);
-
- createIconControl(advancedComposite);
-
- createIDControl(advancedComposite);
-
- advancedComposite.getParent().layout();
- return advancedComposite;
- }
-
- /**
- * creates the control area for the icon path definition
- *
- * @param composite
- * the parent composite
- */
- protected void createIconControl(final Composite composite) {
- final Label iconLabel = new Label(composite, SWT.NONE);
- iconLabel.setText(Messages.Wizard_Drawer_Icon);
- iconLabel.setToolTipText(Messages.Wizard_Drawer_Icon_Tooltip);
-
- imageText = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
- imageText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- imageText.setToolTipText(Messages.Wizard_Drawer_Icon_Tooltip);
-
- // initialize, then add the listener...
- initialPopulateDrawerIconField();
-
- // imageText.addListener(SWT.Modify, this);
-
- Button button = new Button(composite, SWT.NONE);
- button.setText("...");
- button.addMouseListener(new MouseListener() {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseUp(MouseEvent e) {
- BundleIconExplorerDialog dialog = new BundleIconExplorerDialog(composite.getShell(), imageText.getText());
- if (Window.OK == dialog.open()) {
- Object[] values = dialog.getResult();
- if (values.length != 1) {
- Activator.log.error("Waiting one icon path, but found " + values.length, null);
- } else {
- imageDescriptorPath = values[0].toString();
- imageText.setText(imageDescriptorPath);
- }
- }
- setPageComplete(validatePage());
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
-
- }
-
- /**
- * Shows/hides the advanced option widgets.
- */
- protected void handleAdvancedButtonSelect() {
- Composite composite = (Composite) getControl();
-
- if (advancedComposite != null) {
- advancedComposite.dispose();
- advancedComposite = null;
- advancedButton.setText(Messages.Dialog_Advanced_Button_Closed);
- } else {
- createAdvancedComposite(composite);
- advancedButton.setText(Messages.Dialog_Advanced_Button_Opened);
- }
- }
-
- /**
- * creates the control area for the id definition
- *
- * @param control
- * the parent composite
- */
- protected void createIDControl(Composite control) {
- final Label idLabel = new Label(control, SWT.NONE);
- idLabel.setText(Messages.Wizard_Drawer_Id);
- idLabel.setToolTipText(Messages.Wizard_Drawer_Id_Tooltip);
-
- idText = new Text(control, SWT.BORDER);
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
- data.horizontalSpan = 2;
- idText.setLayoutData(data);
- idText.setToolTipText(Messages.Wizard_Drawer_Id_Tooltip);
-
- // initialize, then add the listener...
- initialPopulateDrawerIDField();
-
- idText.addListener(SWT.Modify, this);
- }
-
- /**
- * intialize the field using current value of the palette id
- */
- protected void initialPopulateDrawerIconField() {
- imageText.setText(imageDescriptorPath);
- }
-
- /**
- * intialize the field using current value of the palette id
- */
- protected void initialPopulateDrawerIDField() {
- idText.setText(drawerID);
- }
-
- /**
- * creates the control area for the name definition
- *
- * @param control
- * the parent composite
- */
- protected void createNameControl(Composite control) {
- final Label nameLabel = new Label(control, SWT.NONE);
- nameLabel.setText(Messages.Wizard_Drawer_Name);
- nameLabel.setToolTipText(Messages.Wizard_Drawer_Name_Tooltip);
-
- nameText = new Text(control, SWT.BORDER);
- nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- nameText.setToolTipText(Messages.Wizard_Drawer_Name_Tooltip);
-
- // initialize, then add the listener...
- initialPopulateNameField();
-
- nameText.addListener(SWT.Modify, this);
-
- }
-
- /**
- * initialize name field
- */
- protected void initialPopulateNameField() {
- nameText.setText(name);
- }
-
- /**
- * The <code>WizardNewFileCreationPage</code> implementation of this <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
- @Override
- public void handleEvent(Event event) {
- Widget widget = event.widget;
- if (widget.equals(nameText)) {
- name = nameText.getText();
- } else if (widget.equals(idText)) {
- drawerID = idText.getText();
- }
- setPageComplete(validatePage());
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExportPaletteConfigurationWizard.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExportPaletteConfigurationWizard.java
deleted file mode 100644
index 6e89b2fe30d..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExportPaletteConfigurationWizard.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 507654 Change the save order
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.io.IOException;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.customization.palette.PaletteConstants;
-import org.eclipse.papyrus.customization.palette.utils.PaletteUtils;
-import org.eclipse.papyrus.infra.types.ElementTypeSetConfiguration;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.ProviderDescriptor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- * Wizard to export an existing Palette Definition and its associated models files.
- */
-public class ExportPaletteConfigurationWizard extends AbstractPaletteConfigurationWizard {
-
- /** content page */
- protected PaletteConfigurationContentPage contentPage;
-
- /** the new file creation page of the wizard */
- private WizardNewFileCreationPage newFileCreationPage;
-
- /**
- * Creates a new local Palette Wizard.
- *
- * @param part
- * the editor part where the palette is available
- * @param descriptor
- * the descriptor to edit
- */
- public ExportPaletteConfigurationWizard(final IEditorPart part, final ProviderDescriptor descriptor) {
- super(part, descriptor);
- setWindowTitle(Messages.ExportPaletteConfigurationWizard_ExportWiazrdLabel);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
-
- newFileCreationPage = new WizardNewFileCreationPage("", new StructuredSelection());//$NON-NLS-1$
-
- newFileCreationPage.setTitle(Messages.ExportPaletteConfigurationWizard_export_palette);
- newFileCreationPage.setDescription(Messages.ExportPaletteConfigurationWizard_Export_description);
-
- addPage(newFileCreationPage);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void saveResources() {
-
- // Get the wanted location
- String selectedPath = newFileCreationPage.getContainerFullPath().append(newFileCreationPage.getFileName()).toString();
-
- clearStringBuilder();
- stringBuilder.append(selectedPath);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_SEMENTIC_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- elementTypeSemResource.setURI(URI.createFileURI(stringBuilder.toString()));
-
- clearStringBuilder();
- stringBuilder.append(selectedPath);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_UI_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- elementTypeUIResource.setURI(URI.createFileURI(stringBuilder.toString()));
-
- clearStringBuilder();
- stringBuilder.append(selectedPath);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.PALETTECONFIGURATION_EXTENSION);
- // Set new path
- paletteResource.setURI(URI.createFileURI(stringBuilder.toString()));
-
- // Save
- try {
- // Checks if model are not void and are useful
- if (!((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0)).getElementTypeConfigurations().isEmpty()) {
- elementTypeSemResource.save(PaletteUtils.saveOptions);
- elementTypeUIResource.save(PaletteUtils.saveOptions);
- }
- paletteResource.save(PaletteUtils.saveOptions);
- } catch (IOException e) {
- Activator.log.error(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void deployModels() {
- // Nothings to loads
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExtendedPaletteContentPage.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExtendedPaletteContentPage.java
deleted file mode 100644
index 3f54ff2dbdd..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExtendedPaletteContentPage.java
+++ /dev/null
@@ -1,2463 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009, 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- * Christian W. Damus (CEA) - bug 422257
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - adaptation to use paletteConfiguration model instead of eclipse palette xml file
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-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.EContentAdapter;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.gef.palette.PaletteDrawer;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.palette.PaletteStack;
-import org.eclipse.gef.palette.PaletteToolbar;
-import org.eclipse.gef.palette.ToolEntry;
-import org.eclipse.gef.ui.palette.PaletteCustomizer;
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManagerFactory;
-import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
-import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManagerFactory;
-import org.eclipse.papyrus.emf.facet.custom.core.internal.CustomizationCatalogManager;
-import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
-import org.eclipse.papyrus.emf.facet.custom.ui.internal.CustomizedLabelProvider;
-import org.eclipse.papyrus.emf.facet.custom.ui.internal.CustomizedTreeContentProvider;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectCreationEntry;
-import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant;
-import org.eclipse.papyrus.uml.diagram.common.service.PaletteConfigurationUtils;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.StereotypeAspectActionProvider;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Configuration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.DrawerConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.LeafConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteconfigurationPackage;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.SeparatorConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.StackConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ToolConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.util.PaletteconfigurationSwitch;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.DropTargetListener;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TreeDropTargetEffect;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.w3c.dom.Document;
-
-/**
- * Wizard page for information about the new local palette definition
- */
-public class ExtendedPaletteContentPage extends WizardPage implements Listener {
-
- /** editor part in which the palette is created */
- protected IEditorPart editorPart;
-
- /** available tools viewer */
- protected TreeViewer availableToolsViewer;
-
- /** label provider for the tree viewer */
- protected PaletteLabelProvider paletteLabelProvider;
-
- /** icon path when tools are hidden */
- protected static final String HIDDEN_TOOLS_ICON = "/icons/tools_hidden.gif";
-
- /** icon path when tools are shown */
- protected static final String SHOWN_TOOLS_ICON = "/icons/tools_shown.gif";
-
- /** path to the icon */
- protected static final String WIZARD_ICON = "/icons/local_desc_wiz.png";
-
- /** icon path when drawers are hidden */
- protected static final String SHOWN_DRAWERS_ICON = "/icons/drawers_shown.gif";
-
- /** icon path when drawers are shown */
- protected static final String HIDDEN_DRAWERS_ICON = "/icons/drawers_hidden.gif";
-
- /** icon path for the add button */
- protected static final String ADD_ICON = "/icons/arrow_right.gif";
-
- /** icon path for the remove button */
- protected static final String REMOVE_ICON = "/icons/arrow_left.gif";
-
- /** icon path for the delete button */
- protected static final String DELETE_ICON = "/icons/delete.gif";
-
- /** icon path for the create drawer button */
- protected static final String CREATE_DRAWERS_ICON = "/icons/new_drawer.gif";
-
- /** icon path for the create separator button */
- protected String CREATE_SEPARATOR_ICON = "/icons/separator.gif";
-
- /** icon path for the create stack button */
- protected String CREATE_STACK_ICON = "/icons/stack.gif";
-
- /** icon path for the delete drawer button */
- protected static final String DELETE_DRAWERS_ICON = "/icons/delete.gif";
-
- /** icon for the content provider switch button */
- protected String SWITCH_CONTENT_PROVIDER_ICON = "/icons/switch_provider.gif";
-
- /** label for the standard tools */
- protected static final String UML_TOOLS_LABEL = "UML tools";
-
- /** icon path for the edit drawer button */
- protected static final String EDIT_ICON = "/icons/obj16/file.gif";
-
- /** instance of the filter used to show/hide drawers */
- protected final ViewerFilter drawerFilter = new DrawerFilter();
-
- /** instance of the filter used to show/hide tools */
- protected final ViewerFilter toolFilter = new ToolFilter();
-
- /** stored preferences */
- protected List<String> storedPreferences;
-
- /** add button */
- protected Button addButton;
-
- /** remove button */
- protected Button removeButton;
-
- /** tree viewer for the new palette */
- protected TreeViewer paletteTreeViewer;
-
- /** document for element creation */
- protected Document document;
-
- /** content node for the palette viewer */
- protected PaletteContainerProxy contentNode;
-
- /** combo to select which profile tools should be visible */
- protected Combo profileCombo;
-
- /** list of profiles that can provide tools */
- protected List<String> profileComboList = new ArrayList<String>();
-
- /** tool item in charge of toggling content providers in the available tool viewer */
- protected ToolItem toggleContentProvider;
-
- /** required profile by this palette */
- protected Set<String> requiredProfiles;
-
- /** palette customizer used for the palette */
- protected PaletteCustomizer customizer;
-
- /** current selected entry proxy */
- protected Configuration selectedConfiguration;
-
- /** class in charge of the information composite */
- protected ConfigurationInformationComposite informationComposite = new ConfigurationInformationComposite();
-
- /** class in charge of the aspect tool information composite */
- protected AspectActionsInformationComposite aspectActionComposite = new AspectActionsInformationComposite();
-
- /** toolbar above tools */
- protected ToolBar toolbar;
-
- /** validator key for toolbar items */
- protected final static String VALIDATOR = "validator";
-
- /** priority of the current edited palette */
- protected ProviderPriority priority;
-
- /** resource set that contains the palette configuration resource */
- private ResourceSet resourceSet;
-
- /** palette configuration resource */
- private Resource resourceToEdit;
-
- /** customization manager for the content provider */
- // TODO: EMFFACET: pb of ResourceSET
- private ICustomizationManager manager = ICustomizationManagerFactory.DEFAULT.getOrCreateICustomizationManager(new ResourceSetImpl());
-
-
- /**
- * Creates a new wizard page with the given name, title, and image.
- *
- * @param part
- * the editor part in which the wizard was created
- */
- public ExtendedPaletteContentPage(IEditorPart part, PaletteCustomizer customizer) {
- super(Messages.Local_Palette_ContentPage_Name, Messages.Local_Palette_ContentPage_Title, Activator.getImageDescriptor(WIZARD_ICON));
- this.editorPart = part;
- this.customizer = customizer;
- }
-
- @Override
- public void dispose() {
- super.dispose();
-
- if (resourceSet != null) {
- EMFHelper.unload(resourceSet);
- }
-
- if (manager != null) {
- EMFHelper.unload(manager.getResourceSet());
- }
- }
-
- /**
- * Sets the priority of the current edited palette
- *
- * @param priority
- * the priority of the current edited palette
- */
- public void setPriority(ProviderPriority priority) {
- this.priority = priority;
- }
-
- /**
- * @return the resourceSet
- */
- public ResourceSet getResourceSet() {
- return resourceSet;
- }
-
- /**
- * @return the resourceToEdit
- */
- public Resource getResourceToEdit() {
- return resourceToEdit;
- }
-
- /**
- * Returns the list of required profiles by this local palette definition
- *
- * @return the profiles required by this palette
- */
- public Set<String> getRequiredProfiles() {
- return requiredProfiles;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createControl(Composite parent) {
-
- // initialize dialog units
- initializeDialogUnits(parent);
-
- // Create a new composite as there is the title bar seperator
- // to deal with
- Composite control = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(4, false);
- control.setLayout(layout);
- control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setControl(control);
-
- // create Available Tools Group
- createAvailableToolsGroup();
-
- // create add/remove buttons
- createAddRemoveButtons();
-
- // create Palette Group
- createPalettePreviewGroup();
-
- // create tool description group (custom name, description, and perhaphs icon.... Just under this group, another one with aspect actions)
- createToolDescriptionGroup();
-
- // just under, creates a new line of composites...
- createAspectActionComposite();
-
-
-
- // add listeners inter-groups
- ISelectionChangedListener listener = createToolsViewerSelectionChangeListener();
- availableToolsViewer.addSelectionChangedListener(listener);
- paletteTreeViewer.addSelectionChangedListener(listener);
- resourceToEdit.eAdapters().add(new EContentAdapter() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- paletteTreeViewer.refresh();
- }
- });
-
- // end of the control creation
- Dialog.applyDialogFont(control);
-
- validatePage();
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setControl(control);
- }
-
- /**
- * Creates the composite group that presents information about ascpect actions for aspect tools
- */
- protected void createAspectActionComposite() {
- aspectActionComposite.createComposite((Composite) getControl(), getAllAppliedProfiles());
- }
-
- /**
- * Creates the composite group that presents information about current selected tool
- */
- protected void createToolDescriptionGroup() {
- informationComposite.createComposite((Composite) getControl(), getAllAppliedProfiles());
- }
-
- /**
- * update the preferences to have all tools accessible
- */
- protected void updatePreferences() {
- // change => set to no hidden palettes
- storedPreferences = PapyrusPalettePreferences.getHiddenPalettes(editorPart);
-
- // remove all, but should only remove visible palettes
- for (String id : storedPreferences) {
- PapyrusPalettePreferences.changePaletteVisibility(id, editorPart, true);
- }
- }
-
- /**
- * Restore preferences
- */
- public void restorePreferences() {
- // remove all, but should only remove visible palettes
- for (String id : storedPreferences) {
- PapyrusPalettePreferences.changePaletteVisibility(id, editorPart, false);
- }
- }
-
- /**
- * creates the palette preview group
- */
- protected void createPalettePreviewGroup() {
- Composite parent = (Composite) getControl();
- Composite paletteComposite = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout(2, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- paletteComposite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- paletteComposite.setLayoutData(data);
-
- Label label = new Label(paletteComposite, SWT.NONE);
- label.setText(Messages.Local_Palette_Palette_Preview);
- data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- label.setLayoutData(data);
-
- toolbar = new ToolBar(paletteComposite, SWT.HORIZONTAL);
- data = new GridData(SWT.RIGHT, SWT.FILL, false, false);
- toolbar.setLayoutData(data);
- populatePalettePreviewToolBar(toolbar);
-
- Tree tree = new Tree(paletteComposite, SWT.SINGLE | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- data.widthHint = 185;
- // Make the tree this tall even when there is nothing in it. This will keep the
- // dialog from shrinking to an unusually small size.
- data.heightHint = 200;
- tree.setLayoutData(data);
- paletteTreeViewer = new TreeViewer(tree);
- paletteTreeViewer.setContentProvider(new ExtendedPaletteContentProvider());
- paletteTreeViewer.setLabelProvider(new ExtendedPaletteLabelProvider());
- paletteTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handlePalettePreviewSelectionChanged(event);
- }
- });
-
- addPalettePreviewDropSupport();
- addPalettePreviewDragSupport();
- addPalettePreviewEditSupport();
-
- paletteTreeViewer.setInput(resourceToEdit);
- }
-
- /**
- * handle the selection change event for the palette preview
- *
- * @param event
- * the event that is thrown by the palette viewer
- */
- protected void handlePalettePreviewSelectionChanged(SelectionChangedEvent event) {
- // retrieve current selection
- Configuration configuration = getSelectedConfiguration();
- if (configuration != null) {
- selectedConfiguration = configuration;
- // update the current selected palette entry proxy
- informationComposite.setSelectedConfiguration(selectedConfiguration);
- } else {
- selectedConfiguration = null;
- informationComposite.setSelectedConfiguration(null);
- }
-
- // update toolbar
- if (toolbar != null && !toolbar.isDisposed()) {
- for (int i = 0; i < toolbar.getItemCount(); i++) {
- ToolItem item = toolbar.getItem(i);
- Object validator = item.getData(VALIDATOR);
- if (validator instanceof ToolBarItemValidator) {
- item.setEnabled(((ToolBarItemValidator) validator).isEnable());
- }
- }
- }
- }
-
- /**
- * Adds the behavior for the double click strategy
- */
- protected void addPalettePreviewEditSupport() {
- paletteTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void doubleClick(DoubleClickEvent event) {
- // nothing here
- }
- });
-
- }
-
- /**
- * Add drop behavior for the palette preview
- */
- protected void addPalettePreviewDropSupport() {
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
-
- // drag listener
- DropTargetListener listener = new TreeDropTargetEffect(paletteTreeViewer.getTree()) {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void drop(DropTargetEvent event) {
- super.drop(event);
- IStructuredSelection transferedSelection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().nativeToJava(event.currentDataType);
- Object objectToTransfer = transferedSelection.getFirstElement();
- if (!(objectToTransfer instanceof IAdaptable)) {
- return;
- }
- final EObject eobjectToTransfer = EMFHelper.getEObject(objectToTransfer);
-
- Object targetObject = ((TreeItem) event.item).getData();
- if (!(targetObject instanceof IAdaptable)) {
- return;
- }
-
- final EObject targetEObject = EMFHelper.getEObject(targetObject);
- if (targetEObject == null) {
- return;
- }
-
- new PaletteconfigurationSwitch<Object>() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseDrawerConfiguration(DrawerConfiguration drawerConfigurationToMove) {
- if (targetEObject instanceof DrawerConfiguration) {
- // move the drawer before the target drawer configuration
- PaletteConfiguration paletteConfiguration = (PaletteConfiguration) ((DrawerConfiguration) targetEObject).eContainer();
- PaletteConfigurationUtils.moveDrawerConfiguration(paletteConfiguration, drawerConfigurationToMove, (DrawerConfiguration) targetEObject);
-
- }
- return super.caseDrawerConfiguration(drawerConfigurationToMove);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseSeparatorConfiguration(SeparatorConfiguration separatorConfigurationToMove) {
- if (targetEObject instanceof DrawerConfiguration) {
- PaletteConfigurationUtils.moveSeparatorConfiguration(((DrawerConfiguration) targetEObject), separatorConfigurationToMove);
- } else if (targetEObject instanceof StackConfiguration) {
- PaletteConfigurationUtils.moveSeparatorConfiguration(((StackConfiguration) targetEObject), separatorConfigurationToMove);
- } else if (targetEObject instanceof ToolConfiguration) {
- PaletteConfigurationUtils.moveSeparatorConfiguration(((ToolConfiguration) targetEObject), separatorConfigurationToMove);
- } else if (targetEObject instanceof SeparatorConfiguration) {
- PaletteConfigurationUtils.moveSeparatorConfiguration(((SeparatorConfiguration) targetEObject), separatorConfigurationToMove);
- }
-
- return super.caseSeparatorConfiguration(separatorConfigurationToMove);
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseStackConfiguration(StackConfiguration stackConfigurationToMove) {
- if (targetEObject instanceof DrawerConfiguration) {
- PaletteConfigurationUtils.moveStackConfiguration(((DrawerConfiguration) targetEObject), stackConfigurationToMove);
- } else if (targetEObject instanceof StackConfiguration) {
- PaletteConfigurationUtils.moveStackConfiguration(((StackConfiguration) targetEObject), stackConfigurationToMove);
- } else if (targetEObject instanceof ToolConfiguration) {
- PaletteConfigurationUtils.moveStackConfiguration(((ToolConfiguration) targetEObject), stackConfigurationToMove);
- } else if (targetEObject instanceof SeparatorConfiguration) {
- PaletteConfigurationUtils.moveStackConfiguration(((SeparatorConfiguration) targetEObject), stackConfigurationToMove);
- }
-
- return super.caseStackConfiguration(stackConfigurationToMove);
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseToolConfiguration(ToolConfiguration toolConfigurationToMove) {
- if (targetEObject instanceof DrawerConfiguration) {
- PaletteConfigurationUtils.moveToolConfiguration(((DrawerConfiguration) targetEObject), toolConfigurationToMove);
- } else if (targetEObject instanceof StackConfiguration) {
- PaletteConfigurationUtils.moveToolConfiguration(((StackConfiguration) targetEObject), toolConfigurationToMove);
- } else if (targetEObject instanceof ToolConfiguration) {
- PaletteConfigurationUtils.moveToolConfiguration(((ToolConfiguration) targetEObject), toolConfigurationToMove);
- } else if (targetEObject instanceof SeparatorConfiguration) {
- PaletteConfigurationUtils.moveToolConfiguration(((SeparatorConfiguration) targetEObject), toolConfigurationToMove);
- }
-
- return super.caseToolConfiguration(toolConfigurationToMove);
- };
-
-
- }.doSwitch(eobjectToTransfer);
-
- setPageComplete(validatePage());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragOver(DropTargetEvent event) {
- super.dragOver(event);
-
- IStructuredSelection transferedSelection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().nativeToJava(event.currentDataType);
- // check selection is compatible for drop target
-
- TreeItem item = paletteTreeViewer.getTree().getItem(paletteTreeViewer.getTree().toControl(new Point(event.x, event.y)));
-
- checkSelectionForDrop(transferedSelection, item, event);
- }
- };
-
- paletteTreeViewer.addDropSupport(DND.DROP_LINK | DND.DROP_MOVE, transfers, listener);
- }
-
- /**
- * Adds drag ability to the palette preview composite
- */
- protected void addPalettePreviewDragSupport() {
-
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
-
- // drag listener
- DragSourceListener listener = new DragSourceAdapter() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragStart(DragSourceEvent event) {
- super.dragStart(event);
- event.data = paletteTreeViewer.getSelection();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragSetData(DragSourceEvent event) {
- super.dragSetData(event);
- LocalSelectionTransfer.getTransfer().setSelection(paletteTreeViewer.getSelection());
- }
-
- };
-
- paletteTreeViewer.addDragSupport(DND.DROP_MOVE, transfers, listener);
- }
-
- /**
- * Checks if the selection can be added to the target widget
- *
- * @param transferedSelection
- * the selection to be dropped
- * @param widget
- * the widget where to drop
- */
- protected void checkSelectionForDrop(IStructuredSelection transferedSelection, TreeItem item, final DropTargetEvent event) {
- event.detail = DND.DROP_NONE;
- final Object objectToTransfer = transferedSelection.getFirstElement();
- if (!(objectToTransfer instanceof IAdaptable)) {
- return;
- }
- final EObject eobjectToTransfer = EMFHelper.getEObject(objectToTransfer);
- // handle only first selected element
- if (item == null) {
- // adding to the root, should only be a drawer
- if (eobjectToTransfer instanceof DrawerConfiguration) {
- event.detail = DND.DROP_LINK;
- }
- } else {
- Object targetObject = item.getData();
- if (!(targetObject instanceof IAdaptable)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- final EObject targetEObject = EMFHelper.getEObject(targetObject);
- if (targetEObject == null) {
- event.detail = DND.DROP_NONE;
- return;
- }
-
- new PaletteconfigurationSwitch<Object>() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseDrawerConfiguration(DrawerConfiguration object) {
- if (targetEObject instanceof DrawerConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- }
- return object;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseSeparatorConfiguration(SeparatorConfiguration object) {
- if (targetEObject instanceof DrawerConfiguration) {
- event.detail = DND.DROP_MOVE;
- } else if (targetEObject instanceof StackConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- } else if (targetEObject instanceof ToolConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- } else if (targetEObject instanceof SeparatorConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- }
-
- return object;
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseStackConfiguration(StackConfiguration object) {
- if (targetEObject instanceof DrawerConfiguration) {
- event.detail = DND.DROP_MOVE;
- } else if (targetEObject instanceof StackConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- } else if (targetEObject instanceof ToolConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- } else if (targetEObject instanceof SeparatorConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- }
- return object;
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseToolConfiguration(ToolConfiguration object) {
- if (targetEObject instanceof DrawerConfiguration) {
- event.detail = DND.DROP_MOVE;
- } else if (targetEObject instanceof StackConfiguration) {
- event.detail = DND.DROP_MOVE;
- } else if (targetEObject instanceof ToolConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- } else if (targetEObject instanceof SeparatorConfiguration) {
- event.detail = DND.DROP_MOVE;
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- }
- return object;
- };
-
-
- }.doSwitch(eobjectToTransfer);
-
- }
- }
-
- /**
- * Sets an empty content for the palette preview
- */
- public void initializeContent() {
- contentNode = new PaletteContainerProxy(null);
-
- // adds a default local drawer
- PaletteLocalDrawerProxy proxy = new PaletteLocalDrawerProxy("Default", generateID("Drawer_"), "/icons/drawer.gif", "Default Drawer");
- contentNode.addChild(proxy);
-
- setPageComplete(false);
- }
-
- /**
- * Sets the initial content for the palette preview
- *
- * @param descriptor
- * the descriptor that contains the configuration file to load
- */
- public void initializeContent(PapyrusPaletteService.ExtendedProviderDescriptor descriptor) {
- resourceSet = createResourceSet();
- URI redefinitionFileURI = PaletteUtil.getRedefinitionFileURI(descriptor.getContributionID());
- resourceToEdit = getResourceSet().createResource(redefinitionFileURI);
-
- // check resource is not null;
- if (resourceToEdit == null) {
- Activator.log.error("No resource has been created for uri :" + redefinitionFileURI, null);
- }
- try {
- resourceToEdit.load(Collections.emptyMap());
- } catch (IOException e) {
- Activator.log.error("Impossible to load configuration file", e);
- }
-
- }
-
- /**
- * Creates and returns the resource set used to modidy the content of the palette configuration
- *
- * @return the newly created ResourceSet.
- */
- protected ResourceSet createResourceSet() {
- return new ResourceSetImpl();
- }
-
- /**
- * populates the preview palette toolbar
- *
- * @param toolbar
- * the toolbar to populate
- */
- protected void populatePalettePreviewToolBar(ToolBar toolbar) {
- ConfigurationSelectedValidator validator = new ConfigurationSelectedValidator();
- DrawerConfigurationSelectedValidator drawerConfigurationSelectedValidator = new DrawerConfigurationSelectedValidator();
- createToolBarItem(toolbar, DELETE_ICON, Messages.PapyrusPaletteCustomizerDialog_RemoveButtonTooltip, createRemoveElementListener(), validator);
- createToolBarItem(toolbar, CREATE_DRAWERS_ICON, Messages.Local_Palette_Create_Drawer_Tooltip, createNewDrawerListener(), null);
- createToolBarItem(toolbar, CREATE_SEPARATOR_ICON, Messages.Local_Palette_Create_Separator_Tooltip, createNewSeparatorListener(), validator);
- createToolBarItem(toolbar, CREATE_STACK_ICON, Messages.Local_Palette_Create_Stack_Tooltip, createNewStackListener(), drawerConfigurationSelectedValidator);
- }
-
- /**
- * Creates the listener for the remove item(s) button
- *
- * @return the listener for the remove button
- */
- protected Listener createRemoveElementListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (selection == null || selection.size() < 1) {
- return;
- }
-
- Iterator<?> it = selection.iterator();
- while (it.hasNext()) {
- Object o = it.next();
- if (o instanceof IAdaptable) {
- EObject eobject = EMFHelper.getEObject(o);
- if (eobject instanceof Configuration) {
- PaletteConfigurationUtils.removeConfiguration((Configuration) eobject);
- }
- }
- }
- }
- };
- }
-
- /**
- * Creates the listener for the new drawer tool item
- *
- * @return the listener created
- */
- protected Listener createNewDrawerListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- PaletteConfiguration paletteConfiguration = (PaletteConfiguration) EcoreUtil.getObjectByType(resourceToEdit.getContents(), PaletteconfigurationPackage.eINSTANCE.getPaletteConfiguration());
- if (paletteConfiguration != null) {
- PaletteConfigurationUtils.createDrawer(paletteConfiguration);
- } else {
- Activator.log.error("Impossible to find the palette configuration", null);
- }
-
- setPageComplete(validatePage());
- }
- };
- }
-
- /**
- * Creates the listener for the new stack tool item
- *
- * @return the listener created
- */
- protected Listener createNewStackListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- Configuration selectedConfiguration = getSelectedConfiguration();
- if (selectedConfiguration instanceof DrawerConfiguration) {
- PaletteConfigurationUtils.createStack(((DrawerConfiguration) selectedConfiguration));
- } else if (selectedConfiguration instanceof LeafConfiguration) {
- PaletteConfigurationUtils.createStack(((LeafConfiguration) selectedConfiguration));
- } else {
- Activator.log.error("Invalid selection to create a Stack: " + selectedConfiguration, null);
- }
-
- // paletteTreeViewer.refresh();
- setPageComplete(validatePage());
- }
- };
- }
-
- /**
- * Generates the ID for a local element
- *
- * @param base
- * the begining of the id
- * @return the separator id
- */
- protected String generateID(String base) {
- StringBuffer id = new StringBuffer();
- id.append(base);
- id.append("_");
- id.append(System.currentTimeMillis());
-
- return id.toString();
- }
-
- /**
- * Creates the listener for the new separator tool item
- *
- * @return the listener created
- */
- protected Listener createNewSeparatorListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- Configuration selectedConfiguration = getSelectedConfiguration();
- if (selectedConfiguration instanceof DrawerConfiguration) {
- PaletteConfigurationUtils.createSeparator(((DrawerConfiguration) selectedConfiguration));
- } else if (selectedConfiguration instanceof LeafConfiguration) {
- PaletteConfigurationUtils.createSeparator(((LeafConfiguration) selectedConfiguration));
- } else {
- Activator.log.error("Invalid selection to create a separator: " + selectedConfiguration, null);
- }
-
- setPageComplete(validatePage());
- }
- };
- }
-
- /**
- * Returns the current selected configuration
- *
- * @return the current selected configuration or <code>null</code> if the element is not translatable into a {@link Configuration}
- */
- protected Configuration getSelectedConfiguration() {
- // retrieve selection
- if (paletteTreeViewer != null && !paletteTreeViewer.getControl().isDisposed()) {
- // retrieve selection. first element should be a drawer
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (selection == null) {
- return null;
- } else {
- Object object = selection.getFirstElement();
- if (object instanceof IAdaptable) {
- EObject eobject = EMFHelper.getEObject(object);
- if (eobject instanceof Configuration) {
- return (Configuration) eobject;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Creates a toolbar item.
- *
- * @param toolbar
- * the parent toolbar
- * @param itemIcon
- * path for icon
- * @param tooltip
- * tooltip text for the toolbar item
- * @param listener
- * listener for tool bar item
- */
- protected void createToolBarItem(ToolBar toolbar, String itemIcon, String tooltip, Listener listener, ToolBarItemValidator validator) {
- ToolItem item = new ToolItem(toolbar, SWT.BORDER);
- item.setImage(Activator.getPluginIconImage(Activator.ID, itemIcon));
- item.setToolTipText(tooltip);
- item.addListener(SWT.Selection, listener);
- item.setData(VALIDATOR, validator);
- }
-
- /**
- * creates the buttons to add/remove entries
- */
- protected void createAddRemoveButtons() {
- Composite composite = new Composite((Composite) getControl(), SWT.NONE);
- GridLayout layout = new GridLayout(1, true);
- composite.setLayout(layout);
-
- GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, true);
- composite.setLayoutData(data);
-
- addButton = new Button(composite, SWT.NONE);
- addButton.setImage(Activator.getPluginIconImage(Activator.ID, ADD_ICON));
- addButton.setToolTipText(Messages.PapyrusPaletteCustomizerDialog_AddButtonTooltip);
- addButton.addMouseListener(createAddButtonListener());
- addButton.setEnabled(false);
- addButton.addListener(SWT.MouseUp, this);
-
- removeButton = new Button(composite, SWT.NONE);
- removeButton.setImage(Activator.getPluginIconImage(Activator.ID, REMOVE_ICON));
- removeButton.setToolTipText(Messages.PapyrusPaletteCustomizerDialog_RemoveButtonTooltip);
- removeButton.addMouseListener(createRemoveButtonListener());
- removeButton.setEnabled(false);
- removeButton.addListener(SWT.MouseUp, this);
- }
-
- /**
- * selection listener for the tools viewer , to update the state of the add button
- *
- * @return the new created selection listener
- */
- protected ISelectionChangedListener createToolsViewerSelectionChangeListener() {
- return new ISelectionChangedListener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
-
- // get source and target selection
- // check source entry can be added to target entry
- Object source = ((IStructuredSelection) availableToolsViewer.getSelection()).getFirstElement();
- Object target = ((IStructuredSelection) paletteTreeViewer.getSelection()).getFirstElement();
-
- // manage add button
- if (isAddValidTarget(source, target)) {
- addButton.setEnabled(true);
- } else {
- addButton.setEnabled(false);
- }
-
- // manage remove button
- if (isRemoveValidSource(target)) {
- removeButton.setEnabled(true);
- } else {
- removeButton.setEnabled(false);
- }
-
- }
-
- /**
- * Returns true if the source can be added to the target
- *
- * @param source
- * the source object
- * @param target
- * the target object
- * @return <code>true</code> if the source can be added to the target
- */
- protected boolean isAddValidTarget(Object source, Object target) {
- if (!(source instanceof PaletteEntry)) {
- return false;
- }
-
- // case1: source is a drawer.
- // it can only be added to the root element (no selection)
- // case2: source is a palette tool
- // it can't be added to the root element
- // it can only be added to a container element (drawer or stack)
- if (source instanceof PaletteDrawer) {
- if (target == null) {
- return true;
- }
- return false;
- } else if (source instanceof ToolEntry) {
- if (target instanceof PaletteEntryProxy) {
- // EntryType type = ((PaletteEntryProxy)target).getType();
- // switch(type) {
- // case DRAWER:
- // case STACK:
- // return true;
- // default:
- // return false;
- // }
- }
- return false;
- }
- return false;
- }
-
- /**
- * Returns true if the source can be added to the target
- *
- * @param source
- * the source object
- * @return <code>true</code> if the source can be removed (not null and instanceof
- * PaletteEntryProxy)
- */
- protected boolean isRemoveValidSource(Object source) {
- if (source instanceof PaletteEntryProxy) {
- return true;
- }
- return false;
- }
- };
-
- }
-
- /**
- * Creates the add button listener
- */
- protected MouseListener createAddButtonListener() {
- return new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- // // add the element selected on the left to the right tree
- // // check the selection.
- // IStructuredSelection selection = (IStructuredSelection)availableToolsViewer.getSelection();
- // if(selection == null || selection.size() < 1) {
- // return;
- // }
- // PaletteEntry entry = (PaletteEntry)selection.getFirstElement();
- // if(entry == null) {
- // return;
- // }
- //
- // // find the selection on the right
- // selection = (IStructuredSelection)paletteTreeViewer.getSelection();
- //
- // PaletteEntryProxy parentNode = (PaletteEntryProxy)selection.getFirstElement();
- // // Bugfix: only drawers can be added to root element
- // if(parentNode == null && entry instanceof PaletteDrawer) {
- // parentNode = (PaletteContainerProxy)paletteTreeViewer.getInput();
- // }
- //
- // // check we have a containe here
- // if(!(parentNode instanceof PaletteContainerProxy)) {
- // return;
- // }
- //
- // // create a new entry in the document
- // PaletteEntryProxy proxy = createNodeFromEntry(entry);
- // ((PaletteContainerProxy)parentNode).addChild(proxy);
- //
- // paletteTreeViewer.expandToLevel(parentNode, 1);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
- };
- }
-
- // /**
- // * Creates a node in the xml document from the given entry
- // *
- // * @param entry
- // * the palette entry from which to create the node
- // * @param parentNode
- // * the parent node for the newly created node
- // * @return the created entry proxy or <code>null</code>
- // */
- // protected PaletteEntryProxy createNodeFromEntry(Object entry) {
- // PaletteEntryProxy entryProxy = null;
- //
- // if(entry instanceof AspectCreationEntry) {
- // // should modify id of the element here, otherwise, different elements would have the same id...
- // entryProxy = new PaletteAspectToolEntryProxy(((AspectCreationEntry)entry).clone());
- // } else if(entry instanceof CombinedTemplateCreationEntry) {
- // CombinedTemplateCreationEntry originalEntry = (CombinedTemplateCreationEntry)entry;
- // // create a new Aspect entry proxy
- // AspectCreationEntry aspectEntry = new AspectCreationEntry(originalEntry.getLabel(), originalEntry.getDescription(), originalEntry.getId() + "_" + System.currentTimeMillis(), originalEntry.getSmallIcon(), originalEntry, new HashMap<Object, Object>());
- // entryProxy = new PaletteAspectToolEntryProxy(aspectEntry);
- // } else if(entry instanceof PaletteContainer) {
- // entryProxy = new PaletteContainerProxy((PaletteContainer)entry);
- // } else if(entry instanceof PaletteEntryProxy) {
- // entryProxy = ((PaletteEntryProxy)entry);
- // }
- // return entryProxy;
- // }
-
- /**
- * Creates the add button listener
- */
- protected MouseListener createRemoveButtonListener() {
- return new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- // remove the element selected on the right
- // add the element selected on the left to the right tree
- // check the selection.
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (selection == null || selection.size() < 1) {
- return;
- }
- PaletteEntryProxy proxyToDelete = (PaletteEntryProxy) selection.getFirstElement();
- if (proxyToDelete == null) {
- return;
- }
-
- // create a new entry in the document
- // get container of the proxy to be deleted
- PaletteContainerProxy parentProxy = proxyToDelete.getParent();
- parentProxy.removeChild(proxyToDelete);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
- };
- }
-
- /**
- * creates the available entries group
- */
- protected void createAvailableToolsGroup() {
- Composite parent = (Composite) getControl();
- Composite availableToolsComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- availableToolsComposite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- availableToolsComposite.setLayoutData(data);
-
- Label label = new Label(availableToolsComposite, SWT.NONE);
- label.setText(Messages.Local_Palette_Available_Tools);
- data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- label.setLayoutData(data);
-
- ToolBar toolbar = new ToolBar(availableToolsComposite, SWT.HORIZONTAL);
- data = new GridData(SWT.RIGHT, SWT.FILL, false, false);
- toolbar.setLayoutData(data);
- populateAvailableToolsToolBar(toolbar);
-
- createProfileCombo(availableToolsComposite);
-
- Tree tree = new Tree(availableToolsComposite, SWT.SINGLE | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- data.widthHint = 185;
- // Make the tree this tall even when there is nothing in it. This will keep the
- // dialog from shrinking to an unusually small size.
- data.heightHint = 200;
- tree.setLayoutData(data);
- availableToolsViewer = new TreeViewer(tree);
- availableToolsViewer.setContentProvider(new UMLToolsTreeContentProvider());
- paletteLabelProvider = new PaletteLabelProvider();
- availableToolsViewer.setLabelProvider(paletteLabelProvider);
- ViewerComparator labelComparator = new LabelViewerComparator();
- availableToolsViewer.setComparator(labelComparator);
- // remove the note stack and standard group
- availableToolsViewer.addFilter(new ViewerFilter() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof PaletteStack && "noteStack".equals(((PaletteStack) element).getId())) {
- return false;
- } else if (element instanceof PaletteToolbar && "standardGroup".equals(((PaletteToolbar) element).getId())) {
- return false;
- }
- return true;
- }
- });
- availableToolsViewer.addFilter(new DrawerFilter());
- // add drag support
- addAvailableToolsDragSupport();
- // availableToolsViewer.setInput(getAllVisibleStandardEntries());
- }
-
- /**
- * Creates the profile combo
- *
- * @param availableToolsComposite
- * the available tools composite
- * @return the created combo
- */
- protected Combo createProfileCombo(Composite availableToolsComposite) {
- // retrieve top package, to know which profiles are available
- // creates the combo
- profileCombo = new Combo(availableToolsComposite, SWT.BORDER | SWT.READ_ONLY);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- profileCombo.setLayoutData(data);
-
- // retrieve all applied profiles
- List<Profile> profiles = getAllAppliedProfiles();
-
- int profileNumber = profiles.size();
- for (int i = 0; i < profileNumber; i++) {
- profileComboList.add(i, profiles.get(i).getName());
- }
- profileComboList.add(UML_TOOLS_LABEL);
- profileCombo.setItems(profileComboList.toArray(new String[] {}));
-
- // add selection listener for the combo. selects the "UML tools" item
- ProfileComboSelectionListener listener = new ProfileComboSelectionListener();
- profileCombo.addSelectionListener(listener);
- profileCombo.addModifyListener(listener);
- // profileCombo.select(profileNumber);
-
- return profileCombo;
- }
-
- /**
- * returns the list of applied profile for the nearest package of the top element
- *
- * @return the list of applied profile for the nearest package of the top element or an empty
- * list
- */
- protected List<Profile> getAllAppliedProfiles() {
- Package topPackage = null;
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- EObject element = ((DiagramEditorWithFlyOutPalette) editorPart).getDiagram().getElement();
- if (element instanceof org.eclipse.uml2.uml.Element) {
- topPackage = ((org.eclipse.uml2.uml.Element) element).getNearestPackage();
- }
- }
- if (topPackage != null) {
- return topPackage.getAllAppliedProfiles();
- }
- return Collections.emptyList();
- }
-
- /**
- * Add drag support from the available tools viewer
- */
- protected void addAvailableToolsDragSupport() {
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
-
- // drag listener
- DragSourceListener listener = new DragSourceAdapter() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragStart(DragSourceEvent event) {
- super.dragStart(event);
- event.data = availableToolsViewer.getSelection();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragSetData(DragSourceEvent event) {
- super.dragSetData(event);
- LocalSelectionTransfer.getTransfer().setSelection(availableToolsViewer.getSelection());
- }
-
- };
-
- availableToolsViewer.addDragSupport(DND.DROP_LINK, transfers, listener);
- }
-
- /**
- * Adds elements to the tool bar for available tools viewer
- *
- * @param toolbar
- * the toolbar to populate
- */
- protected void populateAvailableToolsToolBar(ToolBar toolbar) {
- toggleContentProvider = createCheckToolBarItem(toolbar, SWITCH_CONTENT_PROVIDER_ICON, Messages.Local_Palette_SwitchToolsContentProvider_Tooltip, createSwitchToolsContentProviderListener());
- toggleContentProvider.setSelection(true);
- toggleContentProvider.setEnabled(false);
- createCheckToolBarItem(toolbar, SHOWN_TOOLS_ICON, Messages.Local_Palette_ShowTools_Tooltip, createsShowToolListener());
- }
-
- /**
- * Creates the listener for the available tools content provider
- *
- * @return the listener created
- */
- protected Listener createSwitchToolsContentProviderListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- if (!(event.widget instanceof ToolItem)) {
- return;
- }
- ToolItem item = ((ToolItem) event.widget);
- // retrieve current profile selected in the combo profile
- int index = profileCombo.getSelectionIndex();
- Collection<PaletteEntry> standardEntries = getAllVisibleStandardEntries();
- Profile profile = getAllAppliedProfiles().get(index);
-
- if (item.getSelection()) {
- availableToolsViewer.setContentProvider(new ProfileToolsStereotypeMetaclassTreeContentProvider(profile, standardEntries));
- item.setSelection(true);
- } else {
-
- availableToolsViewer.setContentProvider(new ProfileToolsMetaclassStereotypeTreeContentProvider(profile, standardEntries));
- item.setSelection(false);
- }
-
- // generate tools for given profile
- availableToolsViewer.setInput(profile);
- }
- };
- }
-
- /**
- * creates the tool item for drawers visibility listener
- *
- * @return the listener for the tool button
- */
- protected Listener createShowDrawerListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- if (!(event.widget instanceof ToolItem)) {
- return;
- }
- ToolItem item = ((ToolItem) event.widget);
- if (item.getSelection()) {
- // elements should be hidden
- availableToolsViewer.addFilter(drawerFilter);
- item.setSelection(true);
- } else {
- availableToolsViewer.removeFilter(drawerFilter);
- item.setSelection(false);
- }
- }
- };
- }
-
- /**
- * creates the tool item for tools visibility listener
- *
- * @return the listener for the tool button
- */
- protected Listener createsShowToolListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- if (!(event.widget instanceof ToolItem)) {
- return;
- }
- ToolItem item = ((ToolItem) event.widget);
- if (item.getSelection()) {
- // elements should be hidden
- availableToolsViewer.addFilter(toolFilter);
- item.setSelection(true);
- } else {
- availableToolsViewer.removeFilter(toolFilter);
- item.setSelection(false);
- }
- }
- };
- }
-
- /**
- * Creates a toolbar item which can be checked.
- *
- * @param toolbar
- * the parent toolbar
- * @param shownElementsIcon
- * path for shown elements icon
- * @param listener
- * listener for button action
- * @param tooltip
- * tooltip text for the toolbar item
- */
- protected ToolItem createCheckToolBarItem(ToolBar toolbar, String shownElementsIcon, String tooltip, Listener listener) {
- ToolItem item = new ToolItem(toolbar, SWT.CHECK | SWT.BORDER);
- item.setImage(Activator.getPluginIconImage(Activator.ID, shownElementsIcon));
- item.setToolTipText(tooltip);
- item.addListener(SWT.Selection, listener);
- return item;
- }
-
- /**
- * Validates the content of the fields in this page
- */
- protected boolean validatePage() {
- boolean valid = true;
-
- if (valid) {
- setMessage(null);
- setErrorMessage(null);
- }
- return valid;
- }
-
- /**
- * The <code>WizardNewFileCreationPage</code> implementation of this <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
- @Override
- public void handleEvent(Event event) {
- setPageComplete(validatePage());
- }
-
- /**
- * Content provider for available tools viewer
- */
- public class UMLToolsTreeContentProvider implements ITreeContentProvider {
-
- /**
- * Constructor
- *
- * @param viewer
- * The viewer whose ContentProvider this content provider is
- */
- public UMLToolsTreeContentProvider() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(Object inputElement) {
- Object[] elements = null;
-
- if (inputElement instanceof Collection<?>) {
- elements = ((Collection<?>) inputElement).toArray();
- } else if (inputElement instanceof PaletteRoot) {
- // paletteUil.getAllEntries(...) to add drawers
- // if so, uncomment the addFilterbutton for drawers in populate tool bar
- elements = PaletteUtil.getAllToolEntries(((PaletteRoot) inputElement)).toArray();
- }
-
- if (elements == null) {
- elements = new Object[0];
- }
- return elements;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- Object[] elements = null;
-
- if (parentElement instanceof Collection<?>) {
- elements = ((Collection<?>) parentElement).toArray();
- } else if (parentElement instanceof PaletteRoot) {
- // paletteUil.getAllEntries(...) to add drawers
- // if so, uncomment the addFilterbutton for drawers in populate tool bar
- elements = PaletteUtil.getAllToolEntries(((PaletteRoot) parentElement)).toArray();
- }
-
- return elements;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(Object element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- return getChildren(element) != null && getChildren(element).length > 0;
- }
- }
-
- /**
- * Label provider for palette tools.
- * <P>
- * We should be using the Palette label provider from GEF, if it was not with visibility "package"...
- *
- * @see org.eclipse.gef.ui.palette.customize.PaletteLabelProvider
- * </P>
- *
- */
- public class PaletteLabelProvider implements ILabelProvider {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof PaletteEntry) {
- ImageDescriptor descriptor = ((PaletteEntry) element).getSmallIcon();
- if (descriptor == null) {
- return null;
- }
- return Activator.getPluginIconImage(Activator.ID, descriptor);
- } else if (element instanceof Stereotype) {
- return Activator.getPluginIconImage(Activator.ID, "/icons/stereotype.gif");
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getText(Object element) {
- if (element instanceof PaletteEntry) {
- return ((PaletteEntry) element).getLabel();
- } else if (element instanceof Stereotype) {
- return ((Stereotype) element).getName();
- }
- return "unknown element";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeListener(ILabelProviderListener listener) {
-
- }
-
- }
-
- /**
- * Label provider for palette tools.
- * <P>
- * We should be using the Palette label provider from GEF, if it was not with visibility "package"...
- *
- * @see org.eclipse.gef.ui.palette.customize.PaletteLabelProvider
- * </P>
- *
- */
- public class ExtendedPaletteLabelProvider extends CustomizedLabelProvider {
-
- /**
- * Constructor.
- */
- public ExtendedPaletteLabelProvider() {
- super(manager);
- }
- }
-
- /**
- * Filter for the viewer. Hide/show Drawers
- */
- public class DrawerFilter extends ViewerFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof PaletteDrawer) {
- return false;
- }
- return true;
- }
-
- }
-
- /**
- * Filter for the viewer. Hide/show Drawers
- */
- public class ToolFilter extends ViewerFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof ToolEntry) {
- return false;
- }
- return true;
- }
-
- }
-
- /**
- * Content Provider for the palette preview
- */
- public class ExtendedPaletteContentProvider extends CustomizedTreeContentProvider {
-
- private CustomizationCatalogManager catalogManager;
- private ResourceSet catalogManagerResourceSet;
-
- /**
- * Constructor.
- */
- public ExtendedPaletteContentProvider() {
- super(manager);
- // TODO: EMFFACET refactor this code
- catalogManagerResourceSet = new ResourceSetImpl();
- catalogManager = (CustomizationCatalogManager) ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(catalogManagerResourceSet);
- List<Customization> paletteCustomizations = catalogManager.getCustomizationsByName("PaletteConfiguration");
- if (paletteCustomizations.size() > 0) {
- // manager.setShowTypeOfLinks(false);
- // manager.registerCustomization(paletteCustomization);
- // manager.loadCustomizations();
- }
- }
-
- @Override
- public void dispose() {
- super.dispose();
-
- if (catalogManagerResourceSet != null) {
- EMFHelper.unload(catalogManagerResourceSet);
- catalogManagerResourceSet = null;
- }
-
- catalogManager = null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getRootElements(Object inputElement) {
- if (inputElement instanceof PaletteConfiguration) {
- return ((PaletteConfiguration) inputElement).getDrawerConfigurations().toArray();
- } else if (inputElement instanceof Resource) {
- List<EObject> roots = ((Resource) inputElement).getContents();
- if (roots != null && !roots.isEmpty()) {
- EObject rootObject = roots.get(0);
- if (rootObject instanceof PaletteConfiguration) {
- return ((PaletteConfiguration) rootObject).getDrawerConfigurations().toArray();
- }
- }
- }
- return new Object[0];
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- Object[] children = getChildren(element);
- if (children == null) {
- return false;
- }
- if (children.length == 0) {
- return false;
- }
- return true;
- }
- }
-
-
- /**
- * Performs all action on finish
- *
- * @param id
- * the path for the file
- */
- public void performFinish(String path) {
- if (resourceToEdit != null) {
- try {
- resourceToEdit.save(Collections.emptyMap());
- } catch (IOException e) {
- Activator.log.error(e);
- }
- }
-
- // // creates the document
- // Document document = createXMLDocumentFromPalettePreview();
- // saveDocument(document, path);
- // requiredProfiles = collectRequiredProfiles();
- }
-
- // /**
- // * collect the required profiles from all tool provided by the local palette definition
- // */
- // protected Set<String> collectRequiredProfiles() {
- // Set<String> profiles = new HashSet<String>();
- // PaletteContainerProxy rootProxy = (PaletteContainerProxy)paletteTreeViewer.getInput();
- // collectRequiredProfiles(rootProxy.getChildren(), profiles);
- // return profiles;
- // }
- //
- // /**
- // * collect the required profiles from all tool provided by the local palette definition
- // */
- // protected void collectRequiredProfiles(List<PaletteEntryProxy> proxies, Set<String> requiredProfiles) {
- // for(PaletteEntryProxy proxy : proxies) {
- // // add profile(s) if relevant, check for children
- //
- // if(proxy instanceof PaletteAspectToolEntryProxy) {
- // // list of profiles
- // for(String stereotypeQN : ((PaletteAspectToolEntryProxy)proxy).getStereotypesQNList()) {
- // // retrieve list of profiles from the stereotype QN (only remove last segment
- // // ?!)
- // String profileName = PaletteUtil.findProfileNameFromStereotypeName(stereotypeQN);
- // requiredProfiles.add(profileName);
- // }
- // }
- //
- // if(proxy.getChildren() != null) {
- // collectRequiredProfiles(proxy.getChildren(), requiredProfiles);
- // }
- // }
- // }
- //
- // /**
- // * Saves the xml document into file
- // *
- // * @param document
- // * the document to save
- // * @param path
- // * name of the file
- // * @return the file created or updated
- // */
- // protected File saveDocument(Document document, String path) {
- // File file = null;
- // try {
- // // create the file that stores the XML configuration
- // file = Activator.getDefault().getStateLocation().append(path).toFile();
- // TransformerFactory tranFactory = TransformerFactory.newInstance();
- // Transformer aTransformer;
- //
- // aTransformer = tranFactory.newTransformer();
- //
- // Source src = new DOMSource(document);
- // Result dest = new StreamResult(file);
- // aTransformer.transform(src, dest);
- // } catch (TransformerConfigurationException e) {
- // Activator.log.error(e);
- // } catch (TransformerException e) {
- // Activator.log.error(e);
- // }
- // return file;
- //
- // }
- //
- // /**
- // * Creates the document from the palette preview
- // *
- // * @return the dom structure of the document
- // */
- // protected Document createXMLDocumentFromPalettePreview() {
- // DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- // documentBuilderFactory.setNamespaceAware(true);
- // DocumentBuilder documentBuilder;
- // try {
- // documentBuilder = documentBuilderFactory.newDocumentBuilder();
- // document = documentBuilder.newDocument();
- // Element paletteDefElement = document.createElement(IPapyrusPaletteConstant.PALETTE_DEFINITION);
- // document.appendChild(paletteDefElement);
- // Element contentElement = document.createElement(IPapyrusPaletteConstant.CONTENT);
- // paletteDefElement.appendChild(contentElement);
- //
- // generateXMLPaletteContent(document, contentElement);
- // return document;
- // } catch (ParserConfigurationException e) {
- // Activator.getDefault().logError("impossible to create the palette tree viewer content", e);
- // }
- // return null;
- // }
- //
- // /**
- // * Generates the xml content for the palette
- // *
- // * @param document
- // * the document to fill
- // * @param contentElement
- // * the root for the xml content
- // */
- // protected void generateXMLPaletteContent(Document document, Element contentElement) {
- // PaletteContainerProxy rootProxy = (PaletteContainerProxy)paletteTreeViewer.getInput();
- // for(PaletteEntryProxy proxy : rootProxy.getChildren()) {
- // generateXMLPaletteContainerProxy(document, contentElement, proxy);
- // }
- // }
- //
- // /**
- // * Generates the xml content for the given container
- // *
- // * @param document
- // * the document to fill
- // * @param containerProxy
- // * the entry proxy
- // */
- // protected void generateXMLPaletteContainerProxy(Document document, Element contentElement, PaletteEntryProxy containerProxy) {
- //
- // Element element = null;
- // List<PaletteEntryProxy> children = containerProxy.getChildren();
- // // generate the element
- // switch(containerProxy.getType()) {
- // case DRAWER:
- // element = document.createElement(IPapyrusPaletteConstant.DRAWER);
- // element.setAttribute(IPapyrusPaletteConstant.NAME, containerProxy.getLabel());
- // if(containerProxy instanceof PaletteLocalDrawerProxy) {
- // element.setAttribute(IPapyrusPaletteConstant.ICON_PATH, ((PaletteLocalDrawerProxy)containerProxy).getImagePath());
- // }
- // break;
- // case TOOL:
- // element = document.createElement(IPapyrusPaletteConstant.TOOL);
- // break;
- // case SEPARATOR:
- // element = document.createElement(IPapyrusPaletteConstant.SEPARATOR);
- // break;
- // case STACK:
- // element = document.createElement(IPapyrusPaletteConstant.STACK);
- // break;
- // case ASPECT_TOOL:
- // element = document.createElement(IPapyrusPaletteConstant.ASPECT_TOOL);
- // // try to cast the element into PaletteAspectToolEntryProxy
- // if(containerProxy instanceof PaletteAspectToolEntryProxy) {
- // PaletteAspectToolEntryProxy aspectEntryProxy = (PaletteAspectToolEntryProxy)containerProxy;
- // // element.setAttribute(IPapyrusPaletteConstant.ID, aspectEntryProxy.getId());
- // element.setAttribute(IPapyrusPaletteConstant.NAME, aspectEntryProxy.getLabel());
- // element.setAttribute(IPapyrusPaletteConstant.DESCRIPTION, aspectEntryProxy.getEntry().getDescription());
- // element.setAttribute(IPapyrusPaletteConstant.REF_TOOL_ID, aspectEntryProxy.getReferencedPaletteID());
- //
- // if(aspectEntryProxy.getImagePath() != null && !aspectEntryProxy.getImagePath().equals("")) {
- // element.setAttribute(IPapyrusPaletteConstant.ICON_PATH, aspectEntryProxy.getImagePath());
- // }
- //
- //
- // // add post action, stereotype list
- // for(IAspectAction action : ((PaletteAspectToolEntryProxy)containerProxy).getPostActions()) {
- // Element postActionNode = document.createElement(IPapyrusPaletteConstant.POST_ACTION);
- // postActionNode.setAttribute(IPapyrusPaletteConstant.ID, action.getFactoryId());
- // action.save(postActionNode);
- // element.appendChild(postActionNode);
- // }
- // }
- // default:
- // break;
- // }
- //
- // element.setAttribute(IPapyrusPaletteConstant.ID, containerProxy.getId());
- // contentElement.appendChild(element);
- //
- // if(children != null) {
- // for(PaletteEntryProxy proxy : children) {
- // generateXMLPaletteContainerProxy(document, element, proxy);
- // }
- // }
- // }
-
- // public enum EntryType {
- // DRAWER, TOOL, STACK, SEPARATOR, ASPECT_TOOL
- // }
-
-
- /**
- * Comparator for the label viewers
- */
- public class LabelViewerComparator extends ViewerComparator {
-
- /**
- * Creates a new LabelViewerComparator.
- */
- public LabelViewerComparator() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int compare(Viewer testViewer, Object e1, Object e2) {
- String label1 = "";
- String label2 = "";
-
- if (e1 instanceof PaletteEntry) {
- label1 = ((PaletteEntry) e1).getLabel();
- } else if (e1 instanceof Stereotype) {
- label1 = ((Stereotype) e1).getName();
- }
- if (e2 instanceof PaletteEntry) {
- label2 = ((PaletteEntry) e2).getLabel();
- } else if (e2 instanceof Stereotype) {
- label2 = ((Stereotype) e2).getName();
- }
-
- if (label1 == null) {
- return 1;
- }
- if (label2 == null) {
- return -1;
- }
-
- return label1.compareTo(label2);
- }
- }
-
- /**
- * Listener for the profile combo. It changes the input of the following viewer.
- */
- public class ProfileComboSelectionListener implements SelectionListener, ModifyListener {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // nothing to do
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSelectionChanged();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void modifyText(ModifyEvent e) {
- handleSelectionChanged();
- }
-
- /**
- * handles the change selection for the combo
- */
- protected void handleSelectionChanged() {
- int index = profileCombo.getSelectionIndex();
- if (index < 0 || index >= profileCombo.getItems().length) {
- return;
- }
- String name = profileComboList.get(index);
-
- Collection<PaletteEntry> standardEntries = getAllVisibleStandardEntries();
- // retrieve the profile or uml standards tools to display
- if (UML_TOOLS_LABEL.equals(name)) {
- // change content provider
- availableToolsViewer.setContentProvider(new UMLToolsTreeContentProvider());
- availableToolsViewer.setInput(standardEntries);
- toggleContentProvider.setEnabled(false);
- } else {
- if (toggleContentProvider != null && !toggleContentProvider.isDisposed()) {
- toggleContentProvider.setEnabled(true);
- }
- // switch content provider
- // this is a profile in case of uml2 tools
- Profile profile = getAllAppliedProfiles().get(index);
- if (toggleContentProvider.getSelection()) {
- availableToolsViewer.setContentProvider(new ProfileToolsStereotypeMetaclassTreeContentProvider(profile, standardEntries));
- } else {
- availableToolsViewer.setContentProvider(new ProfileToolsMetaclassStereotypeTreeContentProvider(profile, standardEntries));
- }
-
- // generate tools for given profile
- availableToolsViewer.setInput(profile);
- }
- }
- }
-
- /**
- * Content provider for the available tools viewer, when the tools to see are coming from a
- * profile
- */
- public class ProfileToolsStereotypeMetaclassTreeContentProvider implements ITreeContentProvider {
-
- /** standard uml tools palette entries */
- final protected Collection<PaletteEntry> standardEntries;
-
- /**
- * Creates a new ProfileToolsStereotypeMetaclassTreeContentProvider.
- *
- * @param profile
- * the profile for which tools are built
- * @param standardEntries
- * list of standard uml tools palette entries
- */
- public ProfileToolsStereotypeMetaclassTreeContentProvider(Profile profile, Collection<PaletteEntry> standardEntries) {
- this.standardEntries = standardEntries;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Profile) {
- return ((Profile) parentElement).getOwnedStereotypes().toArray();
- } else if (parentElement instanceof Stereotype) {
- List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
- Stereotype stereotype = (Stereotype) parentElement;
-
- for (PaletteEntry entry : standardEntries) {
- // retrieve the element type created by the tool.
- if (entry instanceof CombinedTemplateCreationEntry) {
-
- EClass toolMetaclass = PaletteUtil.getToolMetaclass((CombinedTemplateCreationEntry) entry);
- if (toolMetaclass != null) {
- List<Class> metaclasses = stereotype.getAllExtendedMetaclasses();
- for (Class stMetaclass : metaclasses) {
- // get Eclass
- java.lang.Class<?> metaclassClass = stMetaclass.getClass();
- if (metaclassClass != null) {
- EClassifier metaClassifier = UMLPackage.eINSTANCE.getEClassifier(stMetaclass.getName());
- if (((EClass) metaClassifier).isSuperTypeOf(toolMetaclass)) {
- // should create the palette entry
- Map<Object, Object> properties = new HashMap<Object, Object>();
- properties.put(IPapyrusPaletteConstant.ASPECT_ACTION_KEY, StereotypeAspectActionProvider.createConfigurationNode(stereotype.getQualifiedName()));
- AspectCreationEntry aspectEntry = new AspectCreationEntry(stereotype.getName() + " (" + entry.getLabel() + ")", "Create an element with a stereotype", entry.getId() + "_" + System.currentTimeMillis(),
- entry.getSmallIcon(), (CombinedTemplateCreationEntry) entry, properties);
- entries.add(aspectEntry);
- }
- }
-
- }
- }
- }
- }
- return entries.toArray();
- } else {
- return new Object[0];
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(Object element) {
- if (element instanceof Stereotype) {
- return ((Stereotype) element).getProfile();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- if (element instanceof Profile) {
- return true;
- } else if (element instanceof Stereotype) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof Profile) {
- List<Stereotype> stereotypes = ((Profile) inputElement).getOwnedStereotypes();
- return stereotypes.toArray();
- }
- return new Object[0];
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // nothing to do here
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // nothing to do here
- }
-
- }
-
- /**
- * Content provider for the available tools viewer, when the
- */
- public class ProfileToolsMetaclassStereotypeTreeContentProvider implements ITreeContentProvider {
-
- /** standard uml tools palette entries */
- final protected Collection<PaletteEntry> standardEntries;
-
- /** profile to display */
- final protected Profile profile;
-
- /**
- * Creates a new ProfileToolsMetaclassStereotypeTreeContentProvider.
- *
- * @param profile
- * the profile for which tools are built
- * @param standardEntries
- * list of standard uml tools palette entries
- */
- public ProfileToolsMetaclassStereotypeTreeContentProvider(Profile profile, Collection<PaletteEntry> standardEntries) {
- this.profile = profile;
- this.standardEntries = standardEntries;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Profile) {
- return standardEntries.toArray();
- } else if (parentElement instanceof AspectCreationEntry) {
- return new Object[0];
- } else if (parentElement instanceof PaletteEntry) {
- List<AspectCreationEntry> entries = new ArrayList<AspectCreationEntry>();
- // display all stereotypes applicable to the type of element created by this tool
- if (parentElement instanceof CombinedTemplateCreationEntry) {
- CombinedTemplateCreationEntry entry = (CombinedTemplateCreationEntry) parentElement;
- EClass toolMetaclass = PaletteUtil.getToolMetaclass(entry);
- if (toolMetaclass != null) {
- for (Stereotype stereotype : profile.getOwnedStereotypes()) {
- List<Class> metaclasses = stereotype.getAllExtendedMetaclasses();
- for (Class stMetaclass : metaclasses) {
- // get Eclass
- EClassifier metaClassifier = UMLPackage.eINSTANCE.getEClassifier(stMetaclass.getName());
- if (((EClass) metaClassifier).isSuperTypeOf(toolMetaclass)) {
- // should create the palette entry
- Map<Object, Object> properties = new HashMap<Object, Object>();
- // ArrayList<String> stereotypesQNToApply = new ArrayList<String>();
- properties.put(IPapyrusPaletteConstant.ASPECT_ACTION_KEY, StereotypeAspectActionProvider.createConfigurationNode(stereotype.getQualifiedName()));
- AspectCreationEntry aspectEntry = new AspectCreationEntry(stereotype.getName() + " (" + entry.getLabel() + ")", "Create an element with a stereotype", entry.getId() + "_" + System.currentTimeMillis(), entry.getSmallIcon(),
- entry, properties);
- entries.add(aspectEntry);
- }
- }
- }
- }
- }
- return entries.toArray();
- } else {
- return new Object[0];
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(Object element) {
- if (element instanceof Stereotype) {
- return ((Stereotype) element).getProfile();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- if (element instanceof Profile) {
- return true;
- } else if (element instanceof AspectCreationEntry) {
- return false;
- } else if (element instanceof PaletteEntry) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof Profile) {
- return standardEntries.toArray();
- }
- return new Object[0];
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // nothing to do here
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // nothing to do here
- }
-
- }
-
- /**
- * Returns the list of all visible palette entries
- *
- * @return the list of all visible palette entries
- */
- protected Collection<PaletteEntry> getAllVisibleStandardEntries() {
- HashSet<PaletteEntry> result = new HashSet<PaletteEntry>();
- for (PaletteEntry entry : PaletteUtil.getAvailableEntriesSet(editorPart, priority).values()) {
- // the entry is not just a defineOnly entry but a visible one
- if (getRootParent(entry) != null) {
- result.add(entry);
- }
- }
- return result;
- }
-
- /**
- * Returns the Root element for the palette entry. It searches recursively from parent to parent, until it find the root element
- *
- * @param entry
- * the palette entry for which root element is searched
- * @return the root element or <code>null</code> if none was found
- */
- protected PaletteRoot getRootParent(PaletteEntry entry) {
- PaletteContainer parent = entry.getParent();
- if (parent instanceof PaletteRoot) {
- return (PaletteRoot) parent;
- } else if (parent != null) {
- return getRootParent(parent);
- } else {
- return null;
- }
- }
-
- /**
- * Item validator
- */
- protected abstract class ToolBarItemValidator {
-
- /**
- * Checks if the button should be enable or not
- *
- * @return <code>true</code> if the button should be enable
- */
- public abstract boolean isEnable();
- }
-
- /**
- * validator for the create separator or stack tool item. Only valid when selection is a {@link Configuration}
- */
- protected class ConfigurationSelectedValidator extends ToolBarItemValidator {
-
- /**
- * @{inheritDoc
- */
- @Override
- public boolean isEnable() {
- return getSelectedConfiguration() != null;
- }
- }
-
- /**
- * validator for the create stack tool item. Only valid when selection is a {@link DrawerConfiguration}
- */
- protected class DrawerConfigurationSelectedValidator extends ToolBarItemValidator {
-
- /**
- * @{inheritDoc
- */
- @Override
- public boolean isEnable() {
- return getSelectedConfiguration() instanceof DrawerConfiguration;
- }
-
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExtendedPaletteInformationPage.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExtendedPaletteInformationPage.java
deleted file mode 100644
index 97161d322fc..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/ExtendedPaletteInformationPage.java
+++ /dev/null
@@ -1,462 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.swt.SWT;
-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.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Wizard page for information about the new local palette definition
- */
-public class ExtendedPaletteInformationPage extends WizardPage implements Listener {
-
- /** array list of priorities */
- private static String[] priorityList;
-
- /** text area for the name of the palette definition */
- protected Text nameText;
-
- /** text area for the id of the palette definition */
- protected Text idText;
-
- /** text area for the editor id of the palette definition */
- protected Text editorText;
-
- /** text for the priority of the provider */
- private Text priorityText;
-
- /** parent composite for advanced fields */
- protected Composite advancedComposite;
-
- /** Button to show/hide advanced fields */
- protected Button advancedButton;
-
- /** editor part in which the palette is created */
- protected IEditorPart editorPart;
-
- /** priority value */
- protected ProviderPriority priority;
-
- /** editor ID value */
- protected String editorID;
-
- /** palette ID */
- protected String paletteID;
-
- /** palette name */
- protected String name;
-
- /** path to the icon */
- protected static final String WIZARD_ICON = "/icons/local_desc_wiz.png";
-
- /** validate on opening */
- protected boolean validateOnLaunch = false;
-
- static {
- priorityList = new String[] { ProviderPriority.LOWEST.getName(), ProviderPriority.LOW.getName(), ProviderPriority.MEDIUM.getName(), ProviderPriority.HIGH.getName(), ProviderPriority.HIGHEST.getName() };
- }
-
- /**
- * Creates a new wizard page with the given name, title, and image.
- *
- * @param part
- * the editor part in which the wizard was created
- */
- public ExtendedPaletteInformationPage(IEditorPart part) {
- super(Messages.Local_Palette_InfoPage_Name, Messages.Local_Palette_InfoPage_Title, Activator.getImageDescriptor(WIZARD_ICON));
- this.editorPart = part;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IWizardPage getNextPage() {
- ExtendedPaletteContentPage contentPage = (ExtendedPaletteContentPage) super.getNextPage();
- if (priority != null) {
- contentPage.setPriority(priority);
- contentPage.profileCombo.deselectAll();
- contentPage.profileCombo.select(contentPage.profileCombo.getItems().length - 1); // select the last one (UML)
- }
- return contentPage;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createControl(Composite parent) {
-
- // initialize dialog units
- initializeDialogUnits(parent);
-
- // Create a new composite as there is the title bar seperator
- // to deal with
- Composite control = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- control.setLayout(layout);
- control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setControl(control);
-
- createNameControl(control);
-
- createAdvancedControls(control);
-
- // end of the control creation
- Dialog.applyDialogFont(control);
-
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- if (validateOnLaunch) {
- setPageComplete(validatePage());
- }
- setControl(control);
- }
-
- /**
- * initializes fields using context information
- */
- public void intializeValues() {
- initName("");
- String editorIDValue = "";
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- editorIDValue = ((DiagramEditorWithFlyOutPalette) editorPart).getContributorId();
- }
- initEditorID(editorIDValue);
- initPaletteID(System.getProperty("user.name") + "_" + System.currentTimeMillis());
- initPriority(ProviderPriority.LOWEST);
- }
-
- /**
- * initializes fields using existing descriptor
- */
- public void intializeValues(PapyrusPaletteService.ExtendedProviderDescriptor descriptor) {
- initName(descriptor.getContributionName());
- String editorIDValue = "";
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- editorIDValue = ((DiagramEditorWithFlyOutPalette) editorPart).getContributorId();
- }
- initEditorID(editorIDValue);
- initPaletteID(descriptor.getContributionID());
- initPriority(descriptor.getPriority());
- validateOnLaunch = true;
- }
-
- /**
- * Returns the current value of palette name
- *
- * @return the current value of palette name
- */
- public String getPaletteName() {
- return name;
- }
-
- /**
- * Returns the current value of palette ID
- *
- * @return the current value of palette ID
- */
- public String getPaletteID() {
- return paletteID;
- }
-
- /**
- * Returns the current value of editor ID
- *
- * @return the current value of editor ID
- */
- public String getEditorID() {
- return editorID;
- }
-
- /**
- * Returns the current value of editor ID
- *
- * @return the current value of editor ID
- */
- public ProviderPriority getPalettePriority() {
- return priority;
- }
-
- /**
- * inits the name field value
- *
- * @param value
- * value to set
- */
- protected void initName(String value) {
- name = value;
- }
-
- /**
- * inits the priority value
- *
- * @param value
- * value to set
- */
- protected void initPriority(ProviderPriority value) {
- this.priority = value; // by default, Medium
- }
-
- /**
- * inits the palette id value
- *
- * @param value
- * value to set
- */
- protected void initPaletteID(String value) {
- paletteID = value;
-
- }
-
- /**
- * inits the editor id value
- *
- * @param value
- * value to set
- */
- protected void initEditorID(String value) {
- editorID = value;
- }
-
- /**
- * Validates the content of the fields in this page
- */
- protected boolean validatePage() {
- boolean valid = true;
- if (advancedComposite != null && !advancedComposite.isDisposed()) {
- if ("".equals(getPaletteID())) {
- setErrorMessage(Messages.Local_Palette_Error_PaletteId);
- valid = false;
- }
- }
-
- if ("".equals(getPaletteName())) {
- setErrorMessage(Messages.Local_Palette_Error_Name);
- valid = false;
- }
-
- if (valid) {
- setMessage(null);
- setErrorMessage(null);
- }
- return valid;
- }
-
- /**
- * Creates the widget for advanced options.
- *
- * @param parent
- * the parent composite
- */
- protected void createAdvancedControls(Composite parent) {
- advancedButton = new Button(parent, SWT.PUSH);
- advancedButton.setFont(parent.getFont());
- advancedButton.setText(Messages.Dialog_Advanced_Button_Closed);
- GridData data = setButtonLayoutData(advancedButton);
- data.horizontalAlignment = GridData.BEGINNING;
- data.horizontalSpan = 2;
- advancedButton.setLayoutData(data);
- advancedButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleAdvancedButtonSelect();
- }
- });
- }
-
- public Composite createAdvancedComposite(Composite parent) {
- advancedComposite = new Composite(parent, SWT.NONE);
- advancedComposite.setFont(parent.getFont());
- advancedComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- advancedComposite.setLayout(layout);
-
- createIDControl(advancedComposite);
-
- createEditorIDControl(advancedComposite);
-
- createPriorityControl(advancedComposite);
-
- advancedComposite.getParent().layout();
- return advancedComposite;
- }
-
- /**
- * Shows/hides the advanced option widgets.
- */
- protected void handleAdvancedButtonSelect() {
- Composite composite = (Composite) getControl();
-
- if (advancedComposite != null) {
- advancedComposite.dispose();
- advancedComposite = null;
- advancedButton.setText(Messages.Dialog_Advanced_Button_Closed);
- } else {
- createAdvancedComposite(composite);
- advancedButton.setText(Messages.Dialog_Advanced_Button_Opened);
- }
- }
-
- /**
- * creates the control area for the priority
- *
- * @param control
- * the parent composite
- */
- protected void createPriorityControl(Composite control) {
- final Label priorityLabel = new Label(control, SWT.NONE);
- priorityLabel.setText(Messages.Local_Palette_Priority);
- priorityLabel.setToolTipText(Messages.Local_Palette_Priority_Tooltip);
-
- // choice widget among priority values
- priorityText = new Text(control, SWT.READ_ONLY | SWT.BORDER);
- priorityText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- // initialize
- initialPopulatePriorityField();
-
- }
-
- /**
- * intialize the field using current value of the palette id
- */
- protected void initialPopulatePriorityField() {
- priorityText.setText(this.getPalettePriority().toString());
- }
-
- /**
- * creates the control area for the id definition
- *
- * @param control
- * the parent composite
- */
- protected void createIDControl(Composite control) {
- final Label idLabel = new Label(control, SWT.NONE);
- idLabel.setText(Messages.Local_Palette_Id);
- idLabel.setToolTipText(Messages.Local_Palette_Id_Tooltip);
-
- idText = new Text(control, SWT.BORDER);
- idText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- idText.setToolTipText(Messages.Local_Palette_Id_Tooltip);
-
- // initialize, then add the listener...
- initialPopulatePaletteIDField();
-
- idText.addListener(SWT.Modify, this);
- }
-
- /**
- * intialize the field using current value of the palette id
- */
- protected void initialPopulatePaletteIDField() {
- idText.setText(paletteID);
- }
-
- /**
- * creates the control area for the name definition
- *
- * @param control
- * the parent composite
- */
- protected void createNameControl(Composite control) {
- final Label nameLabel = new Label(control, SWT.NONE);
- nameLabel.setText(Messages.Local_Palette_Name);
- nameLabel.setToolTipText(Messages.Local_Palette_Name_Tooltip);
-
- nameText = new Text(control, SWT.BORDER);
- nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- nameText.setToolTipText(Messages.Local_Palette_Name_Tooltip);
-
- // initialize, then add the listener...
- initialPopulateNameField();
-
- nameText.addListener(SWT.Modify, this);
-
- }
-
- /**
- * creates the control area for the name definition
- *
- * @param control
- * the parent composite
- */
- protected void createEditorIDControl(Composite control) {
- final Label editorLabel = new Label(control, SWT.NONE);
- editorLabel.setText(Messages.Local_Palette_Editor_Id);
- editorLabel.setToolTipText(Messages.Local_Palette_Editor_Id_Tooltip);
-
- editorText = new Text(control, SWT.BORDER | SWT.READ_ONLY);
- editorText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- editorText.setToolTipText(Messages.Local_Palette_Editor_Id_Tooltip);
-
- // initialize, then add the listener...
- initialPopulateEditorIDField();
-
- }
-
- /**
- * intialize the field using current value of the editor id
- */
- protected void initialPopulateEditorIDField() {
- editorText.setText(editorID);
- }
-
- /**
- * initialize name field
- */
- protected void initialPopulateNameField() {
- nameText.setText(name);
- }
-
- /**
- * The <code>WizardNewFileCreationPage</code> implementation of this <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
- @Override
- public void handleEvent(Event event) {
- Widget widget = event.widget;
- if (widget.equals(nameText)) {
- name = nameText.getText();
- } else if (widget.equals(idText)) {
- paletteID = idText.getText();
- } else if (widget.equals(editorText)) {
- editorID = editorText.getText();
- }
- setPageComplete(validatePage());
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/LocalPaletteContentPage.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/LocalPaletteContentPage.java
deleted file mode 100644
index 0a54c6f1bc7..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/LocalPaletteContentPage.java
+++ /dev/null
@@ -1,2548 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009, 2014 CEA LIST, Christian W. Damus, and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 454578
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.gef.palette.PaletteDrawer;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.palette.PaletteStack;
-import org.eclipse.gef.palette.PaletteToolbar;
-import org.eclipse.gef.palette.ToolEntry;
-import org.eclipse.gef.ui.palette.PaletteCustomizer;
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.customization.palette.proxies.XMLPaletteDefinitionProxyFactory;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectCreationEntry;
-import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.papyrus.uml.diagram.common.service.XMLPaletteDefinitionWalker;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectAction;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.StereotypeAspectActionProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.DropTargetListener;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TreeDropTargetEffect;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-/**
- * Wizard page for information about the new local palette definition
- */
-public class LocalPaletteContentPage extends WizardPage implements Listener {
-
- /** editor part in which the palette is created */
- protected IEditorPart editorPart;
-
- /** available tools viewer */
- protected TreeViewer availableToolsViewer;
-
- /** label provider for the tree viewer */
- protected PaletteLabelProvider paletteLabelProvider;
-
- /** icon path when tools are hidden */
- protected static final String HIDDEN_TOOLS_ICON = "/icons/tools_hidden.gif";
-
- /** icon path when tools are shown */
- protected static final String SHOWN_TOOLS_ICON = "/icons/tools_shown.gif";
-
- /** path to the icon */
- protected static final String WIZARD_ICON = "/icons/local_desc_wiz.png";
-
- /** icon path when drawers are hidden */
- protected static final String SHOWN_DRAWERS_ICON = "/icons/drawers_shown.gif";
-
- /** icon path when drawers are shown */
- protected static final String HIDDEN_DRAWERS_ICON = "/icons/drawers_hidden.gif";
-
- /** icon path for the add button */
- protected static final String ADD_ICON = "/icons/arrow_right.gif";
-
- /** icon path for the remove button */
- protected static final String REMOVE_ICON = "/icons/arrow_left.gif";
-
- /** icon path for the delete button */
- protected static final String DELETE_ICON = "/icons/delete.gif";
-
- /** icon path for the create drawer button */
- protected static final String CREATE_DRAWERS_ICON = "/icons/new_drawer.gif";
-
- /** icon path for the create separator button */
- protected String CREATE_SEPARATOR_ICON = "/icons/separator.gif";
-
- /** icon path for the create stack button */
- protected String CREATE_STACK_ICON = "/icons/stack.gif";
-
- /** icon path for the delete drawer button */
- protected static final String DELETE_DRAWERS_ICON = "/icons/delete.gif";
-
- /** icon for the content provider switch button */
- protected String SWITCH_CONTENT_PROVIDER_ICON = "/icons/switch_provider.gif";
-
- /** label for the standard tools */
- protected static final String UML_TOOLS_LABEL = "UML tools";
-
- /** icon path for the edit drawer button */
- protected static final String EDIT_ICON = "/icons/obj16/file.gif";
-
- /** instance of the filter used to show/hide drawers */
- protected final ViewerFilter drawerFilter = new DrawerFilter();
-
- /** instance of the filter used to show/hide tools */
- protected final ViewerFilter toolFilter = new ToolFilter();
-
- /** stored preferences */
- protected List<String> storedPreferences;
-
- /** add button */
- protected Button addButton;
-
- /** remove button */
- protected Button removeButton;
-
- /** tree viewer for the new palette */
- protected TreeViewer paletteTreeViewer;
-
- /** document for element creation */
- protected Document document;
-
- /** content node for the palette viewer */
- protected PaletteContainerProxy contentNode;
-
- /** combo to select which profile tools should be visible */
- protected Combo profileCombo;
-
- /** list of profiles that can provide tools */
- protected List<String> profileComboList = new ArrayList<String>();
-
- /** tool item in charge of toggling content providers in the available tool viewer */
- protected ToolItem toggleContentProvider;
-
- /** required profile by this palette */
- protected Set<String> requiredProfiles;
-
- /** palette customizer used for the palette */
- protected PaletteCustomizer customizer;
-
- /** current selected entry proxy */
- protected PaletteEntryProxy selectedEntryProxy;
-
- /** class in charge of the information composite */
- protected PaletteEntryProxyInformationComposite informationComposite = new PaletteEntryProxyInformationComposite();
-
- /** class in charge of the aspect tool information composite */
- protected AspectActionsInformationComposite aspectActionComposite = new AspectActionsInformationComposite();
-
- protected ToolBar toolbar;
-
- /** validator key for toolbar items */
- protected final static String VALIDATOR = "validator";
-
- /** priority of the current edited palette */
- protected ProviderPriority priority;
-
-
- /**
- * Creates a new wizard page with the given name, title, and image.
- *
- * @param part
- * the editor part in which the wizard was created
- */
- public LocalPaletteContentPage(IEditorPart part, PaletteCustomizer customizer) {
- super(Messages.Local_Palette_ContentPage_Name, Messages.Local_Palette_ContentPage_Title, Activator.getImageDescriptor(WIZARD_ICON));
- this.editorPart = part;
- this.customizer = customizer;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createControl(Composite parent) {
-
- // initialize dialog units
- initializeDialogUnits(parent);
-
- // Create a new composite as there is the title bar seperator
- // to deal with
- Composite control = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(4, false);
- control.setLayout(layout);
- control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setControl(control);
-
- // create Available Tools Group
- createAvailableToolsGroup();
-
- // create add/remove buttons
- createAddRemoveButtons();
-
- // create Palette Group
- createPalettePreviewGroup();
-
- // create tool description group (custom name, description, and perhaphs icon.... Just under this group, another one with aspect actions)
- createToolDescriptionGroup();
-
- // just under, creates a new line of composites...
- createAspectActionComposite();
-
-
-
- // add listeners inter-groups
- ISelectionChangedListener listener = createToolsViewerSelectionChangeListener();
- availableToolsViewer.addSelectionChangedListener(listener);
- paletteTreeViewer.addSelectionChangedListener(listener);
-
- // end of the control creation
- Dialog.applyDialogFont(control);
-
- validatePage();
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setControl(control);
- }
-
- /**
- * Creates the composite group that presents information about ascpect actions for aspect tools
- */
- protected void createAspectActionComposite() {
- aspectActionComposite.createComposite((Composite) getControl(), getAllAppliedProfiles());
- }
-
- /**
- * Creates the composite group that presents information about current selected tool
- */
- protected void createToolDescriptionGroup() {
- informationComposite.createComposite((Composite) getControl(), getAllAppliedProfiles());
- }
-
- /**
- * update the preferences to have all tools accessible
- */
- protected void updatePreferences() {
- // change => set to no hidden palettes
- storedPreferences = PapyrusPalettePreferences.getHiddenPalettes(editorPart);
-
- // remove all, but should only remove visible palettes
- for (String id : storedPreferences) {
- PapyrusPalettePreferences.changePaletteVisibility(id, editorPart, true);
- }
- }
-
- /**
- * Restore preferences
- */
- public void restorePreferences() {
- // remove all, but should only remove visible palettes
- for (String id : storedPreferences) {
- PapyrusPalettePreferences.changePaletteVisibility(id, editorPart, false);
- }
- }
-
- /**
- * creates the palette preview group
- */
- protected void createPalettePreviewGroup() {
- Composite parent = (Composite) getControl();
- Composite paletteComposite = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout(2, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- paletteComposite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- paletteComposite.setLayoutData(data);
-
- Label label = new Label(paletteComposite, SWT.NONE);
- label.setText(Messages.Local_Palette_Palette_Preview);
- data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- label.setLayoutData(data);
-
- toolbar = new ToolBar(paletteComposite, SWT.HORIZONTAL);
- data = new GridData(SWT.RIGHT, SWT.FILL, false, false);
- toolbar.setLayoutData(data);
- populatePalettePreviewToolBar(toolbar);
-
- Tree tree = new Tree(paletteComposite, SWT.SINGLE | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- data.widthHint = 185;
- // Make the tree this tall even when there is nothing in it. This will keep the
- // dialog from shrinking to an unusually small size.
- data.heightHint = 200;
- tree.setLayoutData(data);
- paletteTreeViewer = new TreeViewer(tree);
- paletteTreeViewer.setContentProvider(new PaletteContentProvider(paletteTreeViewer));
- paletteTreeViewer.setLabelProvider(new PaletteProxyLabelProvider());
- paletteTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handlePalettePreviewSelectionChanged(event);
- }
- });
-
- addPalettePreviewDropSupport();
- addPalettePreviewDragSupport();
- addPalettePreviewEditSupport();
-
- paletteTreeViewer.setInput(contentNode);
- }
-
- /**
- * handle the selection change event for the palette preview
- *
- * @param event
- * the event that is thrown by the palette viewer
- */
- protected void handlePalettePreviewSelectionChanged(SelectionChangedEvent event) {
- // retrieve current selection
- ITreeSelection selection = (TreeSelection) event.getSelection();
- Object firstSelected = selection.getFirstElement();
- if (firstSelected instanceof PaletteEntryProxy) {
- // update the current selected palette entry proxy
- selectedEntryProxy = ((PaletteEntryProxy) firstSelected);
- informationComposite.setSelectedEntryProxy(selectedEntryProxy);
- aspectActionComposite.setSelectedEntryProxy(selectedEntryProxy);
- }
-
- // update toolbar
- if (toolbar != null && !toolbar.isDisposed()) {
- for (int i = 0; i < toolbar.getItemCount(); i++) {
- ToolItem item = toolbar.getItem(i);
- Object validator = item.getData(VALIDATOR);
- if (validator instanceof ToolBarItemValidator) {
- item.setEnabled(((ToolBarItemValidator) validator).isEnable());
- }
- }
- }
-
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void dispose() {
- super.dispose();
- }
-
- /**
- * Adds the behavior for the double click strategy
- */
- protected void addPalettePreviewEditSupport() {
- paletteTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void doubleClick(DoubleClickEvent event) {
- // retrieve current item double clicked...
- ITreeSelection selection = (TreeSelection) event.getSelection();
- Object firstSelected = selection.getFirstElement();
- if (firstSelected instanceof PaletteLocalDrawerProxy) {
- UpdateLocalDrawerWizard wizard = new UpdateLocalDrawerWizard(((PaletteLocalDrawerProxy) firstSelected).getParent(), (PaletteLocalDrawerProxy) firstSelected);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.open();
- // paletteTreeViewer.refresh();
- }
- }
- });
-
- }
-
- /**
- * Add drop behavior for the palette preview
- */
- protected void addPalettePreviewDropSupport() {
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
-
- // drag listener
- DropTargetListener listener = new TreeDropTargetEffect(paletteTreeViewer.getTree()) {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void drop(DropTargetEvent event) {
- super.drop(event);
-
- // create proxy and adds it to its target parent
- PaletteEntryProxy target = (PaletteEntryProxy) ((TreeItem) event.item).getData();
- if (target == null) {
- target = (PaletteContainerProxy) paletteTreeViewer.getInput();
- }
-
- // get the elements from the drag listener (either a palette entry or a palette
- // entry proxy)
- IStructuredSelection transferedSelection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- Object entry = transferedSelection.getFirstElement();
-
- // creates the proxy for the element to be dropped
- PaletteEntryProxy entryProxy = createNodeFromEntry(entry);
-
- if (entryProxy == null) {
- return;
- }
- if (target instanceof PaletteContainerProxy) {
- // tries to remove from its parent if possible
- if (entryProxy.getParent() != null) {
- entryProxy.getParent().removeChild(entryProxy);
- }
- ((PaletteContainerProxy) target).addChild(entryProxy);
- paletteTreeViewer.expandToLevel(target, 1);
- } else if (target instanceof PaletteEntryProxy) {
- // tries to remove from its parent if possible
- if (entryProxy.getParent() != null) {
- entryProxy.getParent().removeChild(entryProxy);
- }
- target.getParent().addChild(entryProxy, target);
- paletteTreeViewer.expandToLevel(target.getParent(), 1);
- } else {
- // add to parent...
- target.getParent().addChild(entryProxy);
- paletteTreeViewer.expandToLevel(target.getParent(), AbstractTreeViewer.ALL_LEVELS);
- }
- setPageComplete(validatePage());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragOver(DropTargetEvent event) {
- super.dragOver(event);
-
- LocalSelectionTransfer localTransfer = LocalSelectionTransfer.getTransfer();
- IStructuredSelection transferedSelection = null;
- if (localTransfer.isSupportedType(event.currentDataType)) {
- transferedSelection = (IStructuredSelection) localTransfer.getSelection();
- }
-
- // check selection is compatible for drop target
-
- TreeItem item = paletteTreeViewer.getTree().getItem(paletteTreeViewer.getTree().toControl(new Point(event.x, event.y)));
-
- checkSelectionForDrop(transferedSelection, item, event);
- }
- };
-
- paletteTreeViewer.addDropSupport(DND.DROP_LINK | DND.DROP_MOVE, transfers, listener);
- }
-
- /**
- * Adds drag ability to the palette preview composite
- */
- protected void addPalettePreviewDragSupport() {
-
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
-
- // drag listener
- DragSourceListener listener = new LocalSelectionDragSource(paletteTreeViewer);
-
- paletteTreeViewer.addDragSupport(DND.DROP_MOVE, transfers, listener);
- }
-
- /**
- * Checks if the selection can be added to the target widget
- *
- * @param transferedSelection
- * the selection to be dropped
- * @param widget
- * the widget where to drop
- * @return <code>true</code> if element can be dropped
- */
- protected void checkSelectionForDrop(IStructuredSelection transferedSelection, TreeItem item, DropTargetEvent event) {
- event.detail = DND.DROP_NONE;
-
- if (transferedSelection == null) {
- return;
- }
-
- Object entry = transferedSelection.getFirstElement();
- // handle only first selected element
- if (item == null) {
- // adding to the root, should only be a drawer
- if (entry instanceof PaletteDrawer) {
- event.detail = DND.DROP_LINK;
- }
- } else {
- PaletteEntryProxy targetProxy = (PaletteEntryProxy) item.getData();
- switch (targetProxy.getType()) {
- case DRAWER:
- if (entry instanceof ToolEntry) {
- event.detail = DND.DROP_LINK;
- } else if (entry instanceof PaletteEntryProxy) {
- event.detail = DND.DROP_MOVE;
- }
- break;
- case STACK:
- if (entry instanceof ToolEntry) {
- event.detail = DND.DROP_LINK;
- } else if (entry instanceof PaletteEntryProxy && !(entry instanceof PaletteLocalStackProxy)) {
- event.detail = DND.DROP_MOVE;
- }
- break;
- case TOOL:
- if (entry instanceof ToolEntry) {
- event.detail = DND.DROP_LINK; // add the selected tool before the destination
- // tool
- } else if (entry instanceof PaletteEntryProxy) {
- event.detail = DND.DROP_MOVE; // moves the element before the entry
- }
- break;
- case SEPARATOR:
- if (entry instanceof PaletteEntryProxy) {
- event.detail = DND.DROP_MOVE;
- }
- break;
- default:
- break;
- }
- }
- }
-
- /**
- * Sets an empty content for the palette preview
- */
- public void initializeContent() {
- contentNode = new PaletteContainerProxy(null);
-
- // adds a default local drawer
- PaletteLocalDrawerProxy proxy = new PaletteLocalDrawerProxy("Default", generateID("Drawer_"), "/icons/drawer.gif", "Default Drawer");
- contentNode.addChild(proxy);
-
- setPageComplete(false);
- }
-
- /**
- * Sets the initial content for the palette preview
- */
- public void initializeContent(PapyrusPaletteService.LocalProviderDescriptor descriptor) {
- // retrieve the xml definition file
- String xmlPath = PapyrusPalettePreferences.getPalettePathFromID(descriptor.getContributionID());
-
- // parse the content file
- DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setNamespaceAware(true);
- try {
- DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
-
- // Bundle bundle = Platform.getBundle(pluginID);
- // URL url = bundle.getEntry(path);
-
- File file = Activator.getDefault().getStateLocation().append(xmlPath).toFile();
- if (!file.exists()) {
- Activator.log.error("Impossible to load file: " + file, null);
- } else {
- Document document = documentBuilder.parse(file);
- Map<String, PaletteEntry> entries = PaletteUtil.getAvailableEntriesSet(editorPart, ProviderPriority.HIGHEST);
-
- XMLPaletteDefinitionProxyFactory factory = new XMLPaletteDefinitionProxyFactory(entries);
- XMLPaletteDefinitionWalker walker = new XMLPaletteDefinitionWalker(factory);
-
- for (int i = 0; i < document.getChildNodes().getLength(); i++) {
- Node node = document.getChildNodes().item(i);
- if (IPapyrusPaletteConstant.PALETTE_DEFINITION.equals(node.getNodeName())) {
- walker.walk(node);
- }
- }
- contentNode = factory.getRootProxy();
-
- // tells that the page can be closed directly without modifying the palette
- setPageComplete(true);
- return;
- }
- } catch (ParserConfigurationException e) {
- Activator.log.error(e);
- } catch (IOException e) {
- Activator.log.error(e);
- } catch (SAXException e) {
- Activator.log.error(e);
- }
-
- // paletteTreeViewer.setInput(contentNode);
- contentNode = new PaletteContainerProxy(null);
- }
-
- /**
- * Saves the xml document into file
- *
- * @param document
- * the document to save
- * @param path
- * name of the file
- * @return the file created or updated
- */
- protected File loadDocument(Document document, String path) {
- File file = null;
- try {
- // create the file that stores the XML configuration
- file = Activator.getDefault().getStateLocation().append(path).toFile();
- Transformer aTransformer = TransformerFactory.newInstance().newTransformer();
-
- Source src = new DOMSource(document);
- Result dest = new StreamResult(file);
- aTransformer.transform(src, dest);
- } catch (TransformerConfigurationException e) {
- Activator.log.error(e);
- } catch (TransformerException e) {
- Activator.log.error(e);
- }
- return file;
-
- }
-
- /**
- * populates the preview palette toolbar
- *
- * @param toolbar
- * the toolbar to populate
- */
- protected void populatePalettePreviewToolBar(ToolBar toolbar) {
- PaletteEntryProxySelectedValidator validator = new PaletteEntryProxySelectedValidator();
- createToolBarItem(toolbar, DELETE_ICON, Messages.PapyrusPaletteCustomizerDialog_RemoveButtonTooltip, createRemoveElementListener(), validator);
- createToolBarItem(toolbar, EDIT_ICON, Messages.PapyrusPaletteCustomizerDialog_EditButtonTooltip, createEditElementListener(), new EditElementToolBarItemValidator());
- createToolBarItem(toolbar, CREATE_DRAWERS_ICON, Messages.Local_Palette_Create_Drawer_Tooltip, createNewDrawerListener(), null);
- createToolBarItem(toolbar, CREATE_SEPARATOR_ICON, Messages.Local_Palette_Create_Separator_Tooltip, createNewSeparatorListener(), validator);
- createToolBarItem(toolbar, CREATE_STACK_ICON, Messages.Local_Palette_Create_Stack_Tooltip, createNewStackListener(), validator);
- }
-
- /**
- * Edits the current selected elements. This works for drawers, should work on more elements
- *
- * @return the listener for the edit button
- */
- protected Listener createEditElementListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (selection == null || selection.size() < 1) {
- return;
- }
-
- Object selected = selection.getFirstElement();
- if (selected instanceof PaletteLocalDrawerProxy) {
- UpdateLocalDrawerWizard wizard = new UpdateLocalDrawerWizard(((PaletteLocalDrawerProxy) selected).getParent(), (PaletteLocalDrawerProxy) selected);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.open();
- }
-
- // paletteTreeViewer.refresh();
- }
- };
- }
-
- /**
- * Creates the listener for the remove item(s) button
- *
- * @return the listener for the remove button
- */
- protected Listener createRemoveElementListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (selection == null || selection.size() < 1) {
- return;
- }
-
- Iterator<?> it = selection.iterator();
- while (it.hasNext()) {
- Object o = it.next();
- if (o instanceof PaletteEntryProxy) {
- PaletteEntryProxy proxyToDelete = (PaletteEntryProxy) o;
- // create a new entry in the document
- // get container of the proxy to be deleted
- PaletteContainerProxy parentProxy = proxyToDelete.getParent();
- if (parentProxy != null) {
- parentProxy.removeChild(proxyToDelete);
- }
- }
- }
- // paletteTreeViewer.refresh();
- }
- };
- }
-
- /**
- * Creates the listener for the new drawer tool item
- *
- * @return the listener created
- */
- protected Listener createNewDrawerListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- // retrieve selected container
- PaletteContainerProxy containerProxy;
- containerProxy = (PaletteContainerProxy) paletteTreeViewer.getInput();
- NewDrawerWizard wizard = new NewDrawerWizard(containerProxy);
- WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
- wizardDialog.open();
- // paletteTreeViewer.refresh();
- setPageComplete(validatePage());
- }
- };
- }
-
- /**
- * Creates the listener for the new stack tool item
- *
- * @return the listener created
- */
- protected Listener createNewStackListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- // retrieve selected element
- Object object = ((IStructuredSelection) paletteTreeViewer.getSelection()).getFirstElement();
-
- // if element = drawer => the new stack must be created at the end of the drawer's
- // children list
- // if element = tool => must be placed before this tool
- // else : nothinng to do
- if (object instanceof PaletteLocalDrawerProxy) {
- String id = generateID("Stack");
- PaletteLocalStackProxy proxy = new PaletteLocalStackProxy(id);
- ((PaletteLocalDrawerProxy) object).addChild(proxy);
- } else if (object instanceof PaletteEntryProxy) {
- String id = generateID("Stack");
- PaletteLocalStackProxy proxy = new PaletteLocalStackProxy(id);
- // retrieve parent
- PaletteEntryProxy childProxy = (PaletteEntryProxy) object;
- PaletteContainerProxy parentProxy = childProxy.getParent();
- parentProxy.addChild(proxy, childProxy);
- }
-
- // paletteTreeViewer.refresh();
- setPageComplete(validatePage());
- }
- };
- }
-
- /**
- * Generates the ID for a local element
- *
- * @param base
- * the begining of the id
- * @return the separator id
- */
- protected String generateID(String base) {
- StringBuffer id = new StringBuffer();
- id.append(base);
- id.append("_");
- id.append(System.currentTimeMillis());
-
- return id.toString();
- }
-
- /**
- * Creates the listener for the new separator tool item
- *
- * @return the listener created
- */
- protected Listener createNewSeparatorListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- // retrieve selected element
- Object object = ((IStructuredSelection) paletteTreeViewer.getSelection()).getFirstElement();
-
- // if element = drawer => the new stack must be created at the end of the drawer's
- // children list
- // if element = tool => must be placed before this tool
- // else : nothinng to do
- if (object instanceof PaletteLocalDrawerProxy) {
- String id = generateID("Separator");
- PaletteLocalSeparatorProxy proxy = new PaletteLocalSeparatorProxy(id);
- ((PaletteLocalDrawerProxy) object).addChild(proxy);
- } else if (object instanceof PaletteEntryProxy) {
- String id = generateID("Separator");
- PaletteLocalSeparatorProxy proxy = new PaletteLocalSeparatorProxy(id);
- // retrieve parent
- PaletteEntryProxy childProxy = (PaletteEntryProxy) object;
- PaletteContainerProxy parentProxy = childProxy.getParent();
- parentProxy.addChild(proxy, childProxy);
- }
-
- setPageComplete(validatePage());
- }
- };
- }
-
- /**
- * Creates a toolbar item.
- *
- * @param toolbar
- * the parent toolbar
- * @param itemIcon
- * path for icon
- * @param tooltip
- * tooltip text for the toolbar item
- * @param listener
- * listener for tool bar item
- */
- protected void createToolBarItem(ToolBar toolbar, String itemIcon, String tooltip, Listener listener, ToolBarItemValidator validator) {
- ToolItem item = new ToolItem(toolbar, SWT.BORDER);
- item.setImage(Activator.getPluginIconImage(Activator.ID, itemIcon));
- item.setToolTipText(tooltip);
- item.addListener(SWT.Selection, listener);
- item.setData(VALIDATOR, validator);
- }
-
- /**
- * creates the buttons to add/remove entries
- */
- protected void createAddRemoveButtons() {
- Composite composite = new Composite((Composite) getControl(), SWT.NONE);
- GridLayout layout = new GridLayout(1, true);
- composite.setLayout(layout);
-
- GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, true);
- composite.setLayoutData(data);
-
- addButton = new Button(composite, SWT.NONE);
- addButton.setImage(Activator.getPluginIconImage(Activator.ID, ADD_ICON));
- addButton.setToolTipText(Messages.PapyrusPaletteCustomizerDialog_AddButtonTooltip);
- addButton.addMouseListener(createAddButtonListener());
- addButton.setEnabled(false);
- addButton.addListener(SWT.MouseUp, this);
-
- removeButton = new Button(composite, SWT.NONE);
- removeButton.setImage(Activator.getPluginIconImage(Activator.ID, REMOVE_ICON));
- removeButton.setToolTipText(Messages.PapyrusPaletteCustomizerDialog_RemoveButtonTooltip);
- removeButton.addMouseListener(createRemoveButtonListener());
- removeButton.setEnabled(false);
- removeButton.addListener(SWT.MouseUp, this);
- }
-
- /**
- * selection listener for the tools viewer , to update the state of the add button
- *
- * @return the new created selection listener
- */
- protected ISelectionChangedListener createToolsViewerSelectionChangeListener() {
- return new ISelectionChangedListener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
-
- // get source and target selection
- // check source entry can be added to target entry
- Object source = ((IStructuredSelection) availableToolsViewer.getSelection()).getFirstElement();
- Object target = ((IStructuredSelection) paletteTreeViewer.getSelection()).getFirstElement();
-
- // manage add button
- if (isAddValidTarget(source, target)) {
- addButton.setEnabled(true);
- } else {
- addButton.setEnabled(false);
- }
-
- // manage remove button
- if (isRemoveValidSource(target)) {
- removeButton.setEnabled(true);
- } else {
- removeButton.setEnabled(false);
- }
-
- }
-
- /**
- * Returns true if the source can be added to the target
- *
- * @param source
- * the source object
- * @param target
- * the target object
- * @return <code>true</code> if the source can be added to the target
- */
- protected boolean isAddValidTarget(Object source, Object target) {
- if (!(source instanceof PaletteEntry)) {
- return false;
- }
-
- // case1: source is a drawer.
- // it can only be added to the root element (no selection)
- // case2: source is a palette tool
- // it can't be added to the root element
- // it can only be added to a container element (drawer or stack)
- if (source instanceof PaletteDrawer) {
- if (target == null) {
- return true;
- }
- return false;
- } else if (source instanceof ToolEntry) {
- if (target instanceof PaletteEntryProxy) {
- EntryType type = ((PaletteEntryProxy) target).getType();
- switch (type) {
- case DRAWER:
- case STACK:
- return true;
- default:
- return false;
- }
- }
- return false;
- }
- return false;
- }
-
- /**
- * Returns true if the source can be added to the target
- *
- * @param source
- * the source object
- * @return <code>true</code> if the source can be removed (not null and instanceof
- * PaletteEntryProxy)
- */
- protected boolean isRemoveValidSource(Object source) {
- if (source instanceof PaletteEntryProxy) {
- return true;
- }
- return false;
- }
- };
-
- }
-
- /**
- * Creates the add button listener
- */
- protected MouseListener createAddButtonListener() {
- return new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- // add the element selected on the left to the right tree
- // check the selection.
- IStructuredSelection selection = (IStructuredSelection) availableToolsViewer.getSelection();
- if (selection == null || selection.size() < 1) {
- return;
- }
- PaletteEntry entry = (PaletteEntry) selection.getFirstElement();
- if (entry == null) {
- return;
- }
-
- // find the selection on the right
- selection = (IStructuredSelection) paletteTreeViewer.getSelection();
-
- PaletteEntryProxy parentNode = (PaletteEntryProxy) selection.getFirstElement();
- // Bugfix: only drawers can be added to root element
- if (parentNode == null && entry instanceof PaletteDrawer) {
- parentNode = (PaletteContainerProxy) paletteTreeViewer.getInput();
- }
-
- // check we have a containe here
- if (!(parentNode instanceof PaletteContainerProxy)) {
- return;
- }
-
- // create a new entry in the document
- PaletteEntryProxy proxy = createNodeFromEntry(entry);
- ((PaletteContainerProxy) parentNode).addChild(proxy);
-
- paletteTreeViewer.expandToLevel(parentNode, 1);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
- };
- }
-
- /**
- * Creates a node in the xml document from the given entry
- *
- * @param entry
- * the palette entry from which to create the node
- * @param parentNode
- * the parent node for the newly created node
- * @return the created entry proxy or <code>null</code>
- */
- protected PaletteEntryProxy createNodeFromEntry(Object entry) {
- PaletteEntryProxy entryProxy = null;
-
- if (entry instanceof AspectCreationEntry) {
- // should modify id of the element here, otherwise, different elements would have the same id...
- entryProxy = new PaletteAspectToolEntryProxy(((AspectCreationEntry) entry).clone());
- } else if (entry instanceof CombinedTemplateCreationEntry) {
- CombinedTemplateCreationEntry originalEntry = (CombinedTemplateCreationEntry) entry;
- // create a new Aspect entry proxy
- AspectCreationEntry aspectEntry = new AspectCreationEntry(originalEntry.getLabel(), originalEntry.getDescription(), originalEntry.getId() + "_" + System.currentTimeMillis(), originalEntry.getSmallIcon(), originalEntry,
- new HashMap<Object, Object>());
- entryProxy = new PaletteAspectToolEntryProxy(aspectEntry);
- } else if (entry instanceof PaletteContainer) {
- entryProxy = new PaletteContainerProxy((PaletteContainer) entry);
- } else if (entry instanceof PaletteEntryProxy) {
- entryProxy = ((PaletteEntryProxy) entry);
- }
- return entryProxy;
- }
-
- /**
- * Creates the add button listener
- */
- protected MouseListener createRemoveButtonListener() {
- return new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- // remove the element selected on the right
- // add the element selected on the left to the right tree
- // check the selection.
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (selection == null || selection.size() < 1) {
- return;
- }
- PaletteEntryProxy proxyToDelete = (PaletteEntryProxy) selection.getFirstElement();
- if (proxyToDelete == null) {
- return;
- }
-
- // create a new entry in the document
- // get container of the proxy to be deleted
- PaletteContainerProxy parentProxy = proxyToDelete.getParent();
- parentProxy.removeChild(proxyToDelete);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
- };
- }
-
- /**
- * creates the available entries group
- */
- protected void createAvailableToolsGroup() {
- Composite parent = (Composite) getControl();
- Composite availableToolsComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- availableToolsComposite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- availableToolsComposite.setLayoutData(data);
-
- Label label = new Label(availableToolsComposite, SWT.NONE);
- label.setText(Messages.Local_Palette_Available_Tools);
- data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- label.setLayoutData(data);
-
- ToolBar toolbar = new ToolBar(availableToolsComposite, SWT.HORIZONTAL);
- data = new GridData(SWT.RIGHT, SWT.FILL, false, false);
- toolbar.setLayoutData(data);
- populateAvailableToolsToolBar(toolbar);
-
- createProfileCombo(availableToolsComposite);
-
- Tree tree = new Tree(availableToolsComposite, SWT.SINGLE | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- data.widthHint = 185;
- // Make the tree this tall even when there is nothing in it. This will keep the
- // dialog from shrinking to an unusually small size.
- data.heightHint = 200;
- tree.setLayoutData(data);
- availableToolsViewer = new TreeViewer(tree);
- availableToolsViewer.setContentProvider(new UMLToolsTreeContentProvider());
- paletteLabelProvider = new PaletteLabelProvider();
- availableToolsViewer.setLabelProvider(paletteLabelProvider);
- ViewerComparator labelComparator = new LabelViewerComparator();
- availableToolsViewer.setComparator(labelComparator);
- // remove the note stack and standard group
- availableToolsViewer.addFilter(new ViewerFilter() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof PaletteStack && "noteStack".equals(((PaletteStack) element).getId())) {
- return false;
- } else if (element instanceof PaletteToolbar && "standardGroup".equals(((PaletteToolbar) element).getId())) {
- return false;
- }
- return true;
- }
- });
- availableToolsViewer.addFilter(new DrawerFilter());
- // add drag support
- addAvailableToolsDragSupport();
- // availableToolsViewer.setInput(getAllVisibleStandardEntries());
- }
-
- /**
- * Creates the profile combo
- *
- * @param availableToolsComposite
- * the available tools composite
- * @return the created combo
- */
- protected Combo createProfileCombo(Composite availableToolsComposite) {
- // retrieve top package, to know which profiles are available
- // creates the combo
- profileCombo = new Combo(availableToolsComposite, SWT.BORDER | SWT.READ_ONLY);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- profileCombo.setLayoutData(data);
-
- // retrieve all applied profiles
- List<Profile> profiles = getAllAppliedProfiles();
-
- int profileNumber = profiles.size();
- for (int i = 0; i < profileNumber; i++) {
- String name;
- if (profiles.get(i).eIsProxy()) {
- name = NLS.bind("<unresolved: {0}>", URI.decode(EcoreUtil.getURI(profiles.get(i)).lastSegment()));
- } else {
- name = profiles.get(i).getName();
- if (name == null) {
- name = NLS.bind("<unnamed: {0}>", URI.decode(EcoreUtil.getURI(profiles.get(i)).lastSegment()));
- }
- }
- profileComboList.add(i, name);
- }
- profileComboList.add(UML_TOOLS_LABEL);
- profileCombo.setItems(profileComboList.toArray(new String[] {}));
-
- // add selection listener for the combo. selects the "UML tools" item
- ProfileComboSelectionListener listener = new ProfileComboSelectionListener();
- profileCombo.addSelectionListener(listener);
- profileCombo.addModifyListener(listener);
- // profileCombo.select(profileNumber);
-
- return profileCombo;
- }
-
- /**
- * returns the list of applied profile for the nearest package of the top element
- *
- * @return the list of applied profile for the nearest package of the top element or an empty
- * list
- */
- protected List<Profile> getAllAppliedProfiles() {
- Package topPackage = null;
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- EObject element = ((DiagramEditorWithFlyOutPalette) editorPart).getDiagram().getElement();
- if (element instanceof org.eclipse.uml2.uml.Element) {
- topPackage = ((org.eclipse.uml2.uml.Element) element).getNearestPackage();
- }
- }
- if (topPackage != null) {
- return topPackage.getAllAppliedProfiles();
- }
- return Collections.emptyList();
- }
-
- /**
- * Add drag support from the available tools viewer
- */
- protected void addAvailableToolsDragSupport() {
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
-
- // drag listener
- DragSourceListener listener = new LocalSelectionDragSource(availableToolsViewer);
-
- availableToolsViewer.addDragSupport(DND.DROP_LINK, transfers, listener);
- }
-
- /**
- * Adds elements to the tool bar for available tools viewer
- *
- * @param toolbar
- * the toolbar to populate
- */
- protected void populateAvailableToolsToolBar(ToolBar toolbar) {
- toggleContentProvider = createCheckToolBarItem(toolbar, SWITCH_CONTENT_PROVIDER_ICON, Messages.Local_Palette_SwitchToolsContentProvider_Tooltip, createSwitchToolsContentProviderListener());
- toggleContentProvider.setSelection(true);
- toggleContentProvider.setEnabled(false);
- createCheckToolBarItem(toolbar, SHOWN_TOOLS_ICON, Messages.Local_Palette_ShowTools_Tooltip, createsShowToolListener());
- }
-
- /**
- * Creates the listener for the available tools content provider
- *
- * @return the listener created
- */
- protected Listener createSwitchToolsContentProviderListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- if (!(event.widget instanceof ToolItem)) {
- return;
- }
- ToolItem item = ((ToolItem) event.widget);
- // retrieve current profile selected in the combo profile
- int index = profileCombo.getSelectionIndex();
- Collection<PaletteEntry> standardEntries = getAllVisibleStandardEntries();
- Profile profile = getAllAppliedProfiles().get(index);
-
- if (item.getSelection()) {
- availableToolsViewer.setContentProvider(new ProfileToolsStereotypeMetaclassTreeContentProvider(profile, standardEntries));
- item.setSelection(true);
- } else {
-
- availableToolsViewer.setContentProvider(new ProfileToolsMetaclassStereotypeTreeContentProvider(profile, standardEntries));
- item.setSelection(false);
- }
-
- // generate tools for given profile
- availableToolsViewer.setInput(profile);
- }
- };
- }
-
- /**
- * creates the tool item for drawers visibility listener
- *
- * @return the listener for the tool button
- */
- protected Listener createShowDrawerListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- if (!(event.widget instanceof ToolItem)) {
- return;
- }
- ToolItem item = ((ToolItem) event.widget);
- if (item.getSelection()) {
- // elements should be hidden
- availableToolsViewer.addFilter(drawerFilter);
- item.setSelection(true);
- } else {
- availableToolsViewer.removeFilter(drawerFilter);
- item.setSelection(false);
- }
- }
- };
- }
-
- /**
- * creates the tool item for tools visibility listener
- *
- * @return the listener for the tool button
- */
- protected Listener createsShowToolListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- if (!(event.widget instanceof ToolItem)) {
- return;
- }
- ToolItem item = ((ToolItem) event.widget);
- if (item.getSelection()) {
- // elements should be hidden
- availableToolsViewer.addFilter(toolFilter);
- item.setSelection(true);
- } else {
- availableToolsViewer.removeFilter(toolFilter);
- item.setSelection(false);
- }
- }
- };
- }
-
- /**
- * Creates a toolbar item which can be checked.
- *
- * @param toolbar
- * the parent toolbar
- * @param shownElementsIcon
- * path for shown elements icon
- * @param listener
- * listener for button action
- * @param tooltip
- * tooltip text for the toolbar item
- */
- protected ToolItem createCheckToolBarItem(ToolBar toolbar, String shownElementsIcon, String tooltip, Listener listener) {
- ToolItem item = new ToolItem(toolbar, SWT.CHECK | SWT.BORDER);
- item.setImage(Activator.getPluginIconImage(Activator.ID, shownElementsIcon));
- item.setToolTipText(tooltip);
- item.addListener(SWT.Selection, listener);
- return item;
- }
-
- /**
- * Validates the content of the fields in this page
- */
- protected boolean validatePage() {
- boolean valid = true;
-
- if (valid) {
- setMessage(null);
- setErrorMessage(null);
- }
- return valid;
- }
-
- /**
- * The <code>WizardNewFileCreationPage</code> implementation of this <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
- @Override
- public void handleEvent(Event event) {
- setPageComplete(validatePage());
- }
-
- /**
- * Content provider for available tools viewer
- */
- public class UMLToolsTreeContentProvider implements ITreeContentProvider {
-
- /**
- * Constructor
- *
- * @param viewer
- * The viewer whose ContentProvider this content provider is
- */
- public UMLToolsTreeContentProvider() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(Object inputElement) {
- Object[] elements = null;
-
- if (inputElement instanceof Collection<?>) {
- elements = ((Collection<?>) inputElement).toArray();
- } else if (inputElement instanceof PaletteRoot) {
- // paletteUil.getAllEntries(...) to add drawers
- // if so, uncomment the addFilterbutton for drawers in populate tool bar
- elements = PaletteUtil.getAllToolEntries(((PaletteRoot) inputElement)).toArray();
- }
-
- if (elements == null) {
- elements = new Object[0];
- }
- return elements;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- Object[] elements = null;
-
- if (parentElement instanceof Collection<?>) {
- elements = ((Collection<?>) parentElement).toArray();
- } else if (parentElement instanceof PaletteRoot) {
- // paletteUil.getAllEntries(...) to add drawers
- // if so, uncomment the addFilterbutton for drawers in populate tool bar
- elements = PaletteUtil.getAllToolEntries(((PaletteRoot) parentElement)).toArray();
- }
-
- return elements;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(Object element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- return getChildren(element) != null && getChildren(element).length > 0;
- }
- }
-
- /**
- * Label provider for palette tools.
- * <P>
- * We should be using the Palette label provider from GEF, if it was not with visibility "package"...
- *
- * @see org.eclipse.gef.ui.palette.customize.PaletteLabelProvider
- * </P>
- *
- */
- public class PaletteLabelProvider implements ILabelProvider {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof PaletteEntry) {
- ImageDescriptor descriptor = ((PaletteEntry) element).getSmallIcon();
- if (descriptor == null) {
- return null;
- }
- return Activator.getPluginIconImage(Activator.ID, descriptor);
- } else if (element instanceof Stereotype) {
- return Activator.getPluginIconImage(Activator.ID, "/icons/stereotype.gif");
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getText(Object element) {
- if (element instanceof PaletteEntry) {
- return ((PaletteEntry) element).getLabel();
- } else if (element instanceof Stereotype) {
- return ((Stereotype) element).getName();
- }
- return "unknown element";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeListener(ILabelProviderListener listener) {
-
- }
-
- }
-
- /**
- * Label provider for palette tools.
- * <P>
- * We should be using the Palette label provider from GEF, if it was not with visibility "package"...
- *
- * @see org.eclipse.gef.ui.palette.customize.PaletteLabelProvider
- * </P>
- *
- */
- public class PaletteProxyLabelProvider implements ILabelProvider {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof PaletteEntryProxy) {
- return ((PaletteEntryProxy) element).getImage();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getText(Object element) {
- if (element instanceof PaletteEntryProxy) {
- return ((PaletteEntryProxy) element).getLabel();
- }
- return "unknown element";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeListener(ILabelProviderListener listener) {
-
- }
-
- }
-
- /**
- * Filter for the viewer. Hide/show Drawers
- */
- public class DrawerFilter extends ViewerFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof PaletteDrawer) {
- return false;
- }
- return true;
- }
-
- }
-
- /**
- * Filter for the viewer. Hide/show Drawers
- */
- public class ToolFilter extends ViewerFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof ToolEntry) {
- return false;
- }
- return true;
- }
-
- }
-
- /**
- * Content provider for the palette
- */
- public class PaletteContentProvider implements ITreeContentProvider {
-
- /** tree viewer this provider provides content */
- protected final TreeViewer viewer;
-
- /** the document root where to build the palette */
- protected PaletteContainerProxy rootProxy;
-
- /** model listener that will listens for all modifications in the entries */
- protected PropertyChangeListener modelListener = new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- handlePropertyChanged(evt);
- }
- };
-
- /**
- * Creates a new PaletteContentProvider.
- *
- * @param treeviewer
- * tree viewer this provider provides content
- */
- public PaletteContentProvider(TreeViewer treeviewer) {
- this.viewer = treeviewer;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // remove all listeners
- traverseModel(rootProxy, false);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof PaletteEntryProxy) {
- List<PaletteEntryProxy> children = ((PaletteEntryProxy) parentElement).getChildren();
- return (children != null) ? children.toArray() : new Object[0];
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- if (element instanceof PaletteEntryProxy) {
- return ((PaletteEntryProxy) element).getChildren() != null && !((PaletteEntryProxy) element).getChildren().isEmpty();
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(Object inputElement) {
- Object[] elements = getChildren(inputElement);
- if (elements == null) {
- elements = new Object[0];
- }
- return elements;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(Object element) {
- if (element instanceof PaletteEntryProxy) {
- return ((PaletteEntryProxy) element).getParent();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (rootProxy != null) {
- // warning.. the root has no entry, this is a virtual node
- traverseModel(rootProxy, false);
- }
-
- if (newInput != null) {
- rootProxy = ((PaletteContainerProxy) newInput);
- traverseModel(rootProxy, true);
- }
- }
-
- /**
- * This method is invoked whenever there is any change in the model. It updates the
- * viewer with the changes that were made to the model. Sub-classes may override this
- * method to change or extend its functionality.
- *
- * @param evt
- * The {@link PropertyChangeEvent} that was fired from the model
- */
- protected void handlePropertyChanged(PropertyChangeEvent evt) {
- PaletteEntryProxy entry = ((PaletteEntryProxy) evt.getSource());
- String property = evt.getPropertyName();
- if (property.equals(PaletteEntry.PROPERTY_LABEL) || property.equals(PaletteEntry.PROPERTY_SMALL_ICON) || property.equals(PaletteEntryProxy.PROPERTY_ICON_PATH)) {
- viewer.update(entry, null);
- } else if (property.equals(PaletteEntryProxy.PROPERTY_ADD_CHILDREN)) {
- viewer.refresh(entry.getParent());
- // add the listeners to the child
- traverseModel(((PaletteEntryProxy) evt.getNewValue()), true);
- } else if (property.equals(PaletteEntryProxy.PROPERTY_REMOVE_CHILDREN)) {
- viewer.refresh(entry.getParent());
- // add the listeners to the child
- traverseModel(((PaletteEntryProxy) evt.getOldValue()), false);
- }
-
- }
-
- protected void traverseModel(PaletteEntryProxy entryProxy, boolean isHook) {
- if (entryProxy != null) {
- if (isHook) {
- entryProxy.addPropertyChangeListener(modelListener);
- } else {
- entryProxy.removePropertyChangeListener(modelListener);
- }
- }
-
- if (entryProxy.getChildren() != null && !entryProxy.getChildren().isEmpty()) {
- for (PaletteEntryProxy proxy : entryProxy.getChildren()) {
- traverseModel(proxy, isHook);
- }
- }
- }
- }
-
- /**
- * Performs all action on finish
- *
- * @param id
- * the path for the file
- */
- public void performFinish(String path) {
- // creates the document
- Document document = createXMLDocumentFromPalettePreview();
- saveDocument(document, path);
- requiredProfiles = collectRequiredProfiles();
- }
-
- /**
- * collect the required profiles from all tool provided by the local palette definition
- */
- protected Set<String> collectRequiredProfiles() {
- Set<String> profiles = new HashSet<String>();
- PaletteContainerProxy rootProxy = (PaletteContainerProxy) paletteTreeViewer.getInput();
- collectRequiredProfiles(rootProxy.getChildren(), profiles);
- return profiles;
- }
-
- /**
- * collect the required profiles from all tool provided by the local palette definition
- */
- protected void collectRequiredProfiles(List<PaletteEntryProxy> proxies, Set<String> requiredProfiles) {
- for (PaletteEntryProxy proxy : proxies) {
- // add profile(s) if relevant, check for children
-
- if (proxy instanceof PaletteAspectToolEntryProxy) {
- // list of profiles
- for (String stereotypeQN : ((PaletteAspectToolEntryProxy) proxy).getStereotypesQNList()) {
- // retrieve list of profiles from the stereotype QN (only remove last segment
- // ?!)
- String profileName = PaletteUtil.findProfileNameFromStereotypeName(stereotypeQN);
- requiredProfiles.add(profileName);
- }
- }
-
- if (proxy.getChildren() != null) {
- collectRequiredProfiles(proxy.getChildren(), requiredProfiles);
- }
- }
- }
-
- /**
- * Saves the xml document into file
- *
- * @param document
- * the document to save
- * @param path
- * name of the file
- * @return the file created or updated
- */
- protected File saveDocument(Document document, String path) {
- File file = null;
- try {
- // create the file that stores the XML configuration
- file = Activator.getDefault().getStateLocation().append(path).toFile();
- TransformerFactory tranFactory = TransformerFactory.newInstance();
- Transformer aTransformer;
-
- aTransformer = tranFactory.newTransformer();
-
- Source src = new DOMSource(document);
- Result dest = new StreamResult(file);
- aTransformer.transform(src, dest);
- } catch (TransformerConfigurationException e) {
- Activator.log.error(e);
- } catch (TransformerException e) {
- Activator.log.error(e);
- }
- return file;
-
- }
-
- /**
- * Creates the document from the palette preview
- *
- * @return the dom structure of the document
- */
- protected Document createXMLDocumentFromPalettePreview() {
- DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setNamespaceAware(true);
- DocumentBuilder documentBuilder;
- try {
- documentBuilder = documentBuilderFactory.newDocumentBuilder();
- document = documentBuilder.newDocument();
- Element paletteDefElement = document.createElement(IPapyrusPaletteConstant.PALETTE_DEFINITION);
- document.appendChild(paletteDefElement);
- Element contentElement = document.createElement(IPapyrusPaletteConstant.CONTENT);
- paletteDefElement.appendChild(contentElement);
-
- generateXMLPaletteContent(document, contentElement);
- return document;
- } catch (ParserConfigurationException e) {
- Activator.getDefault().logError("impossible to create the palette tree viewer content", e);
- }
- return null;
- }
-
- /**
- * Generates the xml content for the palette
- *
- * @param document
- * the document to fill
- * @param contentElement
- * the root for the xml content
- */
- protected void generateXMLPaletteContent(Document document, Element contentElement) {
- PaletteContainerProxy rootProxy = (PaletteContainerProxy) paletteTreeViewer.getInput();
- for (PaletteEntryProxy proxy : rootProxy.getChildren()) {
- generateXMLPaletteContainerProxy(document, contentElement, proxy);
- }
- }
-
- /**
- * Generates the xml content for the given container
- *
- * @param document
- * the document to fill
- * @param containerProxy
- * the entry proxy
- */
- protected void generateXMLPaletteContainerProxy(Document document, Element contentElement, PaletteEntryProxy containerProxy) {
-
- Element element = null;
- List<PaletteEntryProxy> children = containerProxy.getChildren();
- // generate the element
- switch (containerProxy.getType()) {
- case DRAWER:
- element = document.createElement(IPapyrusPaletteConstant.DRAWER);
- element.setAttribute(IPapyrusPaletteConstant.NAME, containerProxy.getLabel());
- if (containerProxy instanceof PaletteLocalDrawerProxy) {
- element.setAttribute(IPapyrusPaletteConstant.ICON_PATH, ((PaletteLocalDrawerProxy) containerProxy).getImagePath());
- }
- break;
- case TOOL:
- element = document.createElement(IPapyrusPaletteConstant.TOOL);
- break;
- case SEPARATOR:
- element = document.createElement(IPapyrusPaletteConstant.SEPARATOR);
- break;
- case STACK:
- element = document.createElement(IPapyrusPaletteConstant.STACK);
- break;
- case ASPECT_TOOL:
- element = document.createElement(IPapyrusPaletteConstant.ASPECT_TOOL);
- // try to cast the element into PaletteAspectToolEntryProxy
- if (containerProxy instanceof PaletteAspectToolEntryProxy) {
- PaletteAspectToolEntryProxy aspectEntryProxy = (PaletteAspectToolEntryProxy) containerProxy;
- // element.setAttribute(IPapyrusPaletteConstant.ID, aspectEntryProxy.getId());
- element.setAttribute(IPapyrusPaletteConstant.NAME, aspectEntryProxy.getLabel());
- element.setAttribute(IPapyrusPaletteConstant.DESCRIPTION, aspectEntryProxy.getEntry().getDescription());
- element.setAttribute(IPapyrusPaletteConstant.REF_TOOL_ID, aspectEntryProxy.getReferencedPaletteID());
-
- if (aspectEntryProxy.getImagePath() != null && !aspectEntryProxy.getImagePath().equals("")) {
- element.setAttribute(IPapyrusPaletteConstant.ICON_PATH, aspectEntryProxy.getImagePath());
- }
-
-
- // add post action, stereotype list
- for (IAspectAction action : ((PaletteAspectToolEntryProxy) containerProxy).getPostActions()) {
- Element postActionNode = document.createElement(IPapyrusPaletteConstant.POST_ACTION);
- postActionNode.setAttribute(IPapyrusPaletteConstant.ID, action.getFactoryId());
- action.save(postActionNode);
- element.appendChild(postActionNode);
- }
- for (IAspectAction action : ((PaletteAspectToolEntryProxy) containerProxy).getPreActions()) {
- Element preActionNode = document.createElement(IPapyrusPaletteConstant.PRE_ACTION);
- preActionNode.setAttribute(IPapyrusPaletteConstant.ID, action.getFactoryId());
- action.save(preActionNode);
- element.appendChild(preActionNode);
- }
- }
- default:
- break;
- }
-
- element.setAttribute(IPapyrusPaletteConstant.ID, containerProxy.getId());
- contentElement.appendChild(element);
-
- if (children != null) {
- for (PaletteEntryProxy proxy : children) {
- generateXMLPaletteContainerProxy(document, element, proxy);
- }
- }
- }
-
- public enum EntryType {
- DRAWER, TOOL, STACK, SEPARATOR, ASPECT_TOOL
- }
-
- public class LabelViewerComparator extends ViewerComparator {
-
- /**
- * Creates a new LabelViewerComparator.
- */
- public LabelViewerComparator() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int compare(Viewer testViewer, Object e1, Object e2) {
- String label1 = "";
- String label2 = "";
-
- if (e1 instanceof PaletteEntry) {
- label1 = ((PaletteEntry) e1).getLabel();
- } else if (e1 instanceof Stereotype) {
- label1 = ((Stereotype) e1).getName();
- }
- if (e2 instanceof PaletteEntry) {
- label2 = ((PaletteEntry) e2).getLabel();
- } else if (e2 instanceof Stereotype) {
- label2 = ((Stereotype) e2).getName();
- }
-
- if (label1 == null) {
- return 1;
- }
- if (label2 == null) {
- return -1;
- }
-
- return label1.compareTo(label2);
- }
- }
-
- /**
- * Listener for the profile combo. It changes the input of the following viewer.
- */
- public class ProfileComboSelectionListener implements SelectionListener, ModifyListener {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // nothing to do
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSelectionChanged();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void modifyText(ModifyEvent e) {
- handleSelectionChanged();
- }
-
- /**
- * handles the change selection for the combo
- */
- protected void handleSelectionChanged() {
- int index = profileCombo.getSelectionIndex();
- if (index < 0 || index >= profileCombo.getItems().length) {
- return;
- }
- String name = profileComboList.get(index);
-
- Collection<PaletteEntry> standardEntries = getAllVisibleStandardEntries();
- // retrieve the profile or uml standards tools to display
- if (UML_TOOLS_LABEL.equals(name)) {
- // change content provider
- availableToolsViewer.setContentProvider(new UMLToolsTreeContentProvider());
- availableToolsViewer.setInput(standardEntries);
- toggleContentProvider.setEnabled(false);
- } else {
- if (toggleContentProvider != null && !toggleContentProvider.isDisposed()) {
- toggleContentProvider.setEnabled(true);
- }
- // switch content provider
- // this is a profile in case of uml2 tools
- Profile profile = getAllAppliedProfiles().get(index);
- if (toggleContentProvider.getSelection()) {
- availableToolsViewer.setContentProvider(new ProfileToolsStereotypeMetaclassTreeContentProvider(profile, standardEntries));
- } else {
- availableToolsViewer.setContentProvider(new ProfileToolsMetaclassStereotypeTreeContentProvider(profile, standardEntries));
- }
-
- // generate tools for given profile
- availableToolsViewer.setInput(profile);
- }
- }
- }
-
- /**
- * Content provider for the available tools viewer, when the tools to see are coming from a
- * profile
- */
- public class ProfileToolsStereotypeMetaclassTreeContentProvider implements ITreeContentProvider {
-
- /** standard uml tools palette entries */
- final protected Collection<PaletteEntry> standardEntries;
-
- /**
- * Creates a new ProfileToolsStereotypeMetaclassTreeContentProvider.
- *
- * @param profile
- * the profile for which tools are built
- * @param standardEntries
- * list of standard uml tools palette entries
- */
- public ProfileToolsStereotypeMetaclassTreeContentProvider(Profile profile, Collection<PaletteEntry> standardEntries) {
- this.standardEntries = standardEntries;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Profile) {
- return ((Profile) parentElement).getOwnedStereotypes().toArray();
- } else if (parentElement instanceof Stereotype) {
- List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
- Stereotype stereotype = (Stereotype) parentElement;
-
- for (PaletteEntry entry : standardEntries) {
- // retrieve the element type created by the tool.
- if (entry instanceof CombinedTemplateCreationEntry) {
-
- EClass toolMetaclass = PaletteUtil.getToolMetaclass((CombinedTemplateCreationEntry) entry);
- if (toolMetaclass != null) {
- List<Class> metaclasses = stereotype.getAllExtendedMetaclasses();
- for (Class stMetaclass : metaclasses) {
- // get Eclass
- java.lang.Class<?> metaclassClass = stMetaclass.getClass();
- if (metaclassClass != null) {
- EClassifier metaClassifier = UMLPackage.eINSTANCE.getEClassifier(stMetaclass.getName());
- if (((EClass) metaClassifier).isSuperTypeOf(toolMetaclass)) {
- // should create the palette entry
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(IPapyrusPaletteConstant.ASPECT_ACTION_KEY, StereotypeAspectActionProvider.createConfigurationNode(stereotype.getQualifiedName()));
- AspectCreationEntry aspectEntry = new AspectCreationEntry(stereotype.getName() + " (" + entry.getLabel() + ")", "Create an element with a stereotype", entry.getId() + "_" + System.currentTimeMillis(),
- entry.getSmallIcon(), (CombinedTemplateCreationEntry) entry, properties);
- entries.add(aspectEntry);
- }
- }
-
- }
- }
- }
- }
- return entries.toArray();
- } else {
- return new Object[0];
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(Object element) {
- if (element instanceof Stereotype) {
- return ((Stereotype) element).getProfile();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- if (element instanceof Profile) {
- return true;
- } else if (element instanceof Stereotype) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof Profile) {
- List<Stereotype> stereotypes = ((Profile) inputElement).getOwnedStereotypes();
- return stereotypes.toArray();
- }
- return new Object[0];
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // nothing to do here
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // nothing to do here
- }
-
- }
-
- /**
- * Content provider for the available tools viewer, when the
- */
- public class ProfileToolsMetaclassStereotypeTreeContentProvider implements ITreeContentProvider {
-
- /** standard uml tools palette entries */
- final protected Collection<PaletteEntry> standardEntries;
-
- /** profile to display */
- final protected Profile profile;
-
- /**
- * Creates a new ProfileToolsMetaclassStereotypeTreeContentProvider.
- *
- * @param profile
- * the profile for which tools are built
- * @param standardEntries
- * list of standard uml tools palette entries
- */
- public ProfileToolsMetaclassStereotypeTreeContentProvider(Profile profile, Collection<PaletteEntry> standardEntries) {
- this.profile = profile;
- this.standardEntries = standardEntries;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Profile) {
- return standardEntries.toArray();
- } else if (parentElement instanceof AspectCreationEntry) {
- return new Object[0];
- } else if (parentElement instanceof PaletteEntry) {
- List<AspectCreationEntry> entries = new ArrayList<AspectCreationEntry>();
- // display all stereotypes applicable to the type of element created by this tool
- if (parentElement instanceof CombinedTemplateCreationEntry) {
- CombinedTemplateCreationEntry entry = (CombinedTemplateCreationEntry) parentElement;
- EClass toolMetaclass = PaletteUtil.getToolMetaclass(entry);
- if (toolMetaclass != null) {
- for (Stereotype stereotype : profile.getOwnedStereotypes()) {
- List<Class> metaclasses = stereotype.getAllExtendedMetaclasses();
- for (Class stMetaclass : metaclasses) {
- // get Eclass
- java.lang.Class<?> metaclassClass = stMetaclass.getClass();
- if (metaclassClass != null) {
- EClassifier metaClassifier = UMLPackage.eINSTANCE.getEClassifier(stMetaclass.getName());
- if (((EClass) metaClassifier).isSuperTypeOf(toolMetaclass)) {
- // should create the palette entry
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(IPapyrusPaletteConstant.ASPECT_ACTION_KEY, StereotypeAspectActionProvider.createConfigurationNode(stereotype.getQualifiedName()));
- AspectCreationEntry aspectEntry = new AspectCreationEntry(stereotype.getName() + " (" + entry.getLabel() + ")", "Create an element with a stereotype", entry.getId() + "_" + System.currentTimeMillis(),
- entry.getSmallIcon(), entry, properties);
- entries.add(aspectEntry);
- }
- }
-
- }
- }
- }
- }
- return entries.toArray();
- } else {
- return new Object[0];
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(Object element) {
- if (element instanceof Stereotype) {
- return ((Stereotype) element).getProfile();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(Object element) {
- if (element instanceof Profile) {
- return true;
- } else if (element instanceof AspectCreationEntry) {
- return false;
- } else if (element instanceof PaletteEntry) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof Profile) {
- return standardEntries.toArray();
- }
- return new Object[0];
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // nothing to do here
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // nothing to do here
- }
-
- }
-
- /**
- * Returns the list of all visible palette entries
- *
- * @return the list of all visible palette entries
- */
- protected Collection<PaletteEntry> getAllVisibleStandardEntries() {
- HashSet<PaletteEntry> result = new HashSet<PaletteEntry>();
- for (PaletteEntry entry : PaletteUtil.getAvailableEntriesSet(editorPart, priority).values()) {
- // the entry is not just a defineOnly entry but a visible one
- if (getRootParent(entry) != null) {
- result.add(entry);
- }
- }
- return result;
- }
-
- /**
- * Returns the Root element for the palette entry. It searches recursively from parent to parent, until it find the root element
- *
- * @param entry
- * the palette entry for which root element is searched
- * @return the root element or <code>null</code> if none was found
- */
- protected PaletteRoot getRootParent(PaletteEntry entry) {
- PaletteContainer parent = entry.getParent();
- if (parent instanceof PaletteRoot) {
- return (PaletteRoot) parent;
- } else if (parent != null) {
- return getRootParent(parent);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the list of required profiles by this local palette definition
- *
- * @return the profiles required by this palette
- */
- public Set<String> getRequiredProfiles() {
- return requiredProfiles;
- }
-
- /**
- * Item validator
- */
- protected abstract class ToolBarItemValidator {
-
- /**
- * Checks if the button should be enable or not
- *
- * @return <code>true</code> if the button should be enable
- */
- public abstract boolean isEnable();
- }
-
- /**
- * validator for the edit element tool item. It does not remove
- */
- protected class EditElementToolBarItemValidator extends ToolBarItemValidator {
-
- /**
- * @{inheritDoc
- */
- @Override
- public boolean isEnable() {
- // retrieve selection
- if (paletteTreeViewer != null && !paletteTreeViewer.getControl().isDisposed()) {
- // retrieve selection. first element should be a drawer
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (selection == null) {
- return false;
- } else {
- // look for first element. should be an instance of drawer
- return (selection.getFirstElement() instanceof PaletteLocalDrawerProxy);
- }
- }
- return false;
- }
- }
-
- /**
- * validator for the create separator or stack tool item. Only valid when selection is a {@link PaletteEntryProxy} or a {@link PaletteLocalDrawerProxy}
- */
- protected class PaletteEntryProxySelectedValidator extends ToolBarItemValidator {
-
- /**
- * @{inheritDoc
- */
- @Override
- public boolean isEnable() {
- // retrieve selection
- if (paletteTreeViewer != null && !paletteTreeViewer.getControl().isDisposed()) {
- // retrieve selection. first element should be a drawer
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (selection == null) {
- return false;
- } else {
- Object object = selection.getFirstElement();
- return (object instanceof PaletteEntryProxy);
- }
- }
- return false;
- }
- }
-
- /**
- * Sets the priority of the current edited palette
- *
- * @param priority
- * the priority of the current edited palette
- */
- public void setPriority(ProviderPriority priority) {
- this.priority = priority;
- }
-
- protected static class LocalSelectionDragSource extends DragSourceAdapter {
- private ISelectionProvider selectionSource;
-
- public LocalSelectionDragSource(ISelectionProvider selectionProvider) {
- selectionSource = selectionProvider;
- }
-
- @Override
- public void dragStart(DragSourceEvent event) {
- super.dragStart(event);
- LocalSelectionTransfer.getTransfer().setSelection(selectionSource.getSelection());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragSetData(DragSourceEvent event) {
- super.dragSetData(event);
- LocalSelectionTransfer.getTransfer().setSelection(selectionSource.getSelection());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragFinished(DragSourceEvent event) {
- LocalSelectionTransfer.getTransfer().setSelection(null);
- super.dragFinished(event);
- }
-
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/LocalPaletteInformationPage.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/LocalPaletteInformationPage.java
deleted file mode 100644
index 0fc299a24ce..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/LocalPaletteInformationPage.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.util.Arrays;
-
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.swt.SWT;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Wizard page for information about the new local palette definition
- */
-public class LocalPaletteInformationPage extends WizardPage implements Listener {
-
- /** array list of priorities */
- private static String[] priorityList;
-
- /** text area for the name of the palette definition */
- protected Text nameText;
-
- /** text area for the id of the palette definition */
- protected Text idText;
-
- /** text area for the editor id of the palette definition */
- protected Text editorText;
-
- /** combo for the priority of the provider */
- private Combo priorityCombo;
-
- /** parent composite for advanced fields */
- protected Composite advancedComposite;
-
- /** Button to show/hide advanced fields */
- protected Button advancedButton;
-
- /** editor part in which the palette is created */
- protected IEditorPart editorPart;
-
- /** priority value */
- protected ProviderPriority priority;
-
- /** editor ID value */
- protected String editorID;
-
- /** palette ID */
- protected String paletteID;
-
- /** palette name */
- protected String name;
-
- /** path to the icon */
- protected static final String WIZARD_ICON = "/icons/local_desc_wiz.png";
-
- /** validate on opening */
- protected boolean validateOnLaunch = false;
-
- static {
- priorityList = new String[] { ProviderPriority.LOWEST.getName(), ProviderPriority.LOW.getName(), ProviderPriority.MEDIUM.getName(), ProviderPriority.HIGH.getName(), ProviderPriority.HIGHEST.getName() };
- }
-
- /**
- * Creates a new wizard page with the given name, title, and image.
- *
- * @param part
- * the editor part in which the wizard was created
- */
- public LocalPaletteInformationPage(IEditorPart part) {
- super(Messages.Local_Palette_InfoPage_Name, Messages.Local_Palette_InfoPage_Title, Activator.getImageDescriptor(WIZARD_ICON));
- this.editorPart = part;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IWizardPage getNextPage() {
- LocalPaletteContentPage contentPage = (LocalPaletteContentPage) super.getNextPage();
- if (priority != null) {
- contentPage.setPriority(priority);
- contentPage.profileCombo.deselectAll();
- contentPage.profileCombo.select(contentPage.profileCombo.getItems().length - 1); // select the last one (UML)
- }
- return contentPage;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createControl(Composite parent) {
-
- // initialize dialog units
- initializeDialogUnits(parent);
-
- // Create a new composite as there is the title bar seperator
- // to deal with
- Composite control = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- control.setLayout(layout);
- control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setControl(control);
-
- createNameControl(control);
-
- createAdvancedControls(control);
-
- // end of the control creation
- Dialog.applyDialogFont(control);
-
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- if (validateOnLaunch) {
- setPageComplete(validatePage());
- }
- setControl(control);
- }
-
- /**
- * initializes fields using context information
- */
- public void intializeValues() {
- initName("");
- String editorIDValue = "";
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- editorIDValue = ((DiagramEditorWithFlyOutPalette) editorPart).getContributorId();
- }
- initEditorID(editorIDValue);
- initPaletteID(System.getProperty("user.name") + "_" + System.currentTimeMillis());
- initPriority(ProviderPriority.MEDIUM);
- }
-
- /**
- * initializes fields using existing descriptor
- */
- public void intializeValues(PapyrusPaletteService.LocalProviderDescriptor descriptor) {
- initName(descriptor.getContributionName());
- String editorIDValue = "";
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- editorIDValue = ((DiagramEditorWithFlyOutPalette) editorPart).getContributorId();
- }
- initEditorID(editorIDValue);
- initPaletteID(descriptor.getContributionID());
- initPriority(PapyrusPalettePreferences.getLocalPalettePriority(descriptor.getContributionID()));
- validateOnLaunch = true;
- }
-
- /**
- * Returns the current value of palette name
- *
- * @return the current value of palette name
- */
- public String getPaletteName() {
- return name;
- }
-
- /**
- * Returns the current value of palette ID
- *
- * @return the current value of palette ID
- */
- public String getPaletteID() {
- return paletteID;
- }
-
- /**
- * Returns the current value of editor ID
- *
- * @return the current value of editor ID
- */
- public String getEditorID() {
- return editorID;
- }
-
- /**
- * Returns the current value of editor ID
- *
- * @return the current value of editor ID
- */
- public ProviderPriority getPalettePriority() {
- return priority;
- }
-
- /**
- * inits the name field value
- *
- * @param value
- * value to set
- */
- protected void initName(String value) {
- name = value;
- }
-
- /**
- * inits the priority value
- *
- * @param value
- * value to set
- */
- protected void initPriority(ProviderPriority value) {
- if (value != null) {
- this.priority = value;
- } else {
- // by default, Medium
- this.priority = ProviderPriority.MEDIUM;
- }
- }
-
- /**
- * inits the palette id value
- *
- * @param value
- * value to set
- */
- protected void initPaletteID(String value) {
- paletteID = value;
-
- }
-
- /**
- * inits the editor id value
- *
- * @param value
- * value to set
- */
- protected void initEditorID(String value) {
- editorID = value;
- }
-
- /**
- * Validates the content of the fields in this page
- */
- protected boolean validatePage() {
- boolean valid = true;
- if (advancedComposite != null && !advancedComposite.isDisposed()) {
- if (-1 == priorityCombo.getSelectionIndex()) {
- setErrorMessage(Messages.Local_Palette_Error_Priority);
- valid = false;
- }
- if ("".equals(getEditorID())) {
- setErrorMessage(Messages.Local_Palette_Error_EditorId);
- valid = false;
- }
-
- if ("".equals(getPaletteID())) {
- setErrorMessage(Messages.Local_Palette_Error_PaletteId);
- valid = false;
- }
- }
-
- if ("".equals(getPaletteName())) {
- setErrorMessage(Messages.Local_Palette_Error_Name);
- valid = false;
- }
-
- if (valid) {
- setMessage(null);
- setErrorMessage(null);
- }
- return valid;
- }
-
- /**
- * Creates the widget for advanced options.
- *
- * @param parent
- * the parent composite
- */
- protected void createAdvancedControls(Composite parent) {
- advancedButton = new Button(parent, SWT.PUSH);
- advancedButton.setFont(parent.getFont());
- advancedButton.setText(Messages.Dialog_Advanced_Button_Closed);
- GridData data = setButtonLayoutData(advancedButton);
- data.horizontalAlignment = GridData.BEGINNING;
- data.horizontalSpan = 2;
- advancedButton.setLayoutData(data);
- advancedButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleAdvancedButtonSelect();
- }
- });
- }
-
- public Composite createAdvancedComposite(Composite parent) {
- advancedComposite = new Composite(parent, SWT.NONE);
- advancedComposite.setFont(parent.getFont());
- advancedComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- advancedComposite.setLayout(layout);
-
- createIDControl(advancedComposite);
-
- createEditorIDControl(advancedComposite);
-
- createPriorityControl(advancedComposite);
-
- advancedComposite.getParent().layout();
- return advancedComposite;
- }
-
- /**
- * Shows/hides the advanced option widgets.
- */
- protected void handleAdvancedButtonSelect() {
- Composite composite = (Composite) getControl();
-
- if (advancedComposite != null) {
- advancedComposite.dispose();
- advancedComposite = null;
- advancedButton.setText(Messages.Dialog_Advanced_Button_Closed);
- } else {
- createAdvancedComposite(composite);
- advancedButton.setText(Messages.Dialog_Advanced_Button_Opened);
- }
- }
-
- /**
- * creates the control area for the priority
- *
- * @param control
- * the parent composite
- */
- protected void createPriorityControl(Composite control) {
- final Label priorityLabel = new Label(control, SWT.NONE);
- priorityLabel.setText(Messages.Local_Palette_Priority);
- priorityLabel.setToolTipText(Messages.Local_Palette_Priority_Tooltip);
-
- // choice widget among priority values
- priorityCombo = new Combo(control, SWT.READ_ONLY);
- priorityCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- priorityCombo.setToolTipText(Messages.Local_Palette_Priority_Tooltip);
- priorityCombo.setItems(priorityList);
-
- // initialize, then add the listener...
- initialPopulatePriorityField();
-
- priorityCombo.addListener(SWT.Modify, this);
- }
-
- /**
- * intialize the field using current value of the palette id
- */
- protected void initialPopulatePriorityField() {
- priorityCombo.select(Arrays.asList(priorityList).indexOf(priority.getName()));
- }
-
- /**
- * creates the control area for the id definition
- *
- * @param control
- * the parent composite
- */
- protected void createIDControl(Composite control) {
- final Label idLabel = new Label(control, SWT.NONE);
- idLabel.setText(Messages.Local_Palette_Id);
- idLabel.setToolTipText(Messages.Local_Palette_Id_Tooltip);
-
- idText = new Text(control, SWT.BORDER);
- idText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- idText.setToolTipText(Messages.Local_Palette_Id_Tooltip);
-
- // initialize, then add the listener...
- initialPopulatePaletteIDField();
-
- idText.addListener(SWT.Modify, this);
- }
-
- /**
- * intialize the field using current value of the palette id
- */
- protected void initialPopulatePaletteIDField() {
- idText.setText(paletteID);
- }
-
- /**
- * creates the control area for the name definition
- *
- * @param control
- * the parent composite
- */
- protected void createNameControl(Composite control) {
- final Label nameLabel = new Label(control, SWT.NONE);
- nameLabel.setText(Messages.Local_Palette_Name);
- nameLabel.setToolTipText(Messages.Local_Palette_Name_Tooltip);
-
- nameText = new Text(control, SWT.BORDER);
- nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- nameText.setToolTipText(Messages.Local_Palette_Name_Tooltip);
-
- // initialize, then add the listener...
- initialPopulateNameField();
-
- nameText.addListener(SWT.Modify, this);
-
- }
-
- /**
- * creates the control area for the name definition
- *
- * @param control
- * the parent composite
- */
- protected void createEditorIDControl(Composite control) {
- final Label editorLabel = new Label(control, SWT.NONE);
- editorLabel.setText(Messages.Local_Palette_Editor_Id);
- editorLabel.setToolTipText(Messages.Local_Palette_Editor_Id_Tooltip);
-
- editorText = new Text(control, SWT.BORDER);
- editorText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- editorText.setToolTipText(Messages.Local_Palette_Editor_Id_Tooltip);
-
- // initialize, then add the listener...
- initialPopulateEditorIDField();
-
- editorText.addListener(SWT.Modify, this);
- // this editor should propose a list of existing editors = looking in the extension point?
- }
-
- /**
- * intialize the field using current value of the editor id
- */
- protected void initialPopulateEditorIDField() {
- editorText.setText(editorID);
- }
-
- /**
- * initialize name field
- */
- protected void initialPopulateNameField() {
- nameText.setText(name);
- }
-
- /**
- * The <code>WizardNewFileCreationPage</code> implementation of this <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
- @Override
- public void handleEvent(Event event) {
- Widget widget = event.widget;
- if (widget.equals(nameText)) {
- name = nameText.getText();
- } else if (widget.equals(idText)) {
- paletteID = idText.getText();
- } else if (widget.equals(editorText)) {
- editorID = editorText.getText();
- } else if (widget.equals(priorityCombo)) {
- priority = ProviderPriority.parse(priorityCombo.getText());
- }
- setPageComplete(validatePage());
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/NewDrawerWizard.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/NewDrawerWizard.java
deleted file mode 100644
index ebf866476b7..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/NewDrawerWizard.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.jface.wizard.Wizard;
-
-/**
- * Wizard to create a new Drawer from scratch
- */
-public class NewDrawerWizard extends Wizard {
-
- /** info page */
- protected DrawerInformationPage infoPage;
-
- /** the element where to add the new drawer */
- protected PaletteContainerProxy paletteContainerProxy;
-
- /**
- * Creates a NewDrawerWizard.
- *
- * @param paletteContainerProxy
- * the element where to add the new drawer
- */
- public NewDrawerWizard(PaletteContainerProxy paletteContainerProxy) {
- this.paletteContainerProxy = paletteContainerProxy;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
-
- infoPage = new DrawerInformationPage();
- addPage(infoPage);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- paletteContainerProxy.addChild(new PaletteLocalDrawerProxy(infoPage.getDrawerName(), infoPage.getDrawerID(), infoPage.getImageDescriptorPath(), infoPage.getDescription()));
- return true;
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/NewLocalPaletteWizard.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/NewLocalPaletteWizard.java
deleted file mode 100644
index f3726979ba0..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/NewLocalPaletteWizard.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.gef.ui.palette.PaletteCustomizer;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Wizard to create a new Local Palette Definition from scratch
- */
-public class NewLocalPaletteWizard extends Wizard {
-
- /** Editor part in which the new palette will be created */
- protected IEditorPart editorPart;
-
- /** palette customizer */
- protected PaletteCustomizer customizer;
-
- /** content page */
- protected LocalPaletteContentPage contentPage;
-
- /** info page */
- protected LocalPaletteInformationPage infoPage;
-
- /**
- * Creates a NewLocalPaletteWizard.
- *
- * @param part
- * the editor part where the palette will be available
- */
- public NewLocalPaletteWizard(IEditorPart part, PaletteCustomizer customizer) {
- this.editorPart = part;
- this.customizer = customizer;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
-
- // first paeg: name, id, etc.
- infoPage = new LocalPaletteInformationPage(editorPart);
- // initialize values
- infoPage.intializeValues();
-
- // second page: describe the paletteContent
- contentPage = new LocalPaletteContentPage(editorPart, customizer);
- contentPage.initializeContent();
-
- addPage(infoPage);
- addPage(contentPage);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- // contentPage.restorePreferences();
- // file has been created or updated
- contentPage.performFinish(PapyrusPalettePreferences.getPalettePathFromID(infoPage.getPaletteID()));
-
- // generate the preference for local palette
- PapyrusPalettePreferences.addLocalPalette(infoPage.getPaletteID(), infoPage.getPaletteName(), infoPage.getPalettePriority(), infoPage.getEditorID(), contentPage.getRequiredProfiles());
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performCancel() {
- // contentPage.restorePreferences();
- return super.performCancel();
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteAspectToolEntryProxy.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteAspectToolEntryProxy.java
deleted file mode 100644
index d0e2d6ae469..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteAspectToolEntryProxy.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectCreationEntry;
-import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectAction;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IPaletteAspectToolEntryProxy;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IPostAction;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IPreAction;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.StereotypePostAction;
-import org.eclipse.swt.graphics.Image;
-import org.w3c.dom.NodeList;
-
-/**
- * Proxy for the aspect tool entries
- */
-public class PaletteAspectToolEntryProxy extends PaletteEntryProxy implements IPaletteAspectToolEntryProxy {
-
- /** list of post actions executed by the tool */
- protected List<IPostAction> postActions = new ArrayList<IPostAction>();
-
- /** list of pre actions executed by the tool */
- protected List<IPreAction> preActions = new ArrayList<IPreAction>();
-
- /**
- * Creates a new {@link PaletteAspectToolEntryProxy}
- *
- * @param entry
- * the proxied entry
- */
- public PaletteAspectToolEntryProxy(AspectCreationEntry entry) {
- super(entry);
-
- initAspectActions();
- }
-
- /**
- * returns the list of post actions attached to this {@link PaletteAspectToolEntryProxy}
- *
- * @return the list of post actions attached to this {@link PaletteAspectToolEntryProxy}
- */
- public List<IPostAction> getPostActions() {
- return postActions;
- }
-
- /**
- * Sets the list of post actions attached to this {@link PaletteAspectToolEntryProxy}
- * <p>
- * Warning! This should not be used to initialize the list of action, only move the already existing actions.
- * </p>
- *
- * @param postActions
- * the postActions to set
- */
- public void setPostActions(List<IPostAction> postActions) {
- this.postActions = postActions;
- }
-
- /**
- * returns the list of pre actions attached to this {@link PaletteAspectToolEntryProxy}
- *
- * @return the list of pre actions attached to this {@link PaletteAspectToolEntryProxy}
- */
- public List<IPreAction> getPreActions() {
- return preActions;
- }
-
- /**
- * Sets the list of pre actions attached to this {@link PaletteAspectToolEntryProxy}
- * <p>
- * Warning! This should not be used to initialize the list of action, only move the already existing actions.
- *
- * @param preActions
- * the preActions to set
- */
- protected void setPreActions(List<IPreAction> preActions) {
- this.preActions = preActions;
- }
-
- /**
- * returns the list of aspect actions attached to this {@link PaletteAspectToolEntryProxy}
- *
- * @return the list of aspect actions attached to this {@link PaletteAspectToolEntryProxy}
- */
- public List<IAspectAction> getAspectActions() {
- List<IAspectAction> actions = new ArrayList<IAspectAction>();
- actions.addAll(preActions);
- actions.addAll(postActions);
- return actions;
- }
-
- /**
- * Initializes the aspect actions
- */
- protected void initAspectActions() {
- Object value = getEntry().getAspectProperties(IPapyrusPaletteConstant.ASPECT_ACTION_KEY);
- if (value instanceof NodeList) {
- PaletteUtil.initAspectActions((NodeList) value, postActions, preActions);
- }
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public String getDescription() {
- return getEntry().getDescription();
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public String getImagePath() {
- String path = getEntry().getIconPath();
- return (path != null) ? path : "";
- }
-
- /**
- * returns the small icon of the cached entry
- *
- * @return the small icon of the cached entry
- */
- @Override
- public Image getImage() {
- if (getImagePath() != null && !getImagePath().equals("")) {
- return Activator.getPluginIconImage(Activator.ID, getImagePath());
- }
- return super.getImage();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public AspectCreationEntry getEntry() {
- return (AspectCreationEntry) super.getEntry();
- }
-
- /**
- * Returns the ID of the referenced entry of the aspect entry
- *
- * @return the ID of the referenced entry of the aspect entry
- */
- public String getReferencedPaletteID() {
- return getEntry().getReferencedEntry().getId();
- }
-
- /**
- * Returns the list of stereotypes Qualified names to apply
- *
- * @return the list of stereotypes qualified names to apply
- */
- public List<String> getStereotypesQNList() {
- List<String> list = new ArrayList<String>();
- for (IAspectAction action : postActions) {
- if (action instanceof StereotypePostAction) {
- list.addAll(((StereotypePostAction) action).getStereotypesToApply());
- }
- }
- return list;
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationContentPage.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationContentPage.java
deleted file mode 100644
index 499cafe530e..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationContentPage.java
+++ /dev/null
@@ -1,1498 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009, 2014 CEA LIST, Christian W. Damus, and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 454578
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - new implemenatation for palette configuration model case
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.Diagnostician;
-import org.eclipse.emf.ecore.util.EContentAdapter;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
-import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
-import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
-import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.gef.palette.PaletteDrawer;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.palette.PaletteStack;
-import org.eclipse.gef.palette.PaletteToolbar;
-import org.eclipse.gef.palette.ToolEntry;
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.customization.palette.provider.PaletteLabelProvider;
-import org.eclipse.papyrus.customization.palette.provider.ProfileToolsMetaclassStereotypeTreeContentProvider;
-import org.eclipse.papyrus.customization.palette.provider.ProfileToolsStereotypeMetaclassTreeContentProvider;
-import org.eclipse.papyrus.customization.palette.provider.UMLToolsTreeContentProvider;
-import org.eclipse.papyrus.infra.properties.ui.runtime.DisplayEngine;
-import org.eclipse.papyrus.infra.properties.ui.util.PropertiesDisplayHelper;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ChildConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Configuration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.DrawerConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.LeafConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteconfigurationFactory;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.SeparatorConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.StackConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ToolConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.utils.CreatePaletteItemUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FillLayout;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.Stereotype;
-
-/**
- * Wizard page for information about the new local palette definition
- */
-public class PaletteConfigurationContentPage extends WizardPage {
-
- /** icon path for the add button */
- protected static final String ADD_ICON = "/icons/arrow_right.gif"; //$NON-NLS-1$
-
- /** icon path for the create drawer button */
- protected static final String CREATE_DRAWERS_ICON = "/icons/new_drawer.gif";//$NON-NLS-1$
-
- /** icon path for the create separator button */
- protected static final String CREATE_SEPARATOR_ICON = "/icons/new_separator.gif";//$NON-NLS-1$
-
- /** icon path for the create stack button */
- protected static final String CREATE_STACK_ICON = "/icons/new_stack.gif";//$NON-NLS-1$
-
- /** icon path for the create stack button */
- protected static final String CREATE_TOOL_ICON = "/icons/new_tool.gif";//$NON-NLS-1$
-
- /** icon path for the delete button */
- protected static final String DELETE_ICON = "/icons/delete.gif";//$NON-NLS-1$
-
- /** icon path for the remove button */
- protected static final String REMOVE_ICON = "/icons/arrow_left.gif"; //$NON-NLS-1$
-
- /** icon path when tools are shown */
- protected static final String SHOWN_TOOLS_ICON = "/icons/tools_shown.gif"; //$NON-NLS-1$
-
- /** path to the icon */
- protected static final String WIZARD_ICON = "/icons/local_desc_wiz.png";//$NON-NLS-1$
-
- /** icon for the content provider switch button */
- protected String SWITCH_CONTENT_PROVIDER_ICON = "/icons/switch_provider.gif"; //$NON-NLS-1$
-
- /** the label for drawer */
- private static final String DRAWER_LABEL = Messages.PaletteConfigurationContentPage_Drawer;
-
- /** The label for new tool */
- private static final String NEW_TOOL_LABEL = Messages.PaletteConfigurationContentPage_NewTool;
-
- /** the label for separator */
- private static final String SEPARATOR_LABEL = Messages.PaletteConfigurationContentPage_Separator;
-
- /** the label for stack */
- private static final String STACK_LABEL = Messages.PaletteConfigurationContentPage_Stack;
-
- /** label for the standard tools */
- private static final String UML_TOOLS_LABEL = Messages.PaletteConfigurationContentPage_UMLTools;
-
- /** Validator key for toolbar items */
- private final static String VALIDATOR = "validator"; //$NON-NLS-1$
-
- /** the add button */
- private Button addButton;
-
- /** the remove button */
- private Button removeButton;
-
- /** the tree viewer for available tools */
- private TreeViewer availableToolsViewer;
-
- /** combo to select which profile tools should be visible */
- private Combo profileCombo;
-
- /** list of profiles that can provide tools */
- private List<String> profileComboList = new ArrayList<String>();
-
- /** the tree viewer for the edited palette */
- private TreeViewer paletteTreeViewer;
-
- /** the display engine */
- private DisplayEngine displayEngine;
-
- /** instance of the filter used to show/hide drawers */
- private final ViewerFilter drawerFilter = new DrawerFilter();
-
- /** the editing domain */
- private AdapterFactoryEditingDomain editingDomain;
-
- /** editor part in which the palette is created */
- private IEditorPart editorPart;
-
- /** the label provider for the edited palette */
- private PaletteLabelProvider paletteLabelProvider;
-
- /** priority of the current edited palette */
- private ProviderPriority priority;
-
- /** the properties composite */
- private Composite propertiesComposite;
-
- /** tool item in charge of toggling content providers in the available tool viewer */
- protected ToolItem toggleContentProvider;
-
- /** the toolbar for actions on edited palette */
- private ToolBar toolbar;
-
- /** instance of the filter used to show/hide tools */
- private final ViewerFilter toolFilter = new ToolFilter();
-
- /** enumeration of existing entry types */
- public enum EntryType {
- ASPECT_TOOL, DRAWER, SEPARATOR, STACK, TOOL
- }
-
- /**
- * Filter for the viewer. Hide/show Drawers
- */
- protected class DrawerFilter extends ViewerFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
- boolean notDrawer = true;
- if (element instanceof PaletteDrawer) {
- notDrawer = false;
- }
- return notDrawer;
- }
- }
-
- /**
- * A viewer comparator for label of Palette Entry
- */
- protected class LabelViewerComparator extends ViewerComparator {
-
- /**
- * Creates a new LabelViewerComparator.
- */
- public LabelViewerComparator() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int compare(final Viewer testViewer, final Object e1, final Object e2) {
- String label1 = "";//$NON-NLS-1$
- String label2 = "";//$NON-NLS-1$
-
- if (e1 instanceof PaletteEntry) {
- label1 = ((PaletteEntry) e1).getLabel();
- } else if (e1 instanceof Stereotype) {
- label1 = ((Stereotype) e1).getName();
- }
- if (e2 instanceof PaletteEntry) {
- label2 = ((PaletteEntry) e2).getLabel();
- } else if (e2 instanceof Stereotype) {
- label2 = ((Stereotype) e2).getName();
- }
-
- int comparaison;
- if (null == label1 && null == label2) {
- comparaison = 0;
- } else if (null == label1) {
- comparaison = 1;
- } else if (null == label2) {
- comparaison = -1;
- } else {
- comparaison = label1.compareTo(label2);
- }
- return comparaison;
- }
- }
-
- /**
- * Validator for the create separator or stack tool item. Only valid when selection is a {@link PaletteEntryProxy} or a {@link PaletteLocalDrawerProxy}
- */
- protected class PaletteConfigurationEntrySelectedValidator implements ToolBarItemValidator {
-
- /**
- * @{inheritDoc
- */
- @Override
- public boolean isEnable() {
- boolean enable = false;
- // retrieve selection
- if (null != paletteTreeViewer && !paletteTreeViewer.getControl().isDisposed()) {
- // retrieve selection. first element should be a drawer
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (null != selection) {
- Object object = selection.getFirstElement();
- enable = (object instanceof Configuration);
- }
- }
- return enable;
- }
- }
-
-
- /**
- * validator for the create separator or stack tool item. Only valid when selection is a {@link PaletteEntryProxy} or a {@link PaletteLocalDrawerProxy}
- */
- protected class PaletteConfigurationStackLeafSelectedValidator implements ToolBarItemValidator {
-
- /**
- * @{inheritDoc
- */
- @Override
- public boolean isEnable() {
- boolean enable = false;
- // retrieve selection
- if (paletteTreeViewer != null && !paletteTreeViewer.getControl().isDisposed()) {
- // retrieve selection. first element should be a drawer
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (null != selection) {
- Object object = selection.getFirstElement();
- enable = (object instanceof Configuration && !(((Configuration) object).eContainer() instanceof StackConfiguration));
- }
- }
- return enable;
- }
- }
-
-
-
- /**
- * Listener for the profile combo. It changes the input of the following viewer.
- */
- protected class ProfileComboSelectionListener implements SelectionListener, ModifyListener {
-
- /**
- * handles the change selection for the combo
- */
- protected void handleSelectionChanged() {
- int index = profileCombo.getSelectionIndex();
- if (0 <= index && index < profileCombo.getItems().length) {
- String name = profileComboList.get(index);
-
- Collection<PaletteEntry> standardEntries = getAllVisibleStandardEntries();
- // retrieve the profile or uml standards tools to display
- if (UML_TOOLS_LABEL.equals(name)) {
- // change content provider
- availableToolsViewer.setContentProvider(new UMLToolsTreeContentProvider());
- availableToolsViewer.setInput(standardEntries);
- toggleContentProvider.setEnabled(false);
- } else {
- if (null != toggleContentProvider && !toggleContentProvider.isDisposed()) {
- toggleContentProvider.setEnabled(true);
- }
- // switch content provider
- // this is a profile in case of uml2 tools
- Profile profile = getAllAppliedProfiles().get(index);
- if (toggleContentProvider.getSelection()) {
- availableToolsViewer.setContentProvider(new ProfileToolsStereotypeMetaclassTreeContentProvider(profile, standardEntries));
- } else {
- availableToolsViewer.setContentProvider(new ProfileToolsMetaclassStereotypeTreeContentProvider(profile, standardEntries));
- }
-
- // generate tools for given profile
- availableToolsViewer.setInput(profile);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void modifyText(final ModifyEvent e) {
- handleSelectionChanged();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void widgetDefaultSelected(final SelectionEvent e) {
- // Do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void widgetSelected(final SelectionEvent e) {
- handleSelectionChanged();
- }
- }
-
-
- /**
- * Item validator interface
- */
- interface ToolBarItemValidator {
-
- /**
- * Checks if the button should be enable or not
- *
- * @return <code>true</code> if the button should be enable
- */
- public boolean isEnable();
- }
-
- /**
- * Filter for the viewer. Hide/show Drawers
- */
- protected class ToolFilter extends ViewerFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
- return !(element instanceof ToolEntry);
- }
- }
-
- /** Listener to validate page on change. */
- EContentAdapter adapter = new EContentAdapter() {
- /**
- * @see org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification)
- */
- @Override
- public void notifyChanged(Notification msg) {
- setPageComplete(validatePage());
- }
- };
-
- /** the palette configuration model */
- private PaletteConfiguration paletteConfigurationModel;
-
- /**
- * Constructor.
- *
- * @param editorPart
- * @param editingDomain
- */
- public PaletteConfigurationContentPage(final IEditorPart editorPart, final AdapterFactoryEditingDomain editingDomain) {
- super(Messages.Local_Palette_ContentPage_Name, Messages.Local_Palette_ContentPage_Title, Activator.getImageDescriptor(WIZARD_ICON));
- this.editorPart = editorPart;
- this.editingDomain = editingDomain;
- paletteConfigurationModel = getPaletteConfigurationModel();
- paletteConfigurationModel.eAdapters().add(adapter);
- }
-
- /**
- * Constructor.
- *
- * @param pageName
- */
- protected PaletteConfigurationContentPage(final String pageName) {
- super(pageName);
- }
-
- /**
- * Add drag support from the available tools viewer
- */
- protected void addAvailableToolsDragSupport() {
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
- int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
- // drag listener
-
- availableToolsViewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(availableToolsViewer));
- }
-
-
- /**
- * Adds drag ability to the palette preview composite
- */
- protected void addPalettePreviewDragSupport() {
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
- int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
- // drag listener
- paletteTreeViewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(paletteTreeViewer));
- }
-
- /**
- * Add drop behavior for the palette preview
- */
- protected void addPalettePreviewDropSupport() {
- // transfer types
- Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
- int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
- EditingDomainViewerDropAdapter listener = new EditingDomainViewerDropAdapter(editingDomain, paletteTreeViewer) {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dragEnter(final DropTargetEvent event) {
- super.dragEnter(event);
- expandItem(event);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void drop(final DropTargetEvent event) {
- super.drop(event);
- expandItem(event);
- }
-
- /**
- * Expand the TreeItem from the event
- *
- * @param event
- */
- private void expandItem(final DropTargetEvent event) {
- // Expands branch when over it to show children
- if (event.item instanceof TreeItem) {
- // Get the target Object of the drop
- Object target = ((TreeItem) event.item).getData();
- if (target == null) {
- target = paletteTreeViewer.getInput();
- }
- // Expand tree
- paletteTreeViewer.expandToLevel(target, 1);
- }
- }
-
- };
-
- paletteTreeViewer.addDropSupport(dndOperations, transfers, listener);
- }
-
- /**
- * Creates the add button listener
- */
- protected MouseListener createAddButtonListener() {
- return new MouseAdapter() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- // add the element selected on the left to the right tree
- // check the selection.
- IStructuredSelection selection = (IStructuredSelection) availableToolsViewer.getSelection();
- if (selection == null || selection.size() < 1) {
- return;
- }
- PaletteEntry entry = (PaletteEntry) selection.getFirstElement();
- if (entry == null) {
- return;
- }
-
- // find the selection on the right
- selection = (IStructuredSelection) paletteTreeViewer.getSelection();
-
- Configuration target = (Configuration) selection.getFirstElement();
-
- // Create Entry
- CompoundCommand command = new CompoundCommand();
- ToolConfiguration node = CreatePaletteItemUtil.createToolConfiguration(entry, editingDomain.getResourceSet());
- if (null != node) {
- if (target instanceof PaletteConfiguration) {
- // ((PaletteConfiguration) target).getDrawerConfigurations().add((DrawerConfiguration) node);
- command.append(new AddCommand(editingDomain, ((PaletteConfiguration) target).getDrawerConfigurations(), (DrawerConfiguration) node));
- } else if (target instanceof DrawerConfiguration) {
- // ((DrawerConfiguration) target).getOwnedConfigurations().add((ChildConfiguration) node);
- command.append(new AddCommand(editingDomain, ((DrawerConfiguration) target).getOwnedConfigurations(), (ChildConfiguration) node));
- } else if (target instanceof StackConfiguration) {
- // ((StackConfiguration) target).getOwnedConfigurations().add((LeafConfiguration) node);
- command.append(new AddCommand(editingDomain, ((StackConfiguration) target).getOwnedConfigurations(), (LeafConfiguration) node));
- }
- }
- command.append(CreatePaletteItemUtil.createElementTypesElement(editingDomain, (ToolEntry) entry, node));
- execute(command);
- // Expand tree
- paletteTreeViewer.expandToLevel(target, 1);
- }
- };
- }
-
- /**
- * creates the buttons to add/remove entries from palette entrey and palette preview
- */
- protected void createAddRemoveButtons() {
- Composite composite = new Composite((Composite) getControl(), SWT.NONE);
- GridLayout layout = new GridLayout(1, true);
- composite.setLayout(layout);
-
- GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, true);
- composite.setLayoutData(data);
-
- addButton = new Button(composite, SWT.NONE);
- addButton.setImage(Activator.getPluginIconImage(Activator.ID, ADD_ICON));
- addButton.setToolTipText(Messages.PapyrusPaletteCustomizerDialog_AddButtonTooltip);
- addButton.addMouseListener(createAddButtonListener());
- addButton.setEnabled(false);
-
- removeButton = new Button(composite, SWT.NONE);
- removeButton.setImage(Activator.getPluginIconImage(Activator.ID, REMOVE_ICON));
- removeButton.setToolTipText(Messages.PapyrusPaletteCustomizerDialog_RemoveButtonTooltip);
- removeButton.addMouseListener(createRemoveButtonListener());
- removeButton.setEnabled(false);
- }
-
- /**
- * creates the available entries group
- */
- protected void createAvailableToolsGroup() {
- Composite parent = (Composite) getControl();
- Composite availableToolsComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- availableToolsComposite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- availableToolsComposite.setLayoutData(data);
-
- Label label = new Label(availableToolsComposite, SWT.NONE);
- label.setText(Messages.Local_Palette_Available_Tools);
- data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- label.setLayoutData(data);
-
- ToolBar toolbar = new ToolBar(availableToolsComposite, SWT.HORIZONTAL);
- data = new GridData(SWT.RIGHT, SWT.FILL, false, false);
- toolbar.setLayoutData(data);
- populateAvailableToolsToolBar(toolbar);
-
- createProfileCombo(availableToolsComposite);
-
- Tree tree = new Tree(availableToolsComposite, SWT.SINGLE | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- data.widthHint = 350;
- // Make the tree this tall even when there is nothing in it. This will keep the
- // dialog from shrinking to an unusually small size.
- data.heightHint = 200;
- tree.setLayoutData(data);
- availableToolsViewer = new TreeViewer(tree);
- availableToolsViewer.setContentProvider(new UMLToolsTreeContentProvider());
- paletteLabelProvider = new PaletteLabelProvider();
- availableToolsViewer.setLabelProvider(paletteLabelProvider);
- ViewerComparator labelComparator = new LabelViewerComparator();
- availableToolsViewer.setComparator(labelComparator);
- // remove the note stack and standard group
- availableToolsViewer.addFilter(new ViewerFilter() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
- boolean visible = true;
- if (element instanceof PaletteStack && "noteStack".equals(((PaletteStack) element).getId())) {//$NON-NLS-1$
- visible = false;
- } else if (element instanceof PaletteToolbar && "standardGroup".equals(((PaletteToolbar) element).getId())) {//$NON-NLS-1$
- visible = false;
- }
- return visible;
- }
- });
- availableToolsViewer.addFilter(new DrawerFilter());
-
- // add drag support
- addAvailableToolsDragSupport();
-
- // init availableTools combo on the first elemet
- profileCombo.deselectAll();
- profileCombo.select(profileCombo.getItems().length - 1); // select the last one (UML)
- }
-
-
-
- /**
- * Creates a toolbar item which can be checked.
- *
- * @param toolbar
- * the parent toolbar
- * @param shownElementsIcon
- * path for shown elements icon
- * @param listener
- * listener for button action
- * @param tooltip
- * tooltip text for the toolbar item
- */
- protected ToolItem createCheckToolBarItem(final ToolBar toolbar, final String shownElementsIcon, final String tooltip, final Listener listener) {
- ToolItem item = new ToolItem(toolbar, SWT.CHECK | SWT.BORDER);
- item.setImage(Activator.getPluginIconImage(Activator.ID, shownElementsIcon));
- item.setToolTipText(tooltip);
- item.addListener(SWT.Selection, listener);
- return item;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- *
- * @param parent
- */
- @Override
- public void createControl(final Composite parent) {
-
- // initialize dialog units
- initializeDialogUnits(parent);
-
- // Create a new composite as there is the title bar seperator
- // to deal with
- Composite control = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- control.setLayout(layout);
- control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setControl(control);
-
- // create Available Tools Group
- createAvailableToolsGroup();
-
- // create add/remove buttons
- createAddRemoveButtons();
-
- // Create palette preview
- createPalettePreviewGroup();
-
- // Create properties view
- createPropertiesGroup();
-
- // add listeners inter-groups
- ISelectionChangedListener listener = createToolsViewerSelectionChangeListener();
- availableToolsViewer.addSelectionChangedListener(listener);
- paletteTreeViewer.addSelectionChangedListener(listener);
-
- // end of the control creation
- Dialog.applyDialogFont(control);
-
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setPageComplete(validatePage());
- }
-
- /**
- * Creates the listener for the new drawer tool item
- *
- * @return the listener created
- */
- protected Listener createNewDrawerListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(final Event event) {
-
- EObject palette = editingDomain.getResourceSet().getResources().get(0).getContents().get(0);
- if (palette instanceof PaletteConfiguration) {
- // Create a void drawer
- DrawerConfiguration drawer = PaletteconfigurationFactory.eINSTANCE.createDrawerConfiguration();
- // Set label
- drawer.setLabel(DRAWER_LABEL);
- // Set the drawer on the palette configuration
- EList<DrawerConfiguration> drawerConfigurations = ((PaletteConfiguration) palette).getDrawerConfigurations();
- // Create add command
- Command addCommand = new AddCommand(editingDomain, drawerConfigurations, drawer);
- // Execute add command
- execute(addCommand);
- paletteTreeViewer.refresh();
- }
- }
- };
- }
-
- /**
- * Creates the listener for the new separator tool item
- *
- * @return the listener created
- */
- protected Listener createNewSeparatorListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(final Event event) {
- // retrieve selected element
- Object object = ((IStructuredSelection) paletteTreeViewer.getSelection()).getFirstElement();
- // Create a separator
- SeparatorConfiguration separator = PaletteconfigurationFactory.eINSTANCE.createSeparatorConfiguration();
- // Set label & Id
- separator.setLabel(SEPARATOR_LABEL);
- separator.setId(CreatePaletteItemUtil.generateID(SEPARATOR_LABEL));
- Command addCommand = null;
- if (object instanceof DrawerConfiguration) {
- // Add separator at the end of drawer own configuration
- addCommand = new AddCommand(editingDomain, ((DrawerConfiguration) object).getOwnedConfigurations(), separator);
- } else if (object instanceof ChildConfiguration) {
- // retrieve parent
- EList<ChildConfiguration> ownedConfigurations = ((DrawerConfiguration) ((ChildConfiguration) object).eContainer()).getOwnedConfigurations();
- int index = ownedConfigurations.indexOf(object);
- // adds the separator
- addCommand = new AddCommand(editingDomain, ownedConfigurations, separator, index);
- }
- // Execute add command
- execute(addCommand);
-
- paletteTreeViewer.expandToLevel(object, 1);
- paletteTreeViewer.refresh();
- }
- };
- }
-
- /**
- * Creates the listener for the new stack tool item
- *
- * @return the listener created
- */
- protected Listener createNewStackListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(final Event event) {
- // retrieve selected element
- Object object = ((IStructuredSelection) paletteTreeViewer.getSelection()).getFirstElement();
- // Create a separator
- StackConfiguration stack = PaletteconfigurationFactory.eINSTANCE.createStackConfiguration();
- // Set label & Id
- stack.setLabel(STACK_LABEL);
- stack.setId(CreatePaletteItemUtil.generateID(STACK_LABEL));
- Command addCommand = null;
- if (object instanceof DrawerConfiguration) {
- // Add separator at the end of drawer own configuration
- addCommand = new AddCommand(editingDomain, ((DrawerConfiguration) object).getOwnedConfigurations(), stack);
- } else if (object instanceof ChildConfiguration) {
- // retrieve parent
- EList<ChildConfiguration> ownedConfigurations = ((DrawerConfiguration) ((ChildConfiguration) object).eContainer()).getOwnedConfigurations();
- int index = ownedConfigurations.indexOf(object);
- // adds the stack
- addCommand = new AddCommand(editingDomain, ownedConfigurations, stack, index);
- }
- execute(addCommand);
-
- paletteTreeViewer.expandToLevel(object, 1);
- paletteTreeViewer.refresh();
- }
-
- };
- }
-
- /**
- * Execute command in the command stack.
- */
- protected void execute(final Command command) {
- if (null != command && command.canExecute()) {
- editingDomain.getCommandStack().execute(command);
- }
- }
-
- /**
- * Creates the listener for the new tool item
- *
- * @return the listener created
- */
- protected Listener createNewToolListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(Event event) {
- // retrieve selected element
- Object object = ((IStructuredSelection) paletteTreeViewer.getSelection()).getFirstElement();
- // Create a separator
- ToolConfiguration tool = PaletteconfigurationFactory.eINSTANCE.createToolConfiguration();
- // Set label & Id
- tool.setLabel(NEW_TOOL_LABEL);
- Command addCommand = null;
- if (object instanceof DrawerConfiguration || object instanceof StackConfiguration) {
- // Add separator at the end of drawer own configuration
- if (object instanceof DrawerConfiguration) {
- addCommand = new AddCommand(editingDomain, ((DrawerConfiguration) object).getOwnedConfigurations(), tool);
- } else if (object instanceof StackConfiguration) {
- addCommand = new AddCommand(editingDomain, ((StackConfiguration) object).getOwnedConfigurations(), tool);
- }
- } else if (object instanceof ChildConfiguration) {
- // retrieve parent
- EObject eContainer = ((EObject) object).eContainer();
- // add as sibling of the object
- if (eContainer instanceof DrawerConfiguration) {
- EList<ChildConfiguration> ownedConfigurations = ((DrawerConfiguration) eContainer).getOwnedConfigurations();
- int index = ownedConfigurations.indexOf(object);
- addCommand = new AddCommand(editingDomain, ownedConfigurations, tool, index);
- } else if (eContainer instanceof StackConfiguration) {
- EList<LeafConfiguration> ownedConfigurations = ((StackConfiguration) eContainer).getOwnedConfigurations();
- int index = ownedConfigurations.indexOf(object);
- addCommand = new AddCommand(editingDomain, ownedConfigurations, tool, index);
- }
- }
- execute(addCommand);
- paletteTreeViewer.expandToLevel(object, 1);
- paletteTreeViewer.refresh();
- }
- };
- }
-
- /**
- * creates the palette preview group
- */
- protected void createPalettePreviewGroup() {
- Composite parent = (Composite) getControl();
- Composite paletteComposite = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout(2, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- paletteComposite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- paletteComposite.setLayoutData(data);
-
- Label label = new Label(paletteComposite, SWT.NONE);
- label.setText(Messages.Local_Palette_Palette_Preview);
- data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- label.setLayoutData(data);
-
- toolbar = new ToolBar(paletteComposite, SWT.HORIZONTAL);
- data = new GridData(SWT.RIGHT, SWT.FILL, false, false);
- toolbar.setLayoutData(data);
- populatePalettePreviewToolBar(toolbar);
-
- Tree tree = new Tree(paletteComposite, SWT.SINGLE | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- data.widthHint = 350;
- // Make the tree this tall even when there is nothing in it. This will keep the
- // dialog from shrinking to an unusually small size.
- data.heightHint = 200;
- tree.setLayoutData(data);
-
- paletteTreeViewer = new TreeViewer(tree);
-
- paletteTreeViewer.setContentProvider(new AdapterFactoryContentProvider(editingDomain.getAdapterFactory()));
- paletteTreeViewer.setLabelProvider(new AdapterFactoryLabelProvider(editingDomain.getAdapterFactory()));
- paletteTreeViewer.setInput(editingDomain.getResourceSet());
-
- paletteTreeViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
-
- new AdapterFactoryTreeEditor(paletteTreeViewer.getTree(), editingDomain.getAdapterFactory());
-
- paletteTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handlePalettePreviewSelectionChanged(event);
- }
- });
-
- // Refresh button
- handlePalettePreviewSelectionChanged(null);
- addPalettePreviewDropSupport();
- addPalettePreviewDragSupport();
- }
-
- /**
- * Creates the profile combo
- *
- * @param availableToolsComposite
- * the available tools composite
- * @return the created combo
- */
- protected Combo createProfileCombo(final Composite availableToolsComposite) {
- // retrieve top package, to know which profiles are available
- // creates the combo
- profileCombo = new Combo(availableToolsComposite, SWT.BORDER | SWT.READ_ONLY);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- profileCombo.setLayoutData(data);
-
- // retrieve all applied profiles
- List<Profile> profiles = getAllAppliedProfiles();
-
- int profileNumber = profiles.size();
- for (int i = 0; i < profileNumber; i++) {
- String name;
- if (profiles.get(i).eIsProxy()) {
- name = NLS.bind("<unresolved: {0}>", URI.decode(EcoreUtil.getURI(profiles.get(i)).lastSegment())); //$NON-NLS-1$
- } else {
- name = profiles.get(i).getName();
- if (name == null) {
- name = NLS.bind("<unnamed: {0}>", URI.decode(EcoreUtil.getURI(profiles.get(i)).lastSegment())); //$NON-NLS-1$
- }
- }
- profileComboList.add(i, name);
- }
- profileComboList.add(UML_TOOLS_LABEL);
- profileCombo.setItems(profileComboList.toArray(new String[] {}));
-
- // add selection listener for the combo. selects the "UML tools" item
- ProfileComboSelectionListener listener = new ProfileComboSelectionListener();
- profileCombo.addSelectionListener(listener);
- profileCombo.addModifyListener(listener);
-
- return profileCombo;
- }
-
- /**
- * create the properties group
- */
- protected void createPropertiesGroup() {
- Composite parent = (Composite) getControl();
-
- Label entryInformationLabel = new Label(parent, SWT.NONE);
- entryInformationLabel.setText(Messages.Local_Palette_Entry_Information);
- {
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.horizontalSpan = 3;
- entryInformationLabel.setLayoutData(data);
- }
-
- propertiesComposite = new Composite(parent, SWT.NONE);
- FillLayout layout = new FillLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- propertiesComposite.setLayout(layout);
- {
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.horizontalSpan = 3;
- data.heightHint = 240;
- propertiesComposite.setLayoutData(data);
- }
-
- }
-
- /**
- * Creates the add button listener.
- */
- protected MouseListener createRemoveButtonListener() {
- return new MouseAdapter() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void mouseUp(final MouseEvent e) {
- deleteSelectedConfiguration();
- }
- };
- }
-
- /**
- * Creates the listener for the remove item(s) button.
- *
- * @return the listener for the remove button
- */
- protected Listener createRemoveElementListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(final Event event) {
- deleteSelectedConfiguration();
- }
-
- };
- }
-
- /**
- * Delete the selection configuration in the paletteTreeViewer.
- */
- protected void deleteSelectedConfiguration() {
- IStructuredSelection selection = (IStructuredSelection) paletteTreeViewer.getSelection();
- if (null != selection && 1 <= selection.size()) {
- Iterator<?> it = selection.iterator();
- while (it.hasNext()) {
- Object object = it.next();
- if (object instanceof Configuration) {
- Command deleteCommand = new AbstractCommand() {
-
- @Override
- public void redo() {
- execute();
- }
-
- @Override
- public void execute() {
- EcoreUtil.delete((EObject) object);
- }
-
- @Override
- public boolean prepare() {
- return true;
- }
- };
- deleteCommand.canExecute();
- editingDomain.getCommandStack().execute(deleteCommand);
- }
- }
- paletteTreeViewer.refresh();
- // remove the properties view
- if (null != displayEngine) {
- displayEngine.removeSection(propertiesComposite);
- }
- }
- }
-
- /**
- * creates the tool item for drawers visibility listener
- *
- * @return the listener for the tool button
- */
- protected Listener createShowDrawerListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(final Event event) {
- if (event.widget instanceof ToolItem) {
- ToolItem item = ((ToolItem) event.widget);
- if (item.getSelection()) {
- // elements should be hidden
- availableToolsViewer.addFilter(drawerFilter);
- item.setSelection(true);
- } else {
- availableToolsViewer.removeFilter(drawerFilter);
- item.setSelection(false);
- }
- }
- }
- };
- }
-
- /**
- * creates the tool item for tools visibility listener
- *
- * @return the listener for the tool button
- */
- protected Listener createsShowToolListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(final Event event) {
- if (event.widget instanceof ToolItem) {
- ToolItem item = ((ToolItem) event.widget);
- if (item.getSelection()) {
- // elements should be hidden
- availableToolsViewer.addFilter(toolFilter);
- item.setSelection(true);
- } else {
- availableToolsViewer.removeFilter(toolFilter);
- item.setSelection(false);
- }
- }
- }
- };
- }
-
- /**
- * Creates the listener for the available tools content provider
- *
- * @return the listener created
- */
- protected Listener createSwitchToolsContentProviderListener() {
- return new Listener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleEvent(final Event event) {
- if (event.widget instanceof ToolItem) {
- ToolItem item = ((ToolItem) event.widget);
- // retrieve current profile selected in the combo profile
- int index = profileCombo.getSelectionIndex();
- Collection<PaletteEntry> standardEntries = getAllVisibleStandardEntries();
- Profile profile = getAllAppliedProfiles().get(index);
-
- if (item.getSelection()) {
- availableToolsViewer.setContentProvider(new ProfileToolsStereotypeMetaclassTreeContentProvider(profile, standardEntries));
- item.setSelection(true);
- } else {
-
- availableToolsViewer.setContentProvider(new ProfileToolsMetaclassStereotypeTreeContentProvider(profile, standardEntries));
- item.setSelection(false);
- }
-
- // generate tools for given profile
- availableToolsViewer.setInput(profile);
- }
- }
- };
- }
-
- /**
- * Creates a toolbar item.
- *
- * @param toolbar
- * the parent toolbar
- * @param itemIcon
- * path for icon
- * @param tooltip
- * tooltip text for the toolbar item
- * @param listener
- * listener for tool bar item
- */
- protected void createToolBarItem(final ToolBar toolbar, final String itemIcon, final String tooltip, final Listener listener, final ToolBarItemValidator validator) {
- ToolItem item = new ToolItem(toolbar, SWT.BORDER);
- item.setImage(Activator.getPluginIconImage(Activator.ID, itemIcon));
- item.setToolTipText(tooltip);
- item.addListener(SWT.Selection, listener);
- item.setData(VALIDATOR, validator);
- }
-
- /**
- * selection listener for the tools viewer , to update the state of the add button
- *
- * @return the new created selection listener
- */
- protected ISelectionChangedListener createToolsViewerSelectionChangeListener() {
- return new ISelectionChangedListener() {
-
- /**
- * Returns true if the source can be added to the target
- *
- * @param source
- * the source object
- * @param target
- * the target object
- * @return <code>true</code> if the source can be added to the target
- */
- protected boolean isAddValidTarget(final Object source, final Object target) {
- boolean isAddValidTarget = false;
- if (source instanceof PaletteEntry) {
- // case1: source is a drawer.
- // it can only be added to the root element (no selection)
- // case2: source is a palette tool
- // it can't be added to the root element
- // it can only be added to a container element (drawer or stack)
-
- if (source instanceof PaletteDrawer) {
- isAddValidTarget = null == target;
- } else if (source instanceof ToolEntry) {
- isAddValidTarget = target instanceof DrawerConfiguration || target instanceof StackConfiguration;
- }
- }
- return isAddValidTarget;
- }
-
- /**
- * Returns true if the source can be added to the target
- *
- * @param source
- * the source object
- * @return <code>true</code> if the source can be removed (not null and instanceof
- * PaletteEntryProxy)
- */
- protected boolean isRemoveValidSource(final Object source) {
- return source instanceof Configuration;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void selectionChanged(final SelectionChangedEvent event) {
- // get source and target selection
- // check source entry can be added to target entry
- Object source = ((IStructuredSelection) availableToolsViewer.getSelection()).getFirstElement();
- Object target = ((IStructuredSelection) paletteTreeViewer.getSelection()).getFirstElement();
-
- // manage add button
- if (isAddValidTarget(source, target)) {
- addButton.setEnabled(true);
- } else {
- addButton.setEnabled(false);
- }
-
- // manage remove button
- if (isRemoveValidSource(target)) {
- removeButton.setEnabled(true);
- } else {
- removeButton.setEnabled(false);
- }
-
- }
- };
-
- }
-
- /**
- * @see org.eclipse.jface.dialogs.DialogPage#dispose()
- *
- */
- @Override
- public void dispose() {
- // dispose engine
- if (null != displayEngine) {
- displayEngine.dispose();
- }
- // dispose adapter
- paletteConfigurationModel.eAdapters().remove(adapter);
- super.dispose();
- }
-
- /**
- * returns the list of applied profile for the nearest package of the top element
- *
- * @return the list of applied profile for the nearest package of the top element or an empty
- * list
- */
- protected List<Profile> getAllAppliedProfiles() {
- Package topPackage = null;
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- EObject element = ((DiagramEditorWithFlyOutPalette) editorPart).getDiagram().getElement();
- if (element instanceof org.eclipse.uml2.uml.Element) {
- topPackage = ((org.eclipse.uml2.uml.Element) element).getNearestPackage();
- }
- }
- return null != topPackage ? topPackage.getAllAppliedProfiles() : Collections.emptyList();
- }
-
- /**
- * Returns the list of all visible palette entries
- *
- * @return the list of all visible palette entries
- */
- protected Collection<PaletteEntry> getAllVisibleStandardEntries() {
- HashSet<PaletteEntry> result = new HashSet<PaletteEntry>();
- for (PaletteEntry entry : PaletteUtil.getAvailableEntriesSet(editorPart, priority).values()) {
- // the entry is not just a defineOnly entry but a visible one
- if (getRootParent(entry) != null) {
- result.add(entry);
- }
- }
- return result;
- }
-
- /**
- * Returns the Root element for the palette entry. It searches recursively from parent to parent, until it find the root element
- *
- * @param entry
- * the palette entry for which root element is searched
- * @return the root element or <code>null</code> if none was found
- */
- protected PaletteRoot getRootParent(final PaletteEntry entry) {
- PaletteRoot paletteRoot = null;
-
- PaletteContainer parent = entry.getParent();
- if (parent instanceof PaletteRoot) {
- paletteRoot = (PaletteRoot) parent;
- } else if (null != parent) {
- paletteRoot = getRootParent(parent);
- }
- return paletteRoot;
- }
-
- /**
- * handle the selection change event for the palette preview
- *
- * @param event
- * the event that is thrown by the palette viewer
- */
- protected void handlePalettePreviewSelectionChanged(final SelectionChangedEvent event) {
- // Properties view
- if (null != event) {
- // retrieve current selection
- ITreeSelection selection = (TreeSelection) event.getSelection();
- Object firstSelected = selection.getFirstElement();
-
- if (firstSelected instanceof Configuration) {
- if (null != displayEngine) {
- displayEngine.removeSection(propertiesComposite);
- }
- displayEngine = PropertiesDisplayHelper.display(firstSelected, propertiesComposite);
- propertiesComposite.layout();
- }
- }
- // update toolbar
- if (null != toolbar && !toolbar.isDisposed()) {
- for (int i = 0; i < toolbar.getItemCount(); i++) {
- ToolItem item = toolbar.getItem(i);
- Object validator = item.getData(VALIDATOR);
- if (validator instanceof ToolBarItemValidator) {
- item.setEnabled(((ToolBarItemValidator) validator).isEnable());
- }
- }
- }
- }
-
- /**
- * Adds elements to the tool bar for available tools viewer
- *
- * @param toolbar
- * the toolbar to populate
- */
- protected void populateAvailableToolsToolBar(final ToolBar toolbar) {
- toggleContentProvider = createCheckToolBarItem(toolbar, SWITCH_CONTENT_PROVIDER_ICON, Messages.Local_Palette_SwitchToolsContentProvider_Tooltip, createSwitchToolsContentProviderListener());
- toggleContentProvider.setSelection(true);
- toggleContentProvider.setEnabled(false);
- createCheckToolBarItem(toolbar, SHOWN_TOOLS_ICON, Messages.Local_Palette_ShowTools_Tooltip, createsShowToolListener());
- }
-
- /**
- * populates the preview palette toolbar
- *
- * @param toolbar
- * the toolbar to populate
- */
- protected void populatePalettePreviewToolBar(final ToolBar toolbar) {
- // create validator
- PaletteConfigurationEntrySelectedValidator validator = new PaletteConfigurationEntrySelectedValidator();
- PaletteConfigurationStackLeafSelectedValidator validatorForNotStackChild = new PaletteConfigurationStackLeafSelectedValidator();
-
- createToolBarItem(toolbar, DELETE_ICON, Messages.PapyrusPaletteCustomizerDialog_RemoveButtonTooltip, createRemoveElementListener(), validator);
- createToolBarItem(toolbar, CREATE_DRAWERS_ICON, Messages.Local_Palette_Create_Drawer_Tooltip, createNewDrawerListener(), null);
- createToolBarItem(toolbar, CREATE_SEPARATOR_ICON, Messages.Local_Palette_Create_Separator_Tooltip, createNewSeparatorListener(), validatorForNotStackChild);
- createToolBarItem(toolbar, CREATE_TOOL_ICON, Messages.Local_Palette_Create_Tool_Tooltip, createNewToolListener(), validator);
- createToolBarItem(toolbar, CREATE_STACK_ICON, Messages.Local_Palette_Create_Stack_Tooltip, createNewStackListener(), validatorForNotStackChild);
- }
-
- /**
- * Sets the priority of the current edited palette
- *
- * @param priority
- * the priority of the current edited palette
- */
- public void setPriority(final ProviderPriority priority) {
- this.priority = priority;
- }
-
- /**
- * @return the priority
- */
- public ProviderPriority getPriority() {
- return priority;
- }
-
- /** The model diagnostician. */
- Diagnostician diagnostician = new Diagnostician() {
-
- @Override
- public String getObjectLabel(final EObject eObject) {
- String label = null;
- if (eObject instanceof Configuration) {
- label = ((Configuration) eObject).getLabel();
- }
- if (null == label || label.isEmpty()) {
- label = EcoreUtil.getIdentification(eObject);
- }
- return label;
- }
- };
-
- /**
- * Validates the content of the fields in this page.
- */
- protected boolean validatePage() {
- // TODO Adds OCL validation to Configuration to have error if Id is empty.
- Diagnostic validate = diagnostician.validate(paletteConfigurationModel);
- boolean valid = Diagnostic.OK == validate.getSeverity();
-
- if (!valid) {
- setErrorMessage(validate.getChildren().get(0).getMessage());
- } else {
- setErrorMessage(null);
- }
- return valid;
- }
-
- /**
- * @return The {@link PaletteConfiguration} model from resource set.
- */
- protected PaletteConfiguration getPaletteConfigurationModel() {
- PaletteConfiguration paletteModel = null;
- EList<Resource> resources = editingDomain.getResourceSet().getResources();
- if (!resources.isEmpty()) {
- EList<EObject> contents = resources.get(0).getContents();
- if (!contents.isEmpty()) {
- EObject eObject = (EObject) contents.get(0);
- if (eObject instanceof PaletteConfiguration) {
- paletteModel = (PaletteConfiguration) eObject;
- }
- }
- }
- Assert.isNotNull(paletteModel);
- return paletteModel;
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationInformationPage.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationInformationPage.java
deleted file mode 100644
index 059f556c7f8..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationInformationPage.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*****************************************************************************
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.infra.properties.ui.runtime.DisplayEngine;
-import org.eclipse.papyrus.infra.properties.ui.runtime.PropertiesRuntime;
-import org.eclipse.papyrus.infra.properties.ui.util.PropertiesDisplayHelper;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Layout;
-
-/**
- * {@link WizardPage} for informations of a {@link PaletteConfiguration} Model.
- *
- */
-public class PaletteConfigurationInformationPage extends WizardPage {
-
- /** The {@link PaletteConfiguration} model */
- private PaletteConfiguration paletteConfiguration;
-
- /** The display engine */
- private DisplayEngine displayEngine;
-
- /**
- * Constructor.
- */
- protected PaletteConfigurationInformationPage(final String pageName, final PaletteConfiguration paletteConfiguration) {
- super(pageName);
- this.paletteConfiguration = paletteConfiguration;
-
- // install adapter
- AdapterImpl adapter = new AdapterImpl() {
-
- /**
- * @see org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification)
- */
- @Override
- public void notifyChanged(final Notification msg) {
- setPageComplete(validatePage());
- }
- };
- paletteConfiguration.eAdapters().add(adapter);
- adapter.setTarget(paletteConfiguration);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl(final Composite parent) {
- // initialize dialog units
- initializeDialogUnits(parent);
-
- Composite control = new Composite(parent, SWT.NONE);
- Layout layout = new FillLayout();
- control.setLayout(layout);
- setControl(control);
-
- // Create the composite
- if (!PropertiesRuntime.getConstraintEngine().getDisplayUnits(paletteConfiguration).isEmpty()) {
- displayEngine = PropertiesDisplayHelper.display(paletteConfiguration, control);
- }
- setPageComplete(validatePage());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.DialogPage#dispose()
- */
- @Override
- public void dispose() {
- if (null != displayEngine) {
- displayEngine.dispose();
- }
- super.dispose();
- }
-
-
- /**
- * Validate the paletteConfiguration properties. paletteConfiguration must at leazst have a name and an id.
- */
- protected boolean validatePage() {
- return null != paletteConfiguration
- && null != paletteConfiguration.getLabel()
- && null != paletteConfiguration.getId()
- && !paletteConfiguration.getLabel().isEmpty()
- && !paletteConfiguration.getId().isEmpty();
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationWizard.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationWizard.java
deleted file mode 100644
index a16b2e6ac4c..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteConfigurationWizard.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - new implementation for palette configuration model case
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.customization.palette.PaletteConstants;
-import org.eclipse.papyrus.customization.palette.PaletteConstants.PaletteModelContextEnum;
-import org.eclipse.papyrus.customization.palette.utils.PaletteUtils;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.services.edit.context.TypeContext;
-import org.eclipse.papyrus.infra.types.ElementTypeSetConfiguration;
-import org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.ProviderDescriptor;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteConfiguration;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Wizard to update or create an Palette configuration
- */
-public class PaletteConfigurationWizard extends AbstractPaletteConfigurationWizard {
-
- /** content page */
- protected WizardPage contentPage;
-
- /** info page */
- protected WizardPage infoPage;
-
- /**
- * Creates a NewLocalPaletteWizard.
- *
- * @param part
- * the editor part where the palette is available
- * @param descriptor
- * the descriptor to edit
- */
- public PaletteConfigurationWizard(final IEditorPart part, final ProviderDescriptor descriptor) {
- super(part, descriptor);
- }
-
- /** constructor in case of new palette configuration model */
- public PaletteConfigurationWizard(final IEditorPart part) {
- this(part, null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
-
- // create pages
- infoPage = createPaletteInformationPage();
- contentPage = createPaletteContentPage();
-
- // Add pages
- addPage(infoPage);
- addPage(contentPage);
- }
-
- /**
- * Create the content page.
- */
- protected WizardPage createPaletteContentPage() {
- // second page: describe the paletteContent
- WizardPage page = new PaletteConfigurationContentPage(editorPart, editingDomain);
- page.setTitle(Messages.PaletteConfigurationWizard_NewPaletteContentPageWizard_Title);
- page.setDescription(Messages.PaletteConfigurationWizard_NewPaletteContentPageWizard_Description);
-
- // init content page
- ((PaletteConfigurationContentPage) page).setPriority(priority);
- return page;
- }
-
- /**
- * Create the information page.
- */
- protected WizardPage createPaletteInformationPage() {
- WizardPage page = new PaletteConfigurationInformationPage("", (PaletteConfiguration) paletteResource.getContents().get(0));//$NON-NLS-1$
- if (PaletteModelContextEnum.New.equals(paletteContext)) {
- page.setTitle(Messages.PaletteConfigurationWizard_NewPaletteInfoPageWizard_Title);
- } else {
- page.setTitle(Messages.PaletteConfigurationWizard_EditionPaletteInfoPageWizard_Tilte);
- }
- page.setDescription(Messages.PaletteConfigurationWizard_PaletteInfoPageWizard_Description);
- return page;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void deployModels() {
-
- // Loads element types models.
- deployElementTypesModels();
-
- // loads modified palette model
- deployPaletteModel();
-
- // Force the update
- PaletteUtil.getAvailableEntriesSet(editorPart, priority);
- }
-
- /**
- * load palette models on Papyrus preferences.
- */
- protected void deployPaletteModel() {
- // Get the palette model
- PaletteConfiguration paletteModel = (PaletteConfiguration) paletteResource.getContents().get(0);
-
- // The palette id
- String paletteId = paletteModel.getId();
-
- // Update palette preferences
- switch (paletteContext) {
-
- case New:
- // New model
- PapyrusPalettePreferences.addLocalExtendedPalette(paletteId, paletteId, priority, PaletteUtils.getEditorIdValue(editorPart), new HashSet(paletteModel.getRequiredProfiles()));
- break;
-
- case Local:
- // Edition of a local extended palette
- // Refresh by deletion and re add it.
- PapyrusPalettePreferences.deleteLocalExtendedPalette(descriptor.getContributionID());
- PapyrusPalettePreferences.addLocalExtendedPalette(paletteId, paletteId, priority, PaletteUtils.getEditorIdValue(editorPart), new HashSet(paletteModel.getRequiredProfiles()));
- break;
-
- case Plugin:
- // Edition of palette redefinition from plugin
- // Case of redefinition of read-only palette configuration model
- String path = PapyrusPalettePreferences.getPaletteRedefinition(descriptor.getContributionID());
- if (null != path) {
- // Register the redefinition
- PapyrusPalettePreferences.registerLocalRedefinition(descriptor.getContributionID(), path); // if already exists: removes, then add
- }
- break;
-
- case Workspace:
- // Workspace palette case
- String pathWS = paletteResource.getURI().toPlatformString(false);
- // If identifier is changed: need to delete palette
- if (null != descriptor && !paletteId.equals(descriptor.getContributionID())) {
- PapyrusPalettePreferences.deleteWorkspaceExtendedPalette(descriptor.getContributionID());// Delete it in case of id change
- }
- PapyrusPalettePreferences.addWorkspaceExtendedPalette(paletteId, paletteId, pathWS, priority, PaletteUtils.getEditorIdValue(editorPart), new HashSet(paletteModel.getRequiredProfiles()));
-
- break;
-
- default:
- break;
- }
-
-
- // toggle visibility to refresh the content
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- PapyrusPalettePreferences.changePaletteVisibility(paletteId, editorPart, false);
- PapyrusPalettePreferences.changePaletteVisibility(paletteId, editorPart, true);
- }
-
- }
-
- /**
- * deploy element types models.
- */
- protected void deployElementTypesModels() {
- // deploy element types configuration files
- try {
- if (!elementTypeSemResource.getContents().isEmpty() && !elementTypeUIResource.getContents().isEmpty()) {
- String clientContext = TypeContext.getDefaultContext().getId();
-
- ElementTypeSetConfigurationRegistry.getInstance().unload(clientContext, ((ElementTypeSetConfiguration) elementTypeSemResource.getContents().get(0)).getIdentifier());
- ElementTypeSetConfigurationRegistry.getInstance().unload(clientContext, ((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0)).getIdentifier());
-
- ElementTypeSetConfigurationRegistry.getInstance().loadElementTypeSetConfiguration(clientContext, ((ElementTypeSetConfiguration) elementTypeSemResource.getContents().get(0)));
- ElementTypeSetConfigurationRegistry.getInstance().loadElementTypeSetConfiguration(clientContext, ((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0)));
- }
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void saveResources() {
- // Get the palette model
- PaletteConfiguration paletteModel = (PaletteConfiguration) paletteResource.getContents().get(0);
-
- // The palette id
- String paletteId = paletteModel.getId();
-
- // Save resources
-
- // Id is changed => needs to rename files
- if (PaletteModelContextEnum.Local.equals(paletteContext) && !paletteId.equals(descriptor.getContributionID())) {
-
- // needs to change the file name for local extended palette model
- String newPalettePath = paletteResource.getURI().toFileString().replace(descriptor.getContributionID(), paletteId);
- paletteResource.setURI(URI.createFileURI(newPalettePath));
-
- String newElementTypeUIResourcePath = elementTypeUIResource.getURI().toFileString().replace(descriptor.getContributionID(), paletteId);
- elementTypeUIResource.setURI(URI.createFileURI(newElementTypeUIResourcePath));
-
- String newElementTypeSemResourcePath = elementTypeSemResource.getURI().toFileString().replace(descriptor.getContributionID(), paletteId);
- elementTypeSemResource.setURI(URI.createFileURI(newElementTypeSemResourcePath));
-
- } else if (PaletteModelContextEnum.New.equals(paletteContext)) {
- // set file names for new palette and element type
- clearStringBuilder();
- stringBuilder.append(paletteId);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.PALETTECONFIGURATION_EXTENSION);
- String newPalettePath = paletteResource.getURI().toFileString().replace(paletteResource.getURI().lastSegment().replace("%20", " "), stringBuilder.toString());//$NON-NLS-1$ //$NON-NLS-2$
- paletteResource.setURI(URI.createFileURI(newPalettePath));
-
- clearStringBuilder();
- stringBuilder.append(paletteId);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_UI_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- String newElementTypeUIResourcePath = elementTypeUIResource.getURI().toFileString().replace(elementTypeUIResource.getURI().lastSegment().replace("%20", " "), stringBuilder.toString());//$NON-NLS-1$ //$NON-NLS-2$
- elementTypeUIResource.setURI(URI.createFileURI(newElementTypeUIResourcePath));
-
- clearStringBuilder();
- stringBuilder.append(paletteId);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_SEMENTIC_IDENTIFIER_POSTFIX);
- stringBuilder.append(STR_DOT);
- stringBuilder.append(PaletteConstants.ELEMENTTYPE_EXTENSION);
- String newElementTypeSemResourcePath = elementTypeSemResource.getURI().toFileString().replace(elementTypeSemResource.getURI().lastSegment().replace("%20", " "), stringBuilder.toString());//$NON-NLS-1$ //$NON-NLS-2$
- elementTypeSemResource.setURI(URI.createFileURI(newElementTypeSemResourcePath));
- }
-
- // Save if necessary
- try {
- paletteResource.save(PaletteUtils.saveOptions);
- // Checks if model are not void and are useful
- if (!((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0)).getElementTypeConfigurations().isEmpty()) {
- elementTypeUIResource.save(PaletteUtils.saveOptions);
- elementTypeSemResource.save(PaletteUtils.saveOptions);
- } else {
- String clientContext = TypeContext.getDefaultContext().getId();
- ElementTypeSetConfigurationRegistry.getInstance().unload(clientContext, ((ElementTypeSetConfiguration) elementTypeSemResource.getContents().get(0)).getIdentifier());
- ElementTypeSetConfigurationRegistry.getInstance().unload(clientContext, ((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0)).getIdentifier());
- elementTypeUIResource.delete(Collections.EMPTY_MAP);
- elementTypeSemResource.delete(Collections.EMPTY_MAP);
- }
- } catch (IOException e) {
- Activator.log.error(e);
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteContainerProxy.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteContainerProxy.java
deleted file mode 100644
index efc704c86d4..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteContainerProxy.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.papyrus.customization.palette.dialog.LocalPaletteContentPage.EntryType;
-
-/**
- * Proxy class for container entries
- */
-public class PaletteContainerProxy extends PaletteEntryProxy {
-
- /** list of children for this container */
- protected List<PaletteEntryProxy> children = new ArrayList<PaletteEntryProxy>();
-
- /**
- * Creates a new PaletteContainer
- *
- * @param drawer
- * the drawer to cache
- */
- public PaletteContainerProxy(PaletteContainer drawer) {
- super(drawer);
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public String getDescription() {
- return getEntry().getDescription();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public PaletteContainer getEntry() {
- return (PaletteContainer) super.getEntry();
- }
-
- /**
- * Method to add a child proxy to this proxy
- *
- * @param entry
- * the entry to add
- */
- @Override
- public void addChild(PaletteEntryProxy entry) {
- children.add(entry);
- entry.setParent(this);
- super.addChild(entry);
- }
-
- /**
- * Method to add a child proxy to this proxy, before the given element
- *
- * @param entry
- * the entry to add
- * @param nextElement
- * the element that should be just after the entry
- */
- @Override
- public void addChild(PaletteEntryProxy entry, PaletteEntryProxy nextElement) {
- children.add(children.indexOf(nextElement), entry);
- entry.setParent(this);
- super.addChild(entry, nextElement);
- }
-
- /**
- * Remove the specified children from its parent
- *
- * @param proxy
- * the proxy to remove
- */
- @Override
- public void removeChild(PaletteEntryProxy proxy) {
- children.remove(proxy);
- proxy.setParent(null);
- super.removeChild(proxy);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EntryType getType() {
- return EntryType.DRAWER;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<PaletteEntryProxy> getChildren() {
- return children;
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteEntryProxy.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteEntryProxy.java
deleted file mode 100644
index 6e77f74fc60..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteEntryProxy.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.util.List;
-
-import org.eclipse.gef.palette.PaletteDrawer;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.gef.palette.PaletteSeparator;
-import org.eclipse.gef.palette.PaletteStack;
-import org.eclipse.gef.palette.ToolEntry;
-import org.eclipse.papyrus.customization.palette.dialog.LocalPaletteContentPage.EntryType;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectCreationEntry;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IPaletteEntryProxy;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Proxy class for palette entries
- */
-public class PaletteEntryProxy implements IPaletteEntryProxy {
-
- /** key for the property : the icon path has changed */
- public static final String PROPERTY_ICON_PATH = "ICON_PATH";
-
- /** key for the property : a child has been added */
- public static final String PROPERTY_ADD_CHILDREN = "PROPERTY_ADD_CHILDREN";
-
- /** key for the property : a child has been removed */
- public static final String PROPERTY_REMOVE_CHILDREN = "PROPERTY_REMOVE_CHILDREN";
-
- /** proxy palette entry */
- private final PaletteEntry entry;
-
- /** parent of this proxy */
- private PaletteContainerProxy parent;
-
- /** PropertyChangeSupport */
- protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);
-
- /** proxy type */
- private EntryType type;
-
- public PaletteEntryProxy(PaletteEntry entry) {
- this.entry = entry;
- setType(initType());
- }
-
- /**
- * A listener can only be added once. Adding it more than once will do nothing.
- *
- * @param listener
- * the PropertyChangeListener that is to be notified of changes
- * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
- */
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- listeners.removePropertyChangeListener(listener);
- listeners.addPropertyChangeListener(listener);
- }
-
- /**
- * @param listener
- * the PropertyChangeListener that is not to be notified anymore
- * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
- */
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- listeners.removePropertyChangeListener(listener);
- }
-
- /**
- * Returns the entry cached by this class
- *
- * @return the palette entry
- */
- public PaletteEntry getEntry() {
- return entry;
- }
-
- /**
- * Inits the entry type for this proxy
- *
- * @return the entry type for this proxy
- */
- protected EntryType initType() {
- if (entry instanceof PaletteDrawer) {
- return EntryType.DRAWER;
- } else if (entry instanceof PaletteSeparator) {
- return EntryType.SEPARATOR;
- } else if (entry instanceof PaletteStack) {
- return EntryType.STACK;
- } else if (entry instanceof AspectCreationEntry) {
- return EntryType.ASPECT_TOOL;
- } else if (entry instanceof ToolEntry) {
- return EntryType.TOOL;
- }
- return EntryType.TOOL;
- }
-
- /**
- * returns the label of the cached entry
- *
- * @return the label of the cached entry
- */
- public String getLabel() {
- return entry.getLabel();
- }
-
- /**
- * returns the id of the cached entry
- *
- * @return the id of the cached entry
- */
- public String getId() {
- return entry.getId();
- }
-
- /**
- * returns the small icon of the cached entry
- *
- * @return the small icon of the cached entry
- */
- public Image getImage() {
- return Activator.getPluginIconImage(Activator.ID, entry.getSmallIcon());
- }
-
- /**
- * returns the description of this entry proxy
- *
- * @return the description of this entry proxy
- */
- public String getDescription() {
- return (entry != null) ? entry.getDescription() : "";
- }
-
- /**
- * returns the image path of this entry proxy
- *
- * @return the image path of this entry proxy
- */
- public String getImagePath() {
- return "";
- }
-
- /**
- * Sets the parent for this proxy
- *
- * @param newParent
- * the parent proxy
- */
- public void setParent(PaletteContainerProxy newParent) {
- parent = newParent;
- }
-
- /**
- * Returns the parent of this proxy
- *
- * @return the parent of this proxy
- */
- public PaletteContainerProxy getParent() {
- return parent;
- }
-
- /**
- * Returns the list of children for this entry. By default, entries do not have children.
- *
- * @return the list of children for this entry
- */
- public List<PaletteEntryProxy> getChildren() {
- return null;
- }
-
- /**
- * Sets the king of tool it is.
- *
- * @param type
- * the type to set
- */
- public void setType(EntryType type) {
- this.type = type;
- }
-
- /**
- * Returns the kind of entry
- *
- * @return the kind of entry
- */
- public EntryType getType() {
- return type;
- }
-
- /**
- * Sets the description of the palette entry proxied by this element
- *
- * @param desc
- * the new description
- */
- public void setDescription(String desc) {
- if (getEntry() == null) {
- return;
- }
- String oldDesc = getEntry().getDescription();
-
- if (oldDesc == null && desc == null) {
- return;
- }
-
- if (desc == null || !desc.equals(oldDesc)) {
- getEntry().setDescription(desc);
- listeners.firePropertyChange(PaletteEntry.PROPERTY_DESCRIPTION, oldDesc, desc);
- }
- }
-
- /**
- * Sets the label of the palette entry proxied by this element
- *
- * @param label
- * the new label
- */
- public void setLabel(String label) {
- if (getEntry() == null) {
- return;
- }
- String oldLabel = getEntry().getLabel();
-
- if (oldLabel == null && label == null) {
- return;
- }
-
- if (label == null || !label.equals(oldLabel)) {
- getEntry().setLabel(label);
- listeners.firePropertyChange(PaletteEntry.PROPERTY_LABEL, oldLabel, label);
- }
- }
-
- /**
- * Sets the label of the palette entry proxied by this element
- *
- * @param label
- * the new label
- */
- public void setIcon(String path) {
- if (!(getEntry() instanceof AspectCreationEntry)) {
- return;
- }
- String oldPath = ((AspectCreationEntry) getEntry()).getIconPath();
-
- if (oldPath == null && path == null) {
- return;
- }
-
- if (path == null || !path.equals(oldPath)) {
- ((AspectCreationEntry) getEntry()).setIconPath(path);
- listeners.firePropertyChange(PROPERTY_ICON_PATH, oldPath, path);
- }
- }
-
- /**
- * Method to add a child proxy to this proxy
- *
- * @param entry
- * the entry to add
- */
- protected void addChild(PaletteEntryProxy entry) {
- listeners.firePropertyChange(PROPERTY_ADD_CHILDREN, null, entry);
- }
-
- /**
- * Method to add a child proxy to this proxy, before the given element
- *
- * @param entry
- * the entry to add
- * @param nextElement
- * the element that should be just after the entry
- */
- protected void addChild(PaletteEntryProxy entry, PaletteEntryProxy nextElement) {
- listeners.firePropertyChange(PROPERTY_ADD_CHILDREN, null, entry);
- }
-
- /**
- * Remove the specified children from its parent
- *
- * @param proxy
- * the proxy to remove
- */
- public void removeChild(PaletteEntryProxy proxy) {
- listeners.firePropertyChange(PROPERTY_REMOVE_CHILDREN, proxy, null);
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteEntryProxyInformationComposite.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteEntryProxyInformationComposite.java
deleted file mode 100644
index dec022c7af3..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteEntryProxyInformationComposite.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.customization.palette.dialog.LocalPaletteContentPage.EntryType;
-import org.eclipse.papyrus.infra.widgets.editors.BundleIconExplorerDialog;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-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.Text;
-import org.eclipse.uml2.uml.Profile;
-
-
-/**
- * Class in charge of the composite in the {@link LocalPaletteContentPage}
- */
-public class PaletteEntryProxyInformationComposite {
-
- /** current selected entry proxy */
- protected PaletteEntryProxy selectedEntryProxy;
-
- /** proxy name text */
- protected Text nameText;
-
- /** proxy description text */
- protected Text descriptionText;
-
- /** proxy icon text */
- protected Text iconText;
-
- /** referenced proxy text */
- protected Text referencedText;
-
- /** list of applied profiles */
- protected List<Profile> appliedProfiles;
-
- protected Button iconButton;
-
- /**
- * Creates the content of the information composite
- *
- * @param parent
- * the composite where to add created controls
- * @param appliedProfiles
- * the list of applied profiles
- * @return the newly created composite
- */
- public Composite createComposite(final Composite parent, List<Profile> appliedProfiles) {
- this.appliedProfiles = appliedProfiles;
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- composite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.widthHint = 260;
- data.horizontalIndent = 10;
- composite.setLayoutData(data);
-
- Label entryInformationLabel = new Label(composite, SWT.NONE);
- entryInformationLabel.setText(Messages.Local_Palette_Entry_Information);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.horizontalSpan = 3;
- entryInformationLabel.setLayoutData(data);
-
- Label nameLabel = new Label(composite, SWT.NONE);
- nameLabel.setText(Messages.Local_Palette_Entry_Name);
- data = new GridData(SWT.FILL, SWT.FILL, false, false);
- nameLabel.setLayoutData(data);
- nameText = new Text(composite, SWT.LEAD | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- nameText.setLayoutData(data);
- nameText.addFocusListener(new NameFocusListener());
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.horizontalSpan = 2;
- nameText.setLayoutData(data);
-
- Label referencedLabel = new Label(composite, SWT.NONE);
- referencedLabel.setText(Messages.Local_Palette_Entry_Reference);
- data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- referencedLabel.setLayoutData(data);
- referencedText = new Text(composite, SWT.LEAD | SWT.BORDER | SWT.READ_ONLY);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- referencedText.setLayoutData(data);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.horizontalSpan = 2;
- referencedText.setLayoutData(data);
-
- Label descriptionLabel = new Label(composite, SWT.NONE);
- descriptionLabel.setText(Messages.Local_Palette_Entry_Description);
- data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- descriptionLabel.setLayoutData(data);
- descriptionText = new Text(composite, SWT.WRAP | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.horizontalSpan = 2;
- data.widthHint = 160;
- descriptionText.setLayoutData(data);
- descriptionText.addFocusListener(new DescriptionFocusListener());
-
-
- Label iconLabel = new Label(composite, SWT.NONE);
- iconLabel.setText(Messages.Local_Palette_Entry_Icon);
- data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- iconLabel.setLayoutData(data);
- iconText = new Text(composite, SWT.LEAD | SWT.BORDER);
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- iconText.setLayoutData(data);
- iconText.addFocusListener(new IconFocusListener());
- iconButton = new Button(composite, SWT.NONE);
- iconButton.setText("Select...");
- iconButton.addMouseListener(new MouseListener() {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseUp(MouseEvent e) {
- BundleIconExplorerDialog dialog = new BundleIconExplorerDialog(parent.getShell(), iconText.getText());
- if (Window.OK == dialog.open()) {
- Object[] values = dialog.getResult();
- if (values.length != 1) {
- Activator.log.error("Waiting one icon path, but found " + values.length, null);
- } else {
- iconText.setText(values[0].toString());
- selectedEntryProxy.getEntry().setSmallIcon(Activator.getImageDescriptor(iconText.getText().trim()));
- selectedEntryProxy.getEntry().setLargeIcon(Activator.getImageDescriptor(iconText.getText().trim()));
- if (selectedEntryProxy instanceof PaletteAspectToolEntryProxy) {
- ((PaletteAspectToolEntryProxy) selectedEntryProxy).setIcon(iconText.getText().trim());
- }
- }
- }
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
-
- return composite;
- }
-
- /**
- * Updates the name field in the information area
- */
- protected void updateNameEntryField() {
- EntryType type = selectedEntryProxy.getType();
- switch (type) {
- case STACK:
- case SEPARATOR:
- nameText.setText("");
- nameText.setEnabled(false);
- break;
- case DRAWER:
- case TOOL:
- case ASPECT_TOOL:
- // the fields describing information about entry should be updated
- String name = selectedEntryProxy.getLabel();
- nameText.setText((name != null) ? name : "");
- nameText.setEnabled(true);
- break;
- }
- }
-
- /**
- * Updates the reference field in the information area
- */
- protected void updateReferencedEntryField() {
- if (selectedEntryProxy instanceof PaletteAspectToolEntryProxy) {
- CombinedTemplateCreationEntry entry = ((PaletteAspectToolEntryProxy) selectedEntryProxy).getEntry().getReferencedEntry();
- EClass eClass = PaletteUtil.getToolMetaclass(entry);
- referencedText.setText((eClass != null) ? eClass.getInstanceTypeName() : "");
- } else if (selectedEntryProxy instanceof PaletteEntryProxy) {
- PaletteEntry entry = selectedEntryProxy.getEntry();
- if (entry instanceof CombinedTemplateCreationEntry) {
- EClass eClass = PaletteUtil.getToolMetaclass((CombinedTemplateCreationEntry) entry);
- referencedText.setText((eClass != null) ? eClass.getInstanceTypeName() : "");
- } else {
- referencedText.setText("");
- }
- } else {
- // should never happen
- referencedText.setText("");
- }
- }
-
- /**
- * Updates the description field in the information area
- */
- protected void updateDescriptionEntryField() {
- EntryType type = selectedEntryProxy.getType();
- switch (type) {
- case STACK:
- case SEPARATOR:
- case DRAWER:
- descriptionText.setText("");
- descriptionText.setEnabled(false);
- break;
- case TOOL:
- case ASPECT_TOOL:
- // the fields describing information about entry should be updated
- String name = selectedEntryProxy.getDescription();
- descriptionText.setText((name != null) ? name : "");
- descriptionText.setEnabled(true);
- break;
- }
- }
-
- /**
- * Updates the icon field in the information area
- */
- protected void updateIconEntryField() {
- EntryType type = selectedEntryProxy.getType();
- switch (type) {
- case STACK:
- case SEPARATOR:
- case TOOL:
- iconText.setText("");
- iconText.setEnabled(false);
- iconButton.setEnabled(false);
- break;
- case DRAWER:
- String drawerIcon = selectedEntryProxy.getImagePath();
- iconText.setText((drawerIcon != null) ? drawerIcon : "");
- iconText.setEnabled(false);
- iconButton.setEnabled(false);
- break;
- case ASPECT_TOOL:
- String icon = selectedEntryProxy.getImagePath();
- iconText.setText((icon != null) ? icon : "");
- iconText.setEnabled(true);
- iconButton.setEnabled(true);
- break;
- }
- }
-
-
- /**
- * Sets the new Selected entry
- *
- * @param selectedEntryProxy
- * the selectedEntryProxy to set
- */
- public void setSelectedEntryProxy(PaletteEntryProxy selectedEntryProxy) {
- this.selectedEntryProxy = selectedEntryProxy;
-
- updateNameEntryField();
- updateIconEntryField();
- updateReferencedEntryField();
- updateDescriptionEntryField();
- }
-
- /**
- * focus listener for the name text field
- */
- protected class NameFocusListener implements FocusListener {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusLost(FocusEvent e) {
- if (selectedEntryProxy != null) {
- selectedEntryProxy.setLabel(nameText.getText().trim());
- }
- }
-
- }
-
- /**
- * focus listener for the name text field
- */
- protected class DescriptionFocusListener implements FocusListener {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusLost(FocusEvent e) {
- if (selectedEntryProxy != null && selectedEntryProxy.getEntry() != null) {
- selectedEntryProxy.setDescription(descriptionText.getText().trim());
- }
- }
- }
-
- /**
- * focus listener for the name text field
- */
- protected class IconFocusListener implements FocusListener {
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void focusLost(FocusEvent e) {
- if (selectedEntryProxy != null && iconText.getText() != null && !iconText.getText().equals("")) {
- selectedEntryProxy.getEntry().setSmallIcon(Activator.getImageDescriptor(iconText.getText().trim()));
- selectedEntryProxy.getEntry().setLargeIcon(Activator.getImageDescriptor(iconText.getText().trim()));
- if (selectedEntryProxy instanceof PaletteAspectToolEntryProxy) {
- ((PaletteAspectToolEntryProxy) selectedEntryProxy).setIcon(iconText.getText().trim());
- }
- }
- }
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalDrawerProxy.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalDrawerProxy.java
deleted file mode 100644
index 56d9d8db011..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalDrawerProxy.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Proxy class for container entries
- */
-public class PaletteLocalDrawerProxy extends PaletteContainerProxy {
-
- /** label of the drawer */
- protected String label;
-
- /** id of the drawer */
- protected String id;
-
- /** icon of the drawer */
- protected String imagePath;
-
- /** description of the drawer */
- private String description;
-
-
- /** PropertyChangeSupport */
- protected PropertyChangeSupport drawerListener = new PropertyChangeSupport(this);
-
- /**
- * Creates a new PaletteContainer
- *
- * @param drawer
- * the drawer to cache
- */
- public PaletteLocalDrawerProxy(String name, String id, String imagePath, String description) {
- super(null);
- this.label = name;
- this.id = id;
- this.setDescription(description);
- this.imagePath = imagePath;
- }
-
- /**
- * A listener can only be added once. Adding it more than once will do nothing.
- *
- * @param listener
- * the PropertyChangeListener that is to be notified of changes
- * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
- */
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- drawerListener.removePropertyChangeListener(listener);
- drawerListener.addPropertyChangeListener(listener);
- super.addPropertyChangeListener(listener);
- }
-
- /**
- * @param listener
- * the PropertyChangeListener that is not to be notified anymore
- * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
- */
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- drawerListener.removePropertyChangeListener(listener);
- super.removePropertyChangeListener(listener);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public PaletteContainer getEntry() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getLabel() {
- return label;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getId() {
- return id;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage() {
- return Activator.getPluginIconImage(Activator.ID, imagePath);
- }
-
- /**
- * Returns the image path
- *
- * @return the image path
- */
- @Override
- public String getImagePath() {
- return imagePath;
- }
-
- /**
- * Sets the label of the drawer
- *
- * @param label
- * the label to set
- */
- @Override
- public void setLabel(String label) {
- String oldValue = this.label;
- this.label = label;
- drawerListener.firePropertyChange(PROPERTY_ICON_PATH, oldValue, label);
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public void addChild(PaletteEntryProxy entry) {
- super.addChild(entry);
- }
-
- /**
- * Sets the id of the drawer
- *
- * @param id
- * the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * Sets the image path of the drawer
- *
- * @param imagePath
- * the imagePath to set
- */
- public void setImagePath(String imagePath) {
- String oldValue = this.imagePath;
- this.imagePath = imagePath;
- drawerListener.firePropertyChange(PROPERTY_ICON_PATH, oldValue, imagePath);
- }
-
- /**
- * Sets the description of the drawer
- *
- * @param description
- * the description to set
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the description of the drawer
- *
- * @return the description of the drawer
- */
- @Override
- public String getDescription() {
- return description;
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java
deleted file mode 100644
index ba69166cf28..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.papyrus.customization.palette.dialog.LocalPaletteContentPage.EntryType;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * proxy for a local separator
- */
-public class PaletteLocalSeparatorProxy extends PaletteEntryProxy {
-
- /** id of this separator */
- protected String id;
-
- /** icon for separators */
- public static final String SEPARATOR_ICON = "/icons/separator.gif";
-
- /**
- * Creates a new PaletteLocalEntryProxy
- */
- public PaletteLocalSeparatorProxy(String id) {
- super(null);
- this.id = id;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EntryType getType() {
- return EntryType.SEPARATOR;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getLabel() {
- return "-------------";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getId() {
- return id;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage() {
- return Activator.getPluginIconImage(Activator.ID, SEPARATOR_ICON);
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java
deleted file mode 100644
index b9472ca434c..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.papyrus.customization.palette.dialog.LocalPaletteContentPage.EntryType;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * proxy for a local stack
- */
-public class PaletteLocalStackProxy extends PaletteContainerProxy {
-
- /** id of this separator */
- protected String id;
-
- /** icon for separators */
- public static final String STACK_ICON = "/icons/stack.gif";
-
- /**
- * Creates a new PaletteLocalEntryProxy
- */
- public PaletteLocalStackProxy(String id) {
- super(null);
- this.id = id;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EntryType getType() {
- return EntryType.STACK;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getLabel() {
- return "> Stack";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getId() {
- return id;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage() {
- return Activator.getPluginIconImage(Activator.ID, STACK_ICON);
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public String getDescription() {
- return "<unused element>";
- }
-
- /**
- * @{inheritDoc
- */
- @Override
- public String getImagePath() {
- return "<unused element>";
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PapyrusPaletteCustomizerDialog.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PapyrusPaletteCustomizerDialog.java
deleted file mode 100644
index 7312b62192e..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PapyrusPaletteCustomizerDialog.java
+++ /dev/null
@@ -1,928 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- * Gabriel Pascual (ALL4TEC) gabriel.pascual@gmail.com - Bug 350134
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 482669
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.ui.palette.PaletteCustomizer;
-import org.eclipse.gmf.runtime.common.core.service.IProvider;
-import org.eclipse.gmf.runtime.gef.ui.palette.customize.PaletteCustomizerDialogEx;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.ICheckStateProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.common.service.ExtendedPluginPaletteProvider;
-import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.ExtendedProviderDescriptor;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.ProviderDescriptor;
-import org.eclipse.papyrus.uml.diagram.common.service.PluginPaletteProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-/**
- * Specific dialog window for the customisation of the palette.
- */
-public class PapyrusPaletteCustomizerDialog extends PaletteCustomizerDialogEx implements IPreferenceChangeListener {
-
- /** Id for restore button of extended customization palette. */
- private static final int RESTORE_DEFAULT_PALETTE_BUTTON_ID = 23;
-
- /** Id for restore button of extended customization palette. */
- private static final int EXPORT_DEFAULT_PALETTE_BUTTON_ID = 24;
-
- /** Id for delete button of local palette. */
- private static final int DELETE_PALETTE_BUTTON_ID = 22;
-
- /** Id for edit button of extended and local palette. */
- private static final int EDIT_PALETTE_BUTTON_ID = 21;
-
- /** Id for new button to create local palette. */
- private static final int NEW_LOCAL_PALETTE_BUTTON_ID = 20;
-
- /** Id for new button to create local extended palette. */
- private static final int NEW_EXTENDED_PALETTE_BUTTON_ID = 25;
-
- /** new local palette icon */
- private static final String NEW_LOCAL_DESC_IMAGE = "/icons/local_desc_new.gif"; //$NON-NLS-1$
-
- /** delete palette icon */
- private static final String DELETE_LOCAL_DESC_IMAGE = "/icons/local_desc_destroy.gif"; //$NON-NLS-1$
-
- /** edit palette icon */
- private static final String EDIT_LOCAL_DESC_IMAGE = "/icons/local_desc_edit.gif"; //$NON-NLS-1$
-
- /** restore palette icon */
- private static final String RESTORE_DEFAULT_DESC_IMAGE = "/icons/obj16/eraser.gif"; //$NON-NLS-1$
-
- /** restore palette icon */
- private static final String EXPORT_DEFAULT_DESC_IMAGE = "/icons/obj16/Export.gif"; //$NON-NLS-1$
-
- /** path to the local descriptor icon */
- protected final String LOCAL_DESCRIPTOR = "/icons/local_desc.gif"; //$NON-NLS-1$
-
- /** path to the plugin descriptor icon */
- protected final String PLUGIN_DESCRIPTOR = "/icons/plugin_desc.gif"; //$NON-NLS-1$
-
- /** path to the plugin descriptor icon */
- protected final String EXTENDED_PLUGIN_DESCRIPTOR = "/icons/extended_plugin_desc.gif"; //$NON-NLS-1$
-
- /** table viewed by the availablePalettesTreeViewer */
- protected Table availablePalettesTable;
-
- /** viewer for the available palettes */
- protected CheckboxTableViewer availablePalettesTableViewer;
-
- /** label provider for palette provider */
- protected PaletteLabelProvider providersLabelProvider;
-
- private Map<Integer, Button> paletteButtonsMap = new HashMap<Integer, Button>();
-
- /**
- * Creates a new PapyrusPaletteCustomizerDialog
- *
- * @param shell
- * the shell that hosts the dialog window
- * @param customizer
- * the customizer used to customize the palette
- * @param root
- * the root of the palette
- */
- public PapyrusPaletteCustomizerDialog(Shell shell, PaletteCustomizer customizer, PaletteRoot root) {
- super(shell, customizer, root);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int open() {
- IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(Activator.ID);
- prefs.addPreferenceChangeListener(this);
- return super.open();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean close() {
- IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(Activator.ID);
- prefs.removePreferenceChangeListener(this);
- return super.close();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Control createDialogArea(final Composite parent) {
- // RS: does not call super, as the composite should not be drawn like they are in parent
- Composite mainComposite = createMainComposite(parent);
-
- final Control availableToolsComposite = createAvailablePalettesViewer(mainComposite);
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- // data.right = new FormAttachment(40, 0);
- availableToolsComposite.setLayoutData(data);
-
- final Label nameLabel = new Label(mainComposite, SWT.NONE);
- nameLabel.setText(Messages.Palette_Viewer);
- data = new FormData();
- data.left = new FormAttachment(availableToolsComposite, ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(0, 0);
- nameLabel.setLayoutData(data);
-
- // Create the tree
- Control outline = createOutline(mainComposite);
- data = new FormData();
- data.left = new FormAttachment(availableToolsComposite, ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(nameLabel, 0);
- data.bottom = new FormAttachment(100, 0);
- // data.right = new FormAttachment(90, 0);
- outline.setLayoutData(data);
-
- // Create the panel where the properties of the selected palette entry will
- // be shown
- Control properties = createPropertiesPanel(mainComposite);
- data = new FormData();
- data.left = new FormAttachment(outline, ITabbedPropertyConstants.HSPACE);
- data.right = new FormAttachment(100, 0);
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- properties.setLayoutData(data);
-
- // add listeners
- ISelectionChangedListener listener = createSelectionChangedListener();
- if (listener != null) {
- availablePalettesTableViewer.addSelectionChangedListener(listener);
- }
- return mainComposite;
- }
-
- /**
- * the selection changed listener to available tools, which update buttons status
- *
- * @return the listener
- */
- protected ISelectionChangedListener createSelectionChangedListener() {
- return new ISelectionChangedListener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void selectionChanged(final SelectionChangedEvent event) {
- // retrieve element selected
- Object selectedElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
-
- // Plug-in contribution palette
- if (selectedElement instanceof PapyrusPaletteService.ExtendedProviderDescriptor) {
- IProvider provider = ((PapyrusPaletteService.ExtendedProviderDescriptor) selectedElement).getProvider();
-
- // xml definition of palette
- if (provider instanceof PluginPaletteProvider) {
- paletteButtonsMap.get(DELETE_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EDIT_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(RESTORE_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EXPORT_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
- } else
- // Modelconfiguration model definition
- if (provider instanceof ExtendedPluginPaletteProvider) {
- paletteButtonsMap.get(DELETE_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EDIT_PALETTE_BUTTON_ID).setEnabled(true);
- paletteButtonsMap.get(RESTORE_DEFAULT_PALETTE_BUTTON_ID).setEnabled(isRedefined((ExtendedProviderDescriptor) selectedElement));
- paletteButtonsMap.get(EXPORT_DEFAULT_PALETTE_BUTTON_ID).setEnabled(true);
- }
-
- } else
- // Local Palette configuration model
- if (selectedElement instanceof PapyrusPaletteService.LocalExtendedProviderDescriptor) {
- paletteButtonsMap.get(DELETE_PALETTE_BUTTON_ID).setEnabled(true);
- paletteButtonsMap.get(EDIT_PALETTE_BUTTON_ID).setEnabled(true);
- paletteButtonsMap.get(RESTORE_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EXPORT_DEFAULT_PALETTE_BUTTON_ID).setEnabled(true);
- } else
- // Local XML Palette
- if (selectedElement instanceof PapyrusPaletteService.LocalProviderDescriptor) {
- paletteButtonsMap.get(DELETE_PALETTE_BUTTON_ID).setEnabled(true);
- paletteButtonsMap.get(EDIT_PALETTE_BUTTON_ID).setEnabled(true);
- paletteButtonsMap.get(RESTORE_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EXPORT_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
- } else {
- paletteButtonsMap.get(DELETE_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EDIT_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(RESTORE_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EXPORT_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
- }
-
- }
- };
- }
-
- /**
- * Creates the available palettes viewer part of the dialog.
- *
- * @param container
- * The Composite within which the viewer has to be created
- * @return The newly created Control that has the viewer
- */
- protected Control createAvailablePalettesViewer(final Composite container) {
- // Create the Composite that will contain the available tools
- Composite composite = new Composite(container, SWT.NONE);
- composite.setFont(container.getFont());
- GridLayout layout = new GridLayout(6, false);
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- final Label nameLabel = new Label(composite, SWT.NONE);
- nameLabel.setText(Messages.Available_Palettes);
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
- nameLabel.setLayoutData(data);
-
- // Create action buttons
- createEditionPaletteButton(composite, NEW_EXTENDED_PALETTE_BUTTON_ID, Activator.getImage(NEW_LOCAL_DESC_IMAGE), Messages.Dialog_Create_Palette_Tooltip);
- createEditionPaletteButton(composite, EDIT_PALETTE_BUTTON_ID, Activator.getImage(EDIT_LOCAL_DESC_IMAGE), Messages.Dialog_Edit_Palette_Tooltip);
- createEditionPaletteButton(composite, DELETE_PALETTE_BUTTON_ID, Activator.getImage(DELETE_LOCAL_DESC_IMAGE), Messages.Dialog_Delete_Palette_Tooltip);
- createEditionPaletteButton(composite, RESTORE_DEFAULT_PALETTE_BUTTON_ID, Activator.getImage(RESTORE_DEFAULT_DESC_IMAGE), Messages.Dialog_Restore_Palette_Tooltip);
- createEditionPaletteButton(composite, EXPORT_DEFAULT_PALETTE_BUTTON_ID, Activator.getImage(EXPORT_DEFAULT_DESC_IMAGE), Messages.Dialog_Export_Palette_Tooltip);
-
- // initialize it
- paletteButtonsMap.get(DELETE_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EDIT_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(RESTORE_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
- paletteButtonsMap.get(EXPORT_DEFAULT_PALETTE_BUTTON_ID).setEnabled(false);
-
- availablePalettesTable = new Table(composite, SWT.BORDER | SWT.CHECK);
- availablePalettesTable.setFont(composite.getFont());
- availablePalettesTable.addSelectionListener(new SelectionListener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void widgetSelected(final SelectionEvent e) {
- if (e.detail == SWT.CHECK) {
- TableItem item = (TableItem) e.item;
- // one item was checked => display/hide the given provider
- changeProviderVisibility((PapyrusPaletteService.ProviderDescriptor) item.getData(), item.getChecked());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void widgetDefaultSelected(final SelectionEvent e) {
- // does nothing
- }
- });
- data = new GridData(GridData.FILL_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 6;
- data.widthHint = 185;
- // Make the tree this tall even when there is nothing in it. This will keep the
- // dialog from shrinking to an unusually small size.
- data.heightHint = 200;
- availablePalettesTable.setLayoutData(data);
- availablePalettesTableViewer = new CheckboxTableViewer(availablePalettesTable);
- AvailablePalettesCheckStateProvider availablePalettesCheckStateProvider = new AvailablePalettesCheckStateProvider();
- availablePalettesTableViewer.setCheckStateProvider(availablePalettesCheckStateProvider);
- availablePalettesTableViewer.setContentProvider(new PalettesTableContentProvider(availablePalettesTableViewer));
- providersLabelProvider = new PaletteLabelProvider(availablePalettesTableViewer);
- availablePalettesTableViewer.setLabelProvider(providersLabelProvider);
- availablePalettesTableViewer.setInput(PapyrusPaletteService.getInstance());
- availablePalettesTableViewer.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(DoubleClickEvent event) {
- // get selection. if local palette: open the wizard to edit this local palette
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- editSelectedPalette(selection);
- }
- });
-
- return composite;
- }
-
- /**
- * Create button to edit palette in table.
- *
- * @param parentConposite
- * @return the edition button
- */
- protected Button createEditionPaletteButton(final Composite parentConposite, final int id, final Image icon, final String toolTip) {
- Button button = new Button(parentConposite, SWT.NONE);
- button.setData(new Integer(id));
- button.setImage(icon);
- button.setToolTipText(toolTip);
- button.addMouseListener(new MouseAdapter() {
-
- @Override
- public void mouseUp(final MouseEvent e) {
- int buttonId = ((Integer) e.widget.getData()).intValue();
-
- // If ctrl is pressed use the old editor
- if (NEW_EXTENDED_PALETTE_BUTTON_ID == buttonId && (SWT.CTRL == (SWT.CTRL & e.stateMask))) {
- buttonId = NEW_LOCAL_PALETTE_BUTTON_ID;
- }
- buttonPressed(buttonId);
- }
-
- });
-
- // Register created button
- paletteButtonsMap.put(new Integer(id), button);
-
- return button;
- }
-
- /**
- * {@inheritDoc}
- *
- * @param
- */
- @Override
- protected void buttonPressed(final int buttonId) {
- if (paletteButtonsMap.containsKey(buttonId)) {
-
- switch (buttonId) {
- case NEW_EXTENDED_PALETTE_BUTTON_ID:
- createPaletteConfigurationPalette();
- break;
- case EDIT_PALETTE_BUTTON_ID: {
- IStructuredSelection selection = getPalettesTableSelection();
- editSelectedPalette(selection);
- }
- break;
- case DELETE_PALETTE_BUTTON_ID: {
- IStructuredSelection selection = getPalettesTableSelection();
- deleteSelectedPalette(selection);
- }
- break;
- case RESTORE_DEFAULT_PALETTE_BUTTON_ID:
- restoreExtendedPaletteToDefault();
- break;
-
- case EXPORT_DEFAULT_PALETTE_BUTTON_ID: {
- IStructuredSelection selection = getPalettesTableSelection();
- exportSelectedPalette(selection);
- }
- break;
- default:
- break;
- }
- } else if (NEW_LOCAL_PALETTE_BUTTON_ID == buttonId) {
- createNewLocalPalette();
- } else {
- super.buttonPressed(buttonId);
- }
- }
-
- /**
- * Open wizard to export palette configuration model file to the wanted location
- *
- * @param selection
- * the selected palette
- */
- protected void exportSelectedPalette(final IStructuredSelection selection) {
- /*
- * Two palettes type to export:
- * - ExtendedProviderDescriptor : plug-in definition : needs to create local file if not exist
- * - LocalExtendedProviderDescriptor : local definition
- */
-
- Object firstElement = selection.getFirstElement();
- if (firstElement instanceof PapyrusPaletteService.ExtendedProviderDescriptor) {
-
- if (!isRedefined((ExtendedProviderDescriptor) firstElement)) {
- // create a local redefinition of this palette contribution
- PapyrusPalettePreferences.createPaletteRedefinition((ExtendedProviderDescriptor) firstElement);
- }
- exportPalette((PapyrusPaletteService.ProviderDescriptor) firstElement);
-
- } else if (firstElement instanceof PapyrusPaletteService.LocalExtendedProviderDescriptor) {
- exportPalette((PapyrusPaletteService.ProviderDescriptor) firstElement);
- }
- }
-
- /**
- * export the palette corresponding to the descriptor. The ressource have to exist.
- *
- * @param descriptor
- */
- protected void exportPalette(final PapyrusPaletteService.ProviderDescriptor descriptor) {
- ExportPaletteConfigurationWizard wizard = new ExportPaletteConfigurationWizard(getActiveSashPage(), descriptor);
- WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
- wizardDialog.open();
- }
-
- /**
- * Get selection in palettes table viewer.
- *
- * @return The {@link IStructuredSelection} if there is one, otherwise <code>null</code>
- */
- private IStructuredSelection getPalettesTableSelection() {
- IStructuredSelection structuredSelection = null;
- if (availablePalettesTableViewer != null) {
- ISelection selection = availablePalettesTableViewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- structuredSelection = (IStructuredSelection) selection;
- }
- }
- return structuredSelection;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#setButtonLayoutData(org.eclipse.swt.widgets.Button)
- *
- * @param button
- */
- @Override
- protected void setButtonLayoutData(final Button button) {
- if (paletteButtonsMap.containsValue(button)) {
- GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, false);
- button.setLayoutData(data);
- button.setEnabled(false);
- } else {
- super.setButtonLayoutData(button);
- }
- }
-
- /**
- * Launch the wizard for the palette creation
- *
- * @param shell
- * the shell where to display the wizard
- */
- @Deprecated
- protected void createNewLocalPalette() {
- NewLocalPaletteWizard wizard = new NewLocalPaletteWizard(getActiveSashPage(), getCustomizer());
- WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
- wizardDialog.open();
- }
-
- /**
- * Launch the wizard for the palette creation
- *
- * @param shell
- * the shell where to display the wizard
- */
- protected void createPaletteConfigurationPalette() {
- PaletteConfigurationWizard wizard = new PaletteConfigurationWizard(getActiveSashPage());
- WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
- wizardDialog.open();
- }
-
- /**
- * Deletes the current selected local palette
- */
- protected void deleteLocalPalette(final PapyrusPaletteService.LocalProviderDescriptor descriptor) {
- if (null == descriptor) {
- MessageDialog.openError(getShell(), Messages.Dialog_Not_Local_Palette_Title, Messages.Dialog_Not_Local_Palette_Message);
- } else {
- String id = descriptor.getContributionID();
- PapyrusPalettePreferences.deleteLocalPalette(id);
- }
- }
-
- /**
- * Deletes the current selected local extended palette
- */
- protected void deleteLocalExtendedPalette(final PapyrusPaletteService.LocalExtendedProviderDescriptor descriptor) {
- if (null == descriptor) {
- MessageDialog.openError(getShell(), Messages.Dialog_Not_Local_Palette_Title, Messages.Dialog_Not_Local_Palette_Message);
- } else {
- String id = descriptor.getContributionID();
- deleteAssociatedRessource(descriptor);
- PapyrusPalettePreferences.deleteLocalExtendedPalette(id);
- }
- }
-
- /**
- * Deletes the current selected local palette
- */
- protected void deleteWorkspaceExtendedPalette(final PapyrusPaletteService.LocalProviderDescriptor descriptor) {
- if (null == descriptor) {
- MessageDialog.openError(getShell(), Messages.Dialog_Not_Extended_Palette_Title, Messages.Dialog_Not_Extended_Palette_Message);
- } else {
- String id = descriptor.getContributionID();
- PapyrusPalettePreferences.deleteWorkspaceExtendedPalette(id);
- }
- }
-
- /**
- * Reset the current selected extended palette to the initial configuration in the plugin
- */
- protected void restoreExtendedPaletteToDefault() {
- IStructuredSelection selection = (IStructuredSelection) availablePalettesTableViewer.getSelection();
- if (null == selection || !(selection.getFirstElement() instanceof PapyrusPaletteService.ExtendedProviderDescriptor)) {
- MessageDialog.openError(getShell(), Messages.Dialog_Not_Extended_Palette_Title, Messages.Dialog_Not_Extended_Palette_Message);
- } else {
- PapyrusPaletteService.ExtendedProviderDescriptor descriptor = ((PapyrusPaletteService.ExtendedProviderDescriptor) selection.getFirstElement());
- String id = descriptor.getContributionID();
-
- deleteAssociatedRessource(descriptor);
-
- PapyrusPalettePreferences.unregisterLocalRedefinition(id);
-
- // Refresh element on Palette preview only if is checked
- if (availablePalettesTableViewer.getChecked(descriptor)) {
- // toggle visibility to refresh the content
- changeProviderVisibility(descriptor, false);
- changeProviderVisibility(descriptor, true);
- }
- }
- }
-
-
- /**
- * Delete associated resource and unloads models.
- *
- * @param descriptor
- *
- */
- protected void deleteAssociatedRessource(ProviderDescriptor descriptor) {
- PaletteConfigurationWizard wizard = new PaletteConfigurationWizard(getActiveSashPage(), descriptor);
- wizard.deleteResource();
- wizard.dispose();
- }
-
- /**
- * Method to launch edition dialog according to selection.
- *
- * @param selection
- * Selection which determine kind of edition
- */
- protected void editSelectedPalette(IStructuredSelection selection) {
- if (null != selection) {
- if (selection.getFirstElement() instanceof PapyrusPaletteService.WorkspaceExtendedProviderDescriptor || selection.getFirstElement() instanceof PapyrusPaletteService.LocalExtendedProviderDescriptor) {
- editPaletteConfiguration((ProviderDescriptor) selection.getFirstElement());
- } else if (selection.getFirstElement() instanceof PapyrusPaletteService.LocalProviderDescriptor) {
- editLocalPalette((PapyrusPaletteService.LocalProviderDescriptor) selection.getFirstElement());
- } else if (selection.getFirstElement() instanceof PapyrusPaletteService.ExtendedProviderDescriptor) {
- IProvider provider = ((PapyrusPaletteService.ExtendedProviderDescriptor) selection.getFirstElement()).getProvider();
- if (!(provider instanceof PluginPaletteProvider)) {
- editExtendedPalette((PapyrusPaletteService.ExtendedProviderDescriptor) selection.getFirstElement());
- }
- }
- }
- }
-
- /**
- * Method to delete palette according to selection.
- *
- * @param selection
- * Selection which determine kind of delectino
- */
- protected void deleteSelectedPalette(final IStructuredSelection selection) {
- if (null != selection) {
- if (selection.getFirstElement() instanceof PapyrusPaletteService.WorkspaceExtendedProviderDescriptor) {
- deleteWorkspaceExtendedPalette((PapyrusPaletteService.LocalProviderDescriptor) selection.getFirstElement());
- } else if (selection.getFirstElement() instanceof PapyrusPaletteService.LocalExtendedProviderDescriptor) {
- deleteLocalExtendedPalette((PapyrusPaletteService.LocalExtendedProviderDescriptor) selection.getFirstElement());
- } else if ((selection.getFirstElement() instanceof PapyrusPaletteService.LocalProviderDescriptor)) {
- deleteLocalPalette((PapyrusPaletteService.LocalProviderDescriptor) selection.getFirstElement());
- }
- availablePalettesTableViewer.refresh();
- }
- }
-
- /**
- * Open wizard to edit palette configuration model.
- *
- * @param descriptor
- * the provider descriptor of the palette
- */
- protected void editPaletteConfiguration(final ProviderDescriptor descriptor) {
- PaletteConfigurationWizard wizard = new PaletteConfigurationWizard(getActiveSashPage(), descriptor);
- WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
- wizardDialog.open();
- }
-
- /**
- * Edits the current selected local palette
- *
- * @param descriptor
- * the provider descriptor of the palette
- */
- protected void editLocalPalette(final PapyrusPaletteService.LocalProviderDescriptor descriptor) {
- UpdateLocalPaletteWizard wizard = new UpdateLocalPaletteWizard(getActiveSashPage(), descriptor, getCustomizer());
- WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
- wizardDialog.open();
- }
-
- /**
- * Open wizard to edit palette configuration model for a read-only palette.
- *
- * @param descriptor
- * the provider descriptor of the palette
- */
- protected void editExtendedPalette(final ExtendedProviderDescriptor descriptor) {
- if (!isRedefined(descriptor)) {
- // create a local redefinition of this palette contribution
- PapyrusPalettePreferences.createPaletteRedefinition(descriptor);
- }
- editPaletteConfiguration(descriptor);
- }
-
- /**
- * Test if a palette redefinition exist for the descriptor.
- *
- * @param descriptor
- * the exttended provider desciptor to test
- * @return true if redefined
- */
- public Boolean isRedefined(final ExtendedProviderDescriptor descriptor) {
- // check the file in plugin state area.
- String contributionID = descriptor.getContributionID();
- String paletteRedefinition = PapyrusPalettePreferences.getPaletteRedefinition(contributionID);
- return null != paletteRedefinition;
- }
-
-
- /**
- * Changes the visibility of the given provider
- *
- * @param descriptor
- * the provider to hide/show
- * @param isChecked
- * <code>true</code> if the descriptor should be visible
- */
- protected void changeProviderVisibility(final PapyrusPaletteService.ProviderDescriptor descriptor, final boolean isChecked) {
- PapyrusPalettePreferences.changePaletteVisibility(descriptor.getContributionID(), getActiveSashPage().getClass().getName(), isChecked);
- }
-
- /**
- * Creates the main composite for the dialog area
- *
- * @param parent
- * the parent of the createrd composite
- * @return the newly created Composite
- */
- protected Composite createMainComposite(final Composite parent) {
- // dialog window
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- FormLayout layout = new FormLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- applyDialogFont(composite);
- return composite;
- }
-
- /**
- * Content provider for available tools viewer
- */
- public class PalettesTableContentProvider implements IStructuredContentProvider {
-
- /** the palette root */
- private PapyrusPaletteService paletteService;
-
- /** tree viewer to fill */
- private final TableViewer viewer;
-
- /**
- * Constructor
- *
- * @param tableViewer
- * The TableViewer whose ContentProvider this PaletteTreeProvider is
- */
- public PalettesTableContentProvider(final TableViewer tableViewer) {
- this.viewer = tableViewer;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- paletteService = null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
- if (newInput != null) {
- paletteService = (PapyrusPaletteService) newInput;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(final Object inputElement) {
- if (inputElement instanceof PapyrusPaletteService) {
- List<PapyrusPaletteService.ProviderDescriptor> providers = ((PapyrusPaletteService) inputElement).getContributingProviders(getActiveSashPage(), getPaletteRoot());
-
- return providers.toArray();
- }
- return null;
- }
- }
-
- /**
- * Returns the current active sash page
- *
- * @return the current active sash page
- */
- protected IEditorPart getActiveSashPage() {
- // Lookup ServiceRegistry
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IEditorPart editorPart = page.getActiveEditor();
- assert editorPart != null;
- ISashWindowsContainer sashWindowsContainer = editorPart.getAdapter(ISashWindowsContainer.class);
- if (sashWindowsContainer != null) {
- return sashWindowsContainer.getActiveEditor();
- }
- return null;
- }
-
- /**
- * provider in charge of the check boxes in the available palettes table viewer
- */
- protected class AvailablePalettesCheckStateProvider implements ICheckStateProvider {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isChecked(final Object element) {
- boolean checked = false;
- if (element instanceof PapyrusPaletteService.ProviderDescriptor) {
- checked = !PapyrusPalettePreferences.getHiddenPalettes(getActiveSashPage()).contains(((PapyrusPaletteService.ProviderDescriptor) element).getContributionID());
- }
- return checked;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isGrayed(final Object element) {
- return false;
- }
-
- }
-
- /**
- * Label provider for available tools viewer
- */
- protected class PaletteLabelProvider implements ILabelProvider {
-
- /**
- * Creates a new PaletteLabelProvider.
- *
- * @param viewer
- * the table viewer where the labels are displayed
- */
- public PaletteLabelProvider(final TableViewer viewer) {
- }
-
- private Map<ImageDescriptor, Image> imageCache = new HashMap<ImageDescriptor, Image>();
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage(final Object element) {
- if (element instanceof PapyrusPaletteService.LocalProviderDescriptor) {
- return Activator.getImage(LOCAL_DESCRIPTOR);
- } else if (element instanceof PapyrusPaletteService.ExtendedProviderDescriptor) {
- // icon should be decorated if it is already defined in a local way or not.
- return Activator.getImage(EXTENDED_PLUGIN_DESCRIPTOR);
- } else if (element instanceof PapyrusPaletteService.ProviderDescriptor) {
- return Activator.getImage(PLUGIN_DESCRIPTOR);
- }
- return Activator.getImage(Activator.DEFAULT_IMAGE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getText(final Object element) {
- String text = null;
- if (element instanceof PapyrusPaletteService.ProviderDescriptor) {
- text = ((PapyrusPaletteService.ProviderDescriptor) element).getContributionName();
- }
- return null != text ? text : "<undefined>";//$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addListener(final ILabelProviderListener listener) {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- Iterator<Image> images = imageCache.values().iterator();
- while (images.hasNext()) {
- images.next().dispose();
- }
- imageCache = null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isLabelProperty(final Object element, final String property) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeListener(final ILabelProviderListener listener) {
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void preferenceChange(final PreferenceChangeEvent event) {
- String id = event.getKey();
- if (IPapyrusPaletteConstant.PALETTE_CUSTOMIZATIONS_ID.equals(id) || IPapyrusPaletteConstant.PALETTE_LOCAL_DEFINITIONS.equals(id)) {
- // refresh available palette table viewer
- availablePalettesTableViewer.setInput(PapyrusPaletteService.getInstance());
- }
-
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateExtendedPaletteWizard.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateExtendedPaletteWizard.java
deleted file mode 100644
index 20e85c407da..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateExtendedPaletteWizard.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.gef.ui.palette.PaletteCustomizer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Wizard to update an existing Extended Palette Definition
- */
-public class UpdateExtendedPaletteWizard extends Wizard {
-
- /** Editor part in which the palette is displayed */
- protected IEditorPart editorPart;
-
- /** content page */
- protected ExtendedPaletteContentPage contentPage;
-
- /** info page */
- protected ExtendedPaletteInformationPage infoPage;
-
- /** palette configuration to update */
- protected PapyrusPaletteService.ExtendedProviderDescriptor descriptor;
-
- /** customizer used by the palette viewer */
- private PaletteCustomizer customizer;
-
- /**
- * Creates a NewLocalPaletteWizard.
- *
- * @param part
- * the editor part where the palette is available
- * @param descriptor
- * the descriptor to edit
- */
- public UpdateExtendedPaletteWizard(IEditorPart part, PapyrusPaletteService.ExtendedProviderDescriptor descriptor, PaletteCustomizer customizer) {
- this.editorPart = part;
- this.descriptor = descriptor;
- this.customizer = customizer;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
-
- // first paeg: name, id, etc.
- infoPage = new ExtendedPaletteInformationPage(editorPart);
- infoPage.intializeValues(descriptor);
-
- // second page: describe the paletteContent
- contentPage = new ExtendedPaletteContentPage(editorPart, customizer);
- contentPage.initializeContent(descriptor);
-
- addPage(infoPage);
- addPage(contentPage);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- // contentPage.restorePreferences();
- // file has been created or updated
- contentPage.performFinish(PapyrusPalettePreferences.getPalettePathFromID(infoPage.getPaletteID()));
-
- // PapyrusPalettePreferences.unregisterLocalRedefinition(infoPage.getPaletteID());
- // generate the preference for local palette
- String path = PapyrusPalettePreferences.getPaletteRedefinition(infoPage.getPaletteID());
- PapyrusPalettePreferences.registerLocalRedefinition(infoPage.getPaletteID(), path); // if already exists: removes, then add
-
- // toggle visiblity to refresh the content
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- PapyrusPalettePreferences.changePaletteVisibility(infoPage.getPaletteID(), editorPart, false);
- PapyrusPalettePreferences.changePaletteVisibility(infoPage.getPaletteID(), editorPart, true);
- }
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performCancel() {
- // contentPage.restorePreferences();
- return super.performCancel();
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateLocalDrawerWizard.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateLocalDrawerWizard.java
deleted file mode 100644
index 78da5caae2e..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateLocalDrawerWizard.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.jface.wizard.Wizard;
-
-/**
- * Wizard to create a new Drawer from scratch
- */
-public class UpdateLocalDrawerWizard extends Wizard {
-
- /** info page */
- protected DrawerInformationPage infoPage;
-
- /** the element where to add the new drawer */
- protected PaletteContainerProxy paletteContainerProxy;
-
- /** drawer to edit */
- protected PaletteLocalDrawerProxy drawerProxy;
-
- /**
- * Creates a NewDrawerWizard.
- *
- * @param paletteContainerProxy
- * the element where to add the new drawer
- */
- public UpdateLocalDrawerWizard(PaletteContainerProxy paletteContainerProxy, PaletteLocalDrawerProxy drawerProxy) {
- this.paletteContainerProxy = paletteContainerProxy;
- this.drawerProxy = drawerProxy;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
-
- infoPage = new DrawerInformationPage(drawerProxy);
- addPage(infoPage);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- drawerProxy.setLabel(infoPage.getDrawerName());
- drawerProxy.setId(infoPage.getDrawerID());
- drawerProxy.setImagePath(infoPage.getImageDescriptorPath());
- return true;
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateLocalPaletteWizard.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateLocalPaletteWizard.java
deleted file mode 100644
index fe527ed86c5..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/UpdateLocalPaletteWizard.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.dialog;
-
-import org.eclipse.gef.ui.palette.PaletteCustomizer;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Wizard to update an existing Local Palette Definition
- */
-public class UpdateLocalPaletteWizard extends Wizard {
-
- /** Editor part in which the palette is displayed */
- protected IEditorPart editorPart;
-
- /** content page */
- protected LocalPaletteContentPage contentPage;
-
- /** info page */
- protected LocalPaletteInformationPage infoPage;
-
- /** palette configuration to update */
- protected PapyrusPaletteService.LocalProviderDescriptor descriptor;
-
- /** customizer used by the palette viewer */
- private PaletteCustomizer customizer;
-
- /**
- * Creates a NewLocalPaletteWizard.
- *
- * @param part
- * the editor part where the palette is available
- * @param descriptor
- * the descriptor to edit
- */
- public UpdateLocalPaletteWizard(IEditorPart part, PapyrusPaletteService.LocalProviderDescriptor descriptor, PaletteCustomizer customizer) {
- this.editorPart = part;
- this.descriptor = descriptor;
- this.customizer = customizer;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
-
- // first paeg: name, id, etc.
- infoPage = new LocalPaletteInformationPage(editorPart);
- infoPage.intializeValues(descriptor);
-
- // second page: describe the paletteContent
- contentPage = new LocalPaletteContentPage(editorPart, customizer);
- contentPage.initializeContent(descriptor);
-
- addPage(infoPage);
- addPage(contentPage);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- // contentPage.restorePreferences();
- // file has been created or updated
- contentPage.performFinish(PapyrusPalettePreferences.getPalettePathFromID(infoPage.getPaletteID()));
-
- PapyrusPalettePreferences.deleteLocalPalette(infoPage.getPaletteID());
- // generate the preference for local palette
- PapyrusPalettePreferences.addLocalPalette(infoPage.getPaletteID(), infoPage.getPaletteName(), infoPage.getPalettePriority(), infoPage.getEditorID(), contentPage.getRequiredProfiles());
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean performCancel() {
- // contentPage.restorePreferences();
- return super.performCancel();
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/AbstractDeployPaletteConfigurationHandler.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/AbstractDeployPaletteConfigurationHandler.java
deleted file mode 100644
index 89aa3425d9a..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/AbstractDeployPaletteConfigurationHandler.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Permits to display open diagram editor id
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.handler;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.gmf.runtime.common.ui.services.editor.EditorService;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.TrayDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.XMLMemento;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.statushandlers.StatusManager;
-
-/**
- * @author RS211865
- */
-public abstract class AbstractDeployPaletteConfigurationHandler extends AbstractHandler {
-
- public static class UpdateContentDialog extends TrayDialog {
-
- /** the palette name */
- public String paletteName;
-
- /** the provider priority */
- public ProviderPriority priority;
-
- /** the editor id */
- public String editorID;
-
- /** list of required profiles */
- public String requiredProfiles;
-
- /** file name */
- public String fileName;
-
- /** the name field */
- private Text nameText;
-
- /** the editor filed as a combo */
- private Combo editorIdCombo;
-
- /** the profiles text field */
- private Text profilesText;
-
- /** combo for priority */
- private CCombo priorityCombo;
-
-
- /**
- * Constructor.
- *
- * @param shell
- * the shell
- * @param priority
- * the priority
- * @param editorID
- * the editor id
- * @param requiredProfiles
- * the required profiles
- */
- protected UpdateContentDialog(final Shell shell, final String fileName, final String paletteName, final ProviderPriority priority, final String editorID, final Set<String> requiredProfiles) {
- super(shell);
- this.fileName = fileName;
- this.paletteName = paletteName;
- this.priority = priority;
- this.editorID = editorID;
- if (requiredProfiles != null) {
- this.requiredProfiles = PaletteUtil.getSerializedProfileList(requiredProfiles);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void configureShell(final Shell newShell) {
- super.configureShell(newShell);
- if (newShell != null) {
- newShell.setText(Messages.AbstractDeployPaletteConfigurationHandler_ConfigureDeploymentOfThePalette);
- newShell.setSize(600, 400);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Control createDialogArea(final Composite parent) {
- Composite superComposite = (Composite) super.createDialogArea(parent);
- Composite composite = new Composite(superComposite, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
-
- // new grid data will all necessary info
- Label nameLabel = new Label(composite, SWT.NONE);
- nameLabel.setText(Messages.AbstractDeployPaletteConfigurationHandler_Identifier);
- nameText = new Text(composite, SWT.BORDER);
- if (paletteName == null) {
- paletteName = fileName;
- }
- nameText.setText(paletteName);
- nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-
- Label priorityLabel = new Label(composite, SWT.NONE);
- priorityLabel.setText(Messages.AbstractDeployPaletteConfigurationHandler_Priority);
- priorityCombo = new CCombo(composite, SWT.BORDER);
- priorityCombo.setEditable(false);
- priorityCombo.setItems(new String[] { ProviderPriority.LOWEST.getName(), ProviderPriority.LOW.getName(), ProviderPriority.MEDIUM.getName(), ProviderPriority.HIGH.getName(), ProviderPriority.HIGHEST.getName() });
- if (ProviderPriority.LOWEST.equals(priority)) {
- priorityCombo.select(0);
- } else if (ProviderPriority.LOW.equals(priority)) {
- priorityCombo.select(1);
- } else if (ProviderPriority.MEDIUM.equals(priority)) {
- priorityCombo.select(2);
- } else if (ProviderPriority.HIGH.equals(priority)) {
- priorityCombo.select(3);
- } else if (ProviderPriority.HIGHEST.equals(priority)) {
- priorityCombo.select(4);
- } else {
- priorityCombo.select(2); // default = medium
- }
- priorityCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-
- Label editorLabel = new Label(composite, SWT.NONE);
- editorLabel.setText(Messages.AbstractDeployPaletteConfigurationHandler_Editor);
- editorIdCombo = new Combo(composite, SWT.BORDER);
- if (editorID == null) {
- editorID = ""; //$NON-NLS-1$
- }
- editorIdCombo.setItems(findOpenedDiagramEditor().toArray(new String[] {}));
- editorIdCombo.setText(editorID);
- editorIdCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-
- // list of profiles
- Label profilesLabel = new Label(composite, SWT.NONE);
- profilesLabel.setText(Messages.AbstractDeployPaletteConfigurationHandler_Profiles);
- profilesText = new Text(composite, SWT.BORDER);
- if (requiredProfiles != null) {
- profilesText.setText(requiredProfiles);
- }
- profilesText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-
- return superComposite;
- }
-
- /**
- * Get the list of id of opened diagram editor
- *
- * @return the list of opened diagram editor
- */
- public static List<String> findOpenedDiagramEditor() {
-
- // The list of diagram id
- List<String> ids = new ArrayList<String>();
-
- // The list of open editor part
- List<?> diagramEditors = EditorService.getInstance().getRegisteredEditorParts();
-
- // Filter it and fill the list with contribution id of each DiagramEditor
- diagramEditors.stream()
- .filter(diagram -> diagram instanceof DiagramEditor)
- .forEach(diagram -> {
- ids.add(((DiagramEditor) diagram).getContributorId());
- });
-
- return ids;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void okPressed() {
- // updates values
- if (null != nameText && !nameText.isDisposed()) {
- paletteName = nameText.getText();
- }
-
- if (null != editorIdCombo && !editorIdCombo.isDisposed()) {
- editorID = editorIdCombo.getText();
- }
-
- if (null != priorityCombo && !priorityCombo.isDisposed()) {
- priority = ProviderPriority.parse(priorityCombo.getText());
- }
-
- if (null != profilesText && !profilesText.isDisposed()) {
- requiredProfiles = profilesText.getText();
- }
-
- super.okPressed();
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if (!(currentSelection instanceof IStructuredSelection) || currentSelection.isEmpty()) {
- return null;
- }
-
- final IStructuredSelection selection = (IStructuredSelection) currentSelection;
-
- final Shell activeShell = HandlerUtil.getActiveShell(event);
-
-
- doExecute(selection, activeShell, new NullProgressMonitor());
- return null;
-
- }
-
- protected void doExecute(final IStructuredSelection selection, final Shell activeShell, final IProgressMonitor monitor) {
-
- Iterator<?> selectionIterator = selection.iterator();
-
- MultiStatus result = new MultiStatus(Activator.ID, IStatus.OK, Messages.AbstractDeployPaletteConfigurationHandler_ThePaletteConfigurationHasBeenSuccessfullyDeployedAndActivated, null);
-
- while (selectionIterator.hasNext()) {
- Object selectedElement = selectionIterator.next();
- if (selectedElement instanceof IAdaptable) {
- IFile selectedFile = ((IAdaptable) selectedElement).getAdapter(IFile.class);
- if (selectedFile == null) {
- monitor.worked(1);
- result.add(new Status(IStatus.ERROR, Activator.ID, Messages.AbstractDeployPaletteConfigurationHandler_TheSelectedElementIsNotAFile));
- continue;
- }
-
-
- String fileName = selectedFile.getFullPath().removeFileExtension().lastSegment();
- monitor.subTask(Messages.AbstractDeployPaletteConfigurationHandler_Deploy + fileName);
- boolean alreadyDeployed = false;
- // retrieve info => open a dialog, filled by current opened editor ?
- ProviderPriority priority = getPriority(fileName);
- if (null == priority) {
- priority = ProviderPriority.MEDIUM;
- } else {
- alreadyDeployed = true;
- }
-
- String editorID = getEditorID(fileName);
- if (null != editorID) {
- alreadyDeployed = true;
- }
-
- String paletteName = getPaletteName(fileName);
- if (null != paletteName) {
- alreadyDeployed = true;
- }
- Set<String> requiredProfiles = getRequiredProfiles(fileName);
- if (requiredProfiles != null && requiredProfiles.size() > 0) {
- alreadyDeployed = true;
- }
- String path = selectedFile.getFullPath().toString();
-
-
- UpdateContentDialog dialog = new UpdateContentDialog(activeShell, fileName, paletteName, priority, editorID, requiredProfiles);
- int returnCode = dialog.open();
- if (Window.OK == returnCode) {
- boolean validUpdate = true;
-
- // update values from the editor
- if (dialog.paletteName != null && dialog.paletteName.length() > 0) {
- paletteName = dialog.paletteName;
- } else {
- validUpdate = false;
- }
-
- if (dialog.priority != null) {
- priority = dialog.priority;
- } else {
- validUpdate = false;
- }
-
- if (dialog.editorID != null && dialog.editorID.length() > 0) {
- editorID = dialog.editorID;
- } else {
- validUpdate = false;
- }
-
- if (dialog.requiredProfiles != null && dialog.requiredProfiles.length() > 0) {
- requiredProfiles = PaletteUtil.getProfileSetFromString(dialog.requiredProfiles);
- } else {
- requiredProfiles = Collections.emptySet();
- }
-
- if (validUpdate) {
- if (alreadyDeployed) {
- // update values and set visible again
- result.add(activatePalette(fileName, paletteName, path, priority, editorID, requiredProfiles));
- } else {
- result.add(deployPalette(fileName, paletteName, path, priority, editorID, requiredProfiles));
- }
- } else {
- result.add(new Status(IStatus.ERROR, Activator.ID, Messages.AbstractDeployPaletteConfigurationHandler_Error_ContentDialogNotValid));
- }
- } else {
- result.add(new Status(IStatus.ERROR, Activator.ID, Messages.AbstractDeployPaletteConfigurationHandler_Error_UserCancelDialog));
- }
-
- }
- }
-
- if (result.getChildren().length == 1) {
- if (result.isOK()) {
- MessageDialog.openInformation(activeShell, Messages.AbstractDeployPaletteConfigurationHandler_Success, result.getMessage());
- } else if (result.getSeverity() < IStatus.ERROR) { // Errors are already logged
- StatusManager.getManager().handle(result, StatusManager.SHOW);
- }
- } else { // Merge the result and specify an appropriate message based on the result
- if (result.isOK()) {
- MessageDialog.openInformation(activeShell, Messages.AbstractDeployPaletteConfigurationHandler_Success, result.getMessage());
- } else {
- MultiStatus actualResult = new MultiStatus(Activator.ID, result.getCode(), Messages.AbstractDeployPaletteConfigurationHandler_Error_SomeErrorsOccured, result.getException());
- actualResult.merge(result);
- }
- }
- }
-
- /**
- * get the Required Profiles
- *
- * @param identifier
- * the identifier
- * @return the required profiles
- */
- protected Set<String> getRequiredProfiles(final String identifier) {
- return PapyrusPalettePreferences.getRequiredProfiles(identifier, getMemento());
- }
-
- /**
- * get the Palette Name
- *
- * @param identifier
- * the identifier
- * @return the Palette Name
- */
- protected String getPaletteName(final String identifier) {
- return PapyrusPalettePreferences.getPaletteName(identifier, getMemento());
- }
-
- /**
- * get the Editor ID
- *
- * @param identifier
- * the identifier
- * @return the Editor ID
- */
- protected String getEditorID(final String identifier) {
- return PapyrusPalettePreferences.getEditorID(identifier, getMemento());
- }
-
- /**
- * get the priority
- *
- * Warning. Can be <code>null</code>!
- *
- * @param identifier
- * the identifier
- * @return the provider priority
- */
- protected ProviderPriority getPriority(final String identifier) {
- return PapyrusPalettePreferences.getPalettePriority(identifier, getMemento());
- }
-
- /** get the xml memento */
- protected abstract XMLMemento getMemento();
-
- /**
- * deploy the Palette
- *
- * @param fileName
- * @param paletteName
- * @param path
- * @param priority
- * @param editorID
- * @param requiredProfiles
- * @return
- */
- protected abstract IStatus deployPalette(final String fileName, final String paletteName, final String path, final ProviderPriority priority, final String editorID, final Set<String> requiredProfiles);
-
- /**
- * activate the Palette
- *
- * @param fileName
- * @param paletteName
- * @param path
- * @param priority
- * @param editorID
- * @param requiredProfiles
- * @return
- */
- protected abstract IStatus activatePalette(final String fileName, final String paletteName, final String path, final ProviderPriority priority, final String editorID, final Set<String> requiredProfiles);
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/AbstractUndeployPaletteConfigurationHandler.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/AbstractUndeployPaletteConfigurationHandler.java
deleted file mode 100644
index 43aea9e6f54..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/AbstractUndeployPaletteConfigurationHandler.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.handler;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.XMLMemento;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.statushandlers.StatusManager;
-
-/**
- * @author RS211865
- */
-public abstract class AbstractUndeployPaletteConfigurationHandler extends AbstractHandler {
-
- /**
- *
- */
- public AbstractUndeployPaletteConfigurationHandler() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if (!(currentSelection instanceof IStructuredSelection) || currentSelection.isEmpty()) {
- return null;
- }
-
- final IStructuredSelection selection = (IStructuredSelection) currentSelection;
-
- final Shell activeShell = HandlerUtil.getActiveShell(event);
-
-
- doExecute(selection, activeShell, new NullProgressMonitor());
- return null;
- }
-
- protected void doExecute(IStructuredSelection selection, Shell activeShell, IProgressMonitor monitor) {
- Iterator<?> selectionIterator = selection.iterator();
-
- MultiStatus result = new MultiStatus(Activator.ID, IStatus.OK, "The palette configuration has been successfully deactivated and undeployed", null);
-
- while (selectionIterator.hasNext()) {
- Object selectedElement = selectionIterator.next();
- if (selectedElement instanceof IAdaptable) {
- IFile selectedFile = (IFile) ((IAdaptable) selectedElement).getAdapter(IFile.class);
- if (selectedFile == null) {
- monitor.worked(1);
- result.add(new Status(IStatus.ERROR, Activator.ID, "The selected element is not a file"));
- continue;
- }
-
-
- String fileName = selectedFile.getFullPath().removeFileExtension().lastSegment();
- monitor.subTask("Undeploy " + fileName);
-
- // do not delete.
- // PapyrusPalettePreferences.deleteWorkspacePalette(fileName);
-
- // if not deploy, do nothing and onlyh warn
- String editorId = getEditorID(fileName);
- if (editorId == null) {
- // not deployed: cancel the undeploy action
- MessageDialog.openInformation(activeShell, "Not deployed", "This palette is currently not deployed");
- result.add(new Status(IStatus.ERROR, Activator.ID, "The palette configuration " + fileName + " was not undeployed already"));
- } else {
- result.add(deactivatePalette(fileName, editorId));
- }
-
- }
- }
-
- if (result.getChildren().length == 1) {
- if (result.isOK()) {
- MessageDialog.openInformation(activeShell, "Success", result.getMessage());
- } else if (result.getSeverity() < IStatus.ERROR) { // Errors are already logged
- StatusManager.getManager().handle(result, StatusManager.SHOW);
- }
- } else { // Merge the result and specify an appropriate message based on the result
- if (result.isOK()) {
- MessageDialog.openInformation(activeShell, "Success", result.getMessage());
- } else {
- MultiStatus actualResult = new MultiStatus(Activator.ID, result.getCode(), "Some errors occurred during the deployment", result.getException());
- actualResult.merge(result);
- }
- }
- }
-
- /**
- * @return
- */
- protected abstract XMLMemento getMemento();
-
- /**
- * @param fileName
- * @return
- */
- protected abstract IStatus deactivatePalette(String identifier, String editorId);
-
- /**
- * @param identifier
- * @return
- */
- protected String getEditorID(String identifier) {
- return PapyrusPalettePreferences.getEditorID(identifier, getMemento());
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/DeployExtendedPaletteConfigurationHandler.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/DeployExtendedPaletteConfigurationHandler.java
deleted file mode 100644
index 63e3de2f3d2..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/DeployExtendedPaletteConfigurationHandler.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.handler;
-
-import java.util.Set;
-
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.ui.XMLMemento;
-
-
-/**
- * Handler to deploy new configuration of palette based on a XML file
- */
-public class DeployExtendedPaletteConfigurationHandler extends AbstractDeployPaletteConfigurationHandler implements IHandler {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IStatus deployPalette(String fileName, String paletteName, String path, ProviderPriority priority, String editorID, Set<String> requiredProfiles) {
- // just add the palette
- PapyrusPalettePreferences.addWorkspaceExtendedPalette(paletteName, paletteName, path, priority, editorID, requiredProfiles);
- return new Status(IStatus.OK, Activator.ID, "The palette configuration has been successfully deployed and activated");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IStatus activatePalette(String fileName, String paletteName, String path, ProviderPriority priority, String editorID, Set<String> requiredProfiles) {
- PapyrusPalettePreferences.addWorkspaceExtendedPalette(paletteName, paletteName, path, priority, editorID, requiredProfiles);
- PapyrusPalettePreferences.changePaletteVisibility(fileName, editorID, true);
- return new Status(IStatus.OK, Activator.ID, "The palette configuration was already deployed, it has just been activated");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected XMLMemento getMemento() {
- return PapyrusPalettePreferences.getExistingWorkspaceExtendedPalettes();
- }
-} \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/DeployPaletteConfigurationHandler.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/DeployPaletteConfigurationHandler.java
deleted file mode 100644
index 99e3ae2afd6..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/DeployPaletteConfigurationHandler.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.handler;
-
-import java.util.Set;
-
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.ui.XMLMemento;
-
-
-/**
- * Handler to deploy new configuration of palette based on a XML file
- */
-public class DeployPaletteConfigurationHandler extends AbstractDeployPaletteConfigurationHandler implements IHandler {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IStatus deployPalette(String fileName, String paletteName, String path, ProviderPriority priority, String editorID, Set<String> requiredProfiles) {
- // just add the palette
- PapyrusPalettePreferences.addWorkspacePalette(fileName, paletteName, path, priority, editorID, requiredProfiles);
- return new Status(IStatus.OK, Activator.ID, "The palette configuration has been successfully deployed and activated");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IStatus activatePalette(String fileName, String paletteName, String path, ProviderPriority priority, String editorID, Set<String> requiredProfiles) {
- PapyrusPalettePreferences.addWorkspacePalette(fileName, paletteName, path, priority, editorID, requiredProfiles);
- PapyrusPalettePreferences.changePaletteVisibility(fileName, editorID, true);
- return new Status(IStatus.OK, Activator.ID, "The palette configuration was already deployed, it has just been activated");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected XMLMemento getMemento() {
- return PapyrusPalettePreferences.getExistingWorkspacePalettes();
- }
-} \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/UndeployExtendedPaletteConfigurationHandler.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/UndeployExtendedPaletteConfigurationHandler.java
deleted file mode 100644
index 7e7a6d61c0c..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/UndeployExtendedPaletteConfigurationHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.handler;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.ui.XMLMemento;
-
-
-
-/**
- * Handler to undeploy a palette configured by a EMF model. similar implementation to the XML based palette, because visibility has the same implementation in our case.
- */
-public class UndeployExtendedPaletteConfigurationHandler extends AbstractUndeployPaletteConfigurationHandler {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IStatus deactivatePalette(String identifier, String editorId) {
- PapyrusPalettePreferences.changePaletteVisibility(identifier, editorId, false);
- return new Status(IStatus.OK, Activator.ID, "The palette configuration " + identifier + " has been successfully deactivated and undeployed");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected XMLMemento getMemento() {
- return PapyrusPalettePreferences.getExistingWorkspaceExtendedPalettes();
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/UndeployPaletteConfigurationHandler.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/UndeployPaletteConfigurationHandler.java
deleted file mode 100644
index 40b1be5b983..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/handler/UndeployPaletteConfigurationHandler.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.handler;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.ui.XMLMemento;
-
-/**
- * Handler to undeploy a palette configured by a XML file
- */
-public class UndeployPaletteConfigurationHandler extends AbstractUndeployPaletteConfigurationHandler {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IStatus deactivatePalette(String identifier, String editorId) {
- PapyrusPalettePreferences.changePaletteVisibility(identifier, editorId, false);
- return new Status(IStatus.OK, Activator.ID, "The palette configuration " + identifier + " has been successfully deactivated and undeployed");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected XMLMemento getMemento() {
- return PapyrusPalettePreferences.getExistingWorkspacePalettes();
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/messages.properties b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/messages.properties
deleted file mode 100644
index e41320270a2..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/messages.properties
+++ /dev/null
@@ -1,123 +0,0 @@
-###############################################################################
-# Copyright (c) 2010 CEA LIST.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
-###############################################################################
-
-# Explorer dialog messages
-BundleIconExplorerDialog_Message=Please select an icon in the following list
-BundleIconExplorerDialog_Title=Icon selection
-BundleIconExplorerDialog_UnknownFileName=<Unknown>
-
-########### Palette configuration model edition messages ###########
-ExportPaletteConfigurationWizard_error_cant_read_file=Impossible to read local definition of the file
-ExportPaletteConfigurationWizard_error_file_not_existe=local file does not exists :
-ExportPaletteConfigurationWizard_Export_description=Choose where you want to export the selected palette configuration
-ExportPaletteConfigurationWizard_ExportWiazrdLabel=Export
-ExportPaletteConfigurationWizard_export_palette=Export Palette Configuration
-PaletteConfigurationContentPage_CreateAnElementWithAStereotype=Create an element with a stereotype
-PaletteConfigurationContentPage_Drawer=Drawer
-PaletteConfigurationContentPage_NewTool=NewTool
-PaletteConfigurationContentPage_Separator=Separator
-PaletteConfigurationContentPage_Stack=Stack
-PaletteConfigurationContentPage_UMLTools=UML tools
-PaletteConfigurationContentPage_UnknownElement=unknown element
-PaletteConfigurationWizard_EditionPaletteInfoPageWizard_Tilte=Edit the Palette
-PaletteConfigurationWizard_EditPaletteWizardLabel=Edit Palette
-PaletteConfigurationWizard_NewPaletteContentPageWizard_Description=Edit the content of the palette.
-PaletteConfigurationWizard_NewPaletteContentPageWizard_Title=Palette Content
-PaletteConfigurationWizard_NewPaletteDefaultName=New Palette
-PaletteConfigurationWizard_PaletteInfoPageWizard_Description=Enter information of the new palette.
-PaletteConfigurationWizard_NewPaletteInfoPageWizard_Title=New Local Palette
-PaletteConfigurationWizard_NewPaletteWizardLabel=New Palette
-PaletteConfigurationWizard_ImpossibleToReadDefinitionOfTheFile=Impossible to read definition of the file
-PaletteConfigurationWizard_FileDontExist=File does not exists :
-PapyrusPaletteCustomizerDialog_AddButtonTooltip=Create a new palette
-PapyrusPaletteCustomizerDialog_RemoveButtonTooltip=Delete the selected palette
-
-############# Palette Customisation #################
-PapyrusPaletteCustomizerDialog_AddButtonTooltip=Add the selection to the palette
-PapyrusPaletteCustomizerDialog_RemoveButtonTooltip=Remove the selection from the palette
-PapyrusPaletteCustomizerDialog_EditButtonTooltip_LocalPaletteSelected=Edit the selected local palette
-PapyrusPaletteCustomizerDialog_EditButtonTooltip_LocalPaletteNotSelected=Edit a local palette. Please select a local palette in the available palette viewer.
-PapyrusPaletteCustomizerDialog_EditButtonTooltip_MissingProfile=Impossible to edit this local palette because some required profile are not applied.
-PapyrusPaletteCustomizerDialog_EditButtonTooltip=Edit the current selected drawer
-Available_Palettes=Available palettes
-Palette_Viewer=Palette preview
-Local_Palette_Name=Name*:
-Local_Palette_Name_Tooltip=Enter a name for this palette contribution. This name will be displayed when selecting the visible palettes and the hidden ones.
-Local_Palette_Id=Identifier*:
-Local_Palette_Id_Tooltip=Enter a unique identifier for this palette contribution. This identifier is used to retrieve this palette among others, which means it should be unique.
-Local_Palette_Editor_Id=EditorID*:
-Local_Palette_Editor_Id_Tooltip=Sets the id of the editor for which this configuration is provided.
-Local_Palette_Priority=Priority*:
-Local_Palette_Priority_Tooltip=Sets the palette priority. It determines which palette provider is contributing first.\nThis contribution should have at least a priority higher than predefined tools contributions.
-Dialog_Advanced_Button_Closed=Advanced >>
-Dialog_Advanced_Button_Opened=<< Advanced
-Local_Palette_Error_Priority=One priority should be selected in the list of availables priorities
-Local_Palette_Error_Name=Name field shall not be empty
-Local_Palette_Error_EditorId=Editor ID field shall not be empty
-Local_Palette_Error_PaletteId=Palette ID field shall not be empty
-Local_Palette_InfoPage_Name=LocalPaletteInformation
-Local_Palette_InfoPage_Title=Local Palette Information
-Local_Palette_ContentPage_Name=LocalPaletteContent
-Local_Palette_ContentPage_Title=Local Palette Content
-Local_Palette_Available_Tools=Available tools
-Local_Palette_ShowDrawers_Tooltip=Toggle this button to show/hide the drawers in the list
-Local_Palette_ShowTools_Tooltip=Toggle this button to show/hide the tools in the list
-Local_Palette_SwitchToolsContentProvider_Tooltip=Toggle this button to change the way tools are shown in the list (Metaclass -> Stereotypes or Metaclass -> Stereotypes)
-Local_Palette_Palette_Preview=Palette preview
-Local_Palette_Entry_Name=Name:
-Local_Palette_Entry_Description=Description:
-Local_Palette_Entry_Icon=Icon:
-Local_Palette_Entry_Information=Entry information
-Local_Palette_Entry_Reference:Extended Tool:
-
-Aspect_Action_Information_List_Label=Aspect actions
-
-Dialog_Not_Local_Palette_Title=Bad selection (no item or bad item)
-Dialog_Not_Local_Palette_Message=Please select a local palette to be deleted.
-Dialog_Not_Extended_Palette_Title=Bad selection (no item or bad item)
-Dialog_Not_Extended_Palette_Message=Please select an extended palette to be restored.
-Dialog_Delete_Palette_Tooltip=Delete selected local palette definition
-Dialog_Create_Palette_Tooltip=Create a new local palette
-Dialog_Edit_Palette_Tooltip=Edit selected palette
-Dialog_Restore_Palette_Tooltip=Restore default values of selected palette
-Dialog_Export_Palette_Tooltip= Export configuration model of selected palette
-
-Local_Palette_Create_Drawer_Tooltip=Create a new drawer in the palette
-Local_Palette_Create_Separator_Tooltip=Create a new separator in the palette
-Local_Palette_Create_Tool_Tooltip=Create a new tool in the palette
-Local_Palette_Create_Stack_Tooltip=Create a new stack in the palette
-
-Wizard_Drawer_Page_Name=DrawerWizardPage
-Wizard_Drawer_Page_Title=Drawer Information Page
-Wizard_Drawer_Error_Name=Name field shall not be empty
-Wizard_Drawer_Error_Id=ID field shall not be empty
-Wizard_Drawer_Error_Icon=Icon field shall not be empty
-Wizard_Drawer_Id=Identifier*
-Wizard_Drawer_Id_Tooltip=Enter a unique identifier for this drawer.\nThis identifier is used to retrieve this drawer among others, which means it should be unique.
-Wizard_Drawer_Name=Name*
-Wizard_Drawer_Name_Tooltip=Enter a name for this drawer.
-Wizard_Drawer_Icon_Tooltip=Enter the path to the icon. It can be something like "/icon/drawer.gif" or like "platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/PackageImport.gif"
-Wizard_Drawer_Icon=Icon*
-
-########### Palette deploy wizard ###########
-AbstractDeployPaletteConfigurationHandler_ConfigureDeploymentOfThePalette=Configure deployment of the palette
-AbstractDeployPaletteConfigurationHandler_Deploy=Deploy
-AbstractDeployPaletteConfigurationHandler_Editor=Editor:
-AbstractDeployPaletteConfigurationHandler_Error_UserCancelDialog=The palette configuration was not deployed, because user did cancel the dialog
-AbstractDeployPaletteConfigurationHandler_Error_ContentDialogNotValid=The palette configuration was not deployed, because dialog content was not valid
-AbstractDeployPaletteConfigurationHandler_Error_SomeErrorsOccured=Some errors occurred during the deployment
-AbstractDeployPaletteConfigurationHandler_Identifier=Identifier:
-AbstractDeployPaletteConfigurationHandler_Priority=Priority:
-AbstractDeployPaletteConfigurationHandler_Profiles=Profiles:
-AbstractDeployPaletteConfigurationHandler_Success=Success
-AbstractDeployPaletteConfigurationHandler_ThePaletteConfigurationHasBeenSuccessfullyDeployedAndActivated=The palette configuration has been successfully deployed and activated
-AbstractDeployPaletteConfigurationHandler_TheSelectedElementIsNotAFile=The selected element is not a file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/PaletteLabelProvider.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/PaletteLabelProvider.java
deleted file mode 100644
index 16de72a2579..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/PaletteLabelProvider.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.provider;
-
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.Stereotype;
-
-/**
- * Label provider for palette tools.
- * <P>
- * We should be using the Palette label provider from GEF, if it was not with visibility "package"...
- *
- * @see org.eclipse.gef.ui.palette.customize.PaletteLabelProvider
- * </P>
- *
- */
-public class PaletteLabelProvider implements ILabelProvider {
-
- /** the icon for stereotypes */
- private static final String ICONS_STEREOTYPE = "/icons/stereotype.gif"; // $NON-NLS-N$
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addListener(final ILabelProviderListener listener) {
- // Do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // Do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage(final Object element) {
- Image iconImage = null;
- if (element instanceof PaletteEntry) {
- ImageDescriptor descriptor = ((PaletteEntry) element).getSmallIcon();
- if (descriptor != null) {
- iconImage = Activator.getPluginIconImage(Activator.ID, descriptor);
- }
- } else if (element instanceof Stereotype) {
- iconImage = Activator.getPluginIconImage(Activator.ID, ICONS_STEREOTYPE);
- }
- return iconImage;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getText(final Object element) {
- String text = null;
- if (element instanceof PaletteEntry) {
- text = ((PaletteEntry) element).getLabel();
- } else if (element instanceof Stereotype) {
- text = ((Stereotype) element).getName();
- }
- return null != text ? text : Messages.PaletteConfigurationContentPage_UnknownElement;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isLabelProperty(final Object element, final String property) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeListener(final ILabelProviderListener listener) {
- // Do nothing
- }
-
-} \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/ProfileToolsMetaclassStereotypeTreeContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/ProfileToolsMetaclassStereotypeTreeContentProvider.java
deleted file mode 100644
index aaf12d1158c..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/ProfileToolsMetaclassStereotypeTreeContentProvider.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*****************************************************************************
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.provider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectCreationEntry;
-import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.StereotypeAspectActionProvider;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Content provider for the available tools viewer, when the
- */
-public class ProfileToolsMetaclassStereotypeTreeContentProvider implements ITreeContentProvider {
-
- /** profile to display */
- final protected Profile profile;
-
- /** standard uml tools palette entries */
- final protected Collection<PaletteEntry> standardEntries;
-
- /**
- * Creates a new ProfileToolsMetaclassStereotypeTreeContentProvider.
- *
- * @param profile
- * the profile for which tools are built
- * @param standardEntries
- * list of standard uml tools palette entries
- */
- public ProfileToolsMetaclassStereotypeTreeContentProvider(final Profile profile, final Collection<PaletteEntry> standardEntries) {
- this.profile = profile;
- this.standardEntries = standardEntries;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // nothing to do here
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- Object[] children;
- if (parentElement instanceof Profile) {
- children = standardEntries.toArray();
-
- } else if (parentElement instanceof AspectCreationEntry) {
- children = new Object[0];
-
- } else if (parentElement instanceof PaletteEntry) {
- List<AspectCreationEntry> entries = new ArrayList<AspectCreationEntry>();
- // display all stereotypes applicable to the type of element created by this tool
- if (parentElement instanceof CombinedTemplateCreationEntry) {
- CombinedTemplateCreationEntry entry = (CombinedTemplateCreationEntry) parentElement;
- EClass toolMetaclass = PaletteUtil.getToolMetaclass(entry);
- if (toolMetaclass != null) {
- for (Stereotype stereotype : profile.getOwnedStereotypes()) {
- List<Class> metaclasses = stereotype.getAllExtendedMetaclasses();
- for (Class stMetaclass : metaclasses) {
- // get Eclass
- java.lang.Class<?> metaclassClass = stMetaclass.getClass();
- if (metaclassClass != null) {
- EClassifier metaClassifier = UMLPackage.eINSTANCE.getEClassifier(stMetaclass.getName());
- if (((EClass) metaClassifier).isSuperTypeOf(toolMetaclass)) {
- // should create the palette entry
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(IPapyrusPaletteConstant.ASPECT_ACTION_KEY, StereotypeAspectActionProvider.createConfigurationNode(stereotype.getQualifiedName()));
- StringBuilder name = new StringBuilder();
- name.append(stereotype.getName());
- name.append(" (");//$NON-NLS-1$
- name.append(entry.getLabel());
- name.append(")");//$NON-NLS-1$
- AspectCreationEntry aspectEntry = new AspectCreationEntry(name.toString(), Messages.PaletteConfigurationContentPage_CreateAnElementWithAStereotype, // $NON-NLS-1$ //$NON-NLS-2$
- entry.getId(), // $NON-NLS-4$
- entry.getSmallIcon(), entry, properties);
- entries.add(aspectEntry);
- }
- }
-
- }
- }
- }
- }
- children = entries.toArray();
- } else {
- children = new Object[0];
- }
- return children;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(final Object inputElement) {
- return inputElement instanceof Profile ? standardEntries.toArray() : new Object[0];
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(final Object element) {
- return element instanceof Stereotype ? ((Stereotype) element).getProfile() : null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(final Object element) {
- boolean hasChildren = false;
- if (element instanceof Profile) {
- hasChildren = true;
- } else if (element instanceof PaletteEntry) {
- hasChildren = true;
- }
- return hasChildren;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
- // Do nothing
- }
-
-} \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/ProfileToolsStereotypeMetaclassTreeContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/ProfileToolsStereotypeMetaclassTreeContentProvider.java
deleted file mode 100644
index 9768842ab6c..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/ProfileToolsStereotypeMetaclassTreeContentProvider.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*****************************************************************************
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.provider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.customization.palette.Messages;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectCreationEntry;
-import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.StereotypeAspectActionProvider;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Content provider for the available tools viewer, when the tools to see are coming from a
- * profile
- */
-public class ProfileToolsStereotypeMetaclassTreeContentProvider implements ITreeContentProvider {
-
- /** standard uml tools palette entries */
- final protected Collection<PaletteEntry> standardEntries;
-
- /**
- * Creates a new ProfileToolsStereotypeMetaclassTreeContentProvider.
- *
- * @param profile
- * the profile for which tools are built
- * @param standardEntries
- * list of standard uml tools palette entries
- */
- public ProfileToolsStereotypeMetaclassTreeContentProvider(final Profile profile, final Collection<PaletteEntry> standardEntries) {
- this.standardEntries = standardEntries;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // nothing to do here
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(final Object parentElement) {
- Object[] children;
- if (parentElement instanceof Profile) {
- children = ((Profile) parentElement).getOwnedStereotypes().toArray();
- } else if (parentElement instanceof Stereotype) {
- List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
- Stereotype stereotype = (Stereotype) parentElement;
-
- for (PaletteEntry entry : standardEntries) {
- // retrieve the element type created by the tool.
- if (entry instanceof CombinedTemplateCreationEntry) {
-
- EClass toolMetaclass = PaletteUtil.getToolMetaclass((CombinedTemplateCreationEntry) entry);
- if (toolMetaclass != null) {
- List<Class> metaclasses = stereotype.getAllExtendedMetaclasses();
- for (Class stMetaclass : metaclasses) {
- // get Eclass
- java.lang.Class<?> metaclassClass = stMetaclass.getClass();
- if (metaclassClass != null) {
- EClassifier metaClassifier = UMLPackage.eINSTANCE.getEClassifier(stMetaclass.getName());
- if (((EClass) metaClassifier).isSuperTypeOf(toolMetaclass)) {
- // should create the palette entry
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(IPapyrusPaletteConstant.ASPECT_ACTION_KEY, StereotypeAspectActionProvider.createConfigurationNode(stereotype.getQualifiedName()));
- StringBuilder name = new StringBuilder();
- name.append(stereotype.getName());
- name.append(" (");//$NON-NLS-1$
- name.append(entry.getLabel());
- name.append(")");//$NON-NLS-1$
- AspectCreationEntry aspectEntry = new AspectCreationEntry(name.toString(), Messages.PaletteConfigurationContentPage_CreateAnElementWithAStereotype,
- entry.getId(), // $NON-NLS-4$
- entry.getSmallIcon(), (CombinedTemplateCreationEntry) entry, properties);
- entries.add(aspectEntry);
- }
- }
-
- }
- }
- }
- }
- children = entries.toArray();
- } else {
- children = new Object[0];
- }
- return children;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(final Object inputElement) {
- return inputElement instanceof Profile ? ((Profile) inputElement).getOwnedStereotypes().toArray() : new Object[0];
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(final Object element) {
- return element instanceof Stereotype ? ((Stereotype) element).getProfile() : null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(final Object element) {
- return 0 < getChildren(element).length;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
- // nothing to do here
- }
-
-} \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/UMLToolsTreeContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/UMLToolsTreeContentProvider.java
deleted file mode 100644
index cdb61e3c01c..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/provider/UMLToolsTreeContentProvider.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *****************************************************************************/
-package org.eclipse.papyrus.customization.palette.provider;
-
-import java.util.Collection;
-
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
-
-/**
- * Content provider for available tools viewer
- */
-public class UMLToolsTreeContentProvider implements ITreeContentProvider {
-
- /**
- * Constructor
- *
- * @param viewer
- * The viewer whose ContentProvider this content provider is
- */
- public UMLToolsTreeContentProvider() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- // Do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getChildren(final Object parentElement) {
- Object[] elements = null;
-
- if (parentElement instanceof Collection<?>) {
- elements = ((Collection<?>) parentElement).toArray();
- } else if (parentElement instanceof PaletteRoot) {
- // paletteUil.getAllEntries(...) to add drawers
- // if so, uncomment the addFilterbutton for drawers in populate tool bar
- elements = PaletteUtil.getAllToolEntries(((PaletteRoot) parentElement)).toArray();
- }
-
- return elements;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object[] getElements(final Object inputElement) {
- Object[] elements = null;
-
- if (inputElement instanceof Collection<?>) {
- elements = ((Collection<?>) inputElement).toArray();
- } else if (inputElement instanceof PaletteRoot) {
- // paletteUil.getAllEntries(...) to add drawers
- // if so, uncomment the addFilterbutton for drawers in populate tool bar
- elements = PaletteUtil.getAllToolEntries(((PaletteRoot) inputElement)).toArray();
- }
-
- if (elements == null) {
- elements = new Object[0];
- }
- return elements;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getParent(final Object element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean hasChildren(final Object element) {
- return null != getChildren(element) && 0 < getChildren(element).length;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
- // Do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/proxies/XMLPaletteDefinitionProxyFactory.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/proxies/XMLPaletteDefinitionProxyFactory.java
deleted file mode 100644
index 452d383170b..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/proxies/XMLPaletteDefinitionProxyFactory.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- * Laurent Wouters (CEA LIST) laurent.wouters@cea.fr - Refactoring
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.proxies;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.papyrus.customization.palette.dialog.PaletteAspectToolEntryProxy;
-import org.eclipse.papyrus.customization.palette.dialog.PaletteContainerProxy;
-import org.eclipse.papyrus.customization.palette.dialog.PaletteEntryProxy;
-import org.eclipse.papyrus.customization.palette.dialog.PaletteLocalDrawerProxy;
-import org.eclipse.papyrus.customization.palette.dialog.PaletteLocalSeparatorProxy;
-import org.eclipse.papyrus.customization.palette.dialog.PaletteLocalStackProxy;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectCreationEntry;
-import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant;
-import org.eclipse.papyrus.uml.diagram.common.service.XMLPaletteDefinitionVisitor;
-import org.eclipse.papyrus.uml.diagram.common.service.palette.IPaletteEntryProxy;
-import org.w3c.dom.Node;
-
-/**
- * Implementation that creates proxies used by the palette previewer in the customiza dialog
- */
-public class XMLPaletteDefinitionProxyFactory implements XMLPaletteDefinitionVisitor, IPapyrusPaletteConstant {
-
- /** map of predefined entries */
- protected final Map<String, PaletteEntry> predefinedEntries;
-
- /** root proxy */
- protected PaletteContainerProxy containerProxy;
-
- /** registry of created nodes */
- protected final Map<Node, IPaletteEntryProxy> registry;
-
- /**
- * Creates a new XMLDefinitionPaletteFactory
- *
- * @param root
- * the palette root to fill
- * @param predefinedEntries
- * existing predefined entries
- */
- public XMLPaletteDefinitionProxyFactory(Map<String, PaletteEntry> predefinedEntries) {
- this.predefinedEntries = predefinedEntries;
- registry = new HashMap<Node, IPaletteEntryProxy>();
- }
-
- /**
- * Returns the parent proxy for the given node
- *
- * @param node
- * the node for which the parent is searched
- * @return the parent of this node
- */
- protected PaletteContainerProxy getParentProxy(Node node) {
- return (PaletteContainerProxy) registry.get(node.getParentNode());
- }
-
- /**
- * {@inheritDoc}
- */
- public void onContent(Node node) {
- containerProxy = new PaletteContainerProxy(null);
- registry.put(node, containerProxy);
- }
-
- /**
- * {@inheritDoc}
- */
- public void onDrawer(Node node) {
- String id = node.getAttributes().getNamedItem(ID).getNodeValue();
- PaletteEntry entry = predefinedEntries.get(id);
- PaletteContainerProxy proxy;
- Node descriptionNode = node.getAttributes().getNamedItem(DESCRIPTION);
- proxy = new PaletteLocalDrawerProxy(node.getAttributes().getNamedItem(NAME).getNodeValue(), node.getAttributes().getNamedItem(ID).getNodeValue(), node.getAttributes().getNamedItem(ICON_PATH).getNodeValue(),
- (descriptionNode != null) ? descriptionNode.getNodeValue() : "");
-
- getParentProxy(node).addChild(proxy);
- registry.put(node, proxy);
- }
-
- /**
- * {@inheritDoc}
- */
- public void onSeparator(Node node) {
- String id = node.getAttributes().getNamedItem(ID).getNodeValue();
- PaletteLocalSeparatorProxy proxy = new PaletteLocalSeparatorProxy(id);
- getParentProxy(node).addChild(proxy);
- registry.put(node, proxy);
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void onStack(Node node) {
- String id = node.getAttributes().getNamedItem(ID).getNodeValue();
- PaletteLocalStackProxy proxy = new PaletteLocalStackProxy(id);
- getParentProxy(node).addChild(proxy);
- registry.put(node, proxy);
- }
-
- /**
- * {@inheritDoc}
- */
- public void onToolEntry(Node node) {
- String id = node.getAttributes().getNamedItem(ID).getNodeValue();
- PaletteEntry entry = predefinedEntries.get(id);
- PaletteEntryProxy proxy = new PaletteEntryProxy(entry);
- getParentProxy(node).addChild(proxy);
- registry.put(node, proxy);
- }
-
- /**
- * {@inheritDoc}
- */
- public void onAspectToolEntry(Node node) {
- String id = node.getAttributes().getNamedItem(ID).getNodeValue();
- PaletteEntry entry = predefinedEntries.get(id);
-
- if (entry instanceof AspectCreationEntry) {
- PaletteAspectToolEntryProxy proxy = new PaletteAspectToolEntryProxy((AspectCreationEntry) entry);
- getParentProxy(node).addChild(proxy);
- registry.put(node, proxy);
- } else {
- Activator.log.error("impossible to log class " + id, null);
- }
- }
-
- /**
- * Returns the root proxy for the created element
- *
- * @return the container proxy
- */
- public PaletteContainerProxy getRootProxy() {
- return containerProxy;
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/utils/PaletteUtils.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/utils/PaletteUtils.java
deleted file mode 100644
index 11de2382d08..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/utils/PaletteUtils.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*****************************************************************************
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *****************************************************************************/
-
-package org.eclipse.papyrus.customization.palette.utils;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
-import org.eclipse.papyrus.customization.palette.PaletteConstants.PaletteModelContextEnum;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.ProviderDescriptor;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Utils for palette customization.
- *
- */
-public class PaletteUtils {
-
- /**
- * Save options for palette resources.
- */
- public static final Map<Object, Object> saveOptions;
- static {
- Map<Object, Object> options = new HashMap<Object, Object>();
- options.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED);
- saveOptions = Collections.unmodifiableMap(options);
- }
-
- /**
- * set the status field which describe in which case of palette model we are.
- *
- * @param descriptor
- */
- public static PaletteModelContextEnum getPaletteModelContext(ProviderDescriptor descriptor) {
- PaletteModelContextEnum paletteContext;
- // Case 1: WS
- if (descriptor instanceof PapyrusPaletteService.WorkspaceExtendedProviderDescriptor) {
- paletteContext = PaletteModelContextEnum.Workspace;
- } else
- // case 2: plugin
- if (descriptor instanceof PapyrusPaletteService.ExtendedProviderDescriptor) {
- paletteContext = PaletteModelContextEnum.Plugin;
- } else
- // case 3: local
- if (descriptor instanceof PapyrusPaletteService.LocalExtendedProviderDescriptor) {
- paletteContext = PaletteModelContextEnum.Local;
- } else {
- // case 4 : new
- paletteContext = PaletteModelContextEnum.New;
- }
- return paletteContext;
- }
-
- /**
- * @param the
- * file to test
- * @return true if it exist and is readable.
- */
- public static boolean notErrorOnFile(File file) {
- boolean error = false;
- if (null != file) {
- if (!file.exists()) {
- error = true;
- } else if (!file.canRead()) {
- error = true;
- }
- }
-
- return !error;
- }
-
- /**
- * Get the Id value of the current editor
- *
- * @return the editor id value as a String
- */
- public static String getEditorIdValue(IEditorPart editorPart) {
- String editorIDValue = ""; //$NON-NLS-1$
- if (editorPart instanceof DiagramEditorWithFlyOutPalette) {
- editorIDValue = ((DiagramEditorWithFlyOutPalette) editorPart).getContributorId();
- }
- return editorIDValue;
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.classpath b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.project b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.project
deleted file mode 100644
index cc1ec1fd45d..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.project
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.customization.paletteconfiguration</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>
- <buildCommand>
- <name>org.eclipse.oomph.version.VersionBuilder</name>
- <arguments>
- <dictionary>
- <key>check.maven.pom</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>ignore.lower.bound.dependency.ranges</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>release.path</key>
- <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
- </dictionary>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.papyrus.emf.facet.common.ProjectNature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.oomph.version.VersionNature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.jdt.core.prefs b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 4759947300a..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,291 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
-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/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.jdt.ui.prefs b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 954281dbc31..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,68 +0,0 @@
-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/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.pde.api.tools.prefs b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.pde.api.tools.prefs
deleted file mode 100644
index 23fb95e120f..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/.settings/org.eclipse.pde.api.tools.prefs
+++ /dev/null
@@ -1,98 +0,0 @@
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_ANNOTATION=Ignore
-INVALID_JAVADOC_TAG=Ignore
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=Enabled
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Warning
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/META-INF/MANIFEST.MF b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/META-INF/MANIFEST.MF
deleted file mode 100644
index 9cc430a3925..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.customization.paletteconfiguration,
- org.eclipse.papyrus.customization.paletteconfiguration.queries
-Require-Bundle: org.eclipse.osgi;bundle-version="[3.11.0,4.0.0)",
- org.eclipse.ui.workbench;bundle-version="[3.108.0,4.0.0)",
- org.eclipse.equinox.registry;bundle-version="[3.6.100,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)",
- org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)",
- org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.emf.facet.query.java.core;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
- org.eclipse.papyrus.uml.diagram.paletteconfiguration;bundle-version="[3.0.0,4.0.0)"
-Bundle-Vendor: %Bundle-Vendor
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %Bundle-Name
-Bundle-Activator: org.eclipse.papyrus.customization.paletteconfiguration.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.customization.paletteconfiguration;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/about.html b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/about.html
deleted file mode 100644
index 82d49bf5f81..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>June 5, 2007</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>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/build.properties b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/build.properties
deleted file mode 100644
index 31092449e5e..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/build.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-#Mon Sep 12 09:30:00 CEST 2011
-bin.includes = .,\
- META-INF/,\
- plugin.xml,\
- facet/,\
- about.html,\
- plugin.properties
-output..=bin/
-jars.compile.order=.
-src.includes = about.html
-source..=src/
-bin..=bin/
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.custom b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.custom
deleted file mode 100644
index c7dbdb185a3..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.custom
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<custom:Customization xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:custom="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:javaQuery="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation/javaquery" name="PaletteConfiguration">
- <eClassifiers xsi:type="custom:EClassCustomization" name="PaletteConfiguration" documentation="PaletteConfiguration">
- <extendedMetaclass href="platform:/plugin/org.eclipse.papyrus.uml.diagram.paletteconfiguration/model/PaletteConfiguration.ecore#//PaletteConfiguration"/>
- </eClassifiers>
- <eClassifiers xsi:type="custom:EClassCustomization" name="DrawerConfiguration" documentation="DrawerConfiguration">
- <extendedMetaclass href="platform:/plugin/org.eclipse.papyrus.uml.diagram.paletteconfiguration/model/PaletteConfiguration.ecore#//DrawerConfiguration"/>
- <facetOperations name="getDrawerLabel" documentation="Returns the label for a drawer">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrus.customization.paletteconfiguration.queries.GetDrawerLabelQuery"/>
- </facetOperations>
- </eClassifiers>
- <eClassifiers xsi:type="custom:EClassCustomization" name="Configuration" documentation="Configuration">
- <extendedMetaclass href="platform:/plugin/org.eclipse.papyrus.uml.diagram.paletteconfiguration/model/PaletteConfiguration.ecore#//Configuration"/>
- <facetOperations name="hasIcon" lowerBound="1" documentation="Returns true if the element has a specific icon to display">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
- <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrus.customization.paletteconfiguration.queries.HasIconQuery"/>
- </facetOperations>
- <facetOperations name="getIcon" lowerBound="1" documentation="Gets the icon for a configuration element in the palette configuration model">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrus.customization.paletteconfiguration.queries.GetIconQuery"/>
- </facetOperations>
- </eClassifiers>
- <eClassifiers xsi:type="custom:EClassCustomization" name="ToolConfiguration" documentation="ToolConfiguration">
- <extendedMetaclass href="platform:/plugin/org.eclipse.papyrus.uml.diagram.paletteconfiguration/model/PaletteConfiguration.ecore#//ToolConfiguration"/>
- <facetOperations name="getToolLabel" lowerBound="1" documentation="Returns the Label for a tool.">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrus.customization.paletteconfiguration.queries.GetToolLabelQuery"/>
- </facetOperations>
- </eClassifiers>
- <eClassifiers xsi:type="custom:EClassCustomization" name="StackConfiguration" instanceClassName="" documentation="StackConfiguration">
- <extendedMetaclass href="platform:/plugin/org.eclipse.papyrus.uml.diagram.paletteconfiguration/model/PaletteConfiguration.ecore#//StackConfiguration"/>
- </eClassifiers>
-</custom:Customization>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.facetset b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.facetset
deleted file mode 100644
index 7e2625417b4..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.facetset
+++ /dev/null
@@ -1,37 +0,0 @@
-<efacet:FacetSet xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet"
- xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query"
- xmlns:javaQuery2="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation"
- xmlns:library="http://www.eclipse.org/papyrus/emf/facet/examples/library/0.2.incubation/library"
- name="org.eclipse.papyrus.emf.facet.efacet.examples.library.core.facet"
- documentation="Queries">
- <eSubpackages xsi:type="efacet:FacetSet" name="PaletteConfiguration" documentation="PaletteConfiguration">
- <eClassifiers xsi:type="efacet:Facet" name="Configuration" documentation="Configuration">
- <extendedMetaclass href="http://www.eclipse.org/papyrus/diagram/paletteconfiguration/0.7#//Configuration"/>
- <facetOperations xsi:type="efacet:FacetOperation" name="hasIcon" lowerBound="1" documentation="Returns true if the element has a specific icon to display" >
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
- <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.papyrus.customization.paletteconfiguration.queries.HasIconQuery"/>
- </facetOperations>
- <facetOperations xsi:type="efacet:FacetOperation" name="getIcon" lowerBound="1" documentation="Gets the icon for a configuration element in the palette configuration model" >
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.papyrus.customization.paletteconfiguration.queries.GetIconQuery"/>
- </facetOperations>
- </eClassifiers>
- <eClassifiers xsi:type="efacet:Facet" name="ToolConfiguration" documentation="ToolConfiguration">
- <extendedMetaclass href="http://www.eclipse.org/papyrus/diagram/paletteconfiguration/0.7#//ToolConfiguration"/>
- <facetOperations xsi:type="efacet:FacetOperation" name="getToolLabel" lowerBound="1" documentation="Returns the Label for a tool." >
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.papyrus.customization.paletteconfiguration.queries.GetToolLabelQuery"/>
- </facetOperations>
- </eClassifiers>
- <eClassifiers xsi:type="efacet:Facet" name="DrawerConfiguration" documentation="DrawerConfiguration">
- <extendedMetaclass href="http://www.eclipse.org/papyrus/diagram/paletteconfiguration/0.7#//DrawerConfiguration"/>
- <facetOperations xsi:type="efacet:FacetOperation" name="getDrawerLabel" documentation="Returns the label for a drawer">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.papyrus.customization.paletteconfiguration.queries.GetDrawerLabelQuery"/>
- </facetOperations>
- </eClassifiers>
- </eSubpackages>
-</efacet:FacetSet> \ No newline at end of file
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.uiCustom b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.uiCustom
deleted file mode 100644
index c779bcfc415..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/facet/PaletteConfiguration.uiCustom
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?>
-<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/papyrus/diagram/paletteconfiguration/0.7">
- <types metaclassName="paletteconfiguration.PaletteConfiguration">
- <customizedFeatures>
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
- </customizedFeatures>
- <customizedFeatures customizedFeature="bold">
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
- </customizedFeatures>
- <references referenceName="drawerConfigurations">
- <customizedFeatures customizedFeature="collapseLink">
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
- </customizedFeatures>
- </references>
- <references referenceName="icon">
- <customizedFeatures>
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/>
- </customizedFeatures>
- </references>
- </types>
- <types metaclassName="paletteconfiguration.DrawerConfiguration">
- <customizedFeatures customizedFeature="label">
- <defaultValue xsi:type="uicustom:DerivedFeatureValue">
- <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/PaletteConfiguration#getDrawerLabel"/>
- </defaultValue>
- </customizedFeatures>
- <customizedFeatures customizedFeature="hideMetaclassName">
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
- </customizedFeatures>
- <references referenceName="ownedConfigurations">
- <customizedFeatures customizedFeature="collapseLink">
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
- </customizedFeatures>
- </references>
- </types>
- <types metaclassName="paletteconfiguration.Configuration">
- <customizedFeatures customizedFeature="icon">
- <valueCases>
- <value xsi:type="uicustom:DerivedFeatureValue">
- <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/PaletteConfiguration#getIcon"/>
- </value>
- <condition xsi:type="query:JavaModelQuery" href="emffacet:/query/PaletteConfiguration#hasIcon"/>
- </valueCases>
- </customizedFeatures>
- <references referenceName="icon">
- <customizedFeatures>
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/>
- </customizedFeatures>
- </references>
- </types>
- <types metaclassName="paletteconfiguration.ToolConfiguration">
- <customizedFeatures customizedFeature="label">
- <defaultValue xsi:type="uicustom:DerivedFeatureValue">
- <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/PaletteConfiguration#getToolLabel"/>
- </defaultValue>
- </customizedFeatures>
- <customizedFeatures customizedFeature="hideMetaclassName">
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
- </customizedFeatures>
- <references referenceName="elementDescriptors">
- <customizedFeatures>
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/>
- </customizedFeatures>
- </references>
- </types>
- <types metaclassName="paletteconfiguration.StackConfiguration">
- <references referenceName="toolConfigurations">
- <customizedFeatures customizedFeature="collapseLink">
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
- </customizedFeatures>
- </references>
- <references referenceName="ownedConfigurations">
- <customizedFeatures customizedFeature="collapseLink">
- <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
- </customizedFeatures>
- </references>
- </types>
- <availableQuerySets>PaletteConfiguration</availableQuerySets>
-</uicustom:MetamodelView>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/plugin.properties b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/plugin.properties
deleted file mode 100644
index 6057ad9baed..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/plugin.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-#Properties file for org.eclipse.papyrus.customization.paletteconfiguration
-Bundle-Vendor = Eclipse Modeling Project
-Bundle-Name = Palette Customization
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/plugin.xml b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/plugin.xml
deleted file mode 100644
index af18b758795..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/plugin.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-
-<plugin>
-<!-- TODO: PAPYRUS EMF-FACET
-<extension point="org.eclipse.papyrus.emf.facet.infra.browser.custom.core.registration">
- <browserCustomization file="facet/PaletteConfiguration.uiCustom"/>
- </extension>
- <extension point="org.eclipse.papyrus.emf.facet.infra.query.registration">
- <modelqueryset file="facet/PaletteConfiguration.querySet"/>
- </extension>
- -->
- <extension point="org.eclipse.papyrus.emf.facet.util.emf.core.modeldeclaration">
- <modeldeclaration file="facet/PaletteConfiguration.custom"/>
-</extension>
-</plugin>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/pom.xml b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/pom.xml
deleted file mode 100644
index be2e0085512..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/pom.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?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>
- <groupId>org.eclipse.papyrus</groupId>
- <artifactId>org.eclipse.papyrus.toolsmiths</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <relativePath>../../toolsmiths/pom.xml</relativePath>
- </parent>
- <artifactId>org.eclipse.papyrus.customization.paletteconfiguration</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/Activator.java b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/Activator.java
deleted file mode 100644
index e30e62471ee..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/Activator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.paletteconfiguration;
-
-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.paletteconfiguration"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetDrawerLabelQuery.java b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetDrawerLabelQuery.java
deleted file mode 100644
index c1aad533efe..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetDrawerLabelQuery.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.paletteconfiguration.queries;
-
-import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
-import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.DrawerConfiguration;
-
-/** Returns the label for a drawer */
-public class GetDrawerLabelQuery implements IJavaQuery2<DrawerConfiguration, String> {
-
- public String evaluate(DrawerConfiguration source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
- return (source.getLabel() != null ? source.getLabel() : "<>");
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetIconQuery.java b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetIconQuery.java
deleted file mode 100644
index a4526bdeb8e..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetIconQuery.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.paletteconfiguration.queries;
-
-import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
-import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Configuration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.IconDescriptor;
-
-/** Gets the icon for a configuration element in the palette configuration model */
-public class GetIconQuery implements IJavaQuery2<Configuration, String> {
-
-
- public String evaluate(Configuration source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
- // retrieves icon descriptor
- IconDescriptor descriptor = source.getIcon();
- if (descriptor == null) {
- return "";
- }
-
- String bundleID = descriptor.getPluginID();
- String iconPath = descriptor.getIconPath();
-
- if (bundleID == null || iconPath == null) {
- return "";
- }
-
- return "/" + bundleID + iconPath;
- }
-
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetToolLabelQuery.java b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetToolLabelQuery.java
deleted file mode 100644
index 28af93ff21c..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/GetToolLabelQuery.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.paletteconfiguration.queries;
-
-import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
-import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ToolConfiguration;
-
-/** Returns the Label for a tool. */
-public class GetToolLabelQuery implements IJavaQuery2<ToolConfiguration, String> {
-
- public String evaluate(ToolConfiguration source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
- StringBuffer buffer = new StringBuffer();
- buffer.append('[');
- switch (source.getKind()) {
- case CONNECTION_TOOL:
- buffer.append("Connection Tool");
- break;
- default:
- buffer.append("Node Tool");
- break;
- }
- buffer.append(']');
- buffer.append(' ');
-
-
- buffer.append(source.getLabel());
- return buffer.toString();
- }
-}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/HasIconQuery.java b/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/HasIconQuery.java
deleted file mode 100644
index d7ada123127..00000000000
--- a/plugins/customization/org.eclipse.papyrus.customization.paletteconfiguration/src/org/eclipse/papyrus/customization/paletteconfiguration/queries/HasIconQuery.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.customization.paletteconfiguration.queries;
-
-import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
-import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Configuration;
-
-/** Returns <code>true</code> if the element has a specific icon to display */
-public class HasIconQuery implements IJavaQuery2<Configuration, Boolean> {
-
-
- public Boolean evaluate(Configuration source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
- IJavaQuery2<Configuration, String> getImageQuery = new GetIconQuery();
- String imagePath = getImageQuery.evaluate(source, parameterValues, facetManager);
-
- if (imagePath != null && imagePath.length() > 0) {
- return true;
- }
- return false;
- }
-}

Back to the top