Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-02-11 02:48:20 +0000
committerGerrit Code Review @ Eclipse.org2016-02-12 15:31:41 +0000
commitecd4928b327f5561364c5068c9ff5f1668e92d13 (patch)
tree7c34f46cf82a1d65ac753fa92c2a5d55371b8dba /plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox
parent751a204d74e15eb2db6b41c937691fc56dcc1252 (diff)
downloadorg.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.tar.gz
org.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.tar.xz
org.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.zip
Bug 485220: [Architecture] Provide a more modular architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485220 Factor UI dependencies out of the UML Element Types bundle. This includes moving some advices that interact with the user into a new org.eclipse.papyrus.uml.service.types.ui bundle. Pull up the PasteCommandService and IPasteCommandProvider API into the Infra Diagram layer where the extension point is defined. Deprecate the old API in the UML layer. Introduce a service for participation of languages in CSS styling: * styling reset actions in the Reset Style command * access to semantic model classes and properties to make available to CSS Factor PapyrusObservableValue and cohorts out of the UML Tools bundle into the Infra Layer for more general reuse and to relieve the Diagram Infrastructure layer of UML dependencies. The old API remains as deprecated. Remove the Infra Diagram Layer dependency on UML Layer for property testers governing deletion in the diagram. Includes introduction of a new IGraphicalDeletionHelper OSGi service for delegation of the determination of whether an element can be deleted from the diagram and replacement of the XML expression properties * org.eclipse.papyrus.uml.diagram.common.isSemanticDeletion * org.eclipse.papyrus.uml.diagram.common.isReadOnly by * org.eclipse.papyrus.infra.gmfdiag.common.isSemanticDeletion * org.eclipse.papyrus.infra.gmfdiag.common.canDelete (where the latter is the negation of the property that it supersedes) Extract UML dependencies from the Diagram Outline and CSS Editor bundles. Remove unused MDTUtil APIs that referenced a UML-specific annotation. Move the Diagram Infrastructure CSS Palette bundle into the UML layer because it serves to provide extensions on the Palette Service, which is an overtly UML-specific capability. All client APIs for the Properties View are moved from org.eclipse.papyrus.views.properties bundle to a new org.eclipse.papyrus.infra.properties.ui bundle. This includes renaming of: * extension points * label-provider contexts * XWT namespaces Add an "all UI tests" suite. Define a componentized hierarchical build layout of the main plug-ins Change-Id: I43f8f3644857a18b69715f5a2f1da9b1cf286d67
Diffstat (limited to 'plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox')
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.classpath7
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.project28
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.settings/org.eclipse.jdt.core.prefs291
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/META-INF/MANIFEST.MF28
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/about.html28
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/build.properties7
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/icons/run.gifbin0 -> 379 bytes
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/icons/sample.gifbin0 -> 963 bytes
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/plugin.properties12
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/plugin.xml41
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/pom.xml12
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/schema/papyrusNotificationBuilder.exsd121
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/Activator.java99
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/SwtUtil.java167
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/dialog/InformationDialog.java133
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/draw2d/ManuallyDrawnShortcutDecorationFigure.java71
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/IBuilder.java47
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/ICallBack.java29
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/ICompositeCreator.java35
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/INotification.java23
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/NotificationRunnable.java36
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/PapyrusToolkit.java48
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/Type.java23
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/AsyncNotifierBuilder.java128
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/CombinedPopupAndViewBuilder.java147
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/IContext.java41
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java546
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java112
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PropertyWrapper.java189
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/ViewBuilder.java125
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AbstractNotificationPopup.java583
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AsyncNotification.java51
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/CommonFonts.java106
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/ImagePapyrusAsyncNotificationPopup.java69
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/NotificationPopupColors.java187
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java139
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusPopup.java222
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/exception/NotificationException.java40
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/IconAndMessagePapyrusPopup.java67
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/MessagePapyrusPopup.java74
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/PopupNotification.java63
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/utils/PapyrusControlsFactory.java128
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/AbstractInsideComposite.java174
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/MessageComposite.java50
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/PapyrusNotificationView.java417
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/ViewNotification.java44
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/DialogUtils.java122
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/ISharedImages.java25
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/ToolbooxImageUtils.java78
50 files changed, 5281 insertions, 0 deletions
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.classpath b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.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/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.project b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.project
new file mode 100644
index 00000000000..339688bbd54
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.widgets.toolbox</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..b3aa6d60f94
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,291 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.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/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..954281dbc31
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,68 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Papyrus
+cleanup_settings_version=2
+eclipse.preferences.version=1
+formatter_profile=_Papyrus
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/META-INF/MANIFEST.MF b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..1aea866730d
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/META-INF/MANIFEST.MF
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.widgets.toolbox,
+ org.eclipse.papyrus.infra.widgets.toolbox.dialog,
+ org.eclipse.papyrus.infra.widgets.toolbox.draw2d,
+ org.eclipse.papyrus.infra.widgets.toolbox.notification,
+ org.eclipse.papyrus.infra.widgets.toolbox.notification.builders,
+ org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs,
+ org.eclipse.papyrus.infra.widgets.toolbox.notification.exception,
+ org.eclipse.papyrus.infra.widgets.toolbox.notification.popups,
+ org.eclipse.papyrus.infra.widgets.toolbox.notification.utils,
+ org.eclipse.papyrus.infra.widgets.toolbox.notification.view,
+ org.eclipse.papyrus.infra.widgets.toolbox.utils
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.ui.forms;bundle-version="3.5.100",
+ org.eclipse.draw2d;bundle-version="3.8.1",
+ org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.2.0";visibility:=reexport
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-Activator: org.eclipse.papyrus.infra.widgets.toolbox.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.widgets.toolbox;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/about.html b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/about.html
new file mode 100644
index 00000000000..d35d5aed64c
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>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/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/build.properties b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/build.properties
new file mode 100644
index 00000000000..a491a4cb7bd
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:30:21 CEST 2011
+bin.includes=META-INF/,.,plugin.properties,plugin.xml,about.html,icons/,schema/
+output..=bin/
+src.includes=schema/,about.html,META-INF/,.,plugin.properties,plugin.xml,icons/
+source..=src/
+bin..=bin/
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/icons/run.gif b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/icons/run.gif
new file mode 100644
index 00000000000..57f410224cf
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/icons/run.gif
Binary files differ
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/icons/sample.gif b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/icons/sample.gif
new file mode 100644
index 00000000000..a32f4b1b572
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/icons/sample.gif
Binary files differ
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/plugin.properties b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/plugin.properties
new file mode 100644
index 00000000000..aff1171d040
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/plugin.properties
@@ -0,0 +1,12 @@
+################################################################################
+# Copyright (c) 2008 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Patrick.tessier (CEA LIST) Patrick.Tessier@cea.fr - initial API and implementation
+##################################################################################
+pluginName=Papyrus UI Toolbox
+providerName=Eclipse Modeling Project
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/plugin.xml b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/plugin.xml
new file mode 100644
index 00000000000..d9b8f0fc162
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/plugin.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+
+<!--
+ ################################################################################
+# Copyright (c) 2008 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# CEA LIST - initial API and implementation
+##################################################################################
+-->
+
+<plugin>
+ <extension-point id="papyrusNotificationBuilder" name="Papyrus Notification Builder" schema="schema/papyrusNotificationBuilder.exsd"/>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.eclipse.papyrus.views.category"
+ class="org.eclipse.papyrus.infra.widgets.toolbox.notification.view.PapyrusNotificationView"
+ icon="icons/sample.gif"
+ id="org.eclipse.papyrus.ui.toolbox.notification.view.PapyrusNotificationView"
+ name="Papyrus Notification">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.widgets.toolbox.papyrusNotificationBuilder">
+ <BuilderInstance
+ builder="org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.PopupBuilder">
+ </BuilderInstance>
+ <BuilderInstance
+ builder="org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.ViewBuilder">
+ </BuilderInstance>
+ <BuilderInstance
+ builder="org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.AsyncNotifierBuilder">
+ </BuilderInstance>
+ </extension>
+</plugin>
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/pom.xml b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/pom.xml
new file mode 100644
index 00000000000..ab60287d84d
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-ui</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.widgets.toolbox</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/schema/papyrusNotificationBuilder.exsd b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/schema/papyrusNotificationBuilder.exsd
new file mode 100644
index 00000000000..977b7eb10be
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/schema/papyrusNotificationBuilder.exsd
@@ -0,0 +1,121 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.widgets.toolbox" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.widgets.toolbox" id="papyrusNotificationBuilder" name="Papyrus Notification Builder"/>
+ </appInfo>
+ <documentation>
+ This extension point allows developers to define custom IBuilder instance to be managed by notification Builder.
+An IBuider has to define the methods accept and build.
+Take care to not always return true in the method accept to avoid intercepting all the notifications
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="BuilderInstance"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="BuilderInstance">
+ <complexType>
+ <attribute name="builder" type="string" use="required">
+ <annotation>
+ <documentation>
+ the builder instance. The implementation shall implement the methods to recognize and run a notification.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 0.7.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ /*******************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ATOS ORIGIN - initial API and implementation
+ *******************************************************************************/
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/Activator.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/Activator.java
new file mode 100644
index 00000000000..68a7cbf3ba1
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/Activator.java
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ * Copyright (c) 2008, 2016 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.papyrus.infra.tools.spi.INotificationBuilderFactory;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.widgets.toolbox";
+
+ // The shared instance
+ private static Activator plugin;
+
+ private ServiceRegistration<INotificationBuilderFactory> notificationBuilderReg;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ notificationBuilderReg = context.registerService(INotificationBuilderFactory.class, NotificationBuilder::new, null);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ notificationBuilderReg.unregister();
+ notificationBuilderReg = null;
+
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * This method returns an <code>org.eclipse.swt.graphics.Image</code> identified by its pluginId and iconPath.<BR>
+ *
+ * By default, it returns a default image. This image is the image placed in
+ * the directory <em>resources/icons/default.gif</em>
+ *
+ * @param pluginId
+ * id of plugin
+ * @param iconpPath
+ * the path of the icon image relative to the plugin
+ * @return the Image
+ */
+ public static Image getImage(String iconPath, String defaultPlugin) {
+ // see if the path is using platform:/... to get icon in the fragment, if it is in a fragment
+ String key = defaultPlugin + iconPath;
+ ImageRegistry registry = getDefault().getImageRegistry();
+ Image image = registry.get(key);
+
+ if (image == null) {
+
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(defaultPlugin, iconPath);
+ registry.put(key, desc);
+ image = registry.get(key);
+
+ }
+ return image;
+ }
+
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/SwtUtil.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/SwtUtil.java
new file mode 100644
index 00000000000..f7ea106c770
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/SwtUtil.java
@@ -0,0 +1,167 @@
+/*****************************************************************************
+ * Copyright (c) Eclipse.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mik Kersten
+ * Steffen Pingel
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Mik Kersten
+ * @author Steffen Pingel
+ */
+public class SwtUtil {
+
+ public static final long FADE_RESCHEDULE_DELAY = 80;
+
+ public static final int FADE_IN_INCREMENT = 15;
+
+ public static final int FADE_OUT_INCREMENT = -20;
+
+ public static void collectItemData(TreeItem[] items, Set<Object> allVisible) {
+ for (TreeItem item : items) {
+ allVisible.add(item.getData());
+ collectItemData(item.getItems(), allVisible);
+ }
+ }
+
+ public static FadeJob fastFadeIn(Shell shell, SwtUtil.IFadeListener listener) {
+ return new FadeJob(shell, 2 * FADE_IN_INCREMENT, FADE_RESCHEDULE_DELAY, listener);
+ }
+
+ public static FadeJob fadeIn(Shell shell, SwtUtil.IFadeListener listener) {
+ return new FadeJob(shell, FADE_IN_INCREMENT, FADE_RESCHEDULE_DELAY, listener);
+ }
+
+ public static FadeJob fadeOut(Shell shell, SwtUtil.IFadeListener listener) {
+ return new FadeJob(shell, FADE_OUT_INCREMENT, FADE_RESCHEDULE_DELAY, listener);
+ }
+
+ public static class FadeJob extends Job {
+
+ private final Shell shell;
+
+ private final int increment;
+
+ private volatile boolean stopped;
+
+ private volatile int currentAlpha;
+
+ private final long delay;
+
+ private final IFadeListener fadeListener;
+
+ public FadeJob(Shell shell, int increment, long delay, IFadeListener fadeListener) {
+ super("Fading");
+ if (increment < -255 || increment == 0 || increment > 255) {
+ throw new IllegalArgumentException("-255 <= increment <= 255 && increment != 0"); //$NON-NLS-1$
+ }
+ if (delay < 1) {
+ throw new IllegalArgumentException("delay must be > 0"); //$NON-NLS-1$
+ }
+ this.currentAlpha = shell.getAlpha();
+ this.shell = shell;
+ this.increment = increment;
+ this.delay = delay;
+ this.fadeListener = fadeListener;
+
+ setSystem(true);
+ schedule(delay);
+ }
+
+ @Override
+ protected void canceling() {
+ stopped = true;
+ }
+
+ private void reschedule() {
+ if (stopped) {
+ return;
+ }
+ schedule(delay);
+ }
+
+ public void cancelAndWait(final boolean setAlpha) {
+ if (stopped) {
+ return;
+ }
+ cancel();
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ if (setAlpha) {
+ shell.setAlpha(getLastAlpha());
+ }
+ }
+ });
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (stopped) {
+ return Status.OK_STATUS;
+ }
+
+ currentAlpha += increment;
+ if (currentAlpha <= 0) {
+ currentAlpha = 0;
+ } else if (currentAlpha >= 255) {
+ currentAlpha = 255;
+ }
+
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ if (stopped) {
+ return;
+ }
+
+ if (shell.isDisposed()) {
+ stopped = true;
+ return;
+ }
+
+ shell.setAlpha(currentAlpha);
+
+ if (fadeListener != null) {
+ fadeListener.faded(shell, currentAlpha);
+ }
+ }
+ });
+
+ if (currentAlpha == 0 || currentAlpha == 255) {
+ stopped = true;
+ }
+
+ reschedule();
+ return Status.OK_STATUS;
+ }
+
+ private int getLastAlpha() {
+ return (increment < 0) ? 0 : 255;
+ }
+
+ }
+
+ public static interface IFadeListener {
+
+ public void faded(Shell shell, int alpha);
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/dialog/InformationDialog.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/dialog/InformationDialog.java
new file mode 100644
index 00000000000..78a2033b03d
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/dialog/InformationDialog.java
@@ -0,0 +1,133 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.dialog;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A JFace dialog used to show information to the end user.<br>
+ * This dialog is able to store the user choice into a preference store.<br>
+ *
+ */
+public class InformationDialog extends MessageDialog {
+
+ private IPreferenceStore ps;
+
+ private String preference;
+
+ private Button rememberChoice;
+
+ /**
+ * The Constructor.
+ *
+ * @param parentShell
+ * the parent shell
+ * @param dialogTitle
+ * the dialog title
+ * @param message
+ * the message
+ * @param pso
+ * the preference store
+ * @param preference
+ * the preference
+ */
+ public InformationDialog(Shell parentShell, String dialogTitle,
+ String message, IPreferenceStore ps, String preference) {
+ this(parentShell, dialogTitle, message, ps, preference, SWT.OK,
+ MessageDialog.INFORMATION,
+ new String[] { IDialogConstants.OK_LABEL });
+ }
+
+ /**
+ * The Constructor.
+ *
+ * @param parentShell
+ * the parent shell
+ * @param dialogTitle
+ * the dialog title
+ * @param message
+ * the message
+ * @param ps
+ * the ps the preference store
+ * @param preference
+ * the preference string to store the choice
+ * @param style
+ * the style for buttons : SWT.OK, SWT.YES
+ * @param messageDialogType
+ * : MessageDialog.INFORMATION, MessageDialog.WARNING
+ * @param labels
+ * the labels, for example IDialogConstants.OK_LABEL
+ */
+ public InformationDialog(Shell parentShell, String dialogTitle,
+ String message, IPreferenceStore ps, String preference, int style,
+ int messageDialogType, String[] labels) {
+ super(parentShell, dialogTitle, null, message, messageDialogType,
+ labels, style);
+ this.ps = ps;
+ this.preference = preference;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.MessageDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite container = (Composite) super.createDialogArea(parent);
+
+ if (ps != null && preference != null && preference.length() > 0) {
+ rememberChoice = new Button(container, SWT.CHECK);
+ rememberChoice.setText("Do not show again");
+ }
+ return container;
+ }
+
+ /**
+ * @see org.eclipse.jface.window.Window#open() return Window.OK if it's
+ * valid
+ */
+ @Override
+ public int open() {
+ // Do not open the dialog if the preference is true
+ if (ps != null && preference != null && preference.length() > 0) {
+ if (ps.getBoolean(preference)) {
+ return Window.OK;
+ }
+ }
+ return super.open();
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ // OK pressed
+ if (buttonId == Window.OK && rememberChoice != null && rememberChoice.getSelection()) {
+ if (ps != null && preference != null && preference.length() > 0) {
+ // Store the preference
+ ps.setValue(preference, true);
+ }
+ }
+ super.buttonPressed(buttonId);
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/draw2d/ManuallyDrawnShortcutDecorationFigure.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/draw2d/ManuallyDrawnShortcutDecorationFigure.java
new file mode 100644
index 00000000000..09711f396b1
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/draw2d/ManuallyDrawnShortcutDecorationFigure.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Conselleria de Infraestructuras y Transporte,
+ * Generalitat de la Comunitat Valenciana .
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation
+ *
+ ******************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.draw2d;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Polygon;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.swt.graphics.Color;
+
+public class ManuallyDrawnShortcutDecorationFigure extends RectangleFigure {
+
+ private RectangleFigure border = null;
+
+ public ManuallyDrawnShortcutDecorationFigure() {
+ setOpaque(true);
+ setOutline(false);
+
+ setSize(10, 10);
+ setPreferredSize(10, 10);
+
+ border = new RectangleFigure();
+ border.setForegroundColor(ColorConstants.black);
+ border.setBackgroundColor(ColorConstants.white);
+ border.setSize(10, 10);
+ border.setLocation(new Point(0, 0));
+ this.add(border);
+
+ Polygon arrow = new Polygon();
+ arrow.setLocation(new Point(0, 0));
+ arrow.setForegroundColor(ColorConstants.black);
+ arrow.setBackgroundColor(ColorConstants.black);
+ arrow.setFill(true);
+
+ arrow.addPoint(new Point(7, 2));
+ arrow.addPoint(new Point(7, 5));
+ arrow.addPoint(new Point(7, 4));
+ arrow.addPoint(new Point(5, 4));
+ arrow.addPoint(new Point(5, 5));
+ arrow.addPoint(new Point(3, 7));
+ arrow.addPoint(new Point(4, 8));
+ arrow.addPoint(new Point(3, 7));
+ arrow.addPoint(new Point(3, 5));
+ arrow.addPoint(new Point(5, 3));
+ arrow.addPoint(new Point(5, 3));
+ arrow.addPoint(new Point(4, 2));
+ arrow.addPoint(new Point(7, 2));
+
+ this.add(arrow);
+ }
+
+ @Override
+ public void setBackgroundColor(Color backgroundColor) {
+ border.setBackgroundColor(backgroundColor);
+ }
+
+ @Override
+ protected boolean useLocalCoordinates() {
+ return true;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/IBuilder.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/IBuilder.java
new file mode 100644
index 00000000000..80862cde3ce
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/IBuilder.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.PropertyWrapper;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+/**
+ * An IBuilder helps the notification builder to create a notification
+ *
+ * @author tfaure
+ *
+ */
+public interface IBuilder {
+
+ /**
+ * This method displays the notification message
+ *
+ * @param wrapper
+ * , a wrapper containing all the options to create the message
+ * @param toolkit
+ * , the toolkit for form creation
+ */
+ INotification build(PropertyWrapper wrapper, FormToolkit toolkit);
+
+ /**
+ * Determines if the IBuilder can manage the parameter with its value
+ *
+ * @param parameterName
+ * , the name of the parameter (see constants in {@link NotificationBuilder} calss
+ * @param value
+ * , the value of the corresponding parameter
+ * @return true if the parameterName or the value can be managed by the builder
+ */
+ boolean accept(String parameterName, Object value);
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/ICallBack.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/ICallBack.java
new file mode 100644
index 00000000000..d8edf6394e3
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/ICallBack.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification;
+
+
+/**
+ * A class providing services to be called back
+ *
+ * @author tristan faure
+ *
+ */
+public interface ICallBack {
+
+ /**
+ * This method is called by the callee
+ *
+ * @param element
+ */
+ void callBack(Object element);
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/ICompositeCreator.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/ICompositeCreator.java
new file mode 100644
index 00000000000..3c0e1cf45ce
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/ICompositeCreator.java
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+/**
+ * A composite creator can create a specific composite in the notification
+ *
+ * @author tfaure
+ */
+public interface ICompositeCreator {
+
+ /**
+ * Create the composite in the parent using the toolkit
+ *
+ * @param parent
+ * , the parent of the composite
+ * @param toolkit
+ * , the toolkit to use
+ * @return the composite created
+ */
+ Composite createComposite(Composite parent, FormToolkit toolkit);
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/INotification.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/INotification.java
new file mode 100644
index 00000000000..80082dee0da
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/INotification.java
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * Copyright (c) 2010, 2016 ATOS ORIGIN, 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:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification;
+
+
+/**
+ * The Interface INotification.
+ * offers some services for a notification
+ */
+public interface INotification extends org.eclipse.papyrus.infra.tools.notify.INotification {
+ // No additional API
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/NotificationRunnable.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/NotificationRunnable.java
new file mode 100644
index 00000000000..6cbec8b5325
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/NotificationRunnable.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.IContext;
+
+/**
+ * a runnable
+ *
+ */
+public interface NotificationRunnable {
+
+ /**
+ * Run the runnable
+ *
+ * @param context
+ * , used to fill properties, can contain data
+ */
+ void run(IContext context);
+
+ /**
+ * The label of the runnable
+ *
+ * @return the label
+ */
+ String getLabel();
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/PapyrusToolkit.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/PapyrusToolkit.java
new file mode 100644
index 00000000000..ea919c936f5
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/PapyrusToolkit.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+/**
+ * This class allows specific toolkit for component creation
+ *
+ * @author tfaure
+ *
+ */
+public class PapyrusToolkit extends FormToolkit {
+
+ public static int DEFAULT_STYLE = -1;
+
+ /**
+ * The unique instance of the papyrus toolkit
+ */
+ public static PapyrusToolkit INSTANCE = new PapyrusToolkit(Display.getDefault());
+
+ private PapyrusToolkit(Display display) {
+ super(display);
+ }
+
+ @Override
+ public Section createSection(Composite parent, int sectionStyle) {
+ if (sectionStyle == DEFAULT_STYLE) {
+ return super.createSection(parent, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR);
+ }
+ return super.createSection(parent, sectionStyle);
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/Type.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/Type.java
new file mode 100644
index 00000000000..90dd825d5a7
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/Type.java
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification;
+
+
+/**
+ * The different types of Notifications <li>INFO</i> <li>WARNING</i> <li>ERROR</i> <li>QUESTION</i>
+ *
+ * @author tristan faure
+ *
+ */
+public enum Type {
+ INFO, WARNING, ERROR, QUESTION
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/AsyncNotifierBuilder.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/AsyncNotifierBuilder.java
new file mode 100644
index 00000000000..4f67eeba1a0
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/AsyncNotifierBuilder.java
@@ -0,0 +1,128 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.builders;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.AsyncNotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.ImagePapyrusAsyncNotificationPopup;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.PapyrusAsyncNotificationPopup;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.utils.PapyrusControlsFactory;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+/**
+ * A Builder able to create {@link PapyrusAsyncNotificationPopup} instances
+ *
+ * @author tristan faure
+ *
+ */
+public class AsyncNotifierBuilder implements IBuilder {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder#build(org.eclipse.papyrus.infra.widgets.toolbox.notification.PropertyWrapper,
+ * org.eclipse.ui.forms.widgets.FormToolkit)
+ */
+ public INotification build(PropertyWrapper wrapper, final FormToolkit toolkit) {
+ PapyrusAsyncNotificationPopup popup = null;
+ if (wrapper.getComposite() != null) {
+ final ICompositeCreator composite = wrapper.getComposite();
+ // use the creator to a notification with image
+ if (wrapper.getType() != null) {
+ popup = new ImagePapyrusAsyncNotificationPopup(Display.getDefault(), toolkit, wrapper.getType()) {
+
+ @Override
+ protected void doCreateClient(Composite parent) {
+ PapyrusControlsFactory.createCompositeWithType(getShell(), null, parent, type, image, text, false, composite, context);
+ }
+
+ };
+ } else {
+ // use the creator to a notification without image
+ popup = new PapyrusAsyncNotificationPopup(Display.getDefault(), toolkit) {
+
+ @Override
+ protected void doCreateClient(Composite parent) {
+ Composite compo = composite.createComposite(parent, toolkit);
+ setCompositeCreated(compo);
+ }
+ };
+ }
+ } else {
+ if (wrapper.getType() != null) {
+ popup = new ImagePapyrusAsyncNotificationPopup(Display.getDefault(), toolkit, wrapper.getType());
+ } else {
+ popup = new PapyrusAsyncNotificationPopup(Display.getDefault(), toolkit);
+ }
+ String text = wrapper.getMessage();
+ if (text == null) {
+ text = "no text";
+ }
+ popup.setText(text);
+ }
+ if (wrapper.getDelay() != null) {
+ popup.setDelayClose(wrapper.getDelay());
+ }
+ if (wrapper.getActions() != null) {
+ popup.addAllRunnable(wrapper.getActions());
+ }
+ popup.setTitle(wrapper.getTitle() == null ? "Papyrus" : wrapper.getTitle());
+ AsyncNotification notification = new AsyncNotification(popup);
+ popup.setINotification(notification);
+ popup.open();
+ return notification;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder#accept(java.lang.String, java.lang.Object)
+ */
+ public boolean accept(String parameterName, Object value) {
+ if (NotificationBuilder.ASYNCHRONOUS.equals(parameterName)) {
+ return value instanceof Boolean && ((Boolean) value);
+ }
+ if (NotificationBuilder.TEMPORARY.equals(parameterName)) {
+ return value instanceof Boolean && (Boolean) value;
+ }
+ if (NotificationBuilder.MESSAGE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.COMPOSITE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.ACTION.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.DELAY.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.IMAGE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.TYPE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.HTML.equals(parameterName)) {
+ return value instanceof Boolean && !(Boolean) value;
+ }
+ if (NotificationBuilder.TITLE.equals(parameterName)) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/CombinedPopupAndViewBuilder.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/CombinedPopupAndViewBuilder.java
new file mode 100644
index 00000000000..f6621f36983
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/CombinedPopupAndViewBuilder.java
@@ -0,0 +1,147 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.builders;
+
+import java.util.HashSet;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.AsyncNotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.ImagePapyrusAsyncNotificationPopup;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.PapyrusAsyncNotificationPopup;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.utils.PapyrusControlsFactory;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.view.AbstractInsideComposite;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.view.PapyrusNotificationView;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.view.ViewNotification;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * <pre>
+ * This builder creates notification both in a temporary pop-up and in Papyrus notification view.
+ * It is not supposed to be registered in extension point as its implementation can possibly interfere with existing ones
+ * ({@link ViewBuilder}, {@link AsyncNotifierBuilder}).
+ *
+ * It is assumed the title, message and type are set before use.
+ *
+ * Usage example : new NotificationBuilder().setBuilderClass(MyBuilder.class).setType(type).setTitle(title).setMessage(message).run();
+ *
+ * The expected behavior is the following :
+ * - if the notification view is not active, a popup is shown and a notification is added in the view.
+ * - if the notification view is active the notification is added in the view (no popup).
+ * - if the notification view is not opened, it get created but do not get the focus so that the active view does not switch automatically.
+ * </pre>
+ */
+public class CombinedPopupAndViewBuilder implements IBuilder {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder#build(org.eclipse.papyrus.infra.widgets.toolbox.notification.PropertyWrapper,
+ * org.eclipse.ui.forms.widgets.FormToolkit)
+ */
+ public INotification build(PropertyWrapper wrapper, FormToolkit toolkit) {
+
+ // Find PapyrusNotificationView or create it but do not give it the focus, let the user decide when to consult these
+ // informations.
+ PapyrusNotificationView notificationView = (PapyrusNotificationView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(PapyrusNotificationView.ID);
+ if (notificationView == null) {
+ try {
+ notificationView = (PapyrusNotificationView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PapyrusNotificationView.ID, null, IWorkbenchPage.VIEW_CREATE);
+ } catch (PartInitException e) {
+ // log error - unable to create notification view
+ return null;
+ }
+ }
+
+ // If the Notification view is not visible show temporary notification
+ if ((notificationView != null) && !(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().isPartVisible(notificationView))) {
+ createNotificationPopup(wrapper, toolkit);
+ }
+
+ // In any case, log the notification in the PapyrusNotificationView so that the user can consult this later.
+ return createNotificationLog(notificationView, wrapper, toolkit);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder#accept(java.lang.String, java.lang.Object)
+ */
+ public boolean accept(String parameterName, Object value) {
+ return true;
+ }
+
+ /**
+ * This method creates the notification as a temporary popup.
+ *
+ * @param wrapper
+ * the notification property wrapper.
+ * @param toolkit
+ * the form toolkit.
+ * @return the notification.
+ */
+ private INotification createNotificationPopup(final PropertyWrapper wrapper, FormToolkit toolkit) {
+
+ PapyrusAsyncNotificationPopup popup = new ImagePapyrusAsyncNotificationPopup(Display.getDefault(), toolkit, wrapper.getType());
+ popup.setTitle(wrapper.getTitle());
+ popup.setText(wrapper.getMessage());
+ popup.addAllRunnable(wrapper.getActions() == null ? new HashSet<NotificationRunnable>() : wrapper.getActions());
+
+ AsyncNotification notification = new AsyncNotification(popup);
+ popup.setINotification(notification);
+
+ popup.open();
+
+ return notification;
+ }
+
+ /**
+ * This method add notifications in the notification view.
+ *
+ * @param notificationView
+ * the notification view.
+ * @param wrapper
+ * the notification property wrapper.
+ * @param toolkit
+ * the form toolkit.
+ * @return the notification.
+ */
+ private INotification createNotificationLog(PapyrusNotificationView notificationView, final PropertyWrapper wrapper, final FormToolkit toolkit) {
+
+ ICompositeCreator compositeCreator = wrapper.getComposite();
+ if (compositeCreator == null) {
+
+ compositeCreator = new ICompositeCreator() {
+
+ public Composite createComposite(Composite parent, FormToolkit toolkit) {
+ return PapyrusControlsFactory.createCompositeWithType(Display.getDefault().getActiveShell(), toolkit, parent, wrapper.getType(), wrapper.getImage(), wrapper.getMessage(), false);
+ }
+
+ };
+ }
+
+ AbstractInsideComposite compositeNotification = notificationView.setComposite(compositeCreator, wrapper.getTitle(), wrapper.getActions());
+ ViewNotification notification = new ViewNotification(compositeNotification);
+ compositeNotification.setINotification(notification);
+
+ return notification;
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/IContext.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/IContext.java
new file mode 100644
index 00000000000..8c40affaa39
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/IContext.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2010, 2016 ATOS ORIGIN, 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:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.builders;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * The Class Context.
+ */
+public interface IContext extends org.eclipse.papyrus.infra.tools.notify.IContext {
+
+ class Context implements IContext {
+
+ private Map<String, Object> objects = new HashMap<String, Object>();;
+
+ @Override
+ public void put(String s, Object o) {
+ objects.put(s, o);
+ }
+
+ @Override
+ public Object get(String s) {
+ return objects.get(s);
+ }
+
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java
new file mode 100644
index 00000000000..db46f76958c
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java
@@ -0,0 +1,546 @@
+/*****************************************************************************
+ * Copyright (c) 2010, 2016 ATOS ORIGIN, 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:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.builders;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.infra.tools.notify.INotificationBuilder;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.PapyrusToolkit;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.popups.PopupNotification;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+/**
+ * <p>
+ * A class creating a notification.
+ * The {@link #run()} method launches the message according to the value of the attributes.
+ * </p>
+ * <p>
+ * Consider using the headless-compatible {@link org.eclipse.papyrus.infra.tools.notify.NotificationBuilder API}
+ * if you don't need to specify an {@linkplain #setImage(Image) image} or a
+ * {@linkplain #setComposite(ICompositeCreator) composite} for your notification.
+ *
+ * @author tristan faure
+ *
+ */
+public class NotificationBuilder implements INotificationBuilder {
+
+ private FormToolkit toolkit = PapyrusToolkit.INSTANCE;
+
+ /** The parameters of the notification with the corresponding values */
+ protected Map<String, Object> parameters = new HashMap<String, Object>();
+
+ /** a composite creator for the element */
+ static String COMPOSITE = "composite";
+
+ /** an image displayed generally at the left of the notification */
+ static String IMAGE = "image";
+
+ /** The builders creating the notification */
+ protected static Map<Class<? extends IBuilder>, IBuilder> builders = getBuilders();
+
+ /**
+ * Determine a specific builder class, if it is filled, it is forced to it
+ */
+ protected Class<? extends IBuilder> builderClass;
+
+
+ /**
+ * Returns the ibuilders able to create notifications
+ *
+ * @return the list of {@link IBuilder}
+ */
+ private static Map<Class<? extends IBuilder>, IBuilder> getBuilders() {
+ Map<Class<? extends IBuilder>, IBuilder> result = new HashMap<Class<? extends IBuilder>, IBuilder>();
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.papyrus.infra.widgets.toolbox.papyrusNotificationBuilder");
+ for (IConfigurationElement e : elements) {
+ IBuilder instance;
+ try {
+ instance = (IBuilder) e.createExecutableExtension("builder");
+ result.put(instance.getClass(), instance);
+ } catch (CoreException e1) {
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Set a message for the notification
+ *
+ * @param message
+ * , the message to display
+ * @return this
+ */
+ @Override
+ public NotificationBuilder setMessage(String message) {
+ parameters.put(MESSAGE, message);
+ return this;
+ }
+
+ /**
+ * Determines if the notification is asynchronous (don't force the user to read the notification immediately)
+ *
+ * @param asynchronous
+ * , true if it asynchronous
+ * @return this
+ */
+ @Override
+ public NotificationBuilder setAsynchronous(boolean asynchronous) {
+ parameters.put(ASYNCHRONOUS, asynchronous);
+ return this;
+ }
+
+ /**
+ * Set a default action for the notification
+ *
+ * @param runnable
+ * , a runnable triggered when default action of the notification is selected
+ * The first action added is the default One
+ * @return this
+ */
+ @SuppressWarnings("unchecked")
+ public NotificationBuilder addAction(NotificationRunnable runnable) {
+ Collection<NotificationRunnable> runnables = (Collection<NotificationRunnable>) parameters.get(ACTION);
+ if (runnables == null) {
+ runnables = new LinkedList<NotificationRunnable>();
+ parameters.put(ACTION, runnables);
+ }
+ runnables.add(runnable);
+ return this;
+ }
+
+ @Override
+ public NotificationBuilder addAction(final org.eclipse.papyrus.infra.tools.notify.NotificationRunnable runnable) {
+ return addAction(new NotificationRunnable() {
+
+ @Override
+ public void run(IContext context) {
+ runnable.run(context);
+ }
+
+ @Override
+ public String getLabel() {
+ return runnable.getLabel();
+ }
+ });
+ }
+
+ /**
+ * Set a composite creator, able to fill a notification
+ *
+ * @param creator
+ * , the composite creator
+ * @return this
+ */
+ public NotificationBuilder setComposite(ICompositeCreator creator) {
+ parameters.put(COMPOSITE, creator);
+ return this;
+ }
+
+ /**
+ * Set a delay if the notification is temporary
+ *
+ * @param delayMs
+ * , the delay in ms for visibility
+ * @return this
+ */
+ @Override
+ public NotificationBuilder setDelay(long delayMs) {
+ parameters.put(DELAY, delayMs);
+ return this;
+ }
+
+ /**
+ * Set true if the notification is temporary
+ *
+ * @param temporary
+ * @return this
+ */
+ @Override
+ public NotificationBuilder setTemporary(boolean temporary) {
+ parameters.put(TEMPORARY, temporary);
+ return this;
+ }
+
+ /**
+ * Set a title for the notification
+ *
+ * @param title
+ * , the title
+ * @return this
+ */
+ @Override
+ public NotificationBuilder setTitle(String title) {
+ parameters.put(TITLE, title);
+ return this;
+ }
+
+ /**
+ * Set if the notification has to understand HTML
+ *
+ * @param useHTML
+ * @return this
+ */
+ @Override
+ public NotificationBuilder setHTML(boolean useHTML) {
+ parameters.put(HTML, useHTML);
+ return this;
+ }
+
+ /**
+ * Set the type of the notification according to {@link Type}
+ *
+ * @param type
+ * , the desired type
+ * @return this
+ */
+ public NotificationBuilder setType(Type type) {
+ parameters.put(TYPE, type);
+ return this;
+ }
+
+ @Override
+ public NotificationBuilder setType(org.eclipse.papyrus.infra.tools.notify.Type type) {
+ return setType(Type.valueOf(type.name()));
+ }
+
+ /**
+ * Set an image for the notification
+ *
+ * @param image
+ * , the desired image
+ * @return this
+ */
+ public NotificationBuilder setImage(Image image) {
+ parameters.put(IMAGE, image);
+ return this;
+ }
+
+ /**
+ * Force a builder class
+ *
+ * @param builderClass
+ * , a class which inherits from {@link IBuilder}
+ * @return this
+ */
+ public NotificationBuilder setBuilderClass(Class<? extends IBuilder> builderClass) {
+ this.builderClass = builderClass;
+ return this;
+ }
+
+ /**
+ * Allows the developer to use a specific parameter
+ *
+ * @param name
+ * , the key of the parameter
+ * @param value
+ * , the value
+ * @return this
+ */
+ @Override
+ public NotificationBuilder setParameter(String name, Object value) {
+ if (TYPE.equals(name)) {
+ if (value instanceof org.eclipse.papyrus.infra.tools.notify.Type) {
+ value = Type.valueOf(((org.eclipse.papyrus.infra.tools.notify.Type) value).name());
+ }
+ }
+
+ parameters.put(name, value);
+ return this;
+ }
+
+ /**
+ * Creates a notification according to different parameters
+ */
+ @Override
+ public INotification run() {
+ Set<IBuilder> copy = null;
+ if (builderClass != null) {
+ copy = new HashSet<IBuilder>();
+ try {
+ copy.add(builderClass.newInstance());
+ } catch (InstantiationException e) {
+ } catch (IllegalAccessException e) {
+ }
+ } else {
+ copy = new HashSet<IBuilder>(builders.values());
+ }
+ for (Iterator<IBuilder> i = copy.iterator(); i.hasNext();) {
+ IBuilder b = i.next();
+ for (String string : parameters.keySet()) {
+ if (!b.accept(string, parameters.get(string))) {
+ i.remove();
+ break;
+ }
+ }
+ }
+ INotification result = null;
+ PropertyWrapper wrapper = new PropertyWrapper(parameters);
+ if (copy.size() >= 1) {
+ result = copy.iterator().next().build(wrapper, toolkit);
+ // default case : the popup
+ } else if (copy.isEmpty()) {
+ result = builders.get(PopupBuilder.class).build(wrapper, toolkit);
+ }
+ return result;
+ }
+
+ /**
+ * Creates a notification builder already configured to display an information builder
+ *
+ * @return a notification builder
+ */
+ public static NotificationBuilder createInformationBuilder() {
+ NotificationBuilder builder = new NotificationBuilder();
+ return builder;
+ }
+
+ /**
+ * Creates a notification builder already configured to display an asynchronous popup
+ *
+ * @param text
+ * , the text to display
+ * @return a notification builder
+ */
+ public static NotificationBuilder createAsyncPopup(String text) {
+ return new NotificationBuilder().setAsynchronous(true).setTemporary(true).setMessage(text).setDelay(2000);
+ }
+
+ /**
+ * Creates a notification builder already configured to display an asynchronous popup with a specified title
+ *
+ * @param text
+ * , the text to display
+ * @param title
+ * , the title of the popup
+ * @return a notification builder
+ */
+ public static NotificationBuilder createAsyncPopup(String title, String text) {
+ return new NotificationBuilder().setAsynchronous(true).setTemporary(true).setMessage(text).setTitle(title).setDelay(2000);
+ }
+
+ /**
+ * Creates a notification builder already configured to display an information popup
+ *
+ * @param text
+ * , the text to display
+ * @return a notification builder
+ */
+ public static NotificationBuilder createInfoPopup(String text) {
+ return new NotificationBuilder().setAsynchronous(false).setTemporary(false).setMessage(text).setType(Type.INFO);
+ }
+
+ /**
+ * Creates a notification builder already configured to display an warning popup
+ *
+ * @param text
+ * , the text to display
+ * @return a notification builder
+ */
+ public static NotificationBuilder createWarningPopup(String text) {
+ return new NotificationBuilder().setAsynchronous(false).setTemporary(false).setMessage(text).setType(Type.WARNING);
+ }
+
+ /**
+ * Creates a notification builder already configured to display a popup with question icon
+ *
+ * @param text
+ * , the text to display
+ * @return a notification builder
+ */
+ public static NotificationBuilder createQuestionPopup(String text) {
+ return new NotificationBuilder().setAsynchronous(false).setTemporary(false).setMessage(text).setType(Type.QUESTION);
+ }
+
+ /**
+ * Creates a notification builder already configured to display a popup with error icon
+ *
+ * @param text
+ * , the text to display
+ * @return a notification builder
+ */
+ public static NotificationBuilder createErrorPopup(String text) {
+ return new NotificationBuilder().setAsynchronous(false).setTemporary(false).setMessage(text).setType(Type.ERROR);
+ }
+
+ /**
+ * Creates a notification builder already configured to display a yes no question
+ *
+ * @param yes
+ * , the action to launch if yes is selected
+ * @param no
+ * , the action to launch if no is selected
+ * @return a notification builder
+ */
+ public static NotificationBuilder createYesNo(String message, final Runnable yes, final Runnable no) {
+ return new NotificationBuilder().setType(Type.QUESTION).setAsynchronous(false).setTemporary(false).setMessage(message).addAction(new NotificationRunnable() {
+
+ @Override
+ public void run(IContext context) {
+ if (yes != null) {
+ context.put(IContext.ACTION_ID, SWT.YES);
+ yes.run();
+ }
+ }
+
+ @Override
+ public String getLabel() {
+ return "Yes";
+ }
+ }).addAction(new NotificationRunnable() {
+
+ @Override
+ public void run(IContext context) {
+ if (no != null) {
+ context.put(IContext.ACTION_ID, SWT.NO);
+ no.run();
+ }
+ }
+
+ @Override
+ public String getLabel() {
+ return "No";
+ }
+ });
+ }
+
+ /**
+ * Creates a notification builder already configured to display a yes no question, no runnables are necesary as the user just want the
+ * PopupNotification result
+ * This NotificationRunnable is not intended to be changed to an asynchronous notification for example
+ * When the run method is called use getRsult method in {@link PopupNotification} and test if the value is SWT.YES or SWT.NO
+ *
+ * @param message
+ * , the message to display
+ *
+ * @return a notification builder
+ */
+ public static NotificationBuilder createYesNo(String message) {
+ return new NotificationBuilder().setType(Type.QUESTION).setAsynchronous(false).setTemporary(false).setMessage(message).addAction(new NotificationRunnable() {
+
+ @Override
+ public void run(IContext context) {
+ context.put(IContext.ACTION_ID, SWT.YES);
+ }
+
+ @Override
+ public String getLabel() {
+ return "Yes";
+ }
+ }).addAction(new NotificationRunnable() {
+
+ @Override
+ public void run(IContext context) {
+ context.put(IContext.ACTION_ID, SWT.NO);
+ }
+
+ @Override
+ public String getLabel() {
+ return "No";
+ }
+ });
+ }
+
+ /**
+ * Creates a notification builder already configured to display a yes no question
+ *
+ * @param yes
+ * , the action to launch if yes is selected
+ * @param no
+ * , the action to launch if no is selected
+ * @return a notification builder
+ */
+ public static NotificationBuilder createYesNo(String message, final NotificationRunnable yes, final NotificationRunnable no) {
+ return new NotificationBuilder().setType(Type.QUESTION).setAsynchronous(false).setTemporary(false).setMessage(message).addAction(new NotificationRunnable() {
+
+ @Override
+ public void run(IContext context) {
+ if (yes != null) {
+ context.put(IContext.ACTION_ID, SWT.YES);
+ yes.run(context);
+ }
+ }
+
+ @Override
+ public String getLabel() {
+ return "Yes";
+ }
+ }).addAction(new NotificationRunnable() {
+
+ @Override
+ public void run(IContext context) {
+ if (no != null) {
+ context.put(IContext.ACTION_ID, SWT.NO);
+ no.run(context);
+ }
+ }
+
+ @Override
+ public String getLabel() {
+ return "No";
+ }
+ });
+ }
+
+ /**
+ * Return the system image according to the imageID
+ *
+ * @param imageID
+ * @param shell
+ * @return
+ */
+ public static Image getSWTImage(final int imageID, Shell shell) {
+ final Display display;
+ if (shell == null || shell.isDisposed()) {
+ display = Display.getCurrent();
+ // The dialog should be always instantiated in UI thread.
+ // However it was possible to instantiate it in other threads
+ // (the code worked in most cases) so the assertion covers
+ // only the failing scenario. See bug 107082 for details.
+ Assert.isNotNull(display, "The dialog should be created in UI thread"); //$NON-NLS-1$
+ } else {
+ display = shell.getDisplay();
+ }
+
+ final Image[] image = new Image[1];
+ display.syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ image[0] = display.getSystemImage(imageID);
+ }
+ });
+
+ return image[0];
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java
new file mode 100644
index 00000000000..b2dea10ae00
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.builders;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.PapyrusPopup;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.popups.IconAndMessagePapyrusPopup;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.popups.MessagePapyrusPopup;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.popups.PopupNotification;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * A Builder able to create {@link PapyrusPopup} instances
+ *
+ * @author tristan faure
+ *
+ */
+public class PopupBuilder implements IBuilder {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder#build(org.eclipse.papyrus.infra.widgets.toolbox.notification.PropertyWrapper,
+ * org.eclipse.ui.forms.widgets.FormToolkit)
+ */
+ public INotification build(PropertyWrapper wrapper, FormToolkit toolkit) {
+ PapyrusPopup popup = null;
+ String title = "Papyrus"; //$NON-NLS-1$
+ if (wrapper.getTitle() != null) {
+ title = wrapper.getTitle();
+ }
+ String message = null;
+ if (wrapper.getMessage() != null) {
+ message = wrapper.getMessage();
+ }
+ Shell activeShell = Display.getDefault().getActiveShell();
+ if (wrapper.getType() != null) {
+ popup = new IconAndMessagePapyrusPopup(activeShell, toolkit, message, wrapper.getType());
+ } else if (wrapper.getImage() != null) {
+ popup = new IconAndMessagePapyrusPopup(activeShell, toolkit, message);
+ ((IconAndMessagePapyrusPopup) popup).setImage(wrapper.getImage());
+ } else {
+ popup = new MessagePapyrusPopup(activeShell, toolkit, message);
+ }
+ popup.setTitle(title);
+ popup.setUseHtml(wrapper.isHtml());
+ if (wrapper.getComposite() != null) {
+ popup.setCompositeCreator(wrapper.getComposite());
+ popup.setTitle(title);
+ }
+ if (wrapper.getActions() != null) {
+ popup.addRunnables(wrapper.getActions());
+ }
+ PopupNotification result = new PopupNotification(popup);
+ // assign the open result to the result of the run
+ popup.setINotification(result);
+ result.setResult(popup.open());
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder#accept(java.lang.String, java.lang.Object)
+ */
+ public boolean accept(String parameterName, Object value) {
+ if (NotificationBuilder.ASYNCHRONOUS.equals(parameterName)) {
+ return value instanceof Boolean && !((Boolean) value);
+ }
+ if (NotificationBuilder.DELAY.equals(parameterName)) {
+ return false;
+ }
+ if (NotificationBuilder.TITLE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.TYPE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.IMAGE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.MESSAGE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.COMPOSITE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.HTML.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.ACTION.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.TEMPORARY.equals(parameterName)) {
+ return value instanceof Boolean && !((Boolean) value);
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PropertyWrapper.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PropertyWrapper.java
new file mode 100644
index 00000000000..48db799f622
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PropertyWrapper.java
@@ -0,0 +1,189 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.builders;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * This class provides a more comfortable usage
+ * to access to properties from NotificationBuilder map
+ *
+ * @author tristan faure
+ *
+ */
+public class PropertyWrapper {
+
+ private boolean asynchronous = false;
+
+ private String message = null;
+
+ private ICompositeCreator composite = null;
+
+ private Collection<NotificationRunnable> actions = null;
+
+ private Long delay = null;
+
+ private boolean temporary = false;
+
+ private String title = null;
+
+ private boolean html = false;
+
+ private Type type = null;
+
+ private Image image = null;
+
+ private Map<String, Object> others = new HashMap<String, Object>();
+
+ /**
+ * The class analyses the map and set the fields of the objects according to the values of the map.
+ *
+ * @param properties
+ * the map from Notification Builder
+ */
+ @SuppressWarnings("unchecked")
+ public PropertyWrapper(Map<String, Object> properties) {
+ for (String s : properties.keySet()) {
+ if (NotificationBuilder.ASYNCHRONOUS.equals(s)) {
+ asynchronous = (Boolean) properties.get(s);
+ } else if (NotificationBuilder.COMPOSITE.equals(s)) {
+ composite = (ICompositeCreator) properties.get(s);
+ } else if (NotificationBuilder.MESSAGE.equals(s)) {
+ message = (String) properties.get(s);
+ } else if (NotificationBuilder.ACTION.equals(s)) {
+ actions = (Collection<NotificationRunnable>) properties.get(s);
+ } else if (NotificationBuilder.DELAY.equals(s)) {
+ delay = (Long) properties.get(s);
+ } else if (NotificationBuilder.HTML.equals(s)) {
+ html = (Boolean) properties.get(s);
+ } else if (NotificationBuilder.TEMPORARY.equals(s)) {
+ temporary = (Boolean) properties.get(s);
+ } else if (NotificationBuilder.TITLE.equals(s)) {
+ title = (String) properties.get(s);
+ } else if (NotificationBuilder.TYPE.equals(s)) {
+ type = (Type) properties.get(s);
+ } else if (NotificationBuilder.IMAGE.equals(s)) {
+ image = (Image) properties.get(s);
+ } else {
+ others.put(s, properties.get(s));
+ }
+ }
+ }
+
+ /**
+ * Checks if is asynchronous.
+ *
+ * @return true, if is asynchronous
+ */
+ public boolean isAsynchronous() {
+ return asynchronous;
+ }
+
+ /**
+ * Gets the message.
+ *
+ * @return the message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Gets the composite.
+ *
+ * @return the composite
+ */
+ public ICompositeCreator getComposite() {
+ return composite;
+ }
+
+ /**
+ * Gets the actions.
+ *
+ * @return the actions
+ */
+ public Collection<NotificationRunnable> getActions() {
+ return actions;
+ }
+
+ /**
+ * Gets the delay.
+ *
+ * @return the delay
+ */
+ public Long getDelay() {
+ return delay;
+ }
+
+ /**
+ * Checks if is temporary.
+ *
+ * @return true, if is temporary
+ */
+ public boolean isTemporary() {
+ return temporary;
+ }
+
+ /**
+ * Gets the title.
+ *
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Checks if is html.
+ *
+ * @return true, if is html
+ */
+ public boolean isHtml() {
+ return html;
+ }
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public Type getType() {
+ return type;
+ }
+
+ /**
+ * Gets the image.
+ *
+ * @return the image
+ */
+ public Image getImage() {
+ return image;
+ }
+
+ /**
+ * Get the map containing parameters not predefined
+ *
+ * @return the map
+ */
+ public Map<String, Object> getCustomParameters() {
+ return others;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/ViewBuilder.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/ViewBuilder.java
new file mode 100644
index 00000000000..5ac8faacf14
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/ViewBuilder.java
@@ -0,0 +1,125 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.builders;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.utils.PapyrusControlsFactory;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.view.AbstractInsideComposite;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.view.PapyrusNotificationView;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.view.ViewNotification;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+/**
+ * A Builder able to create {@link PapyrusNotificationView} instances
+ *
+ * @author tristan faure
+ *
+ */
+public class ViewBuilder implements IBuilder {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder#build(org.eclipse.papyrus.infra.widgets.toolbox.notification.PropertyWrapper,
+ * org.eclipse.ui.forms.widgets.FormToolkit)
+ */
+ public INotification build(PropertyWrapper wrapper, FormToolkit toolkit) {
+ try {
+ IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PapyrusNotificationView.ID);
+ if (part instanceof PapyrusNotificationView) {
+ PapyrusNotificationView view = (PapyrusNotificationView) part;
+ AbstractInsideComposite viewCompo = null;
+ if (wrapper.getComposite() != null) {
+ viewCompo = view.setComposite(wrapper.getComposite(), wrapper.getTitle(), wrapper.getActions(), wrapper.getType());
+ } else {
+ if (wrapper.getType() != null || wrapper.getImage() != null || wrapper.isHtml()) {
+ final Image image = wrapper.getImage();
+ final Type type = wrapper.getType();
+ final boolean isHtml = wrapper.isHtml();
+ final String message = wrapper.getMessage();
+ viewCompo = view.setComposite(new ICompositeCreator() {
+
+ public Composite createComposite(Composite parent, FormToolkit toolkit) {
+ Composite created = PapyrusControlsFactory.createCompositeWithType(Display.getDefault().getActiveShell(), toolkit, parent, type, image, message, isHtml);
+ return created;
+ }
+ }, wrapper.getTitle(), wrapper.getActions());
+ } else {
+ if (wrapper.getMessage() != null) {
+ viewCompo = view.setMessage(wrapper.getMessage(), wrapper.getTitle(), wrapper.getActions());
+ }
+ }
+ }
+ ViewNotification notification = new ViewNotification(viewCompo);
+ viewCompo.setINotification(notification);
+ return notification;
+ }
+ } catch (PartInitException e) {
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.IBuilder#accept(java.lang.String, java.lang.Object)
+ */
+ public boolean accept(String parameterName, Object value) {
+ boolean found = false;
+ for (IViewReference ref : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences()) {
+ if (PapyrusNotificationView.ID.equals(ref.getId())) {
+ found = true;
+ }
+ }
+ if (found) {
+ if (NotificationBuilder.ASYNCHRONOUS.equals(parameterName)) {
+ return value instanceof Boolean && (Boolean) value;
+ }
+ if (NotificationBuilder.TEMPORARY.equals(parameterName)) {
+ return value instanceof Boolean && !(Boolean) value;
+ }
+ if (NotificationBuilder.DELAY.equals(parameterName)) {
+ return false;
+ }
+ if (NotificationBuilder.MESSAGE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.COMPOSITE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.ACTION.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.TYPE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.TITLE.equals(parameterName)) {
+ return true;
+ }
+ if (NotificationBuilder.HTML.equals(parameterName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AbstractNotificationPopup.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AbstractNotificationPopup.java
new file mode 100644
index 00000000000..f77b94a991e
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AbstractNotificationPopup.java
@@ -0,0 +1,583 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 Tasktop Technologies 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:
+ * Benjamin Pasero - intial API and implementation
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.resource.LocalResourceManager;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.ui.util.PapyrusImageUtils;
+import org.eclipse.papyrus.infra.widgets.toolbox.SwtUtil;
+import org.eclipse.papyrus.infra.widgets.toolbox.SwtUtil.FadeJob;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @author Benjamin Pasero
+ * @author Mik Kersten
+ * @author Steffen Pingel
+ */
+public abstract class AbstractNotificationPopup extends Window {
+
+ private static final int TITLE_HEIGHT = 24;
+
+ private static final String LABEL_NOTIFICATION = "Notification";
+
+ private static final String LABEL_JOB_CLOSE = "CLOSE";
+
+ private static final int MAX_WIDTH = Display.getDefault().getPrimaryMonitor().getBounds().width;
+
+ private static final int MIN_HEIGHT = 100;
+
+ private static final long DEFAULT_DELAY_CLOSE = 5 * 1000;
+
+ private static final int PADDING_EDGE = 5;
+
+ private long delayClose = DEFAULT_DELAY_CLOSE;
+
+ protected LocalResourceManager resources;
+
+ private NotificationPopupColors color;
+
+ private final Display display;
+
+ private Shell shell;
+
+ private Region lastUsedRegion;
+
+ private Image lastUsedBgImage;
+
+ private final Job closeJob = new Job(LABEL_JOB_CLOSE) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (!display.isDisposed()) {
+ display.asyncExec(new Runnable() {
+
+ public void run() {
+ Shell shell = AbstractNotificationPopup.this.getShell();
+ if (shell == null || shell.isDisposed()) {
+ return;
+ }
+
+ if (isMouseOver(shell)) {
+ scheduleAutoClose();
+ return;
+ }
+
+ AbstractNotificationPopup.this.closeFade();
+ }
+
+ });
+ }
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ private final boolean respectDisplayBounds = true;
+
+ private final boolean respectMonitorBounds = true;
+
+ private FadeJob fadeJob;
+
+ private boolean fadingEnabled;
+
+ protected final FormToolkit toolkit;
+
+ public AbstractNotificationPopup(Display display, FormToolkit toolkit) {
+ this(display, SWT.NO_TRIM | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL, toolkit);
+ }
+
+ public AbstractNotificationPopup(Display display, int style, FormToolkit toolkit) {
+ super(new Shell(display));
+ this.toolkit = toolkit;
+ setShellStyle(style);
+
+ this.display = display;
+ resources = new LocalResourceManager(JFaceResources.getResources());
+ initResources();
+
+ closeJob.setSystem(true);
+ }
+
+ public boolean isFadingEnabled() {
+ return fadingEnabled;
+ }
+
+ public void setFadingEnabled(boolean fadingEnabled) {
+ this.fadingEnabled = fadingEnabled;
+ }
+
+ /**
+ * Override to return a customized name. Default is to return the name of
+ * the product, specified by the -name (e.g. "Eclipse SDK") command line
+ * parameter that's associated with the product ID (e.g.
+ * "org.eclipse.sdk.ide"). Strips the trailing "SDK" for any name, since
+ * this part of the label is considered visual noise.
+ *
+ * @return the name to be used in the title of the popup.
+ */
+ protected String getPopupShellTitle() {
+ String productName = "Papyrus ";
+ return productName + LABEL_NOTIFICATION;
+ }
+
+ protected Image getPopupShellImage(int maximumHeight) {
+ return PapyrusImageUtils.getDefaultIcon();
+ }
+
+ /**
+ * Override to populate with notifications.
+ *
+ * @param parent
+ */
+ protected void createContentArea(Composite parent) {
+ // empty by default
+ }
+
+ /**
+ * Override to customize the title bar
+ */
+ protected void createTitleArea(Composite parent) {
+ ((GridData) parent.getLayoutData()).heightHint = TITLE_HEIGHT;
+
+ Label titleImageLabel = new Label(parent, SWT.NONE);
+ titleImageLabel.setImage(getPopupShellImage(TITLE_HEIGHT));
+
+ Label titleTextLabel = new Label(parent, SWT.NONE);
+ titleTextLabel.setText(getPopupShellTitle());
+ titleTextLabel.setFont(CommonFonts.BOLD);
+ titleTextLabel.setForeground(getTitleForeground());
+ // titleTextLabel.setForeground(color.getTitleText());
+ titleTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ titleTextLabel.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
+
+ final Label button = new Label(parent, SWT.NONE);
+ // TODO
+ // button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
+ button.addMouseTrackListener(new MouseTrackAdapter() {
+
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ // TODO
+ // button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE_HOVER));
+ }
+
+ @Override
+ public void mouseExit(MouseEvent e) {
+ // TODO
+ // button.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
+ }
+ });
+ button.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ close();
+ setReturnCode(CANCEL);
+ }
+
+ });
+ }
+
+ protected Color getTitleForeground() {
+ return color.getTitleText();
+ }
+
+ private void initResources() {
+ color = new NotificationPopupColors(display, resources);
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+
+ shell = newShell;
+ newShell.setBackground(color.getBorder());
+ }
+
+ @Override
+ public void create() {
+ super.create();
+ addRegion(shell);
+ }
+
+ private void addRegion(Shell shell) {
+ Region region = new Region();
+ Point s = shell.getSize();
+
+ /* Add entire Shell */
+ region.add(0, 0, s.x, s.y);
+
+ /* Subtract Top-Left Corner */
+ region.subtract(0, 0, 5, 1);
+ region.subtract(0, 1, 3, 1);
+ region.subtract(0, 2, 2, 1);
+ region.subtract(0, 3, 1, 1);
+ region.subtract(0, 4, 1, 1);
+
+ /* Subtract Top-Right Corner */
+ region.subtract(s.x - 5, 0, 5, 1);
+ region.subtract(s.x - 3, 1, 3, 1);
+ region.subtract(s.x - 2, 2, 2, 1);
+ region.subtract(s.x - 1, 3, 1, 1);
+ region.subtract(s.x - 1, 4, 1, 1);
+
+ /* Subtract Bottom-Left Corner */
+ region.subtract(0, s.y, 5, 1);
+ region.subtract(0, s.y - 1, 3, 1);
+ region.subtract(0, s.y - 2, 2, 1);
+ region.subtract(0, s.y - 3, 1, 1);
+ region.subtract(0, s.y - 4, 1, 1);
+
+ /* Subtract Bottom-Right Corner */
+ region.subtract(s.x - 5, s.y - 0, 5, 1);
+ region.subtract(s.x - 3, s.y - 1, 3, 1);
+ region.subtract(s.x - 2, s.y - 2, 2, 1);
+ region.subtract(s.x - 1, s.y - 3, 1, 1);
+ region.subtract(s.x - 1, s.y - 4, 1, 1);
+
+ /* Dispose old first */
+ if (shell.getRegion() != null) {
+ shell.getRegion().dispose();
+ }
+
+ /* Apply Region */
+ shell.setRegion(region);
+
+ /* Remember to dispose later */
+ lastUsedRegion = region;
+ }
+
+ private boolean isMouseOver(Shell shell) {
+ if (display.isDisposed()) {
+ return false;
+ }
+ return shell.getBounds().contains(display.getCursorLocation());
+ }
+
+ @Override
+ public int open() {
+ if (shell == null || shell.isDisposed()) {
+ shell = null;
+ create();
+ }
+
+ constrainShellSize();
+ shell.setLocation(fixupDisplayBounds(shell.getSize(), shell.getLocation()));
+
+ if (isFadingEnabled()) {
+ shell.setAlpha(0);
+ }
+ shell.setVisible(true);
+ fadeJob = SwtUtil.fadeIn(shell, new SwtUtil.IFadeListener() {
+
+ public void faded(Shell shell, int alpha) {
+ if (shell.isDisposed()) {
+ return;
+ }
+
+ if (alpha == 255) {
+ scheduleAutoClose();
+ }
+ }
+ });
+ return Window.OK;
+ }
+
+ protected void scheduleAutoClose() {
+ if (delayClose > 0) {
+ closeJob.schedule(delayClose);
+ }
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ ((GridLayout) parent.getLayout()).marginWidth = 1;
+ ((GridLayout) parent.getLayout()).marginHeight = 1;
+
+ /* Outer Composite holding the controls */
+ final Composite outerCircle = new Composite(parent, SWT.NO_FOCUS);
+ outerCircle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ outerCircle.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ outerCircle.addControlListener(new ControlAdapter() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ Rectangle clArea = outerCircle.getClientArea();
+ lastUsedBgImage = new Image(outerCircle.getDisplay(), clArea.width, clArea.height);
+ GC gc = new GC(lastUsedBgImage);
+
+ /* Gradient */
+ drawGradient(gc, clArea);
+
+ /* Fix Region Shape */
+ fixRegion(gc, clArea);
+
+ gc.dispose();
+
+ Image oldBGImage = outerCircle.getBackgroundImage();
+ outerCircle.setBackgroundImage(lastUsedBgImage);
+
+ if (oldBGImage != null) {
+ oldBGImage.dispose();
+ }
+ }
+
+ private void drawGradient(GC gc, Rectangle clArea) {
+ gc.setForeground(color.getGradientBegin());
+ gc.setBackground(color.getGradientEnd());
+ gc.fillGradientRectangle(clArea.x, clArea.y, clArea.width, clArea.height, true);
+ }
+
+ private void fixRegion(GC gc, Rectangle clArea) {
+ gc.setForeground(color.getBorder());
+
+ /* Fill Top Left */
+ gc.drawPoint(2, 0);
+ gc.drawPoint(3, 0);
+ gc.drawPoint(1, 1);
+ gc.drawPoint(0, 2);
+ gc.drawPoint(0, 3);
+
+ /* Fill Top Right */
+ gc.drawPoint(clArea.width - 4, 0);
+ gc.drawPoint(clArea.width - 3, 0);
+ gc.drawPoint(clArea.width - 2, 1);
+ gc.drawPoint(clArea.width - 1, 2);
+ gc.drawPoint(clArea.width - 1, 3);
+
+ /* Fill Bottom Left */
+ gc.drawPoint(2, clArea.height - 0);
+ gc.drawPoint(3, clArea.height - 0);
+ gc.drawPoint(1, clArea.height - 1);
+ gc.drawPoint(0, clArea.height - 2);
+ gc.drawPoint(0, clArea.height - 3);
+
+ /* Fill Bottom Right */
+ gc.drawPoint(clArea.width - 4, clArea.height - 0);
+ gc.drawPoint(clArea.width - 3, clArea.height - 0);
+ gc.drawPoint(clArea.width - 2, clArea.height - 1);
+ gc.drawPoint(clArea.width - 1, clArea.height - 2);
+ gc.drawPoint(clArea.width - 1, clArea.height - 3);
+ }
+ });
+
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.verticalSpacing = 0;
+
+ outerCircle.setLayout(layout);
+
+ /* Title area containing label and close button */
+ final Composite titleCircle = new Composite(outerCircle, SWT.NO_FOCUS);
+ titleCircle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ titleCircle.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ layout = new GridLayout(4, false);
+ layout.marginWidth = 3;
+ layout.marginHeight = 0;
+ layout.verticalSpacing = 5;
+ layout.horizontalSpacing = 3;
+
+ titleCircle.setLayout(layout);
+
+ /* Create Title Area */
+ createTitleArea(titleCircle);
+
+ /* Outer composite to hold content controlls */
+ Composite outerContentCircle = new Composite(outerCircle, SWT.NONE);
+ outerContentCircle.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+
+ outerContentCircle.setLayout(layout);
+ outerContentCircle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ outerContentCircle.setBackground(outerCircle.getBackground());
+
+ /* Middle composite to show a 1px black line around the content controls */
+ Composite middleContentCircle = new Composite(outerContentCircle, SWT.NO_FOCUS);
+ middleContentCircle.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.marginTop = 1;
+
+ middleContentCircle.setLayout(layout);
+ middleContentCircle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ middleContentCircle.setBackground(color.getBorder());
+
+ /* Inner composite containing the content controls */
+ Composite innerContent = new Composite(middleContentCircle, SWT.NO_FOCUS);
+ innerContent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ innerContent.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 5;
+ layout.marginLeft = 5;
+ layout.marginRight = 5;
+ innerContent.setLayout(layout);
+
+ innerContent.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+
+ /* Content Area */
+ createContentArea(innerContent);
+
+ setNullBackground(outerCircle);
+
+ return outerCircle;
+ }
+
+ private void setNullBackground(final Composite outerCircle) {
+ for (Control c : outerCircle.getChildren()) {
+ c.setBackground(null);
+ if (c instanceof Composite) {
+ setNullBackground((Composite) c);
+ }
+ }
+ }
+
+ @Override
+ protected void initializeBounds() {
+ Rectangle clArea = getPrimaryClientArea();
+ Point initialSize = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int height = Math.max(initialSize.y, MIN_HEIGHT);
+ int width = Math.min(initialSize.x, MAX_WIDTH);
+
+ Point size = new Point(width, height);
+ shell.setLocation(clArea.width + clArea.x - size.x - PADDING_EDGE, clArea.height + clArea.y - size.y - PADDING_EDGE);
+ shell.setSize(size);
+ }
+
+ private Rectangle getPrimaryClientArea() {
+ Monitor primaryMonitor = shell.getDisplay().getPrimaryMonitor();
+ return (primaryMonitor != null) ? primaryMonitor.getClientArea() : shell.getDisplay().getClientArea();
+ }
+
+ public void closeFade() {
+ if (fadeJob != null) {
+ fadeJob.cancelAndWait(false);
+ }
+ fadeJob = SwtUtil.fadeOut(getShell(), new SwtUtil.IFadeListener() {
+
+ public void faded(Shell shell, int alpha) {
+ if (!shell.isDisposed()) {
+ if (alpha == 0) {
+ shell.close();
+ } else if (isMouseOver(shell)) {
+ if (fadeJob != null) {
+ fadeJob.cancelAndWait(false);
+ }
+ fadeJob = SwtUtil.fastFadeIn(shell, new SwtUtil.IFadeListener() {
+
+ public void faded(Shell shell, int alpha) {
+ if (shell.isDisposed()) {
+ return;
+ }
+
+ if (alpha == 255) {
+ scheduleAutoClose();
+ }
+ }
+ });
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean close() {
+ resources.dispose();
+ if (lastUsedRegion != null) {
+ lastUsedRegion.dispose();
+ }
+ if (lastUsedBgImage != null && !lastUsedBgImage.isDisposed()) {
+ lastUsedBgImage.dispose();
+ }
+ return super.close();
+ }
+
+ public long getDelayClose() {
+ return delayClose;
+ }
+
+ public void setDelayClose(long delayClose) {
+ this.delayClose = delayClose;
+ }
+
+ private Point fixupDisplayBounds(Point tipSize, Point location) {
+ if (respectDisplayBounds) {
+ Rectangle bounds;
+ Point rightBounds = new Point(tipSize.x + location.x, tipSize.y + location.y);
+
+ if (respectMonitorBounds) {
+ bounds = shell.getDisplay().getPrimaryMonitor().getBounds();
+ } else {
+ bounds = getPrimaryClientArea();
+ }
+
+ if (!(bounds.contains(location) && bounds.contains(rightBounds))) {
+ if (rightBounds.x > bounds.x + bounds.width) {
+ location.x -= rightBounds.x - (bounds.x + bounds.width);
+ }
+
+ if (rightBounds.y > bounds.y + bounds.height) {
+ location.y -= rightBounds.y - (bounds.y + bounds.height);
+ }
+
+ if (location.x < bounds.x) {
+ location.x = bounds.x;
+ }
+
+ if (location.y < bounds.y) {
+ location.y = bounds.y;
+ }
+ }
+ }
+
+ return location;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AsyncNotification.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AsyncNotification.java
new file mode 100644
index 00000000000..4771c484b14
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/AsyncNotification.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+
+/**
+ * The INotification corresponding to the async builder
+ *
+ * @author tfaure
+ *
+ */
+public class AsyncNotification implements INotification {
+
+ private final PapyrusAsyncNotificationPopup popup;
+
+ public AsyncNotification(PapyrusAsyncNotificationPopup popup) {
+ this.popup = popup;
+ }
+
+ /**
+ * delete the current notification
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification#delete()
+ */
+ public void delete() {
+ // delete immediately to avoid superposition with another
+ popup.close();
+ }
+
+ /**
+ * whether the current notification is deleted
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification#isDeleted()
+ *
+ * @return true if notification is deleted
+ */
+ public boolean isDeleted() {
+ return popup.getShell() == null || popup.getShell().isDisposed();
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/CommonFonts.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/CommonFonts.java
new file mode 100644
index 00000000000..8e01569d957
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/CommonFonts.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 Tasktop Technologies 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:
+ * Benjamin Pasero - intial API and implementation
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.jface.resource.FontRegistry;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author Mik Kersten
+ * @since 3.0
+ */
+public class CommonFonts {
+
+ public static Font BOLD;
+
+ public static Font ITALIC;
+
+ public static Font BOLD_ITALIC;
+
+ public static Font STRIKETHROUGH = null;
+
+ public static boolean HAS_STRIKETHROUGH;
+
+ static {
+ if (Display.getCurrent() != null) {
+ init();
+ } else {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ init();
+ }
+ });
+ }
+ }
+
+ private static void init() {
+ BOLD = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
+ ITALIC = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
+ BOLD_ITALIC = new Font(Display.getCurrent(), getModifiedFontData(ITALIC.getFontData(), SWT.BOLD | SWT.ITALIC));
+
+ Font defaultFont = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
+ FontData[] defaultData = defaultFont.getFontData();
+ if (defaultData != null && defaultData.length == 1) {
+ FontData data = new FontData(defaultData[0].getName(), defaultData[0].getHeight(), defaultData[0].getStyle());
+
+ if ("win32".equals(SWT.getPlatform())) { //$NON-NLS-1$
+ // NOTE: Windows only, for: data.data.lfStrikeOut = 1;
+ try {
+ Field dataField = data.getClass().getDeclaredField("data"); //$NON-NLS-1$
+ Object dataObject = dataField.get(data);
+ Class<?> clazz = dataObject.getClass().getSuperclass();
+ Field strikeOutFiled = clazz.getDeclaredField("lfStrikeOut"); //$NON-NLS-1$
+ strikeOutFiled.set(dataObject, (byte) 1);
+ CommonFonts.STRIKETHROUGH = new Font(Display.getCurrent(), data);
+ } catch (Throwable t) {
+ // ignore
+ }
+ }
+ }
+ if (CommonFonts.STRIKETHROUGH == null) {
+ CommonFonts.HAS_STRIKETHROUGH = false;
+ CommonFonts.STRIKETHROUGH = defaultFont;
+ } else {
+ CommonFonts.HAS_STRIKETHROUGH = true;
+ }
+ }
+
+ /**
+ * NOTE: disposal of JFaceResources fonts handled by registry.
+ */
+ public static void dispose() {
+ if (CommonFonts.STRIKETHROUGH != null && !CommonFonts.STRIKETHROUGH.isDisposed()) {
+ CommonFonts.STRIKETHROUGH.dispose();
+ CommonFonts.BOLD_ITALIC.dispose();
+ }
+ }
+
+ /**
+ * Copied from {@link FontRegistry}
+ */
+ private static FontData[] getModifiedFontData(FontData[] baseData, int style) {
+ FontData[] styleData = new FontData[baseData.length];
+ for (int i = 0; i < styleData.length; i++) {
+ FontData base = baseData[i];
+ styleData[i] = new FontData(base.getName(), base.getHeight(), base.getStyle() | style);
+ }
+
+ return styleData;
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/ImagePapyrusAsyncNotificationPopup.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/ImagePapyrusAsyncNotificationPopup.java
new file mode 100644
index 00000000000..cfdb8d07b76
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/ImagePapyrusAsyncNotificationPopup.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.utils.PapyrusControlsFactory;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+/**
+ * An async notification with a message and an image
+ *
+ * @author tristan faure
+ *
+ */
+public class ImagePapyrusAsyncNotificationPopup extends PapyrusAsyncNotificationPopup {
+
+ protected final Type type;
+
+ protected Image image = null;
+
+ /**
+ * Create an async popup with a specific type
+ *
+ * @param display
+ * , the display of the application
+ * @param toolkit
+ * , the toolkit able to create the controls
+ * @param type
+ * , the type of the window
+ */
+ public ImagePapyrusAsyncNotificationPopup(Display display, FormToolkit toolkit, Type type) {
+ super(display, toolkit);
+ this.type = type;
+ }
+
+ /**
+ * Set the image to display
+ *
+ * @param image
+ */
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.PapyrusAsyncNotificationPopup#doCreateClient(org.eclipse.swt.widgets.Composite)
+ *
+ * @Override
+ */
+ @Override
+ protected void doCreateClient(Composite parent) {
+ PapyrusControlsFactory.createCompositeWithType(getShell(), null, parent, type, image, text, false);
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/NotificationPopupColors.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/NotificationPopupColors.java
new file mode 100644
index 00000000000..59c823be6c8
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/NotificationPopupColors.java
@@ -0,0 +1,187 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs;
+
+import org.eclipse.jface.resource.DeviceResourceException;
+import org.eclipse.jface.resource.ResourceManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Helper Class to create the colors for the {@link AbstractNotificationPopup}.
+ * <p>
+ * Note: Copied from FormColors of UI Forms.
+ * </p>
+ *
+ * @author Benjamin Pasero (initial contribution from RSSOwl, see bug 177974)
+ * @author Mik Kersten
+ */
+public class NotificationPopupColors {
+
+ private final Display display;
+
+ private Color titleText;
+
+ private Color gradientBegin;
+
+ private Color gradientEnd;
+
+ private Color border;
+
+ private final ResourceManager resourceManager;
+
+ public NotificationPopupColors(Display display, ResourceManager resourceManager) {
+ this.display = display;
+ this.resourceManager = resourceManager;
+
+ createColors();
+ }
+
+ private void createColors() {
+ createBorderColor();
+ createGradientColors();
+ // previously used SWT.COLOR_TITLE_INACTIVE_FOREGROUND, but too light on Windows XP
+ titleText = getColor(resourceManager, getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
+ }
+
+ public Color getGradientBegin() {
+ return gradientBegin;
+ }
+
+ public Color getGradientEnd() {
+ return gradientEnd;
+ }
+
+ public Color getBorder() {
+ return border;
+ }
+
+ public Color getTitleText() {
+ return titleText;
+ }
+
+ private void createBorderColor() {
+ RGB tbBorder = getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
+ RGB bg = getImpliedBackground().getRGB();
+
+ // Group 1
+ // Rule: If at least 2 of the RGB values are equal to or between 180 and
+ // 255, then apply specified opacity for Group 1
+ // Examples: Vista, XP Silver, Wn High Con #2
+ // Keyline = TITLE_BACKGROUND @ 70% Opacity over LIST_BACKGROUND
+ if (testTwoPrimaryColors(tbBorder, 179, 256)) {
+ tbBorder = blend(tbBorder, bg, 70);
+ } else if (testTwoPrimaryColors(tbBorder, 120, 180)) {
+ tbBorder = blend(tbBorder, bg, 50);
+ } else {
+ tbBorder = blend(tbBorder, bg, 30);
+ }
+
+ border = getColor(resourceManager, tbBorder);
+ }
+
+ private void createGradientColors() {
+ RGB titleBg = getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
+ Color bgColor = getImpliedBackground();
+ RGB bg = bgColor.getRGB();
+ RGB bottom, top;
+
+ // Group 1
+ // Rule: If at least 2 of the RGB values are equal to or between 180 and
+ // 255, then apply specified opacity for Group 1
+ // Examples: Vista, XP Silver, Wn High Con #2
+ // Gradient Bottom = TITLE_BACKGROUND @ 30% Opacity over LIST_BACKGROUND
+ // Gradient Top = TITLE BACKGROUND @ 0% Opacity over LIST_BACKGROUND
+ if (testTwoPrimaryColors(titleBg, 179, 256)) {
+ bottom = blend(titleBg, bg, 30);
+ top = bg;
+ }
+
+ // Group 2
+ // Rule: If at least 2 of the RGB values are equal to or between 121 and
+ // 179, then apply specified opacity for Group 2
+ // Examples: XP Olive, OSX Graphite, Linux GTK, Wn High Con Black
+ // Gradient Bottom = TITLE_BACKGROUND @ 20% Opacity over LIST_BACKGROUND
+ // Gradient Top = TITLE BACKGROUND @ 0% Opacity over LIST_BACKGROUND
+ else if (testTwoPrimaryColors(titleBg, 120, 180)) {
+ bottom = blend(titleBg, bg, 20);
+ top = bg;
+ }
+
+ // Group 3
+ // Rule: If at least 2 of the RGB values are equal to or between 0 and
+ // 120, then apply specified opacity for Group 3
+ // Examples: XP Default, Wn Classic Standard, Wn Marine, Wn Plum, OSX
+ // Aqua, Wn High Con White, Wn High Con #1
+ // Gradient Bottom = TITLE_BACKGROUND @ 10% Opacity over LIST_BACKGROUND
+ // Gradient Top = TITLE BACKGROUND @ 0% Opacity over LIST_BACKGROUND
+ else {
+ bottom = blend(titleBg, bg, 10);
+ top = bg;
+ }
+
+ gradientBegin = getColor(resourceManager, top);
+ gradientEnd = getColor(resourceManager, bottom);
+ }
+
+ private RGB blend(RGB c1, RGB c2, int ratio) {
+ int r = blend(c1.red, c2.red, ratio);
+ int g = blend(c1.green, c2.green, ratio);
+ int b = blend(c1.blue, c2.blue, ratio);
+ return new RGB(r, g, b);
+ }
+
+ private int blend(int v1, int v2, int ratio) {
+ int b = (ratio * v1 + (100 - ratio) * v2) / 100;
+ return Math.min(255, b);
+ }
+
+ private boolean testTwoPrimaryColors(RGB rgb, int from, int to) {
+ int total = 0;
+ if (testPrimaryColor(rgb.red, from, to)) {
+ total++;
+ }
+ if (testPrimaryColor(rgb.green, from, to)) {
+ total++;
+ }
+ if (testPrimaryColor(rgb.blue, from, to)) {
+ total++;
+ }
+ return total >= 2;
+ }
+
+ private boolean testPrimaryColor(int value, int from, int to) {
+ return value > from && value < to;
+ }
+
+ private RGB getSystemColor(int code) {
+ return getDisplay().getSystemColor(code).getRGB();
+ }
+
+ private Color getImpliedBackground() {
+ return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ }
+
+ private Display getDisplay() {
+ return display;
+ }
+
+ private Color getColor(ResourceManager manager, RGB rgb) {
+ try {
+ return manager.createColor(rgb);
+ } catch (DeviceResourceException e) {
+ return manager.getDevice().getSystemColor(SWT.COLOR_BLACK);
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java
new file mode 100644
index 00000000000..5bf614e7f61
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java
@@ -0,0 +1,139 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.IContext;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+
+/**
+ * This popup creates an async notification
+ *
+ * @author tristan faure
+ *
+ */
+public class PapyrusAsyncNotificationPopup extends AbstractNotificationPopup {
+
+ protected String text;
+
+ protected String title;
+
+ protected IContext context = new IContext.Context();
+
+ protected Collection<NotificationRunnable> runnables = new LinkedList<NotificationRunnable>();
+
+ public PapyrusAsyncNotificationPopup(Display display, FormToolkit toolkit) {
+ super(display, toolkit);
+ }
+
+ @Override
+ protected void createContentArea(Composite parent) {
+ super.createContentArea(parent);
+ doCreateClient(parent);
+ doCreateActionSection(parent);
+ }
+
+ protected void doCreateActionSection(Composite parent) {
+ Composite compo = toolkit.createComposite(parent);
+ compo.setLayoutData(new GridData(GridData.END, GridData.END, true, false, 1, 1));
+ compo.setLayout(new FillLayout(SWT.HORIZONTAL));
+ createRunnables(compo);
+ }
+
+ protected void createRunnables(Composite compo) {
+ if (!runnables.isEmpty()) {
+ boolean first = true;
+ for (final NotificationRunnable r : runnables) {
+ if (!first) {
+ toolkit.createLabel(compo, " ");
+ }
+ Hyperlink h = toolkit.createHyperlink(compo, r.getLabel() == null ? "run" : r.getLabel(), SWT.NONE);
+ h.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ PapyrusAsyncNotificationPopup.this.run(r);
+ }
+ });
+ }
+ });
+ first = false;
+ }
+ }
+ }
+
+ protected void setCompositeCreated(Composite c) {
+ context.put(IContext.COMPOSITE_CREATED, c);
+ }
+
+ /**
+ * Sets the used notification for recovering when needed (e.g. for removal)
+ *
+ * @param notification
+ * the used notification
+ */
+ public void setINotification(INotification notification) {
+ context.put(IContext.NOTIFICATION_OBJECT, notification);
+ }
+
+ protected void run(NotificationRunnable r) {
+ if (r != null) {
+ r.run(context);
+ }
+ }
+
+ protected void doCreateClient(Composite parent) {
+ Label label = new Label(parent, SWT.None);
+ label.setText(text);
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public void addRunnable(NotificationRunnable runnable) {
+ runnables.add(runnable);
+ }
+
+ public void addAllRunnable(Collection<NotificationRunnable> runnable) {
+ runnables.addAll(runnable);
+ }
+
+ @Override
+ protected String getPopupShellTitle() {
+ if (title == null) {
+ return super.getPopupShellTitle();
+ }
+ return title;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusPopup.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusPopup.java
new file mode 100644
index 00000000000..530dec1e4e1
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusPopup.java
@@ -0,0 +1,222 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.papyrus.infra.ui.util.PapyrusImageUtils;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.PapyrusToolkit;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.IContext;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * A papyrus Popup
+ *
+ * @author tristan faure
+ *
+ */
+public abstract class PapyrusPopup extends Dialog {
+
+ protected FormToolkit toolkit;
+
+ protected boolean useHtml = false;
+
+ protected IContext context = new IContext.Context();
+
+ protected Collection<NotificationRunnable> runnables = new LinkedList<NotificationRunnable>();
+
+ protected Map<Integer, NotificationRunnable> mapForIds = new HashMap<Integer, NotificationRunnable>();
+
+ /**
+ * Used to custom the composite inside the popup
+ */
+ protected ICompositeCreator creator = null;
+
+ private String title;
+
+ public PapyrusPopup(Shell parentShell, FormToolkit toolkit) {
+ super(parentShell);
+ this.toolkit = toolkit;
+ }
+
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText(title == null ? "" : title);
+ getShell().setImage(PapyrusImageUtils.getDefaultIcon());
+ Composite c = (Composite) super.createDialogArea(parent);
+ c.setLayout(new FillLayout());
+ createForm(c);
+ return c;
+ }
+
+
+ /**
+ * Creates a form and a section
+ * override this method to avoid form creation
+ *
+ * @param c
+ * , the composite container
+ */
+ protected void createForm(Composite c) {
+ ScrolledForm form = toolkit.createScrolledForm(c);
+ // form.getBody().setLayoutData(new GridData(GridData.FILL_BOTH));
+ form.getBody().setLayout(new GridLayout());
+ toolkit.decorateFormHeading(form.getForm());
+ createSection(c, form);
+ c.setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+
+ /**
+ * Sets the used notification for recovering when needed (e.g. for removal)
+ *
+ * @param notification
+ * the used notification
+ */
+ public void setINotification(INotification notification) {
+ context.put(IContext.NOTIFICATION_OBJECT, notification);
+ }
+
+ /**
+ * Creates a section
+ * override this method to avoid section creation
+ *
+ * @param c
+ * , the composite container of the form
+ * @param form
+ * , the form container
+ */
+ protected void createSection(Composite c, ScrolledForm form) {
+ Section section = toolkit.createSection(form.getBody(), PapyrusToolkit.DEFAULT_STYLE);
+ section.setText("Papyrus");
+ if (creator != null && c instanceof Composite) {
+ Composite createComposite = creator.createComposite(section, toolkit);
+ section.setClient(createComposite);
+ context.put(IContext.COMPOSITE_CREATED, createComposite);
+ getShell().setFocus();
+ } else {
+ section.setClient(doCreateContents(section));
+ getShell().setFocus();
+ }
+ section.setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+
+ /**
+ * @param runnable
+ */
+ public void addRunnable(NotificationRunnable runnable) {
+ runnables.add(runnable);
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ if (runnables != null && !runnables.isEmpty()) {
+ int START_AFTER_CANCEL = 2;
+ for (final NotificationRunnable r : runnables) {
+ createButton(parent, START_AFTER_CANCEL, r.getLabel(), START_AFTER_CANCEL == 2);
+ mapForIds.put(START_AFTER_CANCEL, r);
+ START_AFTER_CANCEL++;
+ }
+ } else {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ }
+ }
+
+
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId != IDialogConstants.OK_ID && buttonId != IDialogConstants.CANCEL_ID) {
+ NotificationRunnable run = mapForIds.get(buttonId);
+ if (run == null) {
+ super.buttonPressed(buttonId);
+ } else {
+ run.run(context);
+ // retrieve the return code according to the context if it is set
+ Object contextCode = context.get(IContext.ACTION_ID);
+ if (contextCode != null && contextCode instanceof Integer) {
+ setReturnCode((Integer) contextCode);
+ }
+ }
+ } else {
+ super.buttonPressed(buttonId);
+ }
+ close();
+ }
+
+ /**
+ * @param runnable
+ */
+ public void addRunnables(Collection<NotificationRunnable> runnable) {
+ runnables.addAll(runnable);
+ }
+
+ protected abstract Control doCreateContents(Composite composite);
+
+ public void setCompositeCreator(ICompositeCreator creator) {
+ this.creator = creator;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * Gets the bounds.
+ *
+ * @return the bounds
+ */
+ public static Rectangle getBounds() {
+ Display display = Display.getDefault();
+ Rectangle bounds = display.getPrimaryMonitor().getBounds();
+ Rectangle result = new Rectangle(bounds.x + bounds.width / 4, bounds.y + bounds.height / 4, bounds.width / 2, bounds.height / 2);
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.window.Window#getConstrainedShellBounds(org.eclipse.swt.graphics.Rectangle)
+ */
+ @Override
+ protected Rectangle getConstrainedShellBounds(Rectangle preferredSize) {
+ // return getBounds();
+ return super.getConstrainedShellBounds(preferredSize);
+ }
+
+ public void setUseHtml(boolean useHtml) {
+ this.useHtml = useHtml;
+ }
+
+ public boolean isUseHtml() {
+ return useHtml;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/exception/NotificationException.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/exception/NotificationException.java
new file mode 100644
index 00000000000..32847630c20
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/exception/NotificationException.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.exception;
+
+
+/**
+ * An exception for the notification
+ *
+ * @author tfaure
+ *
+ */
+public class NotificationException extends RuntimeException {
+
+ /** serialization UID */
+ private static final long serialVersionUID = 3538113727604912133L;
+
+ private final String message;
+
+ public NotificationException(String message) {
+ this.message = message;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/IconAndMessagePapyrusPopup.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/IconAndMessagePapyrusPopup.java
new file mode 100644
index 00000000000..4656cf2b07b
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/IconAndMessagePapyrusPopup.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.popups;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.PapyrusToolkit;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.utils.PapyrusControlsFactory;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+/**
+ * A notification with icon and message
+ *
+ * @author tristan faure
+ *
+ */
+public class IconAndMessagePapyrusPopup extends MessagePapyrusPopup {
+
+ private Type type = null;
+
+ private Image image;
+
+ public IconAndMessagePapyrusPopup(Shell parentShell, FormToolkit toolkit, String message, Type type) {
+ super(parentShell, toolkit, message);
+ this.type = type;
+ }
+
+ public IconAndMessagePapyrusPopup(Shell activeShell, FormToolkit toolkit, String message) {
+ super(activeShell, toolkit, message);
+ }
+
+
+
+ @Override
+ protected void createSection(Composite c, ScrolledForm form) {
+ Section section = toolkit.createSection(form.getBody(), PapyrusToolkit.DEFAULT_STYLE);
+ section.setText("Papyrus");
+ section.setClient(doCreateContents(section));
+ getShell().setFocus();
+ section.setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+
+ @Override
+ protected Composite createText(Composite composite) {
+ Composite top = PapyrusControlsFactory.createCompositeWithType(getShell(), toolkit, composite, type, image, message, useHtml, creator, context);
+ return top;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/MessagePapyrusPopup.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/MessagePapyrusPopup.java
new file mode 100644
index 00000000000..eb70e24e692
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/MessagePapyrusPopup.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.popups;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.PapyrusPopup;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+/**
+ * A notification with a message
+ *
+ * @author tristan faure
+ *
+ */
+public class MessagePapyrusPopup extends PapyrusPopup {
+
+ protected final String message;
+
+
+ /**
+ * Create a Papyrus message popup
+ *
+ * @param parentShell
+ * , the shell
+ * @param toolkit
+ * , the toolkit to create elements
+ * @param message
+ * , the message to display
+ */
+ public MessagePapyrusPopup(Shell parentShell, FormToolkit toolkit, String message) {
+ super(parentShell, toolkit);
+ this.message = message;
+
+ }
+
+ @Override
+ protected Control doCreateContents(Composite composite) {
+ composite.setLayout(getCompositeLayout());
+ Composite label = createText(composite);
+ return label;
+ }
+
+ protected Layout getCompositeLayout() {
+ return new FillLayout();
+ }
+
+ protected Composite createText(Composite composite) {
+ FormText label = toolkit.createFormText(composite, false);
+ label.setText(message, useHtml, true);
+ return label;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ }
+
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/PopupNotification.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/PopupNotification.java
new file mode 100644
index 00000000000..2ff2ae074c5
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/popups/PopupNotification.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.popups;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.PapyrusPopup;
+import org.eclipse.swt.SWT;
+
+/**
+ * The INotification corresponding to the popup builder
+ *
+ * @author tfaure
+ *
+ */
+public class PopupNotification implements INotification {
+
+ private final PapyrusPopup popup;
+
+ private int popupResult = SWT.NONE;
+
+ public PopupNotification(PapyrusPopup popup) {
+ this.popup = popup;
+ }
+
+ public void delete() {
+ // no effect
+ }
+
+ /**
+ * Whether the popup has been closed
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification#isDeleted()
+ *
+ * @return true
+ */
+ public boolean isDeleted() {
+ // the object is created once the popup is closed
+ return true;
+ }
+
+ public void setResult(int popupResult) {
+ this.popupResult = popupResult;
+ }
+
+ /**
+ * Returns the result of the popup
+ *
+ * @return
+ */
+ public int getResult() {
+ return popupResult;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/utils/PapyrusControlsFactory.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/utils/PapyrusControlsFactory.java
new file mode 100644
index 00000000000..f955bf80ae8
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/utils/PapyrusControlsFactory.java
@@ -0,0 +1,128 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.utils;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.PapyrusToolkit;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.IContext;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+
+public class PapyrusControlsFactory {
+
+ /**
+ * Create a composite according to the type
+ *
+ * @param shell
+ * , the shell of the element
+ * @param toolkit
+ * , the toolkit used
+ * @param parent
+ * , the parent containing the composite created
+ * @param type
+ * , the type to create
+ * @param image
+ * , the image to associate
+ * @param message
+ * , the message to display
+ * @param useHTML
+ * , if the composite use html
+ * @return the composite created
+ */
+ public static Composite createCompositeWithType(Shell shell, FormToolkit toolkit, Composite parent, Type type, Image image, String message, boolean useHTML) {
+ return createCompositeWithType(shell, toolkit, parent, type, image, message, useHTML, null, null);
+ }
+
+ /**
+ * Create a composite according to the type
+ *
+ * @param shell
+ * , the shell of the element
+ * @param toolkit
+ * , the toolkit used
+ * @param parent
+ * , the parent containing the composite created
+ * @param type
+ * , the type to create
+ * @param image
+ * , the image to associate
+ * @param message
+ * , the message to display
+ * @param useHTML
+ * , if the composite use html
+ * @param creator
+ * , the composite creator it can be null
+ * @param context
+ * , the context to add the composite created by the creator
+ * @return the composite created
+ */
+ public static Composite createCompositeWithType(Shell shell, FormToolkit toolkit, Composite parent, Type type, Image image, String message, boolean useHTML, ICompositeCreator creator, IContext context) {
+ Composite top = null;
+ if (toolkit == null) {
+ top = new Composite(parent, SWT.None);
+ } else {
+ top = toolkit.createComposite(parent, SWT.NONE);
+ }
+ top.setLayout(new GridLayout(2, false));
+ Image anImage = image;
+ switch (type) {
+ case ERROR:
+ anImage = NotificationBuilder.getSWTImage(SWT.ICON_ERROR, shell);
+ break;
+ case INFO:
+ anImage = NotificationBuilder.getSWTImage(SWT.ICON_INFORMATION, shell);
+ break;
+ case WARNING:
+ anImage = NotificationBuilder.getSWTImage(SWT.ICON_WARNING, shell);
+ break;
+ case QUESTION:
+ anImage = NotificationBuilder.getSWTImage(SWT.ICON_QUESTION, shell);
+ break;
+ default:
+ }
+ Label labelImage = new Label(top, SWT.None);
+ if (anImage != null) {
+ labelImage.setImage(anImage);
+ }
+ if (creator == null) {
+ if (toolkit != null) {
+ FormText label = toolkit.createFormText(top, false);
+ label.setText(message, useHTML, true);
+ label.setLayoutData(new GridData(GridData.FILL_BOTH));
+ } else {
+ Label label = new Label(top, SWT.None);
+ label.setText(message);
+ label.setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+ } else {
+ if (toolkit == null) {
+ toolkit = PapyrusToolkit.INSTANCE;
+ }
+ Composite compo = creator.createComposite(top, toolkit);
+ if (context != null) {
+ context.put(IContext.COMPOSITE_CREATED, compo);
+ }
+ }
+ return top;
+ }
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/AbstractInsideComposite.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/AbstractInsideComposite.java
new file mode 100644
index 00000000000..4c3cd01ac30
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/AbstractInsideComposite.java
@@ -0,0 +1,174 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.view;
+
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICallBack;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.IContext;
+import org.eclipse.swt.SWT;
+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.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * A composite contained in PapyrusNotificationView
+ *
+ * @author tfaure
+ */
+public abstract class AbstractInsideComposite extends Composite {
+
+ private final FormToolkit toolkit;
+
+ private Section section;
+
+ private Control previous;
+
+ private Control after;
+
+ private final ICallBack callback;
+
+ protected IContext context = new IContext.Context();
+
+ private Collection<NotificationRunnable> runnables;
+
+ AbstractInsideComposite(ICallBack callback, ScrolledForm parent, FormToolkit toolkit, Collection<NotificationRunnable> collection) {
+ super(parent.getBody(), SWT.NONE);
+ this.callback = callback;
+ this.toolkit = toolkit;
+ this.runnables = collection;
+ createContents();
+ }
+
+ /**
+ * Sets the used notification for recovering when needed (e.g. for removal)
+ *
+ * @param notification
+ * the used notification
+ */
+ public void setINotification(INotification notification) {
+ context.put(IContext.NOTIFICATION_OBJECT, notification);
+ }
+
+ private void createContents() {
+ section = toolkit.createSection(this, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ section.setText(getSectionName() + " - " + new SimpleDateFormat("HH'h'mm'm'ss's'").format(new Date()));
+ section.setLayout(new FillLayout());
+ Composite compo = toolkit.createComposite(section);
+ compo.setLayout(new GridLayout(1, false));
+ Control control = doCreateContents(toolkit, compo);
+ control.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createHyperLinkSection(compo);
+ section.setClient(compo);
+ }
+
+ protected void createHyperLinkSection(Composite compo) {
+ Composite compoHL = toolkit.createComposite(compo);
+ compoHL.setLayout(new FillLayout());
+ if (runnables != null && !runnables.isEmpty()) {
+ for (final NotificationRunnable r : runnables) {
+ Button b = toolkit.createButton(compoHL, r.getLabel() == null ? "run" : r.getLabel(), SWT.NONE);
+ b.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ run(r);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ run(r);
+ }
+ });
+ }
+ } else {
+ Button b = toolkit.createButton(compoHL, "close", SWT.NONE);
+ b.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ close();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ close();
+ }
+ });
+ }
+ compoHL.setLayoutData(new GridData(GridData.END, GridData.END, false, true, 1, 1));
+ }
+
+ protected void setCompositeCreated(Composite c) {
+ context.put(IContext.COMPOSITE_CREATED, c);
+ }
+
+ /**
+ * Close the current Composite
+ */
+ public void close() {
+ callback.callBack(this);
+ }
+
+ public void run(NotificationRunnable r) {
+ if (r != null) {
+ r.run(context);
+ close();
+ }
+ }
+
+ public void runDefault() {
+ if (runnables != null && !runnables.isEmpty()) {
+ runnables.iterator().next().run(context);
+ }
+ close();
+ }
+
+ public void expand() {
+ section.setExpanded(true);
+ }
+
+ public void collapse() {
+ section.setExpanded(false);
+ }
+
+ protected abstract Control doCreateContents(FormToolkit toolkit, Composite composite);
+
+ protected abstract String getSectionName();
+
+ public void setAfter(Control after) {
+ this.after = after;
+ }
+
+ public Control getAfter() {
+ return after;
+ }
+
+ public void setPrevious(Control previous) {
+ this.previous = previous;
+ }
+
+ public Control getPrevious() {
+ return previous;
+ }
+
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/MessageComposite.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/MessageComposite.java
new file mode 100644
index 00000000000..a5783f3460a
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/MessageComposite.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.view;
+
+import java.util.Collection;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICallBack;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+public class MessageComposite extends AbstractInsideComposite {
+
+ protected FormText text;
+
+
+ public MessageComposite(ICallBack callBack, ScrolledForm parent, FormToolkit toolkit, Collection<NotificationRunnable> collection) {
+ super(callBack, parent, toolkit, collection);
+ setLayout(new FillLayout(SWT.HORIZONTAL));
+ }
+
+ @Override
+ protected Control doCreateContents(FormToolkit toolkit, Composite composite) {
+ text = toolkit.createFormText(composite, false);
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text.setText(text, false, false);
+ }
+
+ @Override
+ protected String getSectionName() {
+ return "Message";
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/PapyrusNotificationView.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/PapyrusNotificationView.java
new file mode 100644
index 00000000000..a6d5a7d99fb
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/PapyrusNotificationView.java
@@ -0,0 +1,417 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.view;
+
+
+import java.util.Collection;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.papyrus.infra.ui.util.PapyrusImageUtils;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICallBack;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.ICompositeCreator;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.NotificationRunnable;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.PapyrusToolkit;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.utils.PapyrusControlsFactory;
+import org.eclipse.papyrus.infra.widgets.toolbox.utils.ToolbooxImageUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This view displays a list of notifications for users
+ */
+
+public class PapyrusNotificationView extends ViewPart implements ICallBack {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.eclipse.papyrus.infra.widgets.toolbox.notification.view.PapyrusNotificationView";
+
+ private Action closeAllAction;
+
+ private Action collapseAllAction;
+
+ private Action allDefaultAction;
+
+ private boolean isCollapse = true;
+
+ private ScrolledForm form;
+
+ private FormToolkit toolkit = PapyrusToolkit.INSTANCE;
+
+ /**
+ * The constructor.
+ */
+ public PapyrusNotificationView() {
+ }
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ @Override
+ public void createPartControl(Composite parent) {
+ setTitleImage(PapyrusImageUtils.getDefaultIcon());
+ createContent(parent);
+ makeActions();
+ hookContextMenu();
+ hookDoubleClickAction();
+ contributeToActionBars();
+ }
+
+ /**
+ * Add a composite in the view
+ *
+ * @param creator
+ * , the composite creator
+ * @param collection
+ * , the collection of actions
+ * @return the composite
+ */
+ public AbstractInsideComposite setComposite(final ICompositeCreator creator, Collection<NotificationRunnable> collection) {
+ MessageComposite composite = new MessageComposite(this, form, toolkit, collection) {
+
+ @Override
+ protected Control doCreateContents(FormToolkit toolkit, Composite compo) {
+ Composite composite = creator.createComposite(compo, toolkit);
+ setCompositeCreated(composite);
+ return composite;
+ }
+
+ };
+ manageComposite(composite);
+ return composite;
+ }
+
+ /**
+ * Add a composite in the view
+ *
+ * @param creator
+ * , the composite creator
+ * @param messageTitle
+ * , the message in the section
+ * @param collection
+ * , the collection of actions
+ * @return the composite
+ */
+ public AbstractInsideComposite setComposite(final ICompositeCreator creator, final String messageTitle, Collection<NotificationRunnable> runnables) {
+ return setComposite(creator, messageTitle, runnables, null);
+ }
+
+ /**
+ * Add a composite in the view
+ *
+ * @param creator
+ * , the composite creator
+ * @param messageTitle
+ * , the message in the section
+ * @param collection
+ * , the collection of actions
+ * @return the composite
+ */
+ public AbstractInsideComposite setComposite(final ICompositeCreator creator, final String messageTitle, Collection<NotificationRunnable> runnables, final Type type) {
+ MessageComposite composite = new MessageComposite(this, form, toolkit, runnables) {
+
+ @Override
+ protected Control doCreateContents(FormToolkit toolkit, Composite composite) {
+ Composite compo = null;
+ if (type != null) {
+ compo = PapyrusControlsFactory.createCompositeWithType(Display.getDefault().getActiveShell(), toolkit, composite, type, null, null, false, creator, context);
+ } else {
+ compo = creator.createComposite(composite, toolkit);
+ setCompositeCreated(compo);
+ }
+ return compo;
+ }
+
+ @Override
+ protected String getSectionName() {
+ if (messageTitle == null) {
+ return super.getSectionName();
+ } else {
+ return messageTitle;
+ }
+ }
+ };
+ manageComposite(composite);
+ return composite;
+ }
+
+ /**
+ * Add a composite in the view
+ *
+ * @param message
+ * , the message in the composite
+ * @param title
+ * , the title of the section
+ * @param runnables
+ * , the actions
+ * @return
+ */
+ public AbstractInsideComposite setMessage(String message, final String title, Collection<NotificationRunnable> runnables) {
+ MessageComposite compo = new MessageComposite(this, form, toolkit, runnables) {
+
+ @Override
+ protected String getSectionName() {
+ if (title == null) {
+ return super.getSectionName();
+ } else {
+ return title;
+ }
+ }
+ };
+ compo.setText(message);
+ manageComposite(compo);
+ return compo;
+ }
+
+ /**
+ * Add a message in the view
+ *
+ * @param message
+ * , the message to display
+ */
+ public void setMessage(String message) {
+ setMessage(message, null);
+ }
+
+ /**
+ * Add a message with a collection of actions
+ *
+ * @param message
+ * , the message to display
+ * @param runnables
+ * , a collection of actions
+ */
+ public void setMessage(String message, Collection<NotificationRunnable> runnables) {
+ MessageComposite compo = new MessageComposite(this, form, toolkit, runnables);
+ compo.setText(message);
+ manageComposite(compo);
+ }
+
+ private void manageComposite(AbstractInsideComposite compo) {
+ if (form.getBody().getChildren().length > 1) {
+ Control previous = form.getBody().getChildren()[form.getBody().getChildren().length - 2];
+ manageComposite(compo, previous);
+ } else {
+ manageComposite(compo, null);
+ }
+
+ }
+
+ private void manageComposite(Control created, Control previous) {
+ FormData data = new FormData();
+ if (previous != null) {
+ data.bottom = new FormAttachment(previous, -5);
+ } else {
+ data.bottom = new FormAttachment(98, -5);
+ }
+ data.left = new FormAttachment(0, 5);
+
+ data.right = new FormAttachment(100, -5);
+ created.setLayoutData(data);
+ form.reflow(true);
+ if (created instanceof AbstractInsideComposite) {
+ AbstractInsideComposite inside = (AbstractInsideComposite) created;
+ inside.setPrevious(previous);
+ }
+ if (previous instanceof AbstractInsideComposite) {
+ AbstractInsideComposite inside = (AbstractInsideComposite) previous;
+ inside.setAfter(created);
+ }
+ created.setFocus();
+ }
+
+ private void createContent(Composite parent) {
+ parent.setLayout(new FillLayout(SWT.VERTICAL));
+ form = toolkit.createScrolledForm(parent);
+ form.getBody().setLayout(new FormLayout());
+ form.setShowFocusedControl(true);
+ }
+
+ private void hookContextMenu() {
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+
+ public void menuAboutToShow(IMenuManager manager) {
+ PapyrusNotificationView.this.fillContextMenu(manager);
+ }
+ });
+ }
+
+ private void contributeToActionBars() {
+ IActionBars bars = getViewSite().getActionBars();
+ fillLocalPullDown(bars.getMenuManager());
+ fillLocalToolBar(bars.getToolBarManager());
+ }
+
+ private void fillLocalPullDown(IMenuManager manager) {
+ manager.add(allDefaultAction);
+ manager.add(closeAllAction);
+ manager.add(collapseAllAction);
+ manager.add(new Separator());
+ }
+
+ private void fillContextMenu(IMenuManager manager) {
+ }
+
+ private void fillLocalToolBar(IToolBarManager manager) {
+ manager.add(allDefaultAction);
+ manager.add(closeAllAction);
+ manager.add(collapseAllAction);
+ }
+
+ private void makeActions() {
+ allDefaultAction = new Action() {
+
+ @Override
+ public void run() {
+ for (Control c : form.getBody().getChildren()) {
+ if (c instanceof AbstractInsideComposite) {
+ AbstractInsideComposite compo = (AbstractInsideComposite) c;
+ compo.runDefault();
+ }
+ }
+ form.getBody().layout(true, true);
+ form.layout(true, true);
+ }
+ };
+ allDefaultAction.setText("Run all default action");
+ allDefaultAction.setToolTipText("Run all default action");
+ allDefaultAction.setImageDescriptor(ToolbooxImageUtils.getImageDescriptor(org.eclipse.papyrus.infra.widgets.toolbox.utils.ISharedImages.IMG_RUN));
+ closeAllAction = new Action() {
+
+ @Override
+ public void run() {
+ for (Control c : form.getBody().getChildren()) {
+ c.dispose();
+ }
+ form.getBody().layout(true, true);
+ form.layout(true, true);
+ }
+ };
+ closeAllAction.setText("Close All");
+ closeAllAction.setToolTipText("Close all the messages");
+ closeAllAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_DELETE));
+ collapseAllAction = new Action() {
+
+ @Override
+ public void run() {
+ for (Control c : form.getBody().getChildren()) {
+ if (c instanceof AbstractInsideComposite) {
+ AbstractInsideComposite compo = (AbstractInsideComposite) c;
+ if (isCollapse) {
+ compo.collapse();
+ } else {
+ compo.expand();
+ }
+ }
+ }
+ isCollapse = !isCollapse;
+ if (isCollapse) {
+ collapseAllAction.setText("Collapse all the messages");
+ collapseAllAction.setToolTipText("Collapse all the messages");
+ } else {
+ collapseAllAction.setText("Expand all the messages");
+ collapseAllAction.setToolTipText("Expand all the messages");
+ }
+ form.getBody().layout(true, true);
+ form.layout(true, true);
+ }
+ };
+ collapseAllAction.setText("Collapse all the messages");
+ collapseAllAction.setToolTipText("Collapse all the messages");
+ collapseAllAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_COLLAPSEALL));
+ }
+
+ private void hookDoubleClickAction() {
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ @Override
+ public void setFocus() {
+ form.setFocus();
+ }
+
+ /*
+ * (non-Javadoc)
+ * this method update the after and previous attributes to update the layout
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.view.ICloseCallBack#closed(java.lang.Object)
+ */
+ public void callBack(Object element) {
+ destroy(element);
+ }
+
+ /**
+ * This method destroy the object if it is contained in the view
+ *
+ * @param element
+ */
+ protected void destroy(Object element) {
+ if (element instanceof AbstractInsideComposite) {
+ AbstractInsideComposite inside = (AbstractInsideComposite) element;
+
+ if (inside != null) {
+ Control previous = inside.getPrevious();
+ Control after = inside.getAfter();
+
+ if ((after != null) && !(after.isDisposed())
+ && ((previous == null) || !(previous.isDisposed()))) {
+
+ // previous can be null but can not be disposed when not null
+ // after can not be null nor disposed
+ manageComposite(after, previous);
+
+ } else if ((previous instanceof AbstractInsideComposite) && !(previous.isDisposed())) {
+ AbstractInsideComposite compo = (AbstractInsideComposite) previous;
+ compo.setAfter(null);
+ // FormData data = new FormData();
+ // data.bottom = new FormAttachment(previous, -5);
+ // data.left = new FormAttachment(0, 5);
+ // data.right = new FormAttachment(100, -5);
+ // compo.setLayoutData(data);
+ // form.reflow(true);
+ }
+ }
+
+ if (!inside.isDisposed()) {
+ inside.dispose();
+ }
+
+ form.getBody().layout(true, true);
+ form.layout(true, true);
+ }
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/ViewNotification.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/ViewNotification.java
new file mode 100644
index 00000000000..dac34dae29b
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/view/ViewNotification.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.notification.view;
+
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification;
+
+/**
+ * The INotification corresponding to the view builder
+ *
+ * @author tfaure
+ *
+ */
+public class ViewNotification implements INotification {
+
+ private final AbstractInsideComposite viewCompo;
+
+ public ViewNotification(AbstractInsideComposite viewCompo) {
+ this.viewCompo = viewCompo;
+ }
+
+ public void delete() {
+ viewCompo.close();
+ }
+
+ /**
+ *
+ * whether the current notification is deleted
+ *
+ * @see org.eclipse.papyrus.infra.widgets.toolbox.notification.INotification#isDeleted()
+ * @return true if notification is deleted
+ */
+ public boolean isDeleted() {
+ return viewCompo.isDisposed();
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/DialogUtils.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/DialogUtils.java
new file mode 100644
index 00000000000..0449f67cf07
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/DialogUtils.java
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * 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:
+ * Ansgar Radermacher ansgar.radermacher@cea.fr
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.widgets.toolbox.utils;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.dialogs.FilteredList;
+
+/**
+ * Some static utility functions in the context of dialogs
+ */
+public class DialogUtils {
+
+ /**
+ * Create a filtered list that automatically uses the available space (@see createFillGridData)
+ * and a width & height hint
+ *
+ * @param parent
+ * the parent composite
+ * @param labelProvider
+ * the label provider for the filtered list
+ * @param width
+ * a with hint
+ * @param height
+ * a height hint
+ * @param style
+ * the style of the filtered list
+ * @return the created list
+ */
+ public static FilteredList createFilteredList(Composite parent, ILabelProvider labelProvider,
+ int width, int height, int style) {
+ FilteredList list = new FilteredList(parent, style, labelProvider,
+ true, true, true);
+
+ GridData data = createFillGridData();
+ data.widthHint = width;
+ data.heightHint = height;
+ list.setLayoutData(data);
+ list.setFont(parent.getFont());
+ return list;
+ }
+
+ /**
+ * Create a composite containing a label and a combo box within a given parent composite
+ * The label is positioned left of the button
+ *
+ * @param parent
+ * the parent composite
+ * @param label
+ * the text of the label
+ * @param comboFlags
+ * SWT flags for the combo box
+ * @param compFlags
+ * SWT flags for the created composite (that contains combo and label)
+ * @return
+ */
+ public static Combo createComboWithText(Composite parent, String label, int comboFlags, int compFlags) {
+ Composite comboComposite = new Composite(parent, compFlags);
+ comboComposite.setLayout(new GridLayout(2, false));
+ Label comboLabel = new Label(comboComposite, SWT.NONE);
+ comboLabel.setText(label);
+ Combo combo = new Combo(comboComposite, comboFlags);
+ comboComposite.pack();
+ return combo;
+ }
+
+ /**
+ * Create a composite containing a label and a button within a given parent composite
+ * The label is positioned left of the combo box
+ *
+ * @param parent
+ * the parent composite
+ * @param label
+ * the text of the label
+ * @param buttonFlags
+ * SWT flags for the button
+ * @param compFlags
+ * SWT flags for the created composite (that contains combo and label)
+ * @return
+ */
+ public static Button createButtonWithText(Composite parent, String label, int buttonFlags, int compFlags) {
+ Composite buttonComposite = new Composite(parent, compFlags);
+ buttonComposite.setLayout(new GridLayout(2, false));
+ Label buttonLabel = new Label(buttonComposite, SWT.NONE);
+ buttonLabel.setText(label);
+ Button button = new Button(buttonComposite, buttonFlags);
+ buttonComposite.pack();
+ return button;
+ }
+
+ /**
+ * Create a GridData object which fills the available vertical and horizontal space
+ *
+ * @return
+ */
+ public static GridData createFillGridData() {
+ GridData gridData = new GridData();
+ gridData.grabExcessVerticalSpace = true;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.verticalAlignment = GridData.FILL;
+ return gridData;
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/ISharedImages.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/ISharedImages.java
new file mode 100644
index 00000000000..c4a7dd95320
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/ISharedImages.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.utils;
+
+
+/**
+ * Constants to use in {@link ToolbooxImageUtils}
+ *
+ * @author tfaure
+ *
+ */
+public interface ISharedImages {
+
+ int IMG_RUN = 0;
+
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/ToolbooxImageUtils.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/ToolbooxImageUtils.java
new file mode 100644
index 00000000000..5eede25823c
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/utils/ToolbooxImageUtils.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2010 ATOS ORIGIN.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.toolbox.utils;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.papyrus.infra.widgets.toolbox.Activator;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * A class retrieving the icons used in papyrus toolbox
+ *
+ * @author tfaure
+ *
+ */
+public class ToolbooxImageUtils {
+
+ /**
+ * Returns an image according to {@link ISharedImages}
+ *
+ * @param id
+ * , the constant
+ * @return
+ */
+ public static Image getImage(int id) {
+ StringBuffer path = new StringBuffer("/icons/");
+ switch (id) {
+ case ISharedImages.IMG_RUN:
+ path = path.append("run.gif");
+ break;
+ default:
+ break;
+ }
+ String key = Activator.PLUGIN_ID + path;
+ Image result = JFaceResources.getImageRegistry().get(key);
+ if (result == null) {
+ URL url = Activator.getDefault().getBundle().getEntry(path.toString());
+ try {
+ result = new Image(Display.getDefault(), url.openStream());
+ JFaceResources.getImageRegistry().put(key, result);
+ } catch (IOException e) {
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns an image descriptor according to {@link ISharedImages}
+ *
+ * @param id
+ * , the constant
+ * @return
+ */
+ public static ImageDescriptor getImageDescriptor(final int id) {
+ return new ImageDescriptor() {
+
+ @Override
+ public ImageData getImageData() {
+ return getImage(id).getImageData();
+ }
+ };
+ }
+}

Back to the top